2 dnl Copyright (c) 2001-2004, Roger Dingledine
3 dnl Copyright (c) 2004-2007, Roger Dingledine, Nick Mathewson
4 dnl See LICENSE for licensing information
7 AM_INIT_AUTOMAKE(tor, 0.1.2.19)
8 AM_CONFIG_HEADER(orconfig.h)
12 if test -f /etc/redhat-release; then
13 CFLAGS="$CFLAGS -I/usr/kerberos/include"
17 AC_HELP_STRING(--enable-debug, compile with debugging info),
18 [if test x$enableval = xyes; then
22 AC_ARG_ENABLE(eventdns,
23 AC_HELP_STRING(--enable-eventdns, enable asynchronous dns module),
24 [case "${enableval}" in
27 *) AC_MSG_ERROR(bad value for --enable-eventdns) ;;
28 esac], [eventdns=true])
29 AM_CONDITIONAL(EVENTDNS, test x$eventdns = xtrue)
30 if test x$eventdns = xtrue; then
31 AC_DEFINE([USE_EVENTDNS], 1, "Define to 1 if we'll be using eventdns.c")
34 AC_ARG_ENABLE(transparent,
35 AC_HELP_STRING(--disable-transparent, disable transparent proxy support),
36 [case "${enableval}" in
37 yes) transparent=true ;;
38 no) transparent=false ;;
39 *) AC_MSG_ERROR(bad value for --enable-transparent) ;;
40 esac], [transparent=true])
42 AC_ARG_ENABLE(threads,
43 AC_HELP_STRING(--disable-threads, disable multi-threading support))
45 if test x$enable_threads = x; then
47 *-*-netbsd* | *-*-openbsd* )
48 # Don't try multithreading on netbsd -- there is no threadsafe DNS
49 # lookup function there.
50 if test x$eventdns != xtrue; then
51 AC_MSG_NOTICE([You are running OpenBSD or NetBSD; I am assuming that
52 getaddrinfo is not threadsafe here, so I will disable threads.])
55 # This was an inadvertant default up through 0.1.2.14; in 0.2.0.x,
56 # it's getting some testing, but for now, best leave threads off
57 # unless the user urns them on.
58 AC_MSG_NOTICE([You are running OpenBSD or NetBSD; Tor 0.1.2.x hasn't
59 been tested with threads on these platforms, so I'm turning them off. You
60 can enable threads by passing --enable-threads to the configure script.])
64 # Don't try multithreading on solaris -- cpuworkers seem to lock.
65 AC_MSG_NOTICE([You are running Solaris; Sometimes threading makes
66 cpu workers lock up here, so I will disable threads.])
69 enable_threads="yes";;
73 if test $enable_threads = "yes"; then
74 AC_DEFINE(ENABLE_THREADS, 1, [Defined if we will try to use multithreading])
79 AC_DEFINE(_REENTRANT, 1, [Define on some platforms to activate x_r() functions in time.h])
83 AC_ARG_ENABLE(gcc-warnings,
84 AC_HELP_STRING(--enable-gcc-warnings, enable verbose warnings))
91 # The big search for OpenSSL
92 # copied from openssh's configure.ac
95 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
97 if test "x$withval" != "xno" ; then
104 AC_ARG_WITH(libevent-dir,
105 [ --with-libevent-dir=PATH Specify path to Libevent installation ],
107 if test "x$withval" != "xno" ; then
108 trylibeventdir=$withval
114 AC_ARG_WITH(tor-user,
115 [ --with-tor-user=NAME Specify username for tor daemon ],
123 AC_ARG_WITH(tor-group,
124 [ --with-tor-group=NAME Specify group name for tor daemon ],
132 dnl If WIN32 is defined and non-zero, we are building for win32
133 AC_MSG_CHECKING([for win32])
135 int main(int c, char **v) {
146 bwin32=true; AC_MSG_RESULT([yes]),
147 bwin32=false; AC_MSG_RESULT([no]),
148 bwin32=cross; AC_MSG_RESULT([cross])
151 if test $bwin32 = cross; then
152 AC_MSG_CHECKING([for win32 (cross)])
155 int main(int c, char **v) {return 0;}
158 int main(int c, char **v) {return x(y);}
161 bwin32=true; AC_MSG_RESULT([yes]),
162 bwin32=false; AC_MSG_RESULT([no]))
165 if test $bwin32 = true; then
166 AC_DEFINE(MS_WINDOWS, 1, [Define to 1 if we are building for Windows.])
169 dnl Enable C99 when compiling with MIPSpro
170 AC_MSG_CHECKING([for MIPSpro compiler])
172 #if (defined(__sgi) && defined(_COMPILER_VERSION))
177 bmipspro=false; AC_MSG_RESULT([no]),
178 bmipspro=true; AC_MSG_RESULT([yes]))
180 if test $bmipspro = true; then
181 CFLAGS="$CFLAGS -c99"
184 AC_SEARCH_LIBS(socket, [socket])
185 AC_SEARCH_LIBS(gethostbyname, [nsl])
186 AC_SEARCH_LIBS(dlopen, [dl])
187 AC_SEARCH_LIBS(inet_aton, [resolv])
189 if test $enable_threads = "yes"; then
190 AC_SEARCH_LIBS(pthread_create, [pthread])
191 AC_SEARCH_LIBS(pthread_detach, [pthread])
194 dnl -------------------------------------------------------------------
195 dnl Check for functions before libevent, since libevent-1.2 apparently
196 dnl exports strlcpy without defining it in a header.
198 AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime getrlimit strlcat strlcpy strtoull ftello getaddrinfo localtime_r gmtime_r memmem strtok_r)
200 if test $enable_threads = "yes"; then
201 AC_CHECK_HEADERS(pthread.h)
202 AC_CHECK_FUNCS(pthread_create)
205 dnl ------------------------------------------------------
206 dnl Where do you live, libevent? And how do we call you?
208 dnl This needs to happen before the below disgusting hack.
209 AC_CHECK_HEADERS(sys/types.h)
211 dnl This is a disgusting hack so we safely include older libevent headers.
212 AC_CHECK_TYPE(u_int64_t, unsigned long long)
213 AC_CHECK_TYPE(u_int32_t, unsigned long)
214 AC_CHECK_TYPE(u_int16_t, unsigned short)
215 AC_CHECK_TYPE(u_int8_t, unsigned char)
217 AC_CACHE_CHECK([for libevent directory], tor_cv_libevent_dir, [
219 saved_LDFLAGS="$LDFLAGS"
220 saved_CPPFLAGS="$CPPFLAGS"
222 for ledir in $trylibeventdir "" $prefix /usr/local /usr/pkg ; do
223 LDFLAGS="$saved_LDFLAGS"
225 if test $bwin32 = true; then
226 LIBS="$saved_LIBS -levent -lws2_32"
228 LIBS="$saved_LIBS -levent"
231 # Skip the directory if it isn't there.
232 if test ! -z "$ledir" -a ! -d "$ledir" ; then
235 if test ! -z "$ledir" ; then
236 if test -d "$ledir/lib" ; then
237 LDFLAGS="-L$ledir/lib $LDFLAGS"
239 LDFLAGS="-L$ledir $LDFLAGS"
241 if test -d "$ledir/include" ; then
242 CPPFLAGS="-I$ledir/include $CPPFLAGS"
244 CPPFLAGS="-I$ledir $CPPFLAGS"
247 # Can I compile and link it?
248 AC_TRY_LINK([#include <sys/time.h>
249 #include <sys/types.h>
250 #include <event.h>], [ event_init(); ],
251 [ libevent_linked=yes ], [ libevent_linked=no ])
252 if test $libevent_linked = yes; then
253 if test ! -z "$ledir" ; then
254 tor_cv_libevent_dir=$ledir
256 tor_cv_libevent_dir="(system)"
263 LDFLAGS="$saved_LDFLAGS"
264 CPPFLAGS="$saved_CPPFLAGS"
265 if test $le_found = no ; then
266 AC_MSG_ERROR([Could not find a linkable libevent. You can specify an explicit path using --with-libevent-dir])
270 if test $bwin32 = true; then
271 LIBS="$LIBS -levent -lws2_32"
275 if test "$tor_cv_libevent_dir" != "(system)"; then
276 if test -d "$tor_cv_libevent_dir/lib" ; then
277 LDFLAGS="-L$tor_cv_libevent_dir/lib $LDFLAGS"
278 le_libdir="$tor_cv_libevent_dir/lib"
280 LDFLAGS="-L$tor_cv_libevent_dir $LDFLAGS"
281 le_libdir="$tor_cv_libevent_dir"
283 if test -d "$tor_cv_libevent_dir/include" ; then
284 CPPFLAGS="-I$tor_cv_libevent_dir/include $CPPFLAGS"
286 CPPFLAGS="-I$tor_cv_libevent_dir $CPPFLAGS"
290 if test -z "$CROSS_COMPILE"; then
291 AC_CACHE_CHECK([whether we need extra options to link libevent],
292 tor_cv_libevent_linker_option, [
293 saved_LDFLAGS="$LDFLAGS"
296 for le_extra in "" "-Wl,-R$le_libdir" "-R$le_libdir" "-Wl,-rpath,$le_libdir" ; do
297 LDFLAGS="$le_extra $saved_LDFLAGS"
298 AC_TRY_RUN([void *event_init(void);
299 int main(int c, char **v) {
300 event_init(); return 0;
302 libevent_runs=yes, libevent_runs=no, libevent_runs=cross)
303 if test $libevent_runs != no ; then
304 if test -z "$le_extra" ; then
305 tor_cv_libevent_linker_option='(none)'
307 tor_cv_libevent_linker_option=$le_extra
313 if test $le_runs = no ; then
314 AC_MSG_ERROR([Found linkable libevent in $tor_cv_libevent_dir, but it doesn't run, even with -R. Maybe specify another using --with-libevent-dir?])
316 LDFLAGS="$saved_LDFLAGS"
319 if test $tor_cv_libevent_linker_option != '(none)' ; then
320 LDFLAGS="$tor_cv_libevent_linker_option $LDFLAGS"
324 dnl Now check for particular libevent functions.
325 AC_CHECK_FUNCS(event_get_version event_get_method event_set_log_callback)
327 dnl ------------------------------------------------------
328 dnl Where do you live, openssl? And how do we call you?
330 AC_CACHE_CHECK([for OpenSSL directory], tor_cv_openssl_dir, [
332 saved_LDFLAGS="$LDFLAGS"
333 saved_CPPFLAGS="$CPPFLAGS"
335 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
336 LDFLAGS="$saved_LDFLAGS"
338 if test $bwin32 = true; then
339 LIBS="$saved_LIBS -lssl -lcrypto -lws2_32 -lgdi32"
341 LIBS="$saved_LIBS -lssl -lcrypto"
344 # Skip the directory if it isn't there.
345 if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
348 if test ! -z "$ssldir" ; then
349 if test -d "$ssldir/lib" ; then
350 LDFLAGS="-L$ssldir/lib $LDFLAGS"
352 LDFLAGS="-L$ssldir $LDFLAGS"
354 if test -d "$ssldir/include" ; then
355 CPPFLAGS="-I$ssldir/include $CPPFLAGS"
357 CPPFLAGS="-I$ssldir $CPPFLAGS"
361 AC_TRY_LINK([#include <openssl/rand.h>],
362 [ RAND_add((void*)0,0,0); ],
363 [ openssl_linked=yes ], [ openssl_linked=no ])
364 if test $openssl_linked = yes; then
365 if test ! -z "$ssldir" ; then
366 tor_cv_openssl_dir=$ssldir
368 tor_cv_openssl_dir="(system)"
375 LDFLAGS="$saved_LDFLAGS"
376 CPPFLAGS="$saved_CPPFLAGS"
377 if test $ssl_found = no ; then
378 AC_MSG_ERROR([Could not find a linkable OpenSSL. You can specify an explicit path using --with-ssl-dir])
382 if test $bwin32 = true; then
383 LIBS="$LIBS -lssl -lcrypto -lws2_32 -lgdi32"
385 LIBS="$LIBS -lssl -lcrypto"
388 if test "$tor_cv_openssl_dir" != "(system)"; then
389 if test -d "$tor_cv_openssl_dir/lib" ; then
390 LDFLAGS="-L$tor_cv_openssl_dir/lib $LDFLAGS"
391 ssl_libdir="$tor_cv_openssl_dir/lib"
393 LDFLAGS="-L$tor_cv_openssl_dir $LDFLAGS"
394 ssl_libdir="$tor_cv_openssl_dir"
396 if test -d "$tor_cv_openssl_dir/include" ; then
397 CPPFLAGS="-I$tor_cv_openssl_dir/include $CPPFLAGS"
399 CPPFLAGS="-I$tor_cv_openssl_dir $CPPFLAGS"
403 if test -z "$CROSS_COMPILE"
405 AC_CACHE_CHECK([whether we need extra options to link OpenSSL],
406 tor_cv_openssl_linker_option, [
407 saved_LDFLAGS="$LDFLAGS"
410 for ssl_extra in "" "-Wl,-R$ssl_libdir" "-R$ssl_libdir" ; do
411 LDFLAGS="$ssl_extra $saved_LDFLAGS"
414 #include <openssl/rand.h>
418 memset(a, 0, sizeof(a));
419 RAND_add(a, sizeof(a), sizeof(a));
420 return(RAND_status() <= 0);
423 openssl_runs=yes, openssl_runs=no, openssl_runs=cross)
424 if test $openssl_runs != no ; then
425 if test "$linked_with" = nothing; then
426 linked_with="$ssl_extra"
429 #include <openssl/opensslv.h>
430 #include <openssl/crypto.h>
432 return (OPENSSL_VERSION_NUMBER == SSLeay()) == 0;
434 right_version=yes, right_version=no)
435 if test "$right_version" = yes; then
436 if test -z "$ssl_extra" ; then
437 tor_cv_openssl_linker_option='(none)'
439 tor_cv_openssl_linker_option=$ssl_extra
446 if test $ssl_runs = no ; then
447 if test "$linked_with" = 'nothing' ; then
448 AC_MSG_ERROR([Found linkable OpenSSL in $tor_cv_openssl_dir, but it doesn't run, even with -R. Maybe specify another using --with-ssl-dir?])
450 if test -z "$linked_with" ; then
451 tor_cv_openssl_linker_option='(none)'
453 tor_cv_openssl_linker_option=$linked_with
455 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.])
458 LDFLAGS="$saved_LDFLAGS"
461 if test "$tor_cv_openssl_linker_option" != '(none)' ; then
462 LDFLAGS="$tor_cv_openssl_linker_option $LDFLAGS"
466 dnl Make sure to enable support for large off_t if avalable.
470 dnl The warning message here is no longer strictly accurate.
472 AC_CHECK_HEADERS(unistd.h string.h signal.h ctype.h sys/stat.h fcntl.h sys/fcntl.h sys/time.h errno.h assert.h time.h, , AC_MSG_WARN(some headers were not found, compilation may fail))
474 AC_CHECK_HEADERS(netdb.h sys/ioctl.h sys/socket.h arpa/inet.h netinet/in.h pwd.h grp.h)
476 AC_CHECK_HEADERS(event.h, , AC_MSG_ERROR(Libevent header (event.h) not found. Tor requires libevent to build.),
477 [#ifdef HAVE_SYS_TYPES_H
478 #include <sys/types.h>
480 #ifdef HAVE_SYS_TIME_H
481 #include <sys/time.h>
489 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.))
491 dnl These headers are not essential
493 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 inttypes.h utime.h sys/utime.h sys/mman.h netintet/in.h netinet/in6.h sys/syslimits.h)
495 AC_CHECK_HEADERS(net/if.h, [net_if_found=1], [net_if_found=0],
496 [#ifdef HAVE_SYS_TYPES_H
497 #include <sys/types.h>
499 #ifdef HAVE_SYS_SOCKET_H
500 #include <sys/socket.h>
502 AC_CHECK_HEADERS(net/pfvar.h, [net_pfvar_found=1], [net_pfvar_found=0],
503 [#ifdef HAVE_SYS_TYPES_H
504 #include <sys/types.h>
506 #ifdef HAVE_SYS_SOCKET_H
507 #include <sys/socket.h>
512 AC_CHECK_HEADERS(linux/netfilter_ipv4.h,
513 [linux_netfilter_ipv4=1], [linux_netfilter_ipv4=0],
514 [#ifdef HAVE_SYS_TYPES_H
515 #include <sys/types.h>
517 #ifdef HAVE_SYS_SOCKET_H
518 #include <sys/socket.h>
521 if test x$transparent = xtrue ; then
523 if test x$net_if_found = x1 -a x$net_pfvar_found = x1 ; then
526 if test x$linux_netfilter_ipv4 = x1 ; then
529 if test x$transparent_ok = x1 ; then
530 AC_DEFINE(USE_TRANSPARENT, 1, "Define to enable transparent proxy support")
533 AC_DEFINE(OPENBSD, 1, "Define to handle pf on OpenBSD properly") ;;
536 AC_MSG_NOTICE([Transparent proxy support enabled, but missing headers.])
542 AC_CHECK_MEMBERS([struct timeval.tv_sec], , ,
543 [#ifdef HAVE_SYS_TYPES_H
544 #include <sys/types.h>
546 #ifdef HAVE_SYS_TIME_H
547 #include <sys/time.h>
550 dnl In case we aren't given a working stdint.h, we'll need to grow our own.
553 AC_CHECK_SIZEOF(int8_t)
554 AC_CHECK_SIZEOF(int16_t)
555 AC_CHECK_SIZEOF(int32_t)
556 AC_CHECK_SIZEOF(int64_t)
557 AC_CHECK_SIZEOF(uint8_t)
558 AC_CHECK_SIZEOF(uint16_t)
559 AC_CHECK_SIZEOF(uint32_t)
560 AC_CHECK_SIZEOF(uint64_t)
561 AC_CHECK_SIZEOF(intptr_t)
562 AC_CHECK_SIZEOF(uintptr_t)
564 dnl AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t, intptr_t, uintptr_t])
566 AC_CHECK_SIZEOF(char)
567 AC_CHECK_SIZEOF(short)
569 AC_CHECK_SIZEOF(long)
570 AC_CHECK_SIZEOF(long long)
571 AC_CHECK_SIZEOF(__int64)
572 AC_CHECK_SIZEOF(void *)
573 AC_CHECK_SIZEOF(time_t)
574 AC_CHECK_SIZEOF(size_t)
576 AC_CHECK_TYPES([uint, u_char])
578 AC_CHECK_TYPES([struct in6_addr, struct sockaddr_storage], , ,
579 [#ifdef HAVE_SYS_TYPES_H
580 #include <sys/types.h>
582 #ifdef HAVE_NETINET_IN_H
583 #include <netinet/in.h>
585 #ifdef HAVE_NETINET_IN6_H
586 #include <netinet/in6.h>
588 #ifdef HAVE_SYS_SOCKET_H
589 #include <sys/socket.h>
592 AC_CHECK_TYPES([rlim_t], , ,
593 [#ifdef HAVE_SYS_TYPES_H
594 #include <sys/types.h>
596 #ifdef HAVE_SYS_TIME_H
597 #include <sys/time.h>
599 #ifdef HAVE_SYS_RESOURCE_H
600 #include <sys/resource.h>
604 if test -z "$CROSS_COMPILE"; then
605 AC_CACHE_CHECK([whether time_t is signed], tor_cv_time_t_signed, [
607 #ifdef HAVE_SYS_TYPES_H
608 #include <sys/types.h>
610 #ifdef HAVE_SYS_TIME_H
611 #include <sys/time.h>
616 int main(int c, char**v) { if (((time_t)-1)<0) return 1; else return 0; }],
617 tor_cv_time_t_signed=no, tor_cv_time_t_signed=yes)
620 # Cross-compiling; let's hope the target platform isn't loony.
621 AC_MSG_NOTICE([Cross compiling: assuming that time_t is signed.])
622 tor_cv_time_t_signed=yes
625 if test $tor_cv_time_t_signed = yes; then
626 AC_DEFINE([TIME_T_IS_SIGNED], 1,
627 [Define to 1 iff time_t is signed])
630 AC_CHECK_SIZEOF(socklen_t, , [AC_INCLUDES_DEFAULT()
631 #ifdef HAVE_SYS_SOCKET_H
632 #include <sys/socket.h>
636 # We want to make sure that we _don't_ have a cell_t defined, like IRIX does.
638 AC_CHECK_SIZEOF(cell_t)
640 # Now make sure that NULL can be represented as zero bytes.
641 if test -z "$CROSS_COMPILE"; then
642 AC_CACHE_CHECK([whether memset(0) sets pointers to NULL], tor_cv_null_is_zero,
643 [AC_RUN_IFELSE([AC_LANG_SOURCE(
644 [[#include <stdlib.h>
650 int main () { char *p1,*p2; p1=NULL; memset(&p2,0,sizeof(p2));
651 return memcmp(&p1,&p2,sizeof(char*))?1:0; }]])],
652 [tor_cv_null_is_zero=yes],
653 [tor_cv_null_is_zero=no],
654 [tor_cv_null_is_zero=cross])])
657 # Cross-compiling; let's hope that the target isn't raving mad.
658 AC_MSG_NOTICE([Cross-compiling: we'll assume that NULL is represented as a sequence of 0-valued bytes.])
659 tor_cv_null_is_zero=yes
662 if test $tor_cv_null_is_zero = yes; then
663 AC_DEFINE([NULL_REP_IS_ZERO_BYTES], 1,
664 [Define to 1 iff memset(0) sets pointers to NULL])
667 # And what happens when we malloc zero?
669 if test -z "$CROSS_COMPILE"; then
670 AC_CACHE_CHECK([whether we can malloc(0) safely.], tor_cv_malloc_zero_works,
671 [AC_RUN_IFELSE([AC_LANG_SOURCE(
672 [[#include <stdlib.h>
678 int main () { return malloc(0)?0:1; }]])],
679 [tor_cv_malloc_zero_works=yes],
680 [tor_cv_malloc_zero_works=no],
681 [tor_cv_malloc_zero_works=cross])])
684 # Cross-compiling; let's hope that the target isn't raving mad.
685 AC_MSG_NOTICE([Cross-compiling: we'll assume that we need to check malloc() arguments for 0.])
686 tor_cv_malloc_zero_works=no
689 if test $tor_cv_malloc_zero_works = yes; then
690 AC_DEFINE([MALLOC_ZERO_WORKS], 1,
691 [Define to 1 iff malloc(0) returns a pointer])
694 # whether we seem to be in a 2s-complement world.
695 if test -z "$CROSS_COMPILE"; then
696 AC_CACHE_CHECK([whether we are using 2s-complement arithmetic], tor_cv_twos_complement,
697 [AC_RUN_IFELSE([AC_LANG_SOURCE(
698 [[int main () { int problem = ((-99) != (~99)+1);
699 return problem ? 1 : 0; }]])],
700 [tor_cv_twos_complement=yes],
701 [tor_cv_twos_complement=no],
702 [tor_cv_twos_complement=cross])])
705 # Cross-compiling; let's hope that the target isn't raving mad.
706 AC_MSG_NOTICE([Cross-compiling: we'll assume that negative integers are represented with two's complement.])
707 tor_cv_twos_complement=yes
710 if test $tor_cv_twos_complement = yes; then
711 AC_DEFINE([USING_TWOS_COMPLEMENT], 1,
712 [Define to 1 iff we represent negative integers with two's complement])
715 # Whether we should use the dmalloc memory allocation debugging library.
716 AC_MSG_CHECKING(whether to use dmalloc (debug memory allocation library))
718 [ --with-dmalloc Use debug memory allocation library. ],
719 [if [[ "$withval" = "yes" ]]; then
725 fi], [ dmalloc=0; AC_MSG_RESULT(no) ]
728 if [[ $dmalloc -eq 1 ]]; then
729 AC_CHECK_HEADERS(dmalloc.h, , AC_MSG_ERROR(dmalloc header file not found. Do you have the development files for dmalloc installed?))
730 AC_SEARCH_LIBS(dmalloc_malloc, [dmallocth dmalloc], , AC_MSG_ERROR(Libdmalloc library not found. If you enable it you better have it installed.))
731 AC_DEFINE(USE_DMALLOC, 1, [Debug memory allocation library])
732 AC_DEFINE(DMALLOC_FUNC_CHECK, 1, [Enable dmalloc's malloc function check])
735 # Allow user to specify an alternate syslog facility
736 AC_ARG_WITH(syslog-facility,
737 [ --with-syslog-facility=LOG syslog facility to use (default=LOG_DAEMON)],
738 syslog_facility="$withval", syslog_facility="LOG_DAEMON")
739 AC_DEFINE_UNQUOTED(LOGFACILITY,$syslog_facility,[name of the syslog facility])
740 AC_SUBST(LOGFACILITY)
742 # Check for gethostbyname_r in all its glorious incompatible versions.
743 # (This logic is based on that in Python's configure.in)
744 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
745 [Define this if you have any gethostbyname_r()])
747 AC_CHECK_FUNC(gethostbyname_r, [
748 AC_MSG_CHECKING([how many arguments gethostbyname_r() wants])
750 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
755 struct hostent *h1, *h2;
757 (void)gethostbyname_r(cp1,h1,cp2,i1,&h2,&i2);
759 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
760 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
761 [Define this if gethostbyname_r takes 6 arguments])
770 (void)gethostbyname_r(cp1,h1,cp2,i1,&i2);
772 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
773 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
774 [Define this if gethostbyname_r takes 5 arguments])
782 struct hostent_data hd;
783 (void) gethostbyname_r(cp1,h1,&hd);
785 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
786 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
787 [Define this if gethostbyname_r takes 3 arguments])
797 AC_CACHE_CHECK([whether the C compiler supports __func__],
798 tor_cv_have_func_macro,
801 int main(int c, char **v) { puts(__func__); }],
802 tor_cv_have_func_macro=yes,
803 tor_cv_have_func_macro=no))
805 AC_CACHE_CHECK([whether the C compiler supports __FUNC__],
806 tor_cv_have_FUNC_macro,
809 int main(int c, char **v) { puts(__FUNC__); }],
810 tor_cv_have_FUNC_macro=yes,
811 tor_cv_have_FUNC_macro=no))
813 AC_CACHE_CHECK([whether the C compiler supports __FUNCTION__],
814 tor_cv_have_FUNCTION_macro,
817 int main(int c, char **v) { puts(__FUNCTION__); }],
818 tor_cv_have_FUNCTION_macro=yes,
819 tor_cv_have_FUNCTION_macro=no))
821 if test $tor_cv_have_func_macro = 'yes'; then
822 AC_DEFINE(HAVE_MACRO__func__, 1, [Defined if the compiler supports __func__])
825 if test $tor_cv_have_FUNC_macro = 'yes'; then
826 AC_DEFINE(HAVE_MACRO__FUNC__, 1, [Defined if the compiler supports __FUNC__])
829 if test $tor_cv_have_FUNCTION_macro = 'yes'; then
830 AC_DEFINE(HAVE_MACRO__FUNCTION__, 1,
831 [Defined if the compiler supports __FUNCTION__])
834 # $prefix stores the value of the --prefix command line option, or
835 # NONE if the option wasn't set. In the case that it wasn't set, make
836 # it be the default, so that we can use it to expand directories now.
837 if test "x$prefix" = "xNONE"; then
838 prefix=$ac_default_prefix
841 # and similarly for $exec_prefix
842 if test "x$exec_prefix" = "xNONE"; then
846 if test "x$CONFDIR" = "x"; then
847 CONFDIR=`eval echo $sysconfdir/tor`
850 AH_TEMPLATE([CONFDIR],[tor's configuration directory])
851 AC_DEFINE_UNQUOTED(CONFDIR,"$CONFDIR")
853 BINDIR=`eval echo $bindir`
856 LOCALSTATEDIR=`eval echo $localstatedir`
857 AC_SUBST(LOCALSTATEDIR)
858 AH_TEMPLATE([LOCALSTATEDIR], [Default location to store state files.])
859 AC_DEFINE_UNQUOTED(LOCALSTATEDIR,"$LOCALSTATEDIR")
861 # Set CFLAGS _after_ all the above checks, since our warnings are stricter
862 # than autoconf's macros like.
863 if test $ac_cv_c_compiler_gnu = yes; then
864 CFLAGS="$CFLAGS -Wall -g -O2"
866 CFLAGS="$CFLAGS -g -O"
867 enable_gcc_warnings=no
870 # Add some more warnings which we use in the cvs version but not in the
871 # released versions. (Some relevant gcc versions can't handle these.)
872 if test x$enable_gcc_warnings = xyes; then
875 #if !defined(__GNUC__) || (__GNUC__ < 4)
877 #endif], have_gcc4=yes, have_gcc4=no)
879 CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2 -Wwrite-strings -Waggregate-return -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast -Wswitch-enum -Werror"
881 if test x$have_gcc4 = xyes ; then
882 # These warnings break gcc 3.3.5 and work on gcc 4.0.2
883 CFLAGS="$CFLAGS -Winit-self -Wmissing-field-initializers -Wdeclaration-after-statement -Wold-style-definition"
886 ##This will break the world on some 64-bit architectures
887 # CFLAGS="$CFLAGS -Winline"
891 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 doc/spec/Makefile src/config/Makefile src/common/Makefile src/or/Makefile src/win32/Makefile src/tools/Makefile contrib/suse/Makefile contrib/suse/tor.sh)
893 if test -x /usr/bin/perl && test -x ./contrib/updateVersions.pl ; then
894 ./contrib/updateVersions.pl