From ec75e5b3e8befef3066a81990fb5ff4c70ae3ce5 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 13 Feb 2023 21:17:46 -0800 Subject: configure: move the addition of -fPIC to CFLAGS on Haiku earlier. Add it before doing anything about the C compiler, so that all tests done with the compiler are done with -fPIC, in case any of those tests involve producing an executable image. --- configure.ac | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index ffe0f97e..e6bf7064 100644 --- a/configure.ac +++ b/configure.ac @@ -19,6 +19,29 @@ AC_CONFIG_SRCDIR(tcpdump.c) AC_CANONICAL_HOST +case "$host_os" in + +haiku*) + # + # On Haiku, all executables are built as shared objects, + # and must have their code build as PIC. This also + # applies to code in static libraries, as well as + # shared libraries, as executables may be linked + # with that code. + # + # At least some versions of Haiku's GCC default to PIC, + # with a -fno-pic option for cases where that's not desired. + # + # Clang hasn't been modified in that fashion, so Clang + # builds of tcpdump fail. This is Haiku bug 18258. + # + # Force the use of -fPIC (even for GCC; adding -fPIC for GCC + # won't break anything). + # + CFLAGS="$CFLAGS -fPIC" + ;; +esac + AC_LBL_C_INIT_BEFORE_CC(V_INCLS) # # Try to enable as many C99 features as we can. @@ -33,9 +56,6 @@ AC_C_INLINE AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h net/if.h) -# -# Assorted platform checks. -# case "$host_os" in darwin*) @@ -64,23 +84,6 @@ darwin*) esac fi ;; - -haiku*) - # - # On Haiku, all executables are built as shared objects, - # and must have their code build as PIC. - # - # At least some versions of Haiku's GCC default to PIC, - # with a -fno-pic option for cases where that's not desired. - # - # Clang hasn't been modified in that fashion, so Clang - # builds of tcpdump fail. - # - # Force the use of -fPIC (even for GCC; adding -fPIC for GCC - # won't break anything). - # - CFLAGS="$CFLAGS -fPIC" - ;; esac AC_ARG_WITH([smi], -- cgit v1.2.1