3 AM_INIT_AUTOMAKE(tor, 0.0.2pre16)
4 AM_CONFIG_HEADER(orconfig.h)
6 CFLAGS="$CFLAGS -Wall -g -O2 -I/usr/kerberos/include"
9 [ --enable-debug compiles with debugging info],
10 [if test x$enableval = xyes; then
18 # The big search for OpenSSL
19 # copied from openssh's configure.ac
21 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
23 if test "x$withval" != "xno" ; then
30 saved_LDFLAGS="$LDFLAGS"
31 saved_CPPFLAGS="$CPPFLAGS"
32 if test "x$prefix" != "xNONE" ; then
33 tryssldir="$tryssldir $prefix"
35 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
36 for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
37 CPPFLAGS="$saved_CPPFLAGS"
38 LDFLAGS="$saved_LDFLAGS"
39 LIBS="$saved_LIBS -lssl -lcrypto"
41 # Skip directories if they don't exist
42 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
45 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
46 # Try to use $ssldir/lib if it exists, otherwise
48 if test -d "$ssldir/lib" ; then
49 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
50 if test ! -z "$need_dash_r" ; then
51 LDFLAGS="-R$ssldir/lib $LDFLAGS"
54 LDFLAGS="-L$ssldir $saved_LDFLAGS"
55 if test ! -z "$need_dash_r" ; then
56 LDFLAGS="-R$ssldir $LDFLAGS"
59 # Try to use $ssldir/include if it exists, otherwise
61 if test -d "$ssldir/include" ; then
62 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
64 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
68 # Basic test to check for compatible version and correct linking
69 # *does not* test for RSA - that comes later.
73 #include <openssl/rand.h>
77 memset(a, 0, sizeof(a));
78 RAND_add(a, sizeof(a), sizeof(a));
79 return(RAND_status() <= 0);
88 if test ! -z "$found_crypto" ; then
93 if test -z "$found_crypto" ; then
94 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
96 if test -z "$ssldir" ; then
100 ac_cv_openssldir=$ssldir
102 if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ;
104 dnl Need to recover ssldir - test above runs in subshell
105 ssldir=$ac_cv_openssldir
106 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
107 # Try to use $ssldir/lib if it exists, otherwise
109 if test -d "$ssldir/lib" ; then
110 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
111 if test ! -z "$need_dash_r" ; then
112 LDFLAGS="-R$ssldir/lib $LDFLAGS"
115 LDFLAGS="-L$ssldir $saved_LDFLAGS"
116 if test ! -z "$need_dash_r" ; then
117 LDFLAGS="-R$ssldir $LDFLAGS"
120 # Try to use $ssldir/include if it exists, otherwise
122 if test -d "$ssldir/include" ; then
123 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
125 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
129 LIBS="$saved_LIBS -lssl -lcrypto"
131 dnl The warning message here is no longer strictly accurate.
133 AC_CHECK_HEADERS(unistd.h string.h signal.h netdb.h ctype.h poll.h sys/stat.h sys/poll.h sys/types.h sys/fcntl.h sys/ioctl.h sys/socket.h sys/time.h netinet/in.h arpa/inet.h errno.h assert.h time.h pwd.h grp.h, , AC_MSG_WARN(some headers were not found, compilation may fail))
135 dnl These headers are not essential
137 AC_CHECK_HEADERS(stdint.h sys/types.h inttypes.h sys/wait.h netinet/in.h arpa/inet.h)
139 AC_CHECK_FUNCS(gettimeofday ftime socketpair uname daemon)
141 dnl In case we aren't given a working stdint.h, we'll need to grow our own.
144 AC_CHECK_SIZEOF(int8_t)
145 AC_CHECK_SIZEOF(int16_t)
146 AC_CHECK_SIZEOF(int32_t)
147 AC_CHECK_SIZEOF(int64_t)
148 AC_CHECK_SIZEOF(uint8_t)
149 AC_CHECK_SIZEOF(uint16_t)
150 AC_CHECK_SIZEOF(uint32_t)
151 AC_CHECK_SIZEOF(uint64_t)
153 dnl AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t])
155 AC_CHECK_SIZEOF(char)
156 AC_CHECK_SIZEOF(short)
158 AC_CHECK_SIZEOF(long)
159 AC_CHECK_SIZEOF(long long)
160 AC_CHECK_SIZEOF(__int64)
162 # $prefix stores the value of the --prefix command line option, or
163 # NONE if the option wasn't set. In the case that it wasn't set, make
164 # it be the default, so that we can use it to expand directories now.
165 if test "x$prefix" = "xNONE"; then
166 prefix=$ac_default_prefix
169 # and similarly for $exec_prefix
170 if test "x$exec_prefix" = "xNONE"; then
174 CONFDIR=`eval echo $sysconfdir/tor`
176 AC_DEFINE_UNQUOTED(CONFDIR,"$CONFDIR")
177 AC_DEFINE([CONFDIR], [], [tor's configuration directory])
179 BINDIR=`eval echo $bindir`
182 LOCALSTATEDIR=`eval echo $localstatedir`
183 AC_SUBST(LOCALSTATEDIR)
185 echo "confdir: $CONFDIR"
187 AC_OUTPUT(Makefile tor.sh src/config/torrc doc/tor.1 src/Makefile doc/Makefile src/config/Makefile src/common/Makefile src/or/Makefile)