aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-04-11 16:28:44 +0000
committerNick Mathewson <nickm@torproject.org>2007-04-11 16:28:44 +0000
commit795aa1a196630f8b574d69e07ffb353ebeb40ad9 (patch)
tree7885b5053dfd1ffb709f1d90c6e097b7ae078b51
parent38a5f0950250ad21e48ad60c1036621c58ecd9d4 (diff)
downloadtor-795aa1a196630f8b574d69e07ffb353ebeb40ad9.tar
tor-795aa1a196630f8b574d69e07ffb353ebeb40ad9.tar.gz
r12351@catbus: nickm | 2007-04-11 12:09:46 -0400
More autoconf hacking: use same machinery to find zlib as for openssl and libevent. Have unified library finder include setup for --with variable. Start trying to suggest to the user what packages they should install if finding the library fails. svn:r9945
-rw-r--r--ChangeLog5
-rw-r--r--acinclude.m439
-rw-r--r--configure.in52
-rw-r--r--doc/TODO8
-rw-r--r--src/or/Makefile.am4
5 files changed, 69 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index 7b90d0b14..4dfa9289f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,8 +18,11 @@ Changes in version 0.2.0.1-alpha - 2007-??-??
and Damon McCoy.
o Minor features (build):
- - Make autoconf search for libevent and openssl consistently.
+ - Make autoconf search for libevent, openssl, and zlib consistently.
- Update deprecated macros in configure.in
+ - When warning about missing headers, tell the user to let us
+ know if the compile succeeds anyway, so we can downgrade the
+ warning.
o Minor features (logging):
- Always prepend "Bug: " to any log message about a bug.
diff --git a/acinclude.m4 b/acinclude.m4
index cef577ec5..3299c20a1 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -18,14 +18,39 @@ AC_DEFUN([TOR_EXTEND_CODEPATH],
fi
])
+dnl 1:libname
+AC_DEFUN([TOR_WARN_MISSING_LIB], [
+h=""
+if test x$2 = xdevpkg; then
+ h=" headers for"
+fi
+if test -f /etc/debian_version -a x"$tor_$1_$2_debian" != x; then
+ AC_WARN([On Debian, you can install$h $1 using "apt-get install $tor_$1_$2_debian"])
+fi
+if test -f /etc/fedora-release -a x"$tor_$1_$2_redhat" != x; then
+ AC_WARN([On Fedora Core, you can install$h $1 using "yum install $tor_$1_$2_redhat"])
+else
+ if test -f /etc/redhat-release -a x"$tor_$1_$2_redhat" != x; then
+ AC_WARN([On most Redhat-based systems, you can get$h $1 by installing the $tor_$1_$2_redhat" RPM package])
+ fi
+fi
+])
+
dnl Look for a library, and its associated includes, and how to link
dnl against it.
dnl
-dnl TOR_SEARCH_LIBRARY(1:libname, 2:withlocation, 3:linkargs, 4:headers,
+dnl TOR_SEARCH_LIBRARY(1:libname, 2:IGNORED, 3:linkargs, 4:headers,
dnl 5:prototype,
dnl 6:code, 7:optionname, 8:searchextra)
-
AC_DEFUN([TOR_SEARCH_LIBRARY], [
+try$1dir=""
+AC_ARG_WITH($1-dir,
+ [ --with-$1-dir=PATH Specify path to $1 installation ],
+ [
+ if test x$withval != xno ; then
+ try$1dir="$withval"
+ fi
+ ])
tor_saved_LIBS="$LIBS"
tor_saved_LDFLAGS="$LDFLAGS"
tor_saved_CPPFLAGS="$CPPFLAGS"
@@ -33,7 +58,7 @@ AC_CACHE_CHECK([for $1 directory], tor_cv_library_$1_dir, [
tor_$1_dir_found=no
tor_$1_any_linkable=no
- for tor_trydir in "$2" "(system)" "$prefix" /usr/local /usr/pkg $8; do
+ for tor_trydir in "$try$1dir" "(system)" "$prefix" /usr/local /usr/pkg $8; do
LDFLAGS="$tor_saved_LDFLAGS"
LIBS="$tor_saved_LIBS $3"
CPPFLAGS="$tor_saved_CPPFLAGS"
@@ -73,9 +98,13 @@ AC_CACHE_CHECK([for $1 directory], tor_cv_library_$1_dir, [
if test $tor_$1_dir_found = no; then
if test $tor_$1_any_linkable = no ; then
- AC_MSG_ERROR([Could not find a linkable $1. You can specify an explicit path using $7])
+ AC_MSG_WARN([Could not find a linkable $1. If you have it installed somewhere unusal, you can specify an explicit path using $7])
+ TOR_WARN_MISSING_LIB($1, pkg)
+ AC_MSG_ERROR([Missing libraries; unable to proceed.])
else
- AC_MSG_ERROR([We found the libraries for $1, but we could not find the C header files. You may need to install a devel package.])
+ AC_MSG_WARN([We found the libraries for $1, but we could not find the C header files. You may need to install a devel package.])
+ TOR_WARN_MISSING_LIB($1, devpkg)
+ AC_MSG_ERROR([Missing headers; unable to proceed.])
fi
fi
diff --git a/configure.in b/configure.in
index 63d76eafc..2743f70b5 100644
--- a/configure.in
+++ b/configure.in
@@ -67,28 +67,6 @@ AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_RANLIB
-# The big search for OpenSSL
-# copied from openssh's configure.ac
-tryssldir=""
-AC_ARG_WITH(ssl-dir,
- [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
- [
- if test "x$withval" != "xno" ; then
- tryssldir=$withval
- fi
- ]
-)
-
-trylibeventdir=""
-AC_ARG_WITH(libevent-dir,
- [ --with-libevent-dir=PATH Specify path to Libevent installation ],
- [
- if test "x$withval" != "xno" ; then
- trylibeventdir=$withval
- fi
- ]
-)
-
TORUSER=_tor
AC_ARG_WITH(tor-user,
[ --with-tor-user=NAME Specify username for tor daemon ],
@@ -206,6 +184,11 @@ else
GDIlib=
fi
+tor_libevent_pkg_redhat="libevent"
+tor_libevent_pkg_debian="libevent"
+tor_libevent_devpkg_redhat="libevent-devel"
+tor_libevent_devpkg_debian="libevent-dev"
+
TOR_SEARCH_LIBRARY(libevent, $trylibeventdir, [-levent $WS32lib], [
#include <stdlib.h>
#include <sys/time.h>
@@ -219,6 +202,11 @@ AC_CHECK_FUNCS(event_get_version event_get_method event_set_log_callback)
dnl ------------------------------------------------------
dnl Where do you live, openssl? And how do we call you?
+tor_openssl_pkg_redhat="openssl"
+tor_openssl_pkg_debian="libssl"
+tor_openssl_devpkg_redhat="openssl-devel"
+tor_openssl_devpkg_debian="libssl-dev"
+
TOR_SEARCH_LIBRARY(openssl, $tryssldir, [-lssl -lcrypto $GDIlib],
[#include <openssl/rand.h>],
[void RAND_add(const void *buf, int num, double entropy);],
@@ -227,18 +215,28 @@ TOR_SEARCH_LIBRARY(openssl, $tryssldir, [-lssl -lcrypto $GDIlib],
dnl XXXX check for OPENSSL_VERSION_NUMBER == SSLeay()
+dnl ------------------------------------------------------
+dnl Where do you live, zlib? And how do we call you?
+
+tor_openssl_pkg_redhat="zlib"
+tor_openssl_pkg_debian="zlib1g"
+tor_openssl_devpkg_redhat="zlib-devel"
+tor_openssl_devpkg_debian="zlib1g-dev"
+
+TOR_SEARCH_LIBRARY(zlib, $tryzlibdir, [-lz],
+ [#include <zlib.h>],
+ [const char * zlibVersion(void);],
+ [zlibVersion(); exit(0);], [--with-zlib-dir],
+ [/opt/zlib])
+
dnl Make sure to enable support for large off_t if avalable.
AC_SYS_LARGEFILE
-dnl The warning message here is no longer strictly accurate.
-
-AC_CHECK_HEADERS(unistd.h string.h signal.h ctype.h sys/stat.h sys/types.h fcntl.h sys/fcntl.h sys/time.h errno.h assert.h time.h, , AC_MSG_WARN(some headers were not found, compilation may fail))
+AC_CHECK_HEADERS(unistd.h string.h signal.h ctype.h sys/stat.h sys/types.h fcntl.h sys/fcntl.h sys/time.h errno.h assert.h time.h, , AC_MSG_WARN(Some headers were not found, compilation may fail. If compilation succeeds, please send your orconfig.h to the developers so we can fix this warning.))
AC_CHECK_HEADERS(netdb.h sys/ioctl.h sys/socket.h arpa/inet.h netinet/in.h pwd.h grp.h)
-AC_CHECK_HEADERS(zlib.h, , AC_MSG_ERROR(Zlib header (zlib.h) not found. Tor requires zlib to build. You may need to install a zlib development package.))
-
dnl These headers are not essential
AC_CHECK_HEADERS(stdint.h sys/types.h inttypes.h sys/param.h sys/wait.h limits.h sys/limits.h netinet/in.h arpa/inet.h machine/limits.h syslog.h sys/time.h sys/resource.h inttypes.h utime.h sys/utime.h sys/mman.h netintet/in.h netinet/in6.h)
diff --git a/doc/TODO b/doc/TODO
index f317ca9ec..b1f633694 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -101,11 +101,11 @@ Things we'd like to do in 0.2.0.x:
less magic and less control logic.
- Implement TLS shutdown properly when possible.
- Maybe move NT services into their own module.
- - Autoconf cleanups and improvements:
+ . Autoconf cleanups and improvements:
o Remove redundant event.h check.
- - Check for zlib with the same machinery as for libevent and openssl.
- - Make the "no longer strictly accurate" message accurate.
- - Tell the user what -dev package to install based on OS.
+ o Check for zlib with the same machinery as for libevent and openssl.
+ o Make the "no longer strictly accurate" message accurate.
+ . Tell the user what -dev package to install based on OS.
- Detect correct version of libraries.
o Run autoupdate
- Refactor networkstatus generation:
diff --git a/src/or/Makefile.am b/src/or/Makefile.am
index 74def2558..9991a67a2 100644
--- a/src/or/Makefile.am
+++ b/src/or/Makefile.am
@@ -13,7 +13,7 @@ tor_SOURCES = buffers.c circuitbuild.c circuitlist.c \
eventdns.c \
tor_main.c
-tor_LDADD = ../common/libor.a ../common/libor-crypto.a -lz
+tor_LDADD = ../common/libor.a ../common/libor-crypto.a
test_SOURCES = buffers.c circuitbuild.c circuitlist.c \
circuituse.c command.c config.c \
@@ -24,7 +24,7 @@ test_SOURCES = buffers.c circuitbuild.c circuitlist.c \
eventdns.c \
test.c
-test_LDADD = ../common/libor.a ../common/libor-crypto.a -lz
+test_LDADD = ../common/libor.a ../common/libor-crypto.a
noinst_HEADERS = or.h eventdns.h eventdns_tor.h