From patchwork Fri Feb 9 03:09:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10208223 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9322A60247 for ; Fri, 9 Feb 2018 03:09:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8185429680 for ; Fri, 9 Feb 2018 03:09:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 764E829684; Fri, 9 Feb 2018 03:09:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EBAC29680 for ; Fri, 9 Feb 2018 03:09:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752491AbeBIDJS (ORCPT ); Thu, 8 Feb 2018 22:09:18 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:33518 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752509AbeBIDJP (ORCPT ); Thu, 8 Feb 2018 22:09:15 -0500 Received: by mail-io0-f196.google.com with SMTP id n7so8197000iob.0 for ; Thu, 08 Feb 2018 19:09:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=x4Tumi6EiX6xfYa3UG+x2NkjkRqH1yZ8UOtVjgcfnIA=; b=YOiYj8D7Pr+2lbSU/VFXyOAjV+T5S3P8ai2FUNncktbscB4NfC+FgkjQYJaRgFBwUn R1SM2d+1cW6wk8Vp8tIFovxBOz0qdymTupMyizn0ZGVzo7O1y0mUvYPCQKXq01C4oz/G BLdkBhK/LZ+6sEIufMlqSfoqia2G41ypcycZ4VUAFCeji3Jl6v5ZWsuPS0g9QdCGe4Sy hEp2jNqcKsuugYTNZnasGwHsD98f+hzp7fMtOntksckZfa7o7Ug/t4NA4PghXuJjfgoJ Y5WzXhcS4GhMXPpHa41wSjK/9VyNp7JiNm0wIanV6+RDX+0BXB/WiubVHIhIte/KDoHN g+QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=x4Tumi6EiX6xfYa3UG+x2NkjkRqH1yZ8UOtVjgcfnIA=; b=UVY8GzH++l+JFWmhrLiUGGUuzbf9U6UU668A7v31PqYqnvAcAbe8LmZYgI1ah21QIO fAkJ/po0DKJinfaZozPS1Xd82dAsRYNUP6GEesNy2bBUMMvoXxUtLY3mjyLs5Hb3EpXX /P9ZJ8f9a26XqrN/IB6Dj6wK+Aj48zGLaJUBcEp1N/6gAnsgc6W1gGpH7O4QYTJFcZ1K SXD+vgBhg/ewM+vKWhvEcBUBsKFzg7VQ/lesMd6wN2+VdaGWWpR0r5YqoyDT7ox0HHIR +y9Msz5rnUh8akBY8vGre91bGjY5VGDgr1O1kLKjBtTJfKYk6y//X7ipcuYIGiFkaQXX AbtA== X-Gm-Message-State: APf1xPCI/8LBCx8yNI1P7aiM5POsYofbVxcOl5FeLP6zmpP2kA7sa30q NQRtD3G+yM8KF70OOE3q5g+DaQo4xTw= X-Google-Smtp-Source: AH8x226/K6SoCdVaFn0sD4gZESQqeekeysYTr0HmGAav873zxjCOv4u3Xb4zce5HI2lawbEAoIM3Iw== X-Received: by 10.107.174.85 with SMTP id x82mr1408821ioe.27.1518145754708; Thu, 08 Feb 2018 19:09:14 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [70.74.179.152]) by smtp.gmail.com with ESMTPSA id n4sm1275246itg.23.2018.02.08.19.09.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2018 19:09:11 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1ejz3m-0005qQ-9q; Thu, 08 Feb 2018 20:09:10 -0700 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH rdma-core 5/7] Support distros that have old kernel uapi headers Date: Thu, 8 Feb 2018 20:09:02 -0700 Message-Id: <20180209030904.22370-6-jgg@ziepe.ca> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180209030904.22370-1-jgg@ziepe.ca> References: <20180209030904.22370-1-jgg@ziepe.ca> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe Old distros don't allow linux/in.h and others to be included after the glibc headers that define conflicting definitions. We don't actually need the linux headers, so just replace them with empty files on the old distros. Signed-off-by: Jason Gunthorpe --- CMakeLists.txt | 14 ++++++++++++++ buildlib/fixup-include/linux-in.h | 2 ++ buildlib/fixup-include/linux-in6.h | 2 ++ 3 files changed, 18 insertions(+) create mode 100644 buildlib/fixup-include/linux-in.h create mode 100644 buildlib/fixup-include/linux-in6.h diff --git a/CMakeLists.txt b/CMakeLists.txt index e63f4cf563677a..3ba9a0bc6989d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -250,6 +250,17 @@ CHECK_C_SOURCE_COMPILES(" HAVE_FUNC_ATTRIBUTE_ALWAYS_INLINE FAIL_REGEX "warning") +# glibc and kernel uapi headers can co-exist +CHECK_C_SOURCE_COMPILES(" + #include + #include + #include + #include + int main(int argc,const char *argv[]) { return 0; }" + HAVE_GLIBC_UAPI_COMPAT) +RDMA_DoFixup("${HAVE_GLIBC_UAPI_COMPAT}" "linux/in.h") +RDMA_DoFixup("${HAVE_GLIBC_UAPI_COMPAT}" "linux/in6.h") + # Provide a shim if C11 stdatomic.h is not supported. if (NOT HAVE_SPARSE) CHECK_INCLUDE_FILE("stdatomic.h" HAVE_STDATOMIC) @@ -522,3 +533,6 @@ endif() if (NOT HAVE_C_WREDUNDANT_DECLS) message(STATUS " -Wredundant-decls does NOT work") endif() +if (NOT HAVE_GLIBC_UAPI_COMPAT) + message(STATUS " libc netinet/in.h and linux/in.h do NOT coexist") +endif() diff --git a/buildlib/fixup-include/linux-in.h b/buildlib/fixup-include/linux-in.h new file mode 100644 index 00000000000000..07fdbdaeec44e8 --- /dev/null +++ b/buildlib/fixup-include/linux-in.h @@ -0,0 +1,2 @@ +/* if in.h can't be included just leave it empty */ +#include diff --git a/buildlib/fixup-include/linux-in6.h b/buildlib/fixup-include/linux-in6.h new file mode 100644 index 00000000000000..87965b368c9562 --- /dev/null +++ b/buildlib/fixup-include/linux-in6.h @@ -0,0 +1,2 @@ +/* if in6.h can't be included just leave it empty */ +#include