diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-12-19 20:45:18 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-12-20 04:45:48 +0000 |
commit | caf4cc6399083ed5d9b461ee3f372a39337699ba (patch) | |
tree | 3a179c25e592bb467ef507ff209edec19e41866e | |
parent | 1a051afee3fdbbec399af66c4cc934ce18f311da (diff) |
Use AC_SEARCH_LIBS() for math functions.
Use it to check whether we need -lm for various math functions -
including floorl(). Let it handle adding -lm, rather than having that
in the various _LDADD macros.
Change-Id: Ic5d24ec35e060306351f4981c92e26879e597d81
Reviewed-on: https://code.wireshark.org/review/5908
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | Makefile.am | 30 | ||||
-rw-r--r-- | configure.ac | 25 |
2 files changed, 31 insertions, 24 deletions
diff --git a/Makefile.am b/Makefile.am index ac565eedf6..e5670e2fa7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -414,8 +414,7 @@ wireshark_common_ldadd = \ @LIBGCRYPT_LIBS@ \ @LIBGNUTLS_LIBS@ \ @LIBSMI_LDFLAGS@ \ - @GLIB_LIBS@ \ - -lm + @GLIB_LIBS@ if HAVE_Qt wireshark_SOURCES = $(WIRESHARK_COMMON_SRC) @@ -487,8 +486,8 @@ tshark_LDADD = \ @COREFOUNDATION_FRAMEWORKS@ \ @LIBGCRYPT_LIBS@ \ @LIBGNUTLS_LIBS@ \ - @LIBSMI_LDFLAGS@ \ - -lm + @LIBSMI_LDFLAGS@ + tshark_CFLAGS = $(AM_CLEAN_CFLAGS) if ENABLE_STATIC @@ -514,8 +513,8 @@ tfshark_LDADD = \ @SYSTEMCONFIGURATION_FRAMEWORKS@ \ @COREFOUNDATION_FRAMEWORKS@ \ @LIBGNUTLS_LIBS@ \ - @LIBSMI_LDFLAGS@ \ - -lm + @LIBSMI_LDFLAGS@ + tfshark_CFLAGS = $(AM_CLEAN_CFLAGS) if ENABLE_STATIC @@ -544,15 +543,15 @@ rawshark_LDADD = \ @COREFOUNDATION_FRAMEWORKS@ \ @LIBGCRYPT_LIBS@ \ @LIBGNUTLS_LIBS@ \ - @LIBSMI_LDFLAGS@ \ - -lm + @LIBSMI_LDFLAGS@ + rawshark_CFLAGS = $(AM_CLEAN_CFLAGS) # Libraries with which to link text2pcap. text2pcap_LDADD = \ wsutil/libwsutil.la \ - @GLIB_LIBS@ \ - -lm + @GLIB_LIBS@ + # Don't turn on -Werror for text2pcap: its source includes text2pcap-scanner.c # which is generated (and therefore not always clean). # We could generate text2pcap.o as a library with -Werror but for now it @@ -604,8 +603,8 @@ randpkt_LDADD = \ @SOCKET_LIBS@ \ @NSL_LIBS@ \ @C_ARES_LIBS@ \ - @ADNS_LIBS@ \ - -lm + @ADNS_LIBS@ + randpkt_CFLAGS = $(AM_CLEAN_CFLAGS) # Libraries and plugin flags with which to link dftest. @@ -625,8 +624,8 @@ dftest_LDADD = \ @KRB5_LIBS@ \ @LIBGCRYPT_LIBS@ \ @LIBGNUTLS_LIBS@ \ - @LIBSMI_LDFLAGS@ \ - -lm + @LIBSMI_LDFLAGS@ + dftest_CFLAGS = $(AM_CLEAN_CFLAGS) echld_test_LDADD = \ @@ -638,8 +637,7 @@ echld_test_LDADD = \ @SOCKET_LIBS@ \ @NSL_LIBS@ \ @C_ARES_LIBS@ \ - @ADNS_LIBS@ \ - -lm + @ADNS_LIBS@ echld_test_DEPENDENCIES = \ echld/libechld.la \ diff --git a/configure.ac b/configure.ac index b55f2221a4..8fa43242f2 100644 --- a/configure.ac +++ b/configure.ac @@ -507,6 +507,23 @@ AC_SUBST(OSX_MIN_VERSION) AC_SYS_LARGEFILE # +# Look for math functions; use libm if necessary. +# +AC_SEARCH_LIBS(floor, m) +AC_SEARCH_LIBS(ceil, m) +AC_SEARCH_LIBS(exp, m) +AC_SEARCH_LIBS(log, m) +AC_SEARCH_LIBS(log10, m) +AC_SEARCH_LIBS(floorl, m, + [ + FLOORL_LO="" + AC_DEFINE(HAVE_FLOORL, 1, [Define if you have the floorl function.]) + ], + FLOORL_LO="floorl.lo") +AC_SUBST(FLOORL_LO) + + +# # GUI toolkit options # AC_ARG_WITH([qt], @@ -2648,14 +2665,6 @@ AC_C_BIGENDIAN # XXX - do we need this? AC_PROG_GCC_TRADITIONAL -AC_CHECK_FUNC(floorl, - [ - FLOORL_LO="" - AC_DEFINE(HAVE_FLOORL, 1, [Define if you have the floorl function.]) - ], - FLOORL_LO="floorl.lo") -AC_SUBST(FLOORL_LO) - AC_CHECK_FUNC(getopt, [ GETOPT_LO="" |