Forward port patches/07_log_to_file_by_default
[tor.git] / configure.in
blob1176b54adc5bed553dcf0018bba001961c230c82
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.1.17-rc)
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 case $host in
48    *-*-solaris* )
49      AC_DEFINE(_REENTRANT, 1, [Define on some platforms to activate x_r() functions in time.h])
50      ;;
51 esac
53 AC_PROG_CC
54 AC_PROG_MAKE_SET
55 AC_PROG_RANLIB
57 # The big search for OpenSSL
58 # copied from openssh's configure.ac
59 tryssldir=""
60 AC_ARG_WITH(ssl-dir,
61         [  --with-ssl-dir=PATH     Specify path to OpenSSL installation ],
62         [
63                 if test "x$withval" != "xno" ; then
64                         tryssldir=$withval
65                 fi
66         ]
69 trylibeventdir=""
70 AC_ARG_WITH(libevent-dir,
71        [  --with-libevent-dir=PATH     Specify path to Libevent installation ],
72        [
73                 if test "x$withval" != "xno" ; then
74                         trylibeventdir=$withval
75                 fi
76        ]
79 TORUSER=_tor
80 AC_ARG_WITH(tor-user,
81         [  --with-tor-user=NAME    Specify username for tor daemon ],
82         [
83            TORUSER=$withval
84         ]
86 AC_SUBST(TORUSER)
88 TORGROUP=_tor
89 AC_ARG_WITH(tor-group,
90         [  --with-tor-group=NAME   Specify group name for tor daemon ],
91         [
92            TORGROUP=$withval
93         ]
95 AC_SUBST(TORGROUP)
97 AC_SEARCH_LIBS(socket, [socket])
98 AC_SEARCH_LIBS(gethostbyname, [nsl])
99 AC_SEARCH_LIBS(dlopen, [dl])
101 if test $enable_threads = "yes"; then
102   AC_SEARCH_LIBS(pthread_create, [pthread])
103   AC_SEARCH_LIBS(pthread_detach, [pthread])
106 dnl ------------------------------------------------------
107 dnl Where do you live, libevent?  And how do we call you?
109 AC_CACHE_CHECK([for libevent directory], ac_cv_libevent_dir, [
110   saved_LIBS="$LIBS"
111   saved_LDFLAGS="$LDFLAGS"
112   saved_CPPFLAGS="$CPPFLAGS"
113   le_found=no
114   for ledir in $trylibeventdir "" $prefix /usr/local ; do
115     LDFLAGS="$saved_LDFLAGS"
116     LIBS="$saved_LIBS -levent"
118     # Skip the directory if it isn't there.
119     if test ! -z "$ledir" -a ! -d "$ledir" ; then
120        continue;
121     fi
122     if test ! -z "$ledir" ; then
123       if test -d "$ledir/lib" ; then
124         LDFLAGS="-L$ledir/lib $LDFLAGS"
125       else
126         LDFLAGS="-L$ledir $LDFLAGS"
127       fi
128       if test -d "$ledir/include" ; then
129         CPPFLAGS="-I$ledir/include $CPPFLAGS"
130       else
131         CPPFLAGS="-I$ledir $CPPFLAGS"
132       fi
133     fi
134     # Can I compile and link it?
135     AC_TRY_LINK([#include <sys/time.h>
136 #include <sys/types.h>
137 #include <event.h>], [ event_init(); ],
138        [ libevent_linked=yes ], [ libevent_linked=no ])
139     if test $libevent_linked = yes; then
140        if test ! -z "$ledir" ; then
141          ac_cv_libevent_dir=$ledir
142        else
143          ac_cv_libevent_dir="(system)"
144        fi
145        le_found=yes
146        break
147     fi
148   done
149   LIBS="$saved_LIBS"
150   LDFLAGS="$saved_LDFLAGS"
151   CPPFLAGS="$saved_CPPFLAGS"
152   if test $le_found = no ; then
153     AC_MSG_ERROR([Could not find a linkable libevent. You can specify an explicit path using --with-libevent-dir])
154   fi
156 LIBS="$LIBS -levent"
157 if test $ac_cv_libevent_dir != "(system)"; then
158   if test -d "$ac_cv_libevent_dir/lib" ; then
159     LDFLAGS="-L$ac_cv_libevent_dir/lib $LDFLAGS"
160     le_libdir="$ac_cv_libevent_dir/lib"
161   else
162     LDFLAGS="-L$ac_cv_libevent_dir $LDFLAGS"
163     le_libdir="$ac_cv_libevent_dir"
164   fi
165   if test -d "$ac_cv_libevent_dir/include" ; then
166     CPPFLAGS="-I$ac_cv_libevent_dir/include $CPPFLAGS"
167   else
168     CPPFLAGS="-I$ac_cv_libevent_dir $CPPFLAGS"
169   fi
172 AC_CACHE_CHECK([whether we need extra options to link libevent],
173                ac_cv_libevent_linker_option, [
174     saved_LDFLAGS="$LDFLAGS"
175     le_runs=no
176     linked_with=nothing
177     for le_extra in "" "-Wl,-R$le_libdir" "-R$le_libdir" ; do
178       LDFLAGS="$le_extra $saved_LDFLAGS"
179       AC_TRY_RUN([void *event_init(void);
180                 int main(int c, char **v) {
181                    event_init(); return 0;
182                 }],
183                 libevent_runs=yes, libevent_runs=no)
184       if test $libevent_runs = yes ; then
185         if test -z "$le_extra" ; then
186           ac_cv_libevent_linker_option='(none)'
187         else
188           ac_cv_libevent_linker_option=$le_extra
189         fi
190         le_runs=yes
191         break
192       fi
193     done
194     if test $le_runs = no ; then
195       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?])
196     fi
197     LDFLAGS="$saved_LDFLAGS"
200 if test $ac_cv_libevent_linker_option != '(none)' ; then
201    LDFLAGS="$ac_cv_libevent_linker_option $LDFLAGS"
204 dnl ------------------------------------------------------
205 dnl Where do you live, openssl?  And how do we call you?
207 AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssl_dir, [
208   saved_LIBS="$LIBS"
209   saved_LDFLAGS="$LDFLAGS"
210   saved_CPPFLAGS="$CPPFLAGS"
211   ssl_found=no
212   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
213     LDFLAGS="$saved_LDFLAGS"
214     LIBS="$saved_LIBS -lssl -lcrypto"
216     # Skip the directory if it isn't there.
217     if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
218        continue;
219     fi
220     if test ! -z "$ssldir" ; then
221       if test -d "$ssldir/lib" ; then
222         LDFLAGS="-L$ssldir/lib $LDFLAGS"
223       else
224         LDFLAGS="-L$ssldir $LDFLAGS"
225       fi
226       if test -d "$ssldir/include" ; then
227         CPPFLAGS="-I$ssldir/include $CPPFLAGS"
228       else
229         CPPFLAGS="-I$ssldir $CPPFLAGS"
230       fi
231     fi
232     # Can I link it?
233     AC_TRY_LINK([#include <openssl/rand.h>],
234        [ RAND_add((void*)0,0,0); ],
235        [ openssl_linked=yes ], [ openssl_linked=no ])
236     if test $openssl_linked = yes; then
237        if test ! -z "$ssldir" ; then
238          ac_cv_openssl_dir=$ssldir
239        else
240          ac_cv_openssl_dir="(system)"
241        fi
242        ssl_found=yes
243        break
244     fi
245   done
246   LIBS="$saved_LIBS"
247   LDFLAGS="$saved_LDFLAGS"
248   CPPFLAGS="$saved_CPPFLAGS"
249   if test $ssl_found = no ; then
250     AC_MSG_ERROR([Could not find a linkable OpenSSL. You can specify an explicit path using --with-ssl-dir])
251   fi
253 LIBS="$LIBS -lssl -lcrypto"
254 if test "$ac_cv_openssl_dir" != "(system)"; then
255   if test -d "$ac_cv_openssl_dir/lib" ; then
256     LDFLAGS="-L$ac_cv_openssl_dir/lib $LDFLAGS"
257     ssl_libdir="$ac_cv_openssl_dir/lib"
258   else
259     LDFLAGS="-L$ac_cv_openssl_dir $LDFLAGS"
260     ssl_libdir="$ac_cv_openssl_dir"
261   fi
262   if test -d "$ac_cv_openssl_dir/include" ; then
263     CPPFLAGS="-I$ac_cv_openssl_dir/include $CPPFLAGS"
264   else
265     CPPFLAGS="-I$ac_cv_openssl_dir $CPPFLAGS"
266   fi
269 AC_CACHE_CHECK([whether we need extra options to link OpenSSL],
270                ac_cv_openssl_linker_option, [
271     saved_LDFLAGS="$LDFLAGS"
272     ssl_runs=no
273     linked_with=nothing
274     for ssl_extra in "" "-Wl,-R$ssl_libdir" "-R$ssl_libdir" ; do
275       LDFLAGS="$ssl_extra $saved_LDFLAGS"
276       AC_TRY_RUN([
277 #include <string.h>
278 #include <openssl/rand.h>
279 int main(void)
281         char a[2048];
282         memset(a, 0, sizeof(a));
283         RAND_add(a, sizeof(a), sizeof(a));
284         return(RAND_status() <= 0);
286                         ],
287                 openssl_runs=yes, openssl_runs=no)
288       if test $openssl_runs = yes ; then
289         if test "$linked_with" = nothing; then
290            linked_with="$ssl_extra"
291         fi
292         AC_TRY_RUN([
293 #include <openssl/opensslv.h>
294 #include <openssl/crypto.h>
295 int main(void) {
296 return (OPENSSL_VERSION_NUMBER == SSLeay()) == 0;
298         right_version=yes, right_version=no)
299         if test "$right_version" = yes; then
300           if test -z "$ssl_extra" ; then
301             ac_cv_openssl_linker_option='(none)'
302           else
303             ac_cv_openssl_linker_option=$ssl_extra
304           fi
305           ssl_runs=yes
306           break
307         fi
308      fi
309     done
310     if test $ssl_runs = no ; then
311       if test "$linked_with" = 'nothing' ; then
312         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?])
313       else
314         if test -z "$linked_with" ; then
315             ac_cv_openssl_linker_option='(none)'
316         else
317             ac_cv_openssl_linker_option=$linked_with
318         fi
319         AC_MSG_WARN([I managed to make OpenSSL link and run, but I couldn't make it link against with the same version I found header files for.])
320       fi
321     fi
322     LDFLAGS="$saved_LDFLAGS"
325 if test "$ac_cv_openssl_linker_option" != '(none)' ; then
326    LDFLAGS="$ac_cv_openssl_linker_option $LDFLAGS"
329 dnl Make sure to enable support for large off_t if avalable.
331 AC_SYS_LARGEFILE
333 dnl The warning message here is no longer strictly accurate.
335 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))
337 AC_CHECK_HEADERS(event.h, , AC_MSG_ERROR(Libevent header (event.h) not found. Tor requires libevent to build.))
339 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.))
341 dnl These headers are not essential
343 AC_CHECK_HEADERS(stdint.h sys/types.h inttypes.h sys/param.h sys/wait.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)
345 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)
347 if test $enable_threads = "yes"; then
348   AC_CHECK_HEADERS(pthread.h)
349   AC_CHECK_FUNCS(pthread_create)
352 AC_FUNC_FSEEKO
354 AC_CHECK_MEMBERS([struct timeval.tv_sec])
356 dnl In case we aren't given a working stdint.h, we'll need to grow our own.
357 dnl Watch out.
359 AC_CHECK_SIZEOF(int8_t)
360 AC_CHECK_SIZEOF(int16_t)
361 AC_CHECK_SIZEOF(int32_t)
362 AC_CHECK_SIZEOF(int64_t)
363 AC_CHECK_SIZEOF(uint8_t)
364 AC_CHECK_SIZEOF(uint16_t)
365 AC_CHECK_SIZEOF(uint32_t)
366 AC_CHECK_SIZEOF(uint64_t)
367 AC_CHECK_SIZEOF(intptr_t)
368 AC_CHECK_SIZEOF(uintptr_t)
370 dnl AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t, intptr_t, uintptr_t])
372 AC_CHECK_SIZEOF(char)
373 AC_CHECK_SIZEOF(short)
374 AC_CHECK_SIZEOF(int)
375 AC_CHECK_SIZEOF(long)
376 AC_CHECK_SIZEOF(long long)
377 AC_CHECK_SIZEOF(__int64)
378 AC_CHECK_SIZEOF(void *)
379 AC_CHECK_SIZEOF(time_t)
380 AC_CACHE_CHECK([whether time_t is signed], tor_cv_time_t_signed, [
381 AC_TRY_RUN([
382 int main(int c, char**v) { if (((time_t)-1)<0) return 1; else return 0; }],
383   tor_cv_time_t_signed=no, tor_cv_time_t_signed=yes)
386 if test $tor_cv_time_t_signed = yes; then
387   AC_DEFINE([TIME_T_IS_SIGNED], 1,
388             [Define to 1 iff time_t is signed])
391 AC_CHECK_SIZEOF(socklen_t, , [AC_INCLUDES_DEFAULT()
392 #ifdef HAVE_SYS_SOCKET_H
393 #include <sys/socket.h>
394 #endif
397 # We want to make sure that we _don't_ have a cell_t defined, like IRIX does.
399 AC_CHECK_SIZEOF(cell_t)
401 # Now, let's see about alignment requirements.  On some platforms, we override
402 # the default.
403 case $host in
404  ia64-*-* | arm-*-* | sparc-*-* | sparc64-*-* )
405     tor_cv_unaligned_ok=no
406     ;;
407  # On the following architectures unaligned access works, but is not done in
408  # hardware.  This means that when you try to do unaligned access the kernel
409  # gets to sort out an exception and then work around to somehow make your
410  # reqest work, which is quite expensive.  Therefore it's probably better to
411  # not even do it.
412  alpha-*-* | mips-*-* | mipsel-*-* )
413     tor_cv_unaligned_ok=no
414     ;;
415  *)
416 AC_CACHE_CHECK([whether unaligned int access is allowed], tor_cv_unaligned_ok,
417 [AC_RUN_IFELSE([AC_LANG_SOURCE(
418 [[int main () { char s[] = "A\x00\x00\x00\x00\x00\x00\x00";
419 return *(int*)(&s[1]); }]])],
420        [tor_cv_unaligned_ok=yes],
421        [tor_cv_unaligned_ok=no],
422        [tor_cv_unaligned_ok=cross])])
423 esac
425 if test $tor_cv_unaligned_ok = yes; then
426   AC_DEFINE([UNALIGNED_INT_ACCESS_OK], 1,
427             [Define to 1 iff unaligned int access is allowed])
430 # Now make sure that NULL can be represented as zero bytes.
431 AC_CACHE_CHECK([whether memset(0) sets pointers to NULL], tor_cv_null_is_zero,
432 [AC_RUN_IFELSE([AC_LANG_SOURCE(
433 [[#include <stdlib.h>
434 #include <string.h>
435 #include <stdio.h>
436 #ifdef HAVE_STDDEF_H
437 #include <stddef.h>
438 #endif
439 int main () { char *p1,*p2; p1=NULL; memset(&p2,0,sizeof(p2));
440 return memcmp(&p1,&p2,sizeof(char*))?1:0; }]])],
441        [tor_cv_null_is_zero=yes],
442        [tor_cv_null_is_zero=no],
443        [tor_cv_null_is_zero=cross])])
445 if test $tor_cv_null_is_zero = yes; then
446   AC_DEFINE([NULL_REP_IS_ZERO_BYTES], 1,
447             [Define to 1 iff memset(0) sets pointers to NULL])
450 # Whether we should use the dmalloc memory allocation debugging library.
451 AC_MSG_CHECKING(whether to use dmalloc (debug memory allocation library))
452 AC_ARG_WITH(dmalloc,
453 [  --with-dmalloc          Use debug memory allocation library. ],
454 [if [[ "$withval" = "yes" ]]; then
455   dmalloc=1
456   AC_MSG_RESULT(yes)
457 else
458   dmalloc=1
459   AC_MSG_RESULT(no)
460 fi], [ dmalloc=0; AC_MSG_RESULT(no) ]
463 if [[ $dmalloc -eq 1 ]]; then
464   AC_CHECK_HEADERS(dmalloc.h, , AC_MSG_ERROR(dmalloc header file not found. Do you have the development files for dmalloc installed?))
465   AC_SEARCH_LIBS(dmalloc_malloc, [dmallocth dmalloc], , AC_MSG_ERROR(Libdmalloc library not found. If you enable it you better have it installed.))
466   AC_DEFINE(USE_DMALLOC, 1, [Debug memory allocation library])
467   AC_DEFINE(DMALLOC_FUNC_CHECK, 1, [Enable dmalloc's malloc function check])
470 # Allow user to specify an alternate syslog facility
471 AC_ARG_WITH(syslog-facility,
472 [  --with-syslog-facility=LOG syslog facility to use (default=LOG_DAEMON)],
473 syslog_facility="$withval", syslog_facility="LOG_DAEMON")
474 AC_DEFINE_UNQUOTED(LOGFACILITY,$syslog_facility,[name of the syslog facility])
475 AC_SUBST(LOGFACILITY)
477 # Check for gethostbyname_r in all its glorious incompatible versions.
478 #   (This logic is based on that in Python's configure.in)
479 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
480   [Define this if you have any gethostbyname_r()])
482 AC_CHECK_FUNC(gethostbyname_r, [
483   AC_MSG_CHECKING([how many arguments gethostbyname_r() wants])
484   OLD_CFLAGS=$CFLAGS
485   CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
486   AC_TRY_COMPILE([
487 #include <netdb.h>
488   ], [
489     char *cp1, *cp2;
490     struct hostent *h1, *h2;
491     int i1, i2;
492     (void)gethostbyname_r(cp1,h1,cp2,i1,&h2,&i2);
493   ], [
494     AC_DEFINE(HAVE_GETHOSTBYNAME_R)
495     AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
496      [Define this if gethostbyname_r takes 6 arguments])
497     AC_MSG_RESULT(6)
498   ], [
499     AC_TRY_COMPILE([
500 #include <netdb.h>
501     ], [
502       char *cp1, *cp2;
503       struct hostent *h1;
504       int i1, i2;
505       (void)gethostbyname_r(cp1,h1,cp2,i1,&i2);
506     ], [
507       AC_DEFINE(HAVE_GETHOSTBYNAME_R)
508       AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
509         [Define this if gethostbyname_r takes 5 arguments])
510       AC_MSG_RESULT(5)
511    ], [
512       AC_TRY_COMPILE([
513 #include <netdb.h>
514      ], [
515        char *cp1;
516        struct hostent *h1;
517        struct hostent_data hd;
518        (void) gethostbyname_r(cp1,h1,&hd);
519      ], [
520        AC_DEFINE(HAVE_GETHOSTBYNAME_R)
521        AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
522          [Define this if gethostbyname_r takes 3 arguments])
523        AC_MSG_RESULT(3)
524      ], [
525        AC_MSG_RESULT(0)
526      ])
527   ])
528  ])
529  CFLAGS=$OLD_CFLAGS
532 AC_CACHE_CHECK([whether the C compiler supports __func__],
533   ac_cv_have_func_macro,
534   AC_COMPILE_IFELSE([
535 #include <stdio.h>
536 int main(int c, char **v) { puts(__func__); }],
537   ac_cv_have_func_macro=yes,
538   ac_cv_have_func_macro=no))
540 AC_CACHE_CHECK([whether the C compiler supports __FUNC__],
541   ac_cv_have_FUNC_macro,
542   AC_COMPILE_IFELSE([
543 #include <stdio.h>
544 int main(int c, char **v) { puts(__FUNC__); }],
545   ac_cv_have_FUNC_macro=yes,
546   ac_cv_have_FUNC_macro=no))
548 AC_CACHE_CHECK([whether the C compiler supports __FUNCTION__],
549   ac_cv_have_FUNCTION_macro,
550   AC_COMPILE_IFELSE([
551 #include <stdio.h>
552 int main(int c, char **v) { puts(__FUNCTION__); }],
553   ac_cv_have_FUNCTION_macro=yes,
554   ac_cv_have_FUNCTION_macro=no))
556 if test $ac_cv_have_func_macro = 'yes'; then
557   AC_DEFINE(HAVE_MACRO__func__, 1, [Defined if the compiler supports __func__])
561 if test $ac_cv_have_FUNC_macro = 'yes'; then
562   AC_DEFINE(HAVE_MACRO__FUNC__, 1, [Defined if the compiler supports __FUNC__])
565 if test $ac_cv_have_FUNCTION_macro = 'yes'; then
566   AC_DEFINE(HAVE_MACRO__FUNCTION__, 1,
567            [Defined if the compiler supports __FUNCTION__])
571 # $prefix stores the value of the --prefix command line option, or
572 # NONE if the option wasn't set.  In the case that it wasn't set, make
573 # it be the default, so that we can use it to expand directories now.
574 if test "x$prefix" = "xNONE"; then
575   prefix=$ac_default_prefix
578 # and similarly for $exec_prefix
579 if test "x$exec_prefix" = "xNONE"; then
580   exec_prefix=$prefix
583 CONFDIR=`eval echo $sysconfdir/tor`
584 AC_SUBST(CONFDIR)
585 AC_DEFINE_UNQUOTED(CONFDIR,"$CONFDIR")
586 AC_DEFINE([CONFDIR], [], [tor's configuration directory])
588 BINDIR=`eval echo $bindir`
589 AC_SUBST(BINDIR)
591 LOCALSTATEDIR=`eval echo $localstatedir`
592 AC_SUBST(LOCALSTATEDIR)
593 AC_DEFINE_UNQUOTED(LOCALSTATEDIR,"$LOCALSTATEDIR")
594 AC_DEFINE([LOCALSTATEDIR], [], [Default location to store state files.])
596 # Set CFLAGS _after_ all the above checks, since our warnings are stricter
597 # than autoconf's macros like.
598 if test $ac_cv_c_compiler_gnu = yes; then
599   CFLAGS="$CFLAGS -Wall -g -O2"
600 else
601   CFLAGS="$CFLAGS -g -O"
603 # Add some more warnings which we use in the cvs version but not in the
604 # released versions.  (Some relevant gcc versions can't handle these.)
605 #CFLAGS="$CFLAGS -W -Wno-unused-parameter -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"
606 # Add these in when you feel like fun.
607 #CFLAGS="$CFLAGS -Wbad-function-cast -Werror -Wdeclaration-after-statement -Wold-style-definition"
609 echo "confdir: $CONFDIR"
611 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 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)
613 if test -x /usr/bin/perl && test -x ./contrib/updateVersions.pl ; then
614   ./contrib/updateVersions.pl