Skip to content
Snippets Groups Projects
Commit 93d12233 authored by Nick Mathewson's avatar Nick Mathewson :game_die:
Browse files

r17090@catbus: nickm | 2007-12-11 18:05:24 -0500

 Fix some autoconf bugs, and prevent more from occurring.  Partial backport candidate.


svn:r12767
parent 3208b102
No related branches found
No related tags found
No related merge requests found
...@@ -61,6 +61,9 @@ Changes in version 0.2.0.13-alpha - 2007-12-?? ...@@ -61,6 +61,9 @@ Changes in version 0.2.0.13-alpha - 2007-12-??
- Fix handling of hex nicknames when answering controller requests for - Fix handling of hex nicknames when answering controller requests for
networkstatus by name, or when deciding whether to warn about unknown networkstatus by name, or when deciding whether to warn about unknown
routers in a config option. Bugfix on 0.2.0.x. (Patch from mwenge.) routers in a config option. Bugfix on 0.2.0.x. (Patch from mwenge.)
- Fix a couple of hard-to-trigger autoconf problems that could result
in really weird results on platforms whose sys/types.h files define
nonstandard integer types.
o Minor features: o Minor features:
- On USR1, when dmalloc is in use, log the top 10 memory - On USR1, when dmalloc is in use, log the top 10 memory
......
...@@ -113,12 +113,12 @@ AC_CACHE_CHECK([for $1 directory], tor_cv_library_$1_dir, [ ...@@ -113,12 +113,12 @@ AC_CACHE_CHECK([for $1 directory], tor_cv_library_$1_dir, [
AC_LINK_IFELSE(AC_LANG_PROGRAM([$5], [$6]), AC_LINK_IFELSE(AC_LANG_PROGRAM([$5], [$6]),
[linkable=yes], [linkable=no]) [linkable=yes], [linkable=no])
if test $linkable = yes; then if test "$linkable" = yes; then
tor_$1_any_linkable=yes tor_$1_any_linkable=yes
# Okay, we can link against it. Can we find the headers? # Okay, we can link against it. Can we find the headers?
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([$4], [$6]), AC_COMPILE_IFELSE(AC_LANG_PROGRAM([$4], [$6]),
[buildable=yes], [buildable=no]) [buildable=yes], [buildable=no])
if test $buildable = yes; then if test "$buildable" = yes; then
tor_cv_library_$1_dir=$tor_trydir tor_cv_library_$1_dir=$tor_trydir
tor_$1_dir_found=yes tor_$1_dir_found=yes
break break
...@@ -126,8 +126,8 @@ AC_CACHE_CHECK([for $1 directory], tor_cv_library_$1_dir, [ ...@@ -126,8 +126,8 @@ AC_CACHE_CHECK([for $1 directory], tor_cv_library_$1_dir, [
fi fi
done done
if test $tor_$1_dir_found = no; then if test "$tor_$1_dir_found" = no; then
if test $tor_$1_any_linkable = no ; then if test "$tor_$1_any_linkable" = no ; then
AC_MSG_WARN([Could not find a linkable $1. If you have it installed somewhere unusal, you can specify an explicit path using $7]) AC_MSG_WARN([Could not find a linkable $1. If you have it installed somewhere unusal, you can specify an explicit path using $7])
TOR_WARN_MISSING_LIB($1, pkg) TOR_WARN_MISSING_LIB($1, pkg)
AC_MSG_ERROR([Missing libraries; unable to proceed.]) AC_MSG_ERROR([Missing libraries; unable to proceed.])
...@@ -144,7 +144,7 @@ AC_CACHE_CHECK([for $1 directory], tor_cv_library_$1_dir, [ ...@@ -144,7 +144,7 @@ AC_CACHE_CHECK([for $1 directory], tor_cv_library_$1_dir, [
]) dnl end cache check ]) dnl end cache check
LIBS="$LIBS $3" LIBS="$LIBS $3"
if test $tor_cv_library_$1_dir != "(system)"; then if test "$tor_cv_library_$1_dir" != "(system)"; then
TOR_EXTEND_CODEPATH($tor_cv_library_$1_dir) TOR_EXTEND_CODEPATH($tor_cv_library_$1_dir)
fi fi
......
...@@ -10,7 +10,9 @@ AM_CONFIG_HEADER(orconfig.h) ...@@ -10,7 +10,9 @@ AM_CONFIG_HEADER(orconfig.h)
AC_CANONICAL_HOST AC_CANONICAL_HOST
if test -f /etc/redhat-release ; then if test -f /etc/redhat-release ; then
if test -f /usr/kerberos/include ; then
CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include" CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
fi
fi fi
# Not a no-op; we want to make sure that CPPFLAGS is set before we use # Not a no-op; we want to make sure that CPPFLAGS is set before we use
...@@ -54,7 +56,7 @@ cpu workers lock up here, so I will disable threads.]) ...@@ -54,7 +56,7 @@ cpu workers lock up here, so I will disable threads.])
esac esac
fi fi
if test $enable_threads = "yes"; then if test "$enable_threads" = "yes"; then
AC_DEFINE(ENABLE_THREADS, 1, [Defined if we will try to use multithreading]) AC_DEFINE(ENABLE_THREADS, 1, [Defined if we will try to use multithreading])
fi fi
...@@ -68,6 +70,7 @@ AC_ARG_ENABLE(gcc-warnings, ...@@ -68,6 +70,7 @@ AC_ARG_ENABLE(gcc-warnings,
AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings)) AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings))
AC_PROG_CC AC_PROG_CC
AC_PROG_CPP
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
AC_PROG_RANLIB AC_PROG_RANLIB
...@@ -109,7 +112,7 @@ bwin32=false; AC_MSG_RESULT([no]), ...@@ -109,7 +112,7 @@ bwin32=false; AC_MSG_RESULT([no]),
bwin32=cross; AC_MSG_RESULT([cross]) bwin32=cross; AC_MSG_RESULT([cross])
) )
if test $bwin32 = cross; then if test "$bwin32" = cross; then
AC_MSG_CHECKING([for win32 (cross)]) AC_MSG_CHECKING([for win32 (cross)])
AC_COMPILE_IFELSE([ AC_COMPILE_IFELSE([
#ifdef WIN32 #ifdef WIN32
...@@ -123,7 +126,7 @@ bwin32=true; AC_MSG_RESULT([yes]), ...@@ -123,7 +126,7 @@ bwin32=true; AC_MSG_RESULT([yes]),
bwin32=false; AC_MSG_RESULT([no])) bwin32=false; AC_MSG_RESULT([no]))
fi fi
if test $bwin32 = true; then if test "$bwin32" = true; then
AC_DEFINE(MS_WINDOWS, 1, [Define to 1 if we are building for Windows.]) AC_DEFINE(MS_WINDOWS, 1, [Define to 1 if we are building for Windows.])
fi fi
AM_CONDITIONAL(BUILD_NT_SERVICES, test x$bwin32 = xtrue) AM_CONDITIONAL(BUILD_NT_SERVICES, test x$bwin32 = xtrue)
...@@ -139,7 +142,7 @@ AC_COMPILE_IFELSE(AC_LANG_PROGRAM(, [ ...@@ -139,7 +142,7 @@ AC_COMPILE_IFELSE(AC_LANG_PROGRAM(, [
bmipspro=false; AC_MSG_RESULT(no), bmipspro=false; AC_MSG_RESULT(no),
bmipspro=true; AC_MSG_RESULT(yes)) bmipspro=true; AC_MSG_RESULT(yes))
if test $bmipspro = true; then if test "$bmipspro" = true; then
CFLAGS="$CFLAGS -c99" CFLAGS="$CFLAGS -c99"
fi fi
...@@ -150,7 +153,7 @@ AC_SEARCH_LIBS(gethostbyname, [nsl]) ...@@ -150,7 +153,7 @@ AC_SEARCH_LIBS(gethostbyname, [nsl])
AC_SEARCH_LIBS(dlopen, [dl]) AC_SEARCH_LIBS(dlopen, [dl])
AC_SEARCH_LIBS(inet_aton, [resolv]) AC_SEARCH_LIBS(inet_aton, [resolv])
if test $enable_threads = "yes"; then if test "$enable_threads" = "yes"; then
AC_SEARCH_LIBS(pthread_create, [pthread]) AC_SEARCH_LIBS(pthread_create, [pthread])
AC_SEARCH_LIBS(pthread_detach, [pthread]) AC_SEARCH_LIBS(pthread_detach, [pthread])
fi fi
...@@ -161,7 +164,7 @@ dnl exports strlcpy without defining it in a header. ...@@ -161,7 +164,7 @@ dnl exports strlcpy without defining it in a header.
AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime getrlimit strlcat strlcpy strtoull ftello getaddrinfo localtime_r gmtime_r memmem strtok_r inet_pton inet_ntop mallinfo) AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime getrlimit strlcat strlcpy strtoull ftello getaddrinfo localtime_r gmtime_r memmem strtok_r inet_pton inet_ntop mallinfo)
if test $enable_threads = "yes"; then if test "$enable_threads" = "yes"; then
AC_CHECK_HEADERS(pthread.h) AC_CHECK_HEADERS(pthread.h)
AC_CHECK_FUNCS(pthread_create) AC_CHECK_FUNCS(pthread_create)
fi fi
...@@ -169,7 +172,7 @@ fi ...@@ -169,7 +172,7 @@ fi
dnl ------------------------------------------------------ dnl ------------------------------------------------------
dnl Where do you live, libevent? And how do we call you? dnl Where do you live, libevent? And how do we call you?
if test $bwin32 = true; then if test "$bwin32" = true; then
TOR_LIB_WS32=-lws2_32 TOR_LIB_WS32=-lws2_32
# Some of the cargo-cults recommend -lwsock32 as well, but I don't # Some of the cargo-cults recommend -lwsock32 as well, but I don't
# think it's actually necessary. # think it's actually necessary.
...@@ -181,7 +184,10 @@ fi ...@@ -181,7 +184,10 @@ fi
AC_SUBST(TOR_LIB_WS32) AC_SUBST(TOR_LIB_WS32)
AC_SUBST(TOR_LIB_GDI) AC_SUBST(TOR_LIB_GDI)
dnl This is a disgusting hack so we safely include recent libevent headers. dnl We need to do this before we try our disgusting hack below.
AC_CHECK_HEADERS([sys/types.h])
dnl This is a disgusting hack so we safely include older libevent headers.
AC_CHECK_TYPE(u_int64_t, unsigned long long) AC_CHECK_TYPE(u_int64_t, unsigned long long)
AC_CHECK_TYPE(u_int32_t, unsigned long) AC_CHECK_TYPE(u_int32_t, unsigned long)
AC_CHECK_TYPE(u_int16_t, unsigned short) AC_CHECK_TYPE(u_int16_t, unsigned short)
...@@ -417,7 +423,7 @@ else ...@@ -417,7 +423,7 @@ else
tor_cv_time_t_signed=yes tor_cv_time_t_signed=yes
fi fi
if test $tor_cv_time_t_signed = yes; then if test "$tor_cv_time_t_signed" = yes; then
AC_DEFINE([TIME_T_IS_SIGNED], 1, AC_DEFINE([TIME_T_IS_SIGNED], 1,
[Define to 1 iff time_t is signed]) [Define to 1 iff time_t is signed])
fi fi
...@@ -454,7 +460,7 @@ else ...@@ -454,7 +460,7 @@ else
tor_cv_null_is_zero=yes tor_cv_null_is_zero=yes
fi fi
if test $tor_cv_null_is_zero = yes; then if test "$tor_cv_null_is_zero" = yes; then
AC_DEFINE([NULL_REP_IS_ZERO_BYTES], 1, AC_DEFINE([NULL_REP_IS_ZERO_BYTES], 1,
[Define to 1 iff memset(0) sets pointers to NULL]) [Define to 1 iff memset(0) sets pointers to NULL])
fi fi
...@@ -481,7 +487,7 @@ else ...@@ -481,7 +487,7 @@ else
tor_cv_malloc_zero_works=no tor_cv_malloc_zero_works=no
fi fi
if test $tor_cv_malloc_zero_works = yes; then if test "$tor_cv_malloc_zero_works" = yes; then
AC_DEFINE([MALLOC_ZERO_WORKS], 1, AC_DEFINE([MALLOC_ZERO_WORKS], 1,
[Define to 1 iff malloc(0) returns a pointer]) [Define to 1 iff malloc(0) returns a pointer])
fi fi
...@@ -502,7 +508,7 @@ else ...@@ -502,7 +508,7 @@ else
tor_cv_twos_complement=yes tor_cv_twos_complement=yes
fi fi
if test $tor_cv_twos_complement = yes; then if test "$tor_cv_twos_complement" = yes; then
AC_DEFINE([USING_TWOS_COMPLEMENT], 1, AC_DEFINE([USING_TWOS_COMPLEMENT], 1,
[Define to 1 iff we represent negative integers with two's complement]) [Define to 1 iff we represent negative integers with two's complement])
fi fi
...@@ -614,15 +620,15 @@ int main(int c, char **v) { puts(__FUNCTION__); }], ...@@ -614,15 +620,15 @@ int main(int c, char **v) { puts(__FUNCTION__); }],
tor_cv_have_FUNCTION_macro=yes, tor_cv_have_FUNCTION_macro=yes,
tor_cv_have_FUNCTION_macro=no)) tor_cv_have_FUNCTION_macro=no))
if test $tor_cv_have_func_macro = 'yes'; then if test "$tor_cv_have_func_macro" = 'yes'; then
AC_DEFINE(HAVE_MACRO__func__, 1, [Defined if the compiler supports __func__]) AC_DEFINE(HAVE_MACRO__func__, 1, [Defined if the compiler supports __func__])
fi fi
if test $tor_cv_have_FUNC_macro = 'yes'; then if test "$tor_cv_have_FUNC_macro" = 'yes'; then
AC_DEFINE(HAVE_MACRO__FUNC__, 1, [Defined if the compiler supports __FUNC__]) AC_DEFINE(HAVE_MACRO__FUNC__, 1, [Defined if the compiler supports __FUNC__])
fi fi
if test $tor_cv_have_FUNCTION_macro = 'yes'; then if test "$tor_cv_have_FUNCTION_macro" = 'yes'; then
AC_DEFINE(HAVE_MACRO__FUNCTION__, 1, AC_DEFINE(HAVE_MACRO__FUNCTION__, 1,
[Defined if the compiler supports __FUNCTION__]) [Defined if the compiler supports __FUNCTION__])
fi fi
...@@ -653,7 +659,7 @@ AC_SUBST(LOCALSTATEDIR) ...@@ -653,7 +659,7 @@ AC_SUBST(LOCALSTATEDIR)
# Set CFLAGS _after_ all the above checks, since our warnings are stricter # Set CFLAGS _after_ all the above checks, since our warnings are stricter
# than autoconf's macros like. # than autoconf's macros like.
if test $ac_cv_c_compiler_gnu = yes; then if test "$ac_cv_c_compiler_gnu" = yes; then
CFLAGS="$CFLAGS -Wall -g -O2" CFLAGS="$CFLAGS -Wall -g -O2"
else else
CFLAGS="$CFLAGS -g -O" CFLAGS="$CFLAGS -g -O"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment