From: Guy Harris Date: Mon, 13 Feb 2023 08:28:09 +0000 (-0800) Subject: configure: add -fPIC to CFLAGS, not V_CCOPT, on Haiku. X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/9c3f8381e1db212523af0b5398bc6ad1993fc304 configure: add -fPIC to CFLAGS, not V_CCOPT, on Haiku. 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. --- diff --git a/aclocal.m4 b/aclocal.m4 index aa43e0bd..469ba629 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -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. diff --git a/configure.ac b/configure.ac index 96f3f980..ffe0f97e 100644 --- a/configure.ac +++ b/configure.ac @@ -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],