]> git.ipfire.org Git - thirdparty/lldpd.git/blobdiff - configure.ac
lib: don't rely on constructors
[thirdparty/lldpd.git] / configure.ac
index e8d3450866b5744bf8ba5c4f8a896aee2fb74def..b7ff5d79e78dc72390badf0687aa50bb3e569404 100644 (file)
@@ -89,7 +89,6 @@ AX_CFLAGS_GCC_OPTION([-Wno-missing-field-initializers], [LLDP_CFLAGS])
 AX_CFLAGS_GCC_OPTION([-Wno-sign-compare], [LLDP_CFLAGS]) dnl Should be fixed later
 AX_LDFLAGS_OPTION([-Wl,-z,relro], [LLDP_LDFLAGS])
 AX_LDFLAGS_OPTION([-Wl,-z,now], [LLDP_LDFLAGS])
-lldp_CHECK_CTORS
 
 # Hardening
 AC_ARG_ENABLE([hardening],
@@ -115,6 +114,24 @@ if test x"$pie" = x"yes"; then
     [AX_LDFLAGS_OPTION([-fPIE -Wl,-pie], [LLDP_BIN_LDFLAGS])])
 fi
 
+# Sanitizers
+AC_ARG_ENABLE([sanitizers],
+  AS_HELP_STRING(
+    [--enable-sanitizers],
+    [Enable code instrumentation with selected sanitizers @<:@default=no@:>@]),
+  [
+case "$enableval" in
+    no) sanitizers= ;;
+    yes) sanitizers="-fsanitize=address,undefined" ;;
+    *) sanitizers="-fsanitize=$enableval" ;;
+esac
+if test x"$sanitizers" != x; then
+  LLDP_CFLAGS="$LLDP_CFLAGS $sanitizers"
+  LLDP_LDFLAGS="$LLDP_LDFLAGS $sanitizers"
+  AC_DEFINE([HAVE_ADDRESS_SANITIZER], 1, [Define if have both address and leak sanitizer])
+fi
+  ])
+
 # OS
 lldp_CHECK_OS
 lldp_CFLAGS_OS
@@ -336,6 +353,13 @@ if test x"$os" = x"Linux"; then
     fi
 fi
 
+# Build date
+if test x"$SOURCE_DATE_EPOCH" != x; then
+   AC_DEFINE_UNQUOTED(BUILD_DATE, "[$SOURCE_DATE_EPOCH]", [Build date and time])
+fi
+AC_DEFINE_UNQUOTED(LLDP_CC, "[$CC $LLDP_CFLAGS $LLDP_CPPFLAGS $CFLAGS $CPPFLAGS]", [C compiler command])
+AC_DEFINE_UNQUOTED(LLDP_LD, "[$LD $LLDP_LDFLAGS $LLDP_BIN_LDFLAGS $LDFLAGS $LIBS]", [Linker compiler command])
+
 #######################
 # Output results
 AC_SUBST([LLDP_CFLAGS])
@@ -367,6 +391,7 @@ cat <<EOF
   Linker.........: $LD $LLDP_LDFLAGS $LLDP_BIN_LDFLAGS $LDFLAGS $LIBS
   Libevent.......: $libevent
   Readline.......: ${ax_cv_lib_readline}
+
  Optional features:
   SNMP support...: ${with_snmp-no}
   CDP............: $enable_cdp
@@ -381,10 +406,15 @@ cat <<EOF
   JSON output....: ${with_json-no}
   Oldies support.: $enable_oldies
   seccomp........: ${with_seccomp-no}
+
  Privilege separation:
   Enabled........: $enable_privsep
   User/group.....: ${with_privsep_user}/${with_privsep_group}
   Chroot.........: ${with_privsep_chroot}
+------------- Compiler version --------------
+$($CC --version || true)
+-------------- Linker version ---------------
+$($LD --version || true)
 ---------------------------------------------
 
 Check the above options and compile with: