[tor-commits] [tor/master] -lm should not be hardcoded.
nickm at torproject.org
nickm at torproject.org
Mon Dec 19 16:36:09 UTC 2011
commit f783a326b82518bf75b1d3952332b05aac7ffd9b
Author: Martin Hebnes Pedersen <martin.h.pedersen at gmail.com>
Date: Sat Dec 17 14:30:41 2011 +0100
-lm should not be hardcoded.
On some platforms (Haiku/BeOS) libm lives in libcore.
Also added 'network' to the list of libraries to search for connect().
---
configure.in | 16 +++++++++++++++-
src/or/Makefile.am | 2 +-
src/test/Makefile.am | 8 ++++----
src/tools/Makefile.am | 8 +++++---
4 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/configure.in b/configure.in
index b05e935..d1b7c44 100644
--- a/configure.in
+++ b/configure.in
@@ -279,7 +279,7 @@ fi
AC_C_BIGENDIAN
-AC_SEARCH_LIBS(socket, [socket])
+AC_SEARCH_LIBS(socket, [socket network])
AC_SEARCH_LIBS(gethostbyname, [nsl])
AC_SEARCH_LIBS(dlopen, [dl])
AC_SEARCH_LIBS(inet_aton, [resolv])
@@ -483,6 +483,20 @@ fi
AC_SUBST(TOR_LIBEVENT_LIBS)
dnl ------------------------------------------------------
+dnl Where do you live, libm?
+
+dnl On some platforms (Haiku/BeOS) the math library is
+dnl part of libroot. In which case don't link against lm
+TOR_LIB_MATH=""
+save_LIBS="$LIBS"
+AC_SEARCH_LIBS(cos, [m], , AC_MSG_ERROR([Could not find libm and libcore does not provide the functions.]))
+if test "$ac_cv_search_cos" != "none required"; then
+ TOR_LIB_MATH="$ac_cv_search_cos"
+fi
+LIBS="$save_LIBS"
+AC_SUBST(TOR_LIB_MATH)
+
+dnl ------------------------------------------------------
dnl Where do you live, openssl? And how do we call you?
tor_openssl_pkg_redhat="openssl"
diff --git a/src/or/Makefile.am b/src/or/Makefile.am
index a568208..57f5dd6 100644
--- a/src/or/Makefile.am
+++ b/src/or/Makefile.am
@@ -74,7 +74,7 @@ AM_CPPFLAGS = -DSHARE_DATADIR="\"$(datadir)\"" \
tor_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ @TOR_LDFLAGS_libevent@
tor_LDADD = ./libtor.a ../common/libor.a ../common/libor-crypto.a \
../common/libor-event.a \
- @TOR_ZLIB_LIBS@ -lm @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \
+ @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \
@TOR_LIB_WS32@ @TOR_LIB_GDI@
noinst_HEADERS = \
diff --git a/src/test/Makefile.am b/src/test/Makefile.am
index 73de300..e766446 100644
--- a/src/test/Makefile.am
+++ b/src/test/Makefile.am
@@ -31,15 +31,15 @@ test_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
@TOR_LDFLAGS_libevent@
test_LDADD = ../or/libtor.a ../common/libor.a ../common/libor-crypto.a \
../common/libor-event.a \
- @TOR_ZLIB_LIBS@ -lm @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \
- @TOR_LIB_WS32@ @TOR_LIB_GDI@
+ @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
+ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@
bench_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@ \
@TOR_LDFLAGS_libevent@
bench_LDADD = ../or/libtor.a ../common/libor.a ../common/libor-crypto.a \
../common/libor-event.a \
- @TOR_ZLIB_LIBS@ -lm @TOR_LIBEVENT_LIBS@ @TOR_OPENSSL_LIBS@ \
- @TOR_LIB_WS32@ @TOR_LIB_GDI@
+ @TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ @TOR_LIBEVENT_LIBS@ \
+ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@
noinst_HEADERS = \
tinytest.h \
diff --git a/src/tools/Makefile.am b/src/tools/Makefile.am
index a9a6197..35b0a41 100644
--- a/src/tools/Makefile.am
+++ b/src/tools/Makefile.am
@@ -3,17 +3,19 @@ noinst_PROGRAMS = tor-checkkey
tor_resolve_SOURCES = tor-resolve.c
tor_resolve_LDFLAGS =
-tor_resolve_LDADD = ../common/libor.a -lm @TOR_LIB_WS32@
+tor_resolve_LDADD = ../common/libor.a @TOR_LIB_MATH@ @TOR_LIB_WS32@
tor_gencert_SOURCES = tor-gencert.c
tor_gencert_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@
tor_gencert_LDADD = ../common/libor.a ../common/libor-crypto.a \
- -lm @TOR_ZLIB_LIBS@ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@
+ @TOR_LIB_MATH@ @TOR_ZLIB_LIBS@ @TOR_OPENSSL_LIBS@ \
+ @TOR_LIB_WS32@ @TOR_LIB_GDI@
tor_checkkey_SOURCES = tor-checkkey.c
tor_checkkey_LDFLAGS = @TOR_LDFLAGS_zlib@ @TOR_LDFLAGS_openssl@
tor_checkkey_LDADD = ../common/libor.a ../common/libor-crypto.a \
- -lm @TOR_ZLIB_LIBS@ @TOR_OPENSSL_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_GDI@
+ @TOR_LIB_MATH@ @TOR_ZLIB_LIBS@ @TOR_OPENSSL_LIBS@ \
+ @TOR_LIB_WS32@ @TOR_LIB_GDI@
SUBDIRS = tor-fw-helper
DIST_SUBDIRS = tor-fw-helper
More information about the tor-commits
mailing list