Oops, forgot the all important 'r'
[tor.git] / configure.in
blob3cd0ab1be7358cc4296ee03a7440506f35969725
1 dnl $Id$
2 dnl Copyright (c) 2001-2004, Roger Dingledine
3 dnl Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson
4 dnl See LICENSE for licensing information
6 AC_INIT
7 AM_INIT_AUTOMAKE(tor, 0.1.2.0-alpha-cvs)
8 AM_CONFIG_HEADER(orconfig.h)
10 AC_CANONICAL_HOST
12 if test -f /etc/redhat-release; then
13     CFLAGS="$CFLAGS -I/usr/kerberos/include"
16 AC_ARG_ENABLE(debug,
17  AC_HELP_STRING(--enable-debug, compile with debugging info),
18 [if test x$enableval = xyes; then
19     CFLAGS="$CFLAGS -g"
20 fi])
22 AC_ARG_ENABLE(threads,
23      AC_HELP_STRING(--disable-threads, disable multi-threading support))
25 if test x$enable_threads = x; then
26    case $host in
27     *-*-netbsd* | *-*-openbsd* )
28      # Don't try multithreading on netbsd -- there is no threadsafe DNS
29      # lookup function there.
30      AC_MSG_NOTICE([You are running OpenBSD or NetBSD; I am assuming that
31 getaddrinfo is not threadsafe here, so I will disable threads.])
32      enable_threads="no";;
33     *-*-solaris* )
34      # Don't try multithreading on solaris -- cpuworkers seem to lock.
35      AC_MSG_NOTICE([You are running Solaris; Sometimes threading makes
36 cpu workers lock up here, so I will disable threads.])
37      enable_threads="no";;
38     *)
39      enable_threads="yes";;
40    esac
43 if test $enable_threads = "yes"; then
44   AC_DEFINE(ENABLE_THREADS, 1, [Defined if we will try to use multithreading])
47 AC_ARG_ENABLE(eventdns,
48      AC_HELP_STRING(--enable-eventdns, enable asynchronous dns module),
49      [case "${enableval}" in 
50         yes) eventdns=true ;;
51         no)  eventdns=false ;;
52         *) AC_MSG_ERROR(bad value for --enable-eventdns) ;;
53       esac], [eventdns=false])
54 AM_CONDITIONAL(EVENTDNS, test x$eventdns = xtrue)
55 if test x$eventdns = xtrue; then
56    AC_DEFINE([USE_EVENTDNS], 1, "Define to 1 if we'll be using eventdns.c")
59 case $host in
60    *-*-solaris* )
61      AC_DEFINE(_REENTRANT, 1, [Define on some platforms to activate x_r() functions in time.h])
62      ;;
63 esac
65 AC_PROG_CC
66 AC_PROG_MAKE_SET
67 AC_PROG_RANLIB
69 # The big search for OpenSSL
70 # copied from openssh's configure.ac
71 tryssldir=""
72 AC_ARG_WITH(ssl-dir,
73         [  --with-ssl-dir=PATH     Specify path to OpenSSL installation ],
74         [
75                 if test "x$withval" != "xno" ; then
76                         tryssldir=$withval
77                 fi
78         ]
81 trylibeventdir=""
82 AC_ARG_WITH(libevent-dir,
83        [  --with-libevent-dir=PATH     Specify path to Libevent installation ],
84        [
85                 if test "x$withval" != "xno" ; then
86                         trylibeventdir=$withval
87                 fi
88        ]
91 TORUSER=_tor
92 AC_ARG_WITH(tor-user,
93         [  --with-tor-user=NAME    Specify username for tor daemon ],
94         [
95            TORUSER=$withval
96         ]
98 AC_SUBST(TORUSER)
100 TORGROUP=_tor
101 AC_ARG_WITH(tor-group,
102         [  --with-tor-group=NAME   Specify group name for tor daemon ],
103         [
104            TORGROUP=$withval
105         ]
107 AC_SUBST(TORGROUP)
109 AC_SEARCH_LIBS(socket, [socket])
110 AC_SEARCH_LIBS(gethostbyname, [nsl])
111 AC_SEARCH_LIBS(dlopen, [dl])
113 if test $enable_threads = "yes"; then
114   AC_SEARCH_LIBS(pthread_create, [pthread])
115   AC_SEARCH_LIBS(pthread_detach, [pthread])
118 dnl ------------------------------------------------------
119 dnl Where do you live, libevent?  And how do we call you?
121 AC_CACHE_CHECK([for libevent directory], ac_cv_libevent_dir, [
122   saved_LIBS="$LIBS"
123   saved_LDFLAGS="$LDFLAGS"
124   saved_CPPFLAGS="$CPPFLAGS"
125   le_found=no
126   for ledir in $trylibeventdir "" $prefix /usr/local ; do
127     LDFLAGS="$saved_LDFLAGS"
128     LIBS="$saved_LIBS -levent"
130     # Skip the directory if it isn't there.
131     if test ! -z "$ledir" -a ! -d "$ledir" ; then
132        continue;
133     fi
134     if test ! -z "$ledir" ; then
135       if test -d "$ledir/lib" ; then
136         LDFLAGS="-L$ledir/lib $LDFLAGS"
137       else
138         LDFLAGS="-L$ledir $LDFLAGS"
139       fi
140       if test -d "$ledir/include" ; then
141         CPPFLAGS="-I$ledir/include $CPPFLAGS"
142       else
143         CPPFLAGS="-I$ledir $CPPFLAGS"
144       fi
145     fi
146     # Can I compile and link it?
147     AC_TRY_LINK([#include <sys/time.h>
148 #include <sys/types.h>
149 #include <event.h>], [ event_init(); ],
150        [ libevent_linked=yes ], [ libevent_linked=no ])
151     if test $libevent_linked = yes; then
152        if test ! -z "$ledir" ; then
153          ac_cv_libevent_dir=$ledir
154        else
155          ac_cv_libevent_dir="(system)"
156        fi
157        le_found=yes
158        break
159     fi
160   done
161   LIBS="$saved_LIBS"
162   LDFLAGS="$saved_LDFLAGS"
163   CPPFLAGS="$saved_CPPFLAGS"
164   if test $le_found = no ; then
165     AC_MSG_ERROR([Could not find a linkable libevent. You can specify an explicit path using --with-libevent-dir])
166   fi
168 LIBS="$LIBS -levent"
169 if test $ac_cv_libevent_dir != "(system)"; then
170   if test -d "$ac_cv_libevent_dir/lib" ; then
171     LDFLAGS="-L$ac_cv_libevent_dir/lib $LDFLAGS"
172     le_libdir="$ac_cv_libevent_dir/lib"
173   else
174     LDFLAGS="-L$ac_cv_libevent_dir $LDFLAGS"
175     le_libdir="$ac_cv_libevent_dir"
176   fi
177   if test -d "$ac_cv_libevent_dir/include" ; then
178     CPPFLAGS="-I$ac_cv_libevent_dir/include $CPPFLAGS"
179   else
180     CPPFLAGS="-I$ac_cv_libevent_dir $CPPFLAGS"
181   fi
184 if test -z "$CROSS_COMPILE"; then
185 AC_CACHE_CHECK([whether we need extra options to link libevent],
186                ac_cv_libevent_linker_option, [
187     saved_LDFLAGS="$LDFLAGS"
188     le_runs=no
189     linked_with=nothing
190     for le_extra in "" "-Wl,-R$le_libdir" "-R$le_libdir" ; do
191       LDFLAGS="$le_extra $saved_LDFLAGS"
192       AC_TRY_RUN([void *event_init(void);
193                 int main(int c, char **v) {
194                    event_init(); return 0;
195                 }],
196                 libevent_runs=yes, libevent_runs=no)
197       if test $libevent_runs = yes ; then
198         if test -z "$le_extra" ; then
199           ac_cv_libevent_linker_option='(none)'
200         else
201           ac_cv_libevent_linker_option=$le_extra
202         fi
203         le_runs=yes
204         break
205       fi
206     done
207     if test $le_runs = no ; then
208       AC_MSG_ERROR([Found linkable libevent in $ac_cv_libevent_dir, but it doesn't run, even with -R.  Maybe specify another using --with-libevent-dir?])
209     fi
210     LDFLAGS="$saved_LDFLAGS"
213 if test $ac_cv_libevent_linker_option != '(none)' ; then
214    LDFLAGS="$ac_cv_libevent_linker_option $LDFLAGS"
218 dnl ------------------------------------------------------
219 dnl Where do you live, openssl?  And how do we call you?
221 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssl_dir, [
222   saved_LIBS="$LIBS"
223   saved_LDFLAGS="$LDFLAGS"
224   saved_CPPFLAGS="$CPPFLAGS"
225   ssl_found=no
226   for ssldir in $tryssldir "" $prefix /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/athena /usr/pkg /opt /opt/openssl ; do
227     LDFLAGS="$saved_LDFLAGS"
228     LIBS="$saved_LIBS -lssl -lcrypto"
230     # Skip the directory if it isn't there.
231     if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
232        continue;
233     fi
234     if test ! -z "$ssldir" ; then
235       if test -d "$ssldir/lib" ; then
236         LDFLAGS="-L$ssldir/lib $LDFLAGS"
237       else
238         LDFLAGS="-L$ssldir $LDFLAGS"
239       fi
240       if test -d "$ssldir/include" ; then
241         CPPFLAGS="-I$ssldir/include $CPPFLAGS"
242       else
243         CPPFLAGS="-I$ssldir $CPPFLAGS"
244       fi
245     fi
246     # Can I link it?
247     AC_TRY_LINK([#include <openssl/rand.h>],
248        [ RAND_add((void*)0,0,0); ],
249        [ openssl_linked=yes ], [ openssl_linked=no ])
250     if test $openssl_linked = yes; then
251        if test ! -z "$ssldir" ; then
252          ac_cv_openssl_dir=$ssldir
253        else
254          ac_cv_openssl_dir="(system)"
255        fi
256        ssl_found=yes
257        break
258     fi
259   done
260   LIBS="$saved_LIBS"
261   LDFLAGS="$saved_LDFLAGS"
262   CPPFLAGS="$saved_CPPFLAGS"
263   if test $ssl_found = no ; then
264     AC_MSG_ERROR([Could not find a linkable OpenSSL. You can specify an explicit path using --with-ssl-dir])
265   fi
267 LIBS="$LIBS -lssl -lcrypto"
268 if test "$ac_cv_openssl_dir" != "(system)"; then
269   if test -d "$ac_cv_openssl_dir/lib" ; then
270     LDFLAGS="-L$ac_cv_openssl_dir/lib $LDFLAGS"
271     ssl_libdir="$ac_cv_openssl_dir/lib"
272   else
273     LDFLAGS="-L$ac_cv_openssl_dir $LDFLAGS"
274     ssl_libdir="$ac_cv_openssl_dir"
275   fi
276   if test -d "$ac_cv_openssl_dir/include" ; then
277     CPPFLAGS="-I$ac_cv_openssl_dir/include $CPPFLAGS"
278   else
279     CPPFLAGS="-I$ac_cv_openssl_dir $CPPFLAGS"
280   fi
283 if test -z $CROSS_COMPILE
284 then
285 AC_CACHE_CHECK([whether we need extra options to link OpenSSL],
286                ac_cv_openssl_linker_option, [
287     saved_LDFLAGS="$LDFLAGS"
288     ssl_runs=no
289     linked_with=nothing
290     for ssl_extra in "" "-Wl,-R$ssl_libdir" "-R$ssl_libdir" ; do
291       LDFLAGS="$ssl_extra $saved_LDFLAGS"
292       AC_TRY_RUN([
293 #include <string.h>
294 #include <openssl/rand.h>
295 int main(void)
297         char a[2048];
298         memset(a, 0, sizeof(a));
299         RAND_add(a, sizeof(a), sizeof(a));
300         return(RAND_status() <= 0);
302                         ],
303                 openssl_runs=yes, openssl_runs=no)
304       if test $openssl_runs = yes ; then
305         if test "$linked_with" = nothing; then
306            linked_with="$ssl_extra"
307         fi
308         AC_TRY_RUN([
309 #include <openssl/opensslv.h>
310 #include <openssl/crypto.h>
311 int main(void) {
312 return (OPENSSL_VERSION_NUMBER == SSLeay()) == 0;
314         right_version=yes, right_version=no)
315         if test "$right_version" = yes; then
316           if test -z "$ssl_extra" ; then
317             ac_cv_openssl_linker_option='(none)'
318           else
319             ac_cv_openssl_linker_option=$ssl_extra
320           fi
321           ssl_runs=yes
322           break
323         fi
324      fi
325     done
326     if test $ssl_runs = no ; then
327       if test "$linked_with" = 'nothing' ; then
328         AC_MSG_ERROR([Found linkable OpenSSL in $ac_cv_openssl_dir, but it doesn't run, even with -R.  Maybe specify another using --with-ssl-dir?])
329       else
330         if test -z "$linked_with" ; then
331             ac_cv_openssl_linker_option='(none)'
332         else
333             ac_cv_openssl_linker_option=$linked_with
334         fi
335         AC_MSG_WARN([I managed to make OpenSSL link and run, but I couldn't make it link against the same version I found header files for.])
336       fi
337     fi
338     LDFLAGS="$saved_LDFLAGS"
341 if test "$ac_cv_openssl_linker_option" != '(none)' ; then
342    LDFLAGS="$ac_cv_openssl_linker_option $LDFLAGS"
346 dnl Make sure to enable support for large off_t if avalable.
348 AC_SYS_LARGEFILE
350 dnl The warning message here is no longer strictly accurate.
352 AC_CHECK_HEADERS(unistd.h string.h signal.h netdb.h ctype.h sys/stat.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))
354 AC_CHECK_HEADERS(event.h, , AC_MSG_ERROR(Libevent header (event.h) not found. Tor requires libevent to build.))
356 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.))
358 dnl These headers are not essential
360 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 stddef.h inttypes.h utime.h sys/utime.h sys/mman.h alloca.h)
362 AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime getrlimit setrlimit strlcat strlcpy strtoull getpwnam getpwuid ftello getaddrinfo localtime_r gmtime_r event_get_version event_get_method event_set_log_callback memmem mmap strtok_r)
364 if test $enable_threads = "yes"; then
365   AC_CHECK_HEADERS(pthread.h)
366   AC_CHECK_FUNCS(pthread_create)
369 AC_FUNC_FSEEKO
371 AC_CHECK_MEMBERS([struct timeval.tv_sec])
373 dnl In case we aren't given a working stdint.h, we'll need to grow our own.
374 dnl Watch out.
376 AC_CHECK_SIZEOF(int8_t)
377 AC_CHECK_SIZEOF(int16_t)
378 AC_CHECK_SIZEOF(int32_t)
379 AC_CHECK_SIZEOF(int64_t)
380 AC_CHECK_SIZEOF(uint8_t)
381 AC_CHECK_SIZEOF(uint16_t)
382 AC_CHECK_SIZEOF(uint32_t)
383 AC_CHECK_SIZEOF(uint64_t)
384 AC_CHECK_SIZEOF(intptr_t)
385 AC_CHECK_SIZEOF(uintptr_t)
387 dnl AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t, intptr_t, uintptr_t])
389 AC_CHECK_SIZEOF(char)
390 AC_CHECK_SIZEOF(short)
391 AC_CHECK_SIZEOF(int)
392 AC_CHECK_SIZEOF(long)
393 AC_CHECK_SIZEOF(long long)
394 AC_CHECK_SIZEOF(__int64)
395 AC_CHECK_SIZEOF(void *)
396 AC_CHECK_SIZEOF(time_t)
398 if test -z "$CROSS_COMPILE"; then
399 AC_CACHE_CHECK([whether time_t is signed], tor_cv_time_t_signed, [
400 AC_TRY_RUN([
401 int main(int c, char**v) { if (((time_t)-1)<0) return 1; else return 0; }],
402   tor_cv_time_t_signed=no, tor_cv_time_t_signed=yes)
404 else
405   # Cross-compiling; let's hope the target platform isn't loony.
406   AC_MSG_NOTICE([Cross compiling: assuming that time_t is signed.])
407   tor_cv_time_t_signed=yes
410 if test $tor_cv_time_t_signed = yes; then
411   AC_DEFINE([TIME_T_IS_SIGNED], 1,
412             [Define to 1 iff time_t is signed])
415 AC_CHECK_SIZEOF(socklen_t, , [AC_INCLUDES_DEFAULT()
416 #ifdef HAVE_SYS_SOCKET_H
417 #include <sys/socket.h>
418 #endif
421 # We want to make sure that we _don't_ have a cell_t defined, like IRIX does.
423 AC_CHECK_SIZEOF(cell_t)
425 # Now make sure that NULL can be represented as zero bytes.
426 if test -z "$CROSS_COMPILE"; then
427 AC_CACHE_CHECK([whether memset(0) sets pointers to NULL], tor_cv_null_is_zero,
428 [AC_RUN_IFELSE([AC_LANG_SOURCE(
429 [[#include <stdlib.h>
430 #include <string.h>
431 #include <stdio.h>
432 #ifdef HAVE_STDDEF_H
433 #include <stddef.h>
434 #endif
435 int main () { char *p1,*p2; p1=NULL; memset(&p2,0,sizeof(p2));
436 return memcmp(&p1,&p2,sizeof(char*))?1:0; }]])],
437        [tor_cv_null_is_zero=yes],
438        [tor_cv_null_is_zero=no],
439        [tor_cv_null_is_zero=cross])])
441 else
442   # Cross-compiling; let's hope that the target isn't raving mad.
443   AC_MSG_NOTICE([Cross-compiling: we'll assume that NULL is represented as a sequence of 0-valued bytes.])
444   tor_cv_null_is_zero=yes
447 if test $tor_cv_null_is_zero = yes; then
448   AC_DEFINE([NULL_REP_IS_ZERO_BYTES], 1,
449             [Define to 1 iff memset(0) sets pointers to NULL])
452 # Whether we should use the dmalloc memory allocation debugging library.
453 AC_MSG_CHECKING(whether to use dmalloc (debug memory allocation library))
454 AC_ARG_WITH(dmalloc,
455 [  --with-dmalloc          Use debug memory allocation library. ],
456 [if [[ "$withval" = "yes" ]]; then
457   dmalloc=1
458   AC_MSG_RESULT(yes)
459 else
460   dmalloc=1
461   AC_MSG_RESULT(no)
462 fi], [ dmalloc=0; AC_MSG_RESULT(no) ]
465 if [[ $dmalloc -eq 1 ]]; then
466   AC_CHECK_HEADERS(dmalloc.h, , AC_MSG_ERROR(dmalloc header file not found. Do you have the development files for dmalloc installed?))
467   AC_SEARCH_LIBS(dmalloc_malloc, [dmallocth dmalloc], , AC_MSG_ERROR(Libdmalloc library not found. If you enable it you better have it installed.))
468   AC_DEFINE(USE_DMALLOC, 1, [Debug memory allocation library])
469   AC_DEFINE(DMALLOC_FUNC_CHECK, 1, [Enable dmalloc's malloc function check])
472 # Allow user to specify an alternate syslog facility
473 AC_ARG_WITH(syslog-facility,
474 [  --with-syslog-facility=LOG syslog facility to use (default=LOG_DAEMON)],
475 syslog_facility="$withval", syslog_facility="LOG_DAEMON")
476 AC_DEFINE_UNQUOTED(LOGFACILITY,$syslog_facility,[name of the syslog facility])
477 AC_SUBST(LOGFACILITY)
479 # Check for gethostbyname_r in all its glorious incompatible versions.
480 #   (This logic is based on that in Python's configure.in)
481 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
482   [Define this if you have any gethostbyname_r()])
484 AC_CHECK_FUNC(gethostbyname_r, [
485   AC_MSG_CHECKING([how many arguments gethostbyname_r() wants])
486   OLD_CFLAGS=$CFLAGS
487   CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
488   AC_TRY_COMPILE([
489 #include <netdb.h>
490   ], [
491     char *cp1, *cp2;
492     struct hostent *h1, *h2;
493     int i1, i2;
494     (void)gethostbyname_r(cp1,h1,cp2,i1,&h2,&i2);
495   ], [
496     AC_DEFINE(HAVE_GETHOSTBYNAME_R)
497     AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
498      [Define this if gethostbyname_r takes 6 arguments])
499     AC_MSG_RESULT(6)
500   ], [
501     AC_TRY_COMPILE([
502 #include <netdb.h>
503     ], [
504       char *cp1, *cp2;
505       struct hostent *h1;
506       int i1, i2;
507       (void)gethostbyname_r(cp1,h1,cp2,i1,&i2);
508     ], [
509       AC_DEFINE(HAVE_GETHOSTBYNAME_R)
510       AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
511         [Define this if gethostbyname_r takes 5 arguments])
512       AC_MSG_RESULT(5)
513    ], [
514       AC_TRY_COMPILE([
515 #include <netdb.h>
516      ], [
517        char *cp1;
518        struct hostent *h1;
519        struct hostent_data hd;
520        (void) gethostbyname_r(cp1,h1,&hd);
521      ], [
522        AC_DEFINE(HAVE_GETHOSTBYNAME_R)
523        AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
524          [Define this if gethostbyname_r takes 3 arguments])
525        AC_MSG_RESULT(3)
526      ], [
527        AC_MSG_RESULT(0)
528      ])
529   ])
530  ])
531  CFLAGS=$OLD_CFLAGS
534 AC_CACHE_CHECK([whether the C compiler supports __func__],
535   ac_cv_have_func_macro,
536   AC_COMPILE_IFELSE([
537 #include <stdio.h>
538 int main(int c, char **v) { puts(__func__); }],
539   ac_cv_have_func_macro=yes,
540   ac_cv_have_func_macro=no))
542 AC_CACHE_CHECK([whether the C compiler supports __FUNC__],
543   ac_cv_have_FUNC_macro,
544   AC_COMPILE_IFELSE([
545 #include <stdio.h>
546 int main(int c, char **v) { puts(__FUNC__); }],
547   ac_cv_have_FUNC_macro=yes,
548   ac_cv_have_FUNC_macro=no))
550 AC_CACHE_CHECK([whether the C compiler supports __FUNCTION__],
551   ac_cv_have_FUNCTION_macro,
552   AC_COMPILE_IFELSE([
553 #include <stdio.h>
554 int main(int c, char **v) { puts(__FUNCTION__); }],
555   ac_cv_have_FUNCTION_macro=yes,
556   ac_cv_have_FUNCTION_macro=no))
558 if test $ac_cv_have_func_macro = 'yes'; then
559   AC_DEFINE(HAVE_MACRO__func__, 1, [Defined if the compiler supports __func__])
563 if test $ac_cv_have_FUNC_macro = 'yes'; then
564   AC_DEFINE(HAVE_MACRO__FUNC__, 1, [Defined if the compiler supports __FUNC__])
567 if test $ac_cv_have_FUNCTION_macro = 'yes'; then
568   AC_DEFINE(HAVE_MACRO__FUNCTION__, 1,
569            [Defined if the compiler supports __FUNCTION__])
573 # $prefix stores the value of the --prefix command line option, or
574 # NONE if the option wasn't set.  In the case that it wasn't set, make
575 # it be the default, so that we can use it to expand directories now.
576 if test "x$prefix" = "xNONE"; then
577   prefix=$ac_default_prefix
580 # and similarly for $exec_prefix
581 if test "x$exec_prefix" = "xNONE"; then
582   exec_prefix=$prefix
585 CONFDIR=`eval echo $sysconfdir/tor`
586 AC_SUBST(CONFDIR)
587 AH_TEMPLATE([CONFDIR],[tor's configuration directory])
588 AC_DEFINE_UNQUOTED(CONFDIR,"$CONFDIR")
590 BINDIR=`eval echo $bindir`
591 AC_SUBST(BINDIR)
593 LOCALSTATEDIR=`eval echo $localstatedir`
594 AC_SUBST(LOCALSTATEDIR)
595 AH_TEMPLATE([LOCALSTATEDIR], [Default location to store state files.])
596 AC_DEFINE_UNQUOTED(LOCALSTATEDIR,"$LOCALSTATEDIR")
598 # Set CFLAGS _after_ all the above checks, since our warnings are stricter
599 # than autoconf's macros like.
600 if test $ac_cv_c_compiler_gnu = yes; then
601   CFLAGS="$CFLAGS -Wall -g -O2"
602 else
603   CFLAGS="$CFLAGS -g -O"
605 # Add some more warnings which we use in the cvs version but not in the
606 # released versions.  (Some relevant gcc versions can't handle these.)
607 #CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2 -Winit-self -Wwrite-strings -Waggregate-return -Wmissing-declarations -Wmissing-field-initializers -Wredundant-decls -Winline"
608 # Add these in when you feel like fun.
609 #CFLAGS="$CFLAGS -Wbad-function-cast -Werror -Wdeclaration-after-statement -Wold-style-definition"
611 echo "confdir: $CONFDIR"
613 AC_OUTPUT(Makefile tor.spec contrib/tor.sh contrib/torctl contrib/torify contrib/tor.logrotate contrib/Makefile contrib/osx/Makefile contrib/osx/TorBundleDesc.plist contrib/osx/TorBundleInfo.plist contrib/osx/TorDesc.plist contrib/osx/TorInfo.plist contrib/osx/TorStartupDesc.plist contrib/osx/net.freehaven.tor.plist src/config/torrc.sample doc/tor.1 src/Makefile doc/Makefile doc/design-paper/Makefile src/config/Makefile src/common/Makefile src/or/Makefile src/win32/Makefile src/tools/Makefile contrib/suse/Makefile contrib/suse/tor.sh)
615 if test -x /usr/bin/perl && test -x ./contrib/updateVersions.pl ; then
616   ./contrib/updateVersions.pl