Skip to content

Commit

Permalink
r17090@catbus: nickm | 2007-12-11 18:05:24 -0500
Browse files Browse the repository at this point in the history
 Fix some autoconf bugs, and prevent more from occurring.  Partial backport candidate.


svn:r12767
  • Loading branch information
nmathewson committed Dec 11, 2007
1 parent 3208b10 commit 93d1223
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 21 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ Changes in version 0.2.0.13-alpha - 2007-12-??
- Fix handling of hex nicknames when answering controller requests for
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.)
- 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:
- On USR1, when dmalloc is in use, log the top 10 memory
Expand Down
10 changes: 5 additions & 5 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,21 @@ AC_CACHE_CHECK([for $1 directory], tor_cv_library_$1_dir, [
AC_LINK_IFELSE(AC_LANG_PROGRAM([$5], [$6]),
[linkable=yes], [linkable=no])
if test $linkable = yes; then
if test "$linkable" = yes; then
tor_$1_any_linkable=yes
# Okay, we can link against it. Can we find the headers?
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([$4], [$6]),
[buildable=yes], [buildable=no])
if test $buildable = yes; then
if test "$buildable" = yes; then
tor_cv_library_$1_dir=$tor_trydir
tor_$1_dir_found=yes
break
fi
fi
done
if test $tor_$1_dir_found = no; then
if test $tor_$1_any_linkable = no ; then
if test "$tor_$1_dir_found" = 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])
TOR_WARN_MISSING_LIB($1, pkg)
AC_MSG_ERROR([Missing libraries; unable to proceed.])
Expand All @@ -144,7 +144,7 @@ AC_CACHE_CHECK([for $1 directory], tor_cv_library_$1_dir, [
]) dnl end cache check
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)
fi
Expand Down
38 changes: 22 additions & 16 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ AM_CONFIG_HEADER(orconfig.h)
AC_CANONICAL_HOST

if test -f /etc/redhat-release ; then
if test -f /usr/kerberos/include ; then
CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
fi
fi

# Not a no-op; we want to make sure that CPPFLAGS is set before we use
Expand Down Expand Up @@ -54,7 +56,7 @@ cpu workers lock up here, so I will disable threads.])
esac
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])
fi

Expand All @@ -68,6 +70,7 @@ AC_ARG_ENABLE(gcc-warnings,
AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings))

AC_PROG_CC
AC_PROG_CPP
AC_PROG_MAKE_SET
AC_PROG_RANLIB

Expand Down Expand Up @@ -109,7 +112,7 @@ bwin32=false; AC_MSG_RESULT([no]),
bwin32=cross; AC_MSG_RESULT([cross])
)

if test $bwin32 = cross; then
if test "$bwin32" = cross; then
AC_MSG_CHECKING([for win32 (cross)])
AC_COMPILE_IFELSE([
#ifdef WIN32
Expand All @@ -123,7 +126,7 @@ bwin32=true; AC_MSG_RESULT([yes]),
bwin32=false; AC_MSG_RESULT([no]))
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.])
fi
AM_CONDITIONAL(BUILD_NT_SERVICES, test x$bwin32 = xtrue)
Expand All @@ -139,7 +142,7 @@ AC_COMPILE_IFELSE(AC_LANG_PROGRAM(, [
bmipspro=false; AC_MSG_RESULT(no),
bmipspro=true; AC_MSG_RESULT(yes))

if test $bmipspro = true; then
if test "$bmipspro" = true; then
CFLAGS="$CFLAGS -c99"
fi

Expand All @@ -150,7 +153,7 @@ AC_SEARCH_LIBS(gethostbyname, [nsl])
AC_SEARCH_LIBS(dlopen, [dl])
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_detach, [pthread])
fi
Expand All @@ -161,15 +164,15 @@ 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)

if test $enable_threads = "yes"; then
if test "$enable_threads" = "yes"; then
AC_CHECK_HEADERS(pthread.h)
AC_CHECK_FUNCS(pthread_create)
fi

dnl ------------------------------------------------------
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
# Some of the cargo-cults recommend -lwsock32 as well, but I don't
# think it's actually necessary.
Expand All @@ -181,7 +184,10 @@ fi
AC_SUBST(TOR_LIB_WS32)
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_int32_t, unsigned long)
AC_CHECK_TYPE(u_int16_t, unsigned short)
Expand Down Expand Up @@ -417,7 +423,7 @@ else
tor_cv_time_t_signed=yes
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,
[Define to 1 iff time_t is signed])
fi
Expand Down Expand Up @@ -454,7 +460,7 @@ else
tor_cv_null_is_zero=yes
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,
[Define to 1 iff memset(0) sets pointers to NULL])
fi
Expand All @@ -481,7 +487,7 @@ else
tor_cv_malloc_zero_works=no
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,
[Define to 1 iff malloc(0) returns a pointer])
fi
Expand All @@ -502,7 +508,7 @@ else
tor_cv_twos_complement=yes
fi

if test $tor_cv_twos_complement = yes; then
if test "$tor_cv_twos_complement" = yes; then
AC_DEFINE([USING_TWOS_COMPLEMENT], 1,
[Define to 1 iff we represent negative integers with two's complement])
fi
Expand Down Expand Up @@ -614,15 +620,15 @@ int main(int c, char **v) { puts(__FUNCTION__); }],
tor_cv_have_FUNCTION_macro=yes,
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__])
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__])
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,
[Defined if the compiler supports __FUNCTION__])
fi
Expand Down Expand Up @@ -653,7 +659,7 @@ AC_SUBST(LOCALSTATEDIR)

# Set CFLAGS _after_ all the above checks, since our warnings are stricter
# 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"
else
CFLAGS="$CFLAGS -g -O"
Expand Down

0 comments on commit 93d1223

Please sign in to comment.