3 AM_INIT_AUTOMAKE(tor, 0.0.6rc1)
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
29 AC_SEARCH_LIBS(socket, [socket])
30 AC_SEARCH_LIBS(gethostbyname, [nsl])
33 saved_LDFLAGS="$LDFLAGS"
34 saved_CPPFLAGS="$CPPFLAGS"
35 if test "x$prefix" != "xNONE" ; then
36 tryssldir="$tryssldir $prefix"
38 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
39 for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
40 CPPFLAGS="$saved_CPPFLAGS"
41 LDFLAGS="$saved_LDFLAGS"
42 LIBS="$saved_LIBS -lssl -lcrypto"
44 # Skip directories if they don't exist
45 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
48 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
49 # Try to use $ssldir/lib if it exists, otherwise
51 if test -d "$ssldir/lib" ; then
52 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
53 if test ! -z "$need_dash_r" ; then
54 LDFLAGS="-R$ssldir/lib $LDFLAGS"
57 LDFLAGS="-L$ssldir $saved_LDFLAGS"
58 if test ! -z "$need_dash_r" ; then
59 LDFLAGS="-R$ssldir $LDFLAGS"
62 # Try to use $ssldir/include if it exists, otherwise
64 if test -d "$ssldir/include" ; then
65 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
67 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
71 # Basic test to check for compatible version and correct linking
72 # *does not* test for RSA - that comes later.
76 #include <openssl/rand.h>
80 memset(a, 0, sizeof(a));
81 RAND_add(a, sizeof(a), sizeof(a));
82 return(RAND_status() <= 0);
91 if test ! -z "$found_crypto" ; then
96 if test -z "$found_crypto" ; then
97 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
99 if test -z "$ssldir" ; then
103 ac_cv_openssldir=$ssldir
105 if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ;
107 dnl Need to recover ssldir - test above runs in subshell
108 ssldir=$ac_cv_openssldir
109 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
110 # Try to use $ssldir/lib if it exists, otherwise
112 if test -d "$ssldir/lib" ; then
113 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
114 if test ! -z "$need_dash_r" ; then
115 LDFLAGS="-R$ssldir/lib $LDFLAGS"
118 LDFLAGS="-L$ssldir $saved_LDFLAGS"
119 if test ! -z "$need_dash_r" ; then
120 LDFLAGS="-R$ssldir $LDFLAGS"
123 # Try to use $ssldir/include if it exists, otherwise
125 if test -d "$ssldir/include" ; then
126 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
128 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
132 LIBS="$saved_LIBS -lssl -lcrypto"
134 dnl The warning message here is no longer strictly accurate.
136 AC_CHECK_HEADERS(unistd.h string.h signal.h netdb.h ctype.h poll.h sys/stat.h sys/poll.h sys/types.h fcntl.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))
138 dnl These headers are not essential
140 AC_CHECK_HEADERS(stdint.h sys/types.h inttypes.h sys/wait.h sys/limits.h netinet/in.h arpa/inet.h machine/limits.h)
142 AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime)
143 AC_REPLACE_FUNCS(strlcat strlcpy)
145 dnl In case we aren't given a working stdint.h, we'll need to grow our own.
148 AC_CHECK_SIZEOF(int8_t)
149 AC_CHECK_SIZEOF(int16_t)
150 AC_CHECK_SIZEOF(int32_t)
151 AC_CHECK_SIZEOF(int64_t)
152 AC_CHECK_SIZEOF(uint8_t)
153 AC_CHECK_SIZEOF(uint16_t)
154 AC_CHECK_SIZEOF(uint32_t)
155 AC_CHECK_SIZEOF(uint64_t)
157 dnl AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t])
159 AC_CHECK_SIZEOF(char)
160 AC_CHECK_SIZEOF(short)
162 AC_CHECK_SIZEOF(long)
163 AC_CHECK_SIZEOF(long long)
164 AC_CHECK_SIZEOF(__int64)
166 # Now, let's see about alignment requirements
167 AC_CACHE_CHECK([whether unaligned int access is allowed], tor_cv_unaligned_ok,
168 [AC_RUN_IFELSE([AC_LANG_SOURCE(
169 [[int main () { char s[] = "A\x00\x00\x00\x00\x00\x00\x00";
170 return *(int*)(&s[1]); }]])],
171 [tor_cv_unaligned_ok=yes],
172 [tor_cv_unaligned_ok=no],
173 [tor_cv_unaligned_ok=cross])])
174 if test $tor_cv_unaligned_ok = yes; then
175 AC_DEFINE([UNALIGNED_INT_ACCESS_OK], 1,
176 [Define to 1 iff unaligned int access is allowed])
179 # $prefix stores the value of the --prefix command line option, or
180 # NONE if the option wasn't set. In the case that it wasn't set, make
181 # it be the default, so that we can use it to expand directories now.
182 if test "x$prefix" = "xNONE"; then
183 prefix=$ac_default_prefix
186 # and similarly for $exec_prefix
187 if test "x$exec_prefix" = "xNONE"; then
191 CONFDIR=`eval echo $sysconfdir/tor`
193 AC_DEFINE_UNQUOTED(CONFDIR,"$CONFDIR")
194 AC_DEFINE([CONFDIR], [], [tor's configuration directory])
196 BINDIR=`eval echo $bindir`
199 LOCALSTATEDIR=`eval echo $localstatedir`
200 AC_SUBST(LOCALSTATEDIR)
202 echo "confdir: $CONFDIR"
204 AC_OUTPUT(Makefile contrib/tor.sh contrib/torify contrib/Makefile contrib/tor.spec src/config/torrc.sample doc/tor.1 src/Makefile doc/Makefile src/config/Makefile src/common/Makefile src/or/Makefile)