3 AM_INIT_AUTOMAKE(tor, 0.0.7pre1-cvs-2)
4 AM_CONFIG_HEADER(orconfig.h)
8 CFLAGS="$CFLAGS -Wall -g -O2 -I/usr/kerberos/include"
11 [ --enable-debug compiles with debugging info],
12 [if test x$enableval = xyes; then
20 # The big search for OpenSSL
21 # copied from openssh's configure.ac
23 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
25 if test "x$withval" != "xno" ; then
31 AC_SEARCH_LIBS(socket, [socket])
32 AC_SEARCH_LIBS(gethostbyname, [nsl])
35 saved_LDFLAGS="$LDFLAGS"
36 saved_CPPFLAGS="$CPPFLAGS"
37 if test "x$prefix" != "xNONE" ; then
38 tryssldir="$tryssldir $prefix"
40 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
41 for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
42 CPPFLAGS="$saved_CPPFLAGS"
43 LDFLAGS="$saved_LDFLAGS"
44 LIBS="$saved_LIBS -lssl -lcrypto"
46 # Skip directories if they don't exist
47 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
50 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
51 # Try to use $ssldir/lib if it exists, otherwise
53 if test -d "$ssldir/lib" ; then
54 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
55 if test ! -z "$need_dash_r" ; then
56 LDFLAGS="-R$ssldir/lib $LDFLAGS"
59 LDFLAGS="-L$ssldir $saved_LDFLAGS"
60 if test ! -z "$need_dash_r" ; then
61 LDFLAGS="-R$ssldir $LDFLAGS"
64 # Try to use $ssldir/include if it exists, otherwise
66 if test -d "$ssldir/include" ; then
67 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
69 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
73 # Basic test to check for compatible version and correct linking
74 # *does not* test for RSA - that comes later.
78 #include <openssl/rand.h>
82 memset(a, 0, sizeof(a));
83 RAND_add(a, sizeof(a), sizeof(a));
84 return(RAND_status() <= 0);
93 if test ! -z "$found_crypto" ; then
98 if test -z "$found_crypto" ; then
99 AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log])
101 if test -z "$ssldir" ; then
105 ac_cv_openssldir=$ssldir
107 if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ;
109 dnl Need to recover ssldir - test above runs in subshell
110 ssldir=$ac_cv_openssldir
111 if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
112 # Try to use $ssldir/lib if it exists, otherwise
114 if test -d "$ssldir/lib" ; then
115 LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
116 if test ! -z "$need_dash_r" ; then
117 LDFLAGS="-R$ssldir/lib $LDFLAGS"
120 LDFLAGS="-L$ssldir $saved_LDFLAGS"
121 if test ! -z "$need_dash_r" ; then
122 LDFLAGS="-R$ssldir $LDFLAGS"
125 # Try to use $ssldir/include if it exists, otherwise
127 if test -d "$ssldir/include" ; then
128 CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS"
130 CPPFLAGS="-I$ssldir $saved_CPPFLAGS"
134 LIBS="$saved_LIBS -lssl -lcrypto"
136 dnl The warning message here is no longer strictly accurate.
138 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))
140 dnl These headers are not essential
142 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)
144 AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime)
145 AC_REPLACE_FUNCS(strlcat strlcpy)
147 dnl In case we aren't given a working stdint.h, we'll need to grow our own.
150 AC_CHECK_SIZEOF(int8_t)
151 AC_CHECK_SIZEOF(int16_t)
152 AC_CHECK_SIZEOF(int32_t)
153 AC_CHECK_SIZEOF(int64_t)
154 AC_CHECK_SIZEOF(uint8_t)
155 AC_CHECK_SIZEOF(uint16_t)
156 AC_CHECK_SIZEOF(uint32_t)
157 AC_CHECK_SIZEOF(uint64_t)
158 AC_CHECK_SIZEOF(intptr_t)
159 AC_CHECK_SIZEOF(uintptr_t)
161 dnl AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t, intptr_t, uintptr_t])
163 AC_CHECK_SIZEOF(char)
164 AC_CHECK_SIZEOF(short)
166 AC_CHECK_SIZEOF(long)
167 AC_CHECK_SIZEOF(long long)
168 AC_CHECK_SIZEOF(__int64)
169 AC_CHECK_SIZEOF(void *)
171 # Now, let's see about alignment requirements. On some platforms, we override
175 tor_cv_unaligned_ok=no
178 AC_CACHE_CHECK([whether unaligned int access is allowed], tor_cv_unaligned_ok,
179 [AC_RUN_IFELSE([AC_LANG_SOURCE(
180 [[int main () { char s[] = "A\x00\x00\x00\x00\x00\x00\x00";
181 return *(int*)(&s[1]); }]])],
182 [tor_cv_unaligned_ok=yes],
183 [tor_cv_unaligned_ok=no],
184 [tor_cv_unaligned_ok=cross])])
187 if test $tor_cv_unaligned_ok = yes; then
188 AC_DEFINE([UNALIGNED_INT_ACCESS_OK], 1,
189 [Define to 1 iff unaligned int access is allowed])
192 # $prefix stores the value of the --prefix command line option, or
193 # NONE if the option wasn't set. In the case that it wasn't set, make
194 # it be the default, so that we can use it to expand directories now.
195 if test "x$prefix" = "xNONE"; then
196 prefix=$ac_default_prefix
199 # and similarly for $exec_prefix
200 if test "x$exec_prefix" = "xNONE"; then
204 CONFDIR=`eval echo $sysconfdir/tor`
206 AC_DEFINE_UNQUOTED(CONFDIR,"$CONFDIR")
207 AC_DEFINE([CONFDIR], [], [tor's configuration directory])
209 BINDIR=`eval echo $bindir`
212 LOCALSTATEDIR=`eval echo $localstatedir`
213 AC_SUBST(LOCALSTATEDIR)
215 echo "confdir: $CONFDIR"
217 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)