From 80b82d370745c97375eba64b548898db32f506b0 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Tue, 1 Dec 2015 17:20:51 -0300 Subject: [PATCH] Adds the Global LDADD option and fed according to the platform --- configure.ac | 20 +++++++++++++++++++- src/Makefile.am | 2 +- test/Makefile.am | 6 +++--- test/benchmark/Makefile.am | 2 +- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 16aa6b02..45efef48 100644 --- a/configure.ac +++ b/configure.ac @@ -128,42 +128,52 @@ case $host in *-*-aix*) echo "Checking platform... Identified as AIX" AC_DEFINE([AIX], [1], [Define if the operating system is AIX]) + PLATFORM="AIX" ;; *-*-hpux*) echo "Checking platform... Identified as HPUX" AC_DEFINE([HPUX], [1], [Define if the operating system is HPUX]) + PLATFORM="HPUX" ;; *-*-darwin*) echo "Checking platform... Identified as Macintosh OS X" AC_DEFINE([MACOSX], [1], [Define if the operating system is Macintosh OSX]) + PLATFORM="MacOSX" ;; *-*-linux*) echo "Checking platform... Identified as Linux" AC_DEFINE([LINUX], [1], [Define if the operating system is LINUX]) + PLATFORM="Linux" ;; *-*-solaris*) echo "Checking platform... Identified as Solaris" AC_DEFINE([SOLARIS], [1], [Define if the operating system is SOLARIS]) + PLATFORM="Solaris" ;; *-*-freebsd*) echo "Checking platform... Identified as FreeBSD" AC_DEFINE([FREEBSD], [1], [Define if the operating system is FREEBSD]) + PLATFORM="FreeBSD" ;; *-*-netbsd*) echo "Checking platform... Identified as NetBSD" AC_DEFINE([NETBSD], [1], [Define if the operating system is NETBSD]) + PLATFORM="NetBSD" ;; *-*-openbsd*) echo "Checking platform... Identified as OpenBSD" AC_DEFINE([OPENBSD], [1], [Define if the operating system is OPENBSD]) + PLATFORM="OpenBSD" ;; *-*-kfreebsd*) echo "Checking platform... Identified as kFreeBSD, treating as linux" AC_DEFINE([FREEBSD], [1], [Define if the operating system is FREEBSD]) + PLATFORM="kFreeBSD" ;; *-*-gnu*.*) echo "Checking platform... Identified as HURD, treating as linux" AC_DEFINE([LINUX], [1], [Define if the operating system is LINUX]) + PLATFORM="HURD" ;; *) echo "Unknown CANONICAL_HOST $host" @@ -215,6 +225,14 @@ fi AM_CONDITIONAL([TEST_UTILITIES], [test $buildTestUtilities = true]) + +# General link options +if test "$PLATFORM" != "MacOSX"; then + GLOBAL_LDADD="-lrt" + AC_SUBST(GLOBAL_LDADD) +fi + + # Files to be generated via autotools. AC_CONFIG_FILES([\ Makefile \ @@ -249,7 +267,7 @@ AC_OUTPUT # Print a fancy summary echo " " echo " " -echo "ModSecurity - v${MSC_GIT_VERSION}" +echo "ModSecurity - v${MSC_GIT_VERSION} for $PLATFORM" echo " " echo " Mandatory dependencies" echo -n " + libInjection ...." diff --git a/src/Makefile.am b/src/Makefile.am index e94f5073..ad9ada7a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -213,7 +213,7 @@ libmodsecurity_la_CPPFLAGS = \ $(PCRE_CFLAGS) libmodsecurity_la_LIBADD = \ - -lrt \ + $(GLOBAL_LDADD) \ $(CURL_LDADD) \ $(GEOIP_LDFLAGS) $(GEOIP_LDADD) \ @LEXLIB@ \ diff --git a/test/Makefile.am b/test/Makefile.am index a60e02ae..30d89fa1 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -22,7 +22,7 @@ unit_tests_SOURCES = \ unit/unit_test.cc unit_tests_LDADD = \ - -lrt \ + $(GLOBAL_LDADD) \ $(top_builddir)/src/.libs/libmodsecurity.a \ $(CURL_LDADD) \ $(GEOIP_LDFLAGS) $(GEOIP_LDADD) \ @@ -51,7 +51,7 @@ regression_tests_SOURCES = \ regression/custom_debug_log.cc regression_tests_LDADD = \ - -lrt \ + $(GLOBAL_LDADD) \ $(top_builddir)/src/.libs/libmodsecurity.a \ $(CURL_LDADD) \ $(GEOIP_LDFLAGS) $(GEOIP_LDADD) \ @@ -78,7 +78,7 @@ rules_optimization_SOURCES = \ optimization/optimization.cc rules_optimization_LDADD = \ - -lrt \ + $(GLOBAL_LDADD) \ $(top_builddir)/src/.libs/libmodsecurity.a \ $(CURL_LDADD) \ $(GEOIP_LDFLAGS) $(GEOIP_LDADD) \ diff --git a/test/benchmark/Makefile.am b/test/benchmark/Makefile.am index df3f34a5..b3066d6f 100644 --- a/test/benchmark/Makefile.am +++ b/test/benchmark/Makefile.am @@ -6,7 +6,7 @@ benchmark_SOURCES = \ benchmark.cc benchmark_LDADD = \ - -lrt \ + $(GLOBAL_LDADD) \ $(top_builddir)/src/.libs/libmodsecurity.a \ $(CURL_LDADD) \ $(GEOIP_LDFLAGS) $(GEOIP_LDADD) \