summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2023-02-13 13:41:51 -0800
committerGuy Harris <gharris@sonic.net>2023-02-13 13:41:51 -0800
commit941924ed6da1b67e077bc2f825a57cff51c5a5e9 (patch)
tree1a6e9a5526f1401dedf3e4fa94415d53be3275c6
parent8a4ea1d8b10f57ad8afbf7bb1b5eb0067ef54c9c (diff)
downloadlibpcap-941924ed6da1b67e077bc2f825a57cff51c5a5e9.tar.gz
configure: add -fPIC to CFLAGS on Haiku.
Tat 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.
-rw-r--r--configure.ac23
1 files changed, 23 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 8efa665c..940979fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,6 +103,29 @@ AC_SUBST(LIBS_PRIVATE)
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_CCOPT, V_INCLS)
#
# We require C99 or later.