From c2b7d77784beeae5f86f19e33ba3da5ddce55898 Mon Sep 17 00:00:00 2001 From: Sam James Date: Tue, 18 Jan 2022 13:30:14 +0000 Subject: build: respect environment options more (#1392) * build: update m4/ax_pthread.m4 from serial 23 -> serial 31 Update ax_pthread.m4 to the latest version from the autoconf-archive project. Signed-off-by: Sam James * build: properly detect AR, CC, RANLIB It's necessary to be able to override choice of AR/CC/RANLIB and other toolchain variables/tools for cross-compilation, testing with other toolchains, and to ensure the compiler chosen by the user is actually used for the build. Previously, GNU_PREFIX was kind-of used for this but this isn't a standard variable (at all) and it wasn't applied consistently anyway. We now use the standard autoconf mechanisms for finding these tools. (RANLIB is already covered by LT_INIT.) Signed-off-by: Sam James * build: use $(MAKE) This ensures that parallel make works correctly, as otherwise, a fresh make job will be started without the jobserver fd, and hence not know about its parent, forcing -j1. * build: respect CPPFLAGS, LDFLAGS - CPPFLAGS is for the C preprocessor (usually for setting defines) - LDFLAGS should be placed before objects for certain flags to work (e.g. -Wl,--as-needed) Signed-off-by: Sam James Co-authored-by: Luca Deri --- configure.ac | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index b71a2ddee..4e5ee5b1a 100644 --- a/configure.ac +++ b/configure.ac @@ -13,8 +13,6 @@ AS_IF([test "${with_only_libndpi+set}" = set],[ EXTRA_TARGETS="" ]) -GNU_PREFIX="" - AC_ARG_WITH(sanitizer, AS_HELP_STRING([--with-sanitizer], [Build with support for address, undefined and leak sanitizer])) AC_ARG_ENABLE(fuzztargets, AS_HELP_STRING([--enable-fuzztargets], [Enable fuzz targets]),[enable_fuzztargets=$enableval],[enable_fuzztargets=no]) AS_IF([test "x$enable_fuzztargets" = "xyes"], [BUILD_FUZZTARGETS=1], [BUILD_FUZZTARGETS=0]) @@ -36,11 +34,14 @@ dnl> AC_PROG_CC(clang gcc) AC_PROG_CXX(clang++ g++) AC_PROG_CC_STDC(clang gcc) else -dnl> AC_PROG_CC - AM_PROG_CC_C_O + AC_PROG_CC AC_PROG_CXX AC_PROG_CC_STDC fi + +dnl> Can't iuse AM_PROG_AR because not all of our Makefiles are automake (yet?) +AC_CHECK_TOOL(AR, ar, [false]) + AC_LANG_WERROR NDPI_MAJOR=`echo "${PACKAGE_VERSION}" | cut -d . -f 1` @@ -163,7 +164,7 @@ case "$host" in ;; esac CFLAGS="${CFLAGS}" - LDFLAGS="${LDFLAGS} -lws2_32" + LIBS="${LIBS} -lws2_32" BUILD_MINGW=1 ;; *) @@ -305,5 +306,4 @@ AC_SUBST(JSONC_CFLAGS) AC_SUBST(JSONC_LIBS) AC_SUBST(GCRYPT_ENABLED) AC_SUBST(PCRE_ENABLED) -AC_SUBST(GNU_PREFIX) AC_OUTPUT -- cgit v1.2.3