]> The Tcpdump Group git mirrors - tcpdump/commitdiff
configure: move the addition of -fPIC to CFLAGS on Haiku earlier.
authorGuy Harris <[email protected]>
Tue, 14 Feb 2023 05:17:46 +0000 (21:17 -0800)
committerGuy Harris <[email protected]>
Tue, 14 Feb 2023 05:17:46 +0000 (21:17 -0800)
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

index ffe0f97ed8d9b21b27f3f8205b0ae3e4df4f8fd0..e6bf70643369675df42d886ec72c7f8f49e6c244 100644 (file)
@@ -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],