1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

ccan: check for all the used config.h defines

In particular, not checking for byteswap.h meant we defined duplicates:
https://bugzilla.samba.org/show_bug.cgi?id=9286

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date(master): Wed Oct 17 01:55:14 CEST 2012 on sn-devel-104
This commit is contained in:
Rusty Russell 2012-10-14 16:05:58 +10:30
parent 05a5974891
commit 029654897d
2 changed files with 37 additions and 0 deletions

View File

@ -23,6 +23,8 @@ AC_SUBST(CCAN_CFLAGS)
# fairly harmless. # fairly harmless.
AC_CHECK_HEADERS(err.h) AC_CHECK_HEADERS(err.h)
AC_CHECK_HEADERS(byteswap.h)
AC_CACHE_CHECK([whether we can compile with __attribute__((cold))], AC_CACHE_CHECK([whether we can compile with __attribute__((cold))],
samba_cv_attribute_cold, samba_cv_attribute_cold,
[ [
@ -270,6 +272,19 @@ if test x"$samba_cv_compound_literals" = xyes ; then
[whether we have compound literals]) [whether we have compound literals])
fi fi
AC_CACHE_CHECK([whether we have flexible array members],
samba_cv_have_flex_arr_member,
[
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[struct foo { unsigned int x; int arr@<:@@:>@; }; ])],
samba_cv_have_flex_arr_member=yes)
])
if test x"$samba_cv_have_flex_arr_member" = xyes ; then
AC_DEFINE(HAVE_FLEXIBLE_ARRAY_MEMBER, 1,
[whether we have flexible array member support])
fi
AC_CACHE_CHECK([whether we have isblank], AC_CACHE_CHECK([whether we have isblank],
samba_cv_have_isblank, samba_cv_have_isblank,
[ [
@ -331,3 +346,4 @@ if test x"$samba_cv_warn_unused_result" = xyes ; then
AC_DEFINE(HAVE_WARN_UNUSED_RESULT, 1, AC_DEFINE(HAVE_WARN_UNUSED_RESULT, 1,
[whether we have __attribute__((warn_unused_result))]) [whether we have __attribute__((warn_unused_result))])
fi fi
AC_HAVE_DECL(bswap_64, [#include <byteswap.h>])

View File

@ -5,6 +5,9 @@ import Logs, sys, Options
def configure(conf): def configure(conf):
conf.DEFINE('HAVE_CCAN', 1) conf.DEFINE('HAVE_CCAN', 1)
conf.CHECK_HEADERS('err.h') conf.CHECK_HEADERS('err.h')
conf.CHECK_HEADERS('byteswap.h')
conf.CHECK_FUNCS('bswap_64', link=False, headers="byteswap.h")
# FIXME: if they don't have -Werror, these will all fail. But they # FIXME: if they don't have -Werror, these will all fail. But they
# probably will anyway... # probably will anyway...
conf.CHECK_CODE('int __attribute__((cold)) func(int x) { return x; }', conf.CHECK_CODE('int __attribute__((cold)) func(int x) { return x; }',
@ -107,6 +110,9 @@ def configure(conf):
define='HAVE_BUILTIN_TYPES_COMPATIBLE_P') define='HAVE_BUILTIN_TYPES_COMPATIBLE_P')
conf.CHECK_CODE('int *foo = (int[]) { 1, 2, 3, 4 }; return foo[0] ? 0 : 1;', conf.CHECK_CODE('int *foo = (int[]) { 1, 2, 3, 4 }; return foo[0] ? 0 : 1;',
define='HAVE_COMPOUND_LITERALS') define='HAVE_COMPOUND_LITERALS')
conf.CHECK_CODE('struct foo { unsigned int x; int arr[]; };',
addmain=False, link=False,
define='HAVE_FLEXIBLE_ARRAY_MEMBER')
conf.CHECK_CODE("""#include <ctype.h> conf.CHECK_CODE("""#include <ctype.h>
int main(void) { return isblank(' ') ? 0 : 1; }""", int main(void) { return isblank(' ') ? 0 : 1; }""",
link=True, addmain=False, add_headers=False, link=True, addmain=False, add_headers=False,
@ -121,6 +127,21 @@ def configure(conf):
# backtrace could be in libexecinfo or in libc # backtrace could be in libexecinfo or in libc
conf.CHECK_FUNCS_IN('backtrace backtrace_symbols', 'execinfo', checklibc=True, headers='execinfo.h') conf.CHECK_FUNCS_IN('backtrace backtrace_symbols', 'execinfo', checklibc=True, headers='execinfo.h')
# Only check for FILE_OFFSET_BITS=64 if off_t is normally small:
# use raw routines because wrappers include previous _GNU_SOURCE
# or _FILE_OFFSET_BITS defines.
conf.check(fragment="""#include <sys/types.h>
int main(void) { return !(sizeof(off_t) < 8); }""",
execute=True, msg='Checking for small off_t',
define_name='SMALL_OFF_T')
# Unreliable return value above, hence use define.
if conf.CONFIG_SET('SMALL_OFF_T'):
conf.check(fragment="""#include <sys/types.h>
int main(void) { return !(sizeof(off_t) >= 8); }""",
execute=True, msg='Checking for -D_FILE_OFFSET_BITS=64',
ccflags='-D_FILE_OFFSET_BITS=64',
define_name='HAVE_FILE_OFFSET_BITS')
def ccan_module(bld, name, deps=''): def ccan_module(bld, name, deps=''):
bld.SAMBA_SUBSYSTEM('ccan-%s' % name, bld.SAMBA_SUBSYSTEM('ccan-%s' % name,
source=bld.path.ant_glob('%s/*.c' % name), source=bld.path.ant_glob('%s/*.c' % name),