From: Volker Lendecke Date: Mon, 30 Jun 2014 13:46:21 +0000 (+0200) Subject: libreplace: Only check for malloc.h if needed X-Git-Tag: ldb-1.1.24~124 X-Git-Url: http://git.samba.org/samba.git/?p=kai%2Fsamba-autobuild%2F.git;a=commitdiff_plain;h=5f6c4fa4860f794d25f1fcc2e557ca81cbe90183 libreplace: Only check for malloc.h if needed OpenBSD complains that malloc.h is deprecated on every gcc invocation. That hides a lot of real warnings. malloc and friends nowadays are typically defined in stdlib.h, only check there. We need memalign. On OpenBSD this does not exist, so libreplace replaces it. The wscript test in libreplace only checks whether memalign can link. Unfortunately in glibc memalign comes from malloc.h. Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- diff --git a/lib/replace/wscript b/lib/replace/wscript index d6cddf513c3..37cbbb7dc23 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -44,7 +44,10 @@ def configure(conf): conf.CHECK_HEADERS('sys/resource.h sys/security.h sys/shm.h sys/statfs.h sys/statvfs.h sys/termio.h') conf.CHECK_HEADERS('sys/vfs.h sys/xattr.h termio.h termios.h sys/file.h') conf.CHECK_HEADERS('sys/ucontext.h sys/wait.h sys/stat.h') - conf.CHECK_HEADERS('malloc.h') + + if not conf.CHECK_DECLS('malloc', headers='stdlib.h'): + conf.CHECK_HEADERS('malloc.h') + conf.CHECK_HEADERS('grp.h') conf.CHECK_HEADERS('sys/select.h setjmp.h utime.h sys/syslog.h syslog.h') conf.CHECK_HEADERS('stdarg.h vararg.h sys/mount.h mntent.h') @@ -247,6 +250,10 @@ def configure(conf): conf.CHECK_FUNCS('link readlink symlink realpath snprintf vsnprintf') conf.CHECK_FUNCS('asprintf vasprintf setenv unsetenv strnlen strtoull __strtoull') conf.CHECK_FUNCS('strtouq strtoll __strtoll strtoq memalign posix_memalign') + + if conf.CONFIG_SET('HAVE_MEMALIGN'): + conf.CHECK_DECLS('memalign', headers='malloc.h') + conf.CHECK_FUNCS('prctl dirname basename') # libbsd on some platforms provides strlcpy and strlcat