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.
This commit is contained in:
Guy Harris 2023-02-13 21:17:46 -08:00
parent 93a3b993be
commit ec75e5b3e8

View 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],