mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-23 20:03:31 +01:00
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
This commit is contained in:
parent
0b06546620
commit
b4ebe55d12
@ -5,6 +5,9 @@ Changes in version 0.2.0.19-alpha - 2008-0?-??
|
|||||||
recognize them. Fixes bug 571. Bugfix on 0.2.0.x.
|
recognize them. Fixes bug 571. Bugfix on 0.2.0.x.
|
||||||
- Stop recommending that every server operator send mail to tor-ops.
|
- Stop recommending that every server operator send mail to tor-ops.
|
||||||
Resolves bug 597. Bugfix on 0.1.2.x.
|
Resolves bug 597. Bugfix on 0.1.2.x.
|
||||||
|
- Detect version of OSX where malloc_good_size is present in the
|
||||||
|
library but never actually declared. Resolves bug 587. Bugfix
|
||||||
|
on 0.2.0.x.
|
||||||
|
|
||||||
|
|
||||||
Changes in version 0.2.0.18-alpha - 2008-01-25
|
Changes in version 0.2.0.18-alpha - 2008-01-25
|
||||||
|
14
acinclude.m4
14
acinclude.m4
@ -193,3 +193,17 @@ CPPFLAGS="$tor_saved_CPPFLAGS"
|
|||||||
|
|
||||||
]) dnl end defun
|
]) 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
|
||||||
|
])
|
@ -275,6 +275,14 @@ dnl These headers are not essential
|
|||||||
|
|
||||||
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 malloc.h sys/syslimits.h malloc/malloc.h)
|
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 malloc.h sys/syslimits.h malloc/malloc.h)
|
||||||
|
|
||||||
|
TOR_CHECK_PROTOTYPE(malloc_good_size, HAVE_MALLOC_GOOD_SIZE_PROTOTYPE,
|
||||||
|
[#ifdef HAVE_MALLOC_H
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_MALLOC_MALLOC_H
|
||||||
|
#include <malloc/malloc.h>
|
||||||
|
#endif])
|
||||||
|
|
||||||
AC_CHECK_HEADERS(net/if.h, net_if_found=1, net_if_found=0,
|
AC_CHECK_HEADERS(net/if.h, net_if_found=1, net_if_found=0,
|
||||||
[#ifdef HAVE_SYS_TYPES_H
|
[#ifdef HAVE_SYS_TYPES_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -224,6 +224,14 @@ _tor_free(void *mem)
|
|||||||
tor_free(mem);
|
tor_free(mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(HAVE_MALLOC_GOOD_SIZE) && !defined(HAVE_MALLOC_GOOD_SIZE_PROTOTYPE)
|
||||||
|
/* Some version of Mac OSX have malloc_good_size in their libc, but not
|
||||||
|
* actually defined in malloc/malloc.h. We detect this and work around it by
|
||||||
|
* prototyping.
|
||||||
|
*/
|
||||||
|
extern size_t malloc_good_size(size_t size);
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Allocate and return a chunk of memory of size at least *<b>size</p>, using
|
/** Allocate and return a chunk of memory of size at least *<b>size</p>, using
|
||||||
* the same resources we would use to malloc *<b>sizep</b>. Set *<b>sizep</b>
|
* the same resources we would use to malloc *<b>sizep</b>. Set *<b>sizep</b>
|
||||||
* to the number of usable bytes in the chunk of memory. */
|
* to the number of usable bytes in the chunk of memory. */
|
||||||
|
Loading…
Reference in New Issue
Block a user