]> The Tcpdump Group git mirrors - tcpdump/commitdiff
configure: add -fPIC to CFLAGS, not V_CCOPT, on Haiku.
authorGuy Harris <[email protected]>
Mon, 13 Feb 2023 08:28:09 +0000 (00:28 -0800)
committerGuy Harris <[email protected]>
Mon, 13 Feb 2023 08:28:09 +0000 (00:28 -0800)
THat forces *all* uses of the C compiler, whether it's being used in
configure-script tests or used to compile tcpdump, to gave -fPIC, which
is necessary on Haiku in order for linking to work.  Otherwise,
configure script tests that involve linking will fail.

aclocal.m4
configure.ac

index aa43e0bd2a370033f066e4968ba9d022157eae15..469ba62997ee6a2c059182c5a6b8faf6d918b48a 100644 (file)
@@ -82,32 +82,6 @@ dnl
 AC_DEFUN(AC_LBL_C_INIT,
 [
     AC_BEFORE([$0], [AC_LBL_DEVEL])
-    #
-    # Changes to copt that are required even for compilers that appear
-    # to be GCC (note that not all compilers that apper to be GCC
-    # are, in fact, GCC; Clang, for example, looks enough like GCC
-    # that the autoconf tests for the C compiler set GCC to yes).
-    #
-    case "$host_os" in
-
-    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).
-           #
-           $1="$$1 -fPIC"
-           ;;
-    esac
-
     if test "$GCC" = yes ; then
            #
            # -Werror forces warnings to be errors.
index 96f3f980986bc55cb2705bf6ac723a7784acbe39..ffe0f97ed8d9b21b27f3f8205b0ae3e4df4f8fd0 100644 (file)
@@ -33,6 +33,9 @@ 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*)
@@ -61,8 +64,24 @@ darwin*)
                esac
        fi
        ;;
-esac
 
+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],
    [AS_HELP_STRING([--with-smi],