From b4ebe55d12d46c79ac46c801b1096ae1afda75f7 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 30 Jan 2008 19:25:31 +0000 Subject: r13971@tombo: nickm | 2008-01-30 14:25:25 -0500 Write a new autoconf macro to test whether a function is declared. It is suboptimal and possibly buggy in some way, but it seems to work for me. use it to test for a declaration of malloc_good_size, so we can workaround operating systems (like older OSX) that have the function in their libc but do not deign to declare it in their headers. Should resolve bug 587. svn:r13339 --- acinclude.m4 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'acinclude.m4') diff --git a/acinclude.m4 b/acinclude.m4 index 7f27afd5a3..fb2eba834d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -193,3 +193,17 @@ CPPFLAGS="$tor_saved_CPPFLAGS" ]) dnl end defun +dnl Check whether the prototype for a function is present or missing. +dnl Apple has a nasty habit of putting functions in their libraries (so that +dnl AC_CHECK_FUNCS passes) but not actually declaring them in the headers. +dnl +dnl TOR_CHECK_PROTYPE(1:functionname, 2:macroname, 2: includes) +AC_DEFUN([TOR_CHECK_PROTOTYPE], [ + AC_CACHE_CHECK([for declaration of $1], tor_cv_$1_declared, [ + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([$3],[void *ptr= $1 ;]), + tor_cv_$1_declared=yes,tor_cv_$1_declared=no)]) +if test x$tor_cv_$1_declared != xno ; then + AC_DEFINE($2, 1, + [Defined if the prototype for $1 seems to be present.]) +fi +]) \ No newline at end of file -- cgit v1.2.3-54-g00ecf