diff options
author | James Peach <jpeach@samba.org> | 2006-02-10 02:46:45 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:10:01 -0500 |
commit | 457e6ac0430abc9961747366e0ec90d755362d1d (patch) | |
tree | 36f48006e99c67f694a96b3f1ccc5d58d2eba735 /source3/configure.in | |
parent | e2ad693d032814506e4bf405880259135794936a (diff) | |
download | samba-457e6ac0430abc9961747366e0ec90d755362d1d.tar.gz samba-457e6ac0430abc9961747366e0ec90d755362d1d.tar.bz2 samba-457e6ac0430abc9961747366e0ec90d755362d1d.zip |
r13425: Revert all the "clever" compiler options checks. They broke
the build on Solaris, AIX and S390. The fundamental problem is
that macros like AX_CFLAGS_IRIX_OPTION can spuriously succeed.
(This used to be commit 30122f61c35b1af977efd6e4727204c2e2e1c7a3)
Diffstat (limited to 'source3/configure.in')
-rw-r--r-- | source3/configure.in | 241 |
1 files changed, 81 insertions, 160 deletions
diff --git a/source3/configure.in b/source3/configure.in index 3dad967295..6ec2b3808f 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -5,6 +5,9 @@ AC_PREREQ(2.53) AC_INIT(include/includes.h) AC_CONFIG_HEADER(include/config.h) +AC_DISABLE_STATIC +AC_ENABLE_SHARED + SMB_VERSION_STRING=`cat $srcdir/include/version.h | grep 'SAMBA_VERSION_OFFICIAL_STRING' | cut -d '"' -f2` echo "SAMBA VERSION: ${SMB_VERSION_STRING}" @@ -14,52 +17,6 @@ if test -n "${SAMBA_VERSION_SVN_REVISION}";then fi ################################################# -# Figure out what type of system we are building on. - -UNAME_S=`(uname -s) 2>/dev/null` || UNAME_S="unknown" -AC_MSG_CHECKING(uname -s) -AC_MSG_RESULT(${UNAME_S}) - -UNAME_R=`(uname -r) 2>/dev/null` || UNAME_R="unknown" -AC_MSG_CHECKING(uname -r) -AC_MSG_RESULT(${UNAME_R}) - -UNAME_M=`(uname -m) 2>/dev/null` || UNAME_M="unknown" -AC_MSG_CHECKING(uname -m) -AC_MSG_RESULT(${UNAME_M}) - -UNAME_P=`(uname -p) 2>/dev/null` || UNAME_P="unknown" -AC_MSG_CHECKING(uname -p) -AC_MSG_RESULT(${UNAME_P}) - -AC_CANONICAL_SYSTEM - -################################################# -# Detect the compiler early so we know how to run -# feature tests correctly. - -sinclude(compiler.m4) - -## -## for some reason this macro resets the CFLAGS -## so save and restore -## -OLD_CFLAGS=${CFLAGS} -AC_PROG_CC -CFLAGS=${OLD_CFLAGS} - -OLD_CFLAGS=${CFLAGS} -AC_PROG_CPP -CFLAGS=${OLD_CFLAGS} - -dnl Check if we use GNU ld -LD=${LD-ld} -AC_PROG_LD_GNU - -AC_DISABLE_STATIC -AC_ENABLE_SHARED - -################################################# # Directory handling stuff to support both the # legacy SAMBA directories and FHS compliant # ones... @@ -330,44 +287,37 @@ AC_ARG_ENABLE(socket-wrapper, # if it has no value. This prevent *very* large debug binaries from occurring # by default. if test "x$CFLAGS" = x; then - AX_CFLAGS_GCC_OPTION(-O, CFLAGS) - AX_CFLAGS_IRIX_OPTION(-O, CFLAGS) - # Make sure the MIPSPro compiler will never decide functions are too - # big to optimise - AX_CFLAGS_IRIX_OPTION(-OPT:Olimit=0, CFLAGS) - AX_CFLAGS_HPUX_OPTION(-O, CFLAGS) - AX_CFLAGS_SUN_OPTION(-O, CFLAGS) - AX_CFLAGS_AIX_OPTION(-O, CFLAGS) + CFLAGS="-O" fi -CPPFLAGS="${CPPFLAGS} -D_SAMBA_BUILD_" +CFLAGS="${CFLAGS} -D_SAMBA_BUILD_" AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings and debugging (default=no)], [if eval "test x$enable_developer = xyes"; then developer=yes - AX_CFLAGS_WARN_ALL(CFLAGS) - AX_CFLAGS_GCC_OPTION(-gstabs, CFLAGS) - AX_CFLAGS_GCC_OPTION(-Wshadow, CFLAGS) - AX_CFLAGS_GCC_OPTION(-Wstrict-prototypes, CFLAGS) - AX_CFLAGS_GCC_OPTION(-Wpointer-arith, CFLAGS) - AX_CFLAGS_GCC_OPTION(-Wcast-align, CFLAGS) - AX_CFLAGS_GCC_OPTION(-Wwrite-strings, CFLAGS) - AX_CFLAGS_GCC_OPTION(-Wdeclaration-after-statement, CFLAGS) - CPPFLAGS="${CPPFLAGS} -DDEBUG_PASSWORD -DDEVELOPER" + CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER" + # Add -Wdeclaration-after-statement if compiler supports it + AC_CACHE_CHECK( + [that the C compiler understands -Wdeclaration-after-statement], + samba_cv_HAVE_Wdeclaration_after_statement, [ + AC_TRY_RUN_STRICT([ + int main(void) + { + return 0; + }],[-Wdeclaration-after-statement],[$CPPFLAGS],[$LDFLAGS], + samba_cv_HAVE_Wdeclaration_after_statement=yes, + samba_cv_HAVE_Wdeclaration_after_statement=no, + samba_cv_HAVE_Wdeclaration_after_statement=cross) + ]) + if test x"$samba_cv_HAVE_Wdeclaration_after_statement" = x"yes"; then + CFLAGS="${CFLAGS} -Wdeclaration-after-statement" + fi fi]) AC_ARG_ENABLE(krb5developer, [ --enable-krb5developer Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no)], [if eval "test x$enable_krb5developer = xyes"; then developer=yes - AX_CFLAGS_WARN_ALL(CFLAGS) - AX_CFLAGS_GCC_OPTION(-gstabs, CFLAGS) - AX_CFLAGS_GCC_OPTION(-Wshadow, CFLAGS) - AX_CFLAGS_GCC_OPTION(-Wpointer-arith, CFLAGS) - AX_CFLAGS_GCC_OPTION(-Wcast-align, CFLAGS) - AX_CFLAGS_GCC_OPTION(-Wcast-qual, CFLAGS) - AX_CFLAGS_GCC_OPTION(-Wwrite-strings, CFLAGS) - AX_CFLAGS_GCC_OPTION(-Wdeclaration-after-statement, CFLAGS) - CPPFLAGS="${CPPFLAGS} -DDEBUG_PASSWORD -DDEVELOPER" + CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER" fi]) AC_ARG_ENABLE(dmalloc, [ --enable-dmalloc Enable heap debugging [default=no]]) @@ -380,89 +330,19 @@ then LIBS="$LIBS -ldmalloc" fi -# Check for profile guided optimisation (PGO) support. - -AC_ARG_ENABLE(pgo, -[ --enable-pgo=SCRIPT Compile with PGO (default=no)], -[ - case $enableval in - yes|no) - AC_MSG_ERROR(the argument to --enable-pgo must be an executable script) - esac - - samba_cv_have_pgo=no - - # Test for IRIX PGO first. Unfortunately, some of the later GCC option - # tests can spuriously succeed with the MIPSPro compilers. Despite the - # test succeeding, the GCC options don't work. - if test "x$samba_cv_have_pgo" = "xno" ; then - samba_cv_have_pgo=yes - # The backslash below is horrible but necessary -- jpeach - AX_CFLAGS_IRIX_OPTION("-fb_create\ samba.feedback", - PGO_GENERATE_CFLAGS, [], [samba_cv_have_pgo=no]) - AX_CFLAGS_IRIX_OPTION("-fb_opt\ samba.feedback", - PGO_USE_CFLAGS, [], [samba_cv_have_pgo=no]) - fi - - # Test GCC 4.x style profile flags. - if test "x$samba_cv_have_pgo" = "xno" ; then - samba_cv_have_pgo=yes - AX_CFLAGS_GCC_OPTION(-fprofile-generate, PGO_GENERATE_CFLAGS, - [], [samba_cv_have_pgo=no]) - AX_CFLAGS_GCC_OPTION(-fprofile-use, PGO_USE_CFLAGS, - [], [samba_cv_have_pgo=no]) - fi - - # Test GCC 3.x style profile flags. This is rather more complicated so - # we only require a minimal set of options to enable PGO. - if test "x$samba_cv_have_pgo" = "xno" ; then - samba_cv_have_pgo=yes - AX_CFLAGS_GCC_OPTION(-fprofile-arcs, PGO_GENERATE_CFLAGS, - [], [samba_cv_have_pgo=no]) - AX_CFLAGS_GCC_OPTION(-fvpt, PGO_GENERATE_CFLAGS, [], []) - AX_CFLAGS_GCC_OPTION(-fspeculative-prefetching, PGO_GENERATE_CFLAGS, - [], []) - AX_CFLAGS_GCC_OPTION(-fprofile-values, PGO_GENERATE_CFLAGS, [], []) - AX_CFLAGS_GCC_OPTION(-fbranch-probabilities, PGO_USE_CFLAGS, - [], [samba_cv_have_pgo=no]) - AX_CFLAGS_GCC_OPTION(-fvpt, PGO_USE_CFLAGS, [], []) - AX_CFLAGS_GCC_OPTION(-freorder-functions, PGO_USE_CFLAGS, [], []) - AX_CFLAGS_GCC_OPTION(-fprofile-values, PGO_USE_CFLAGS, [], []) - AX_CFLAGS_GCC_OPTION(-fspeculative-prefetching, PGO_USE_CFLAGS, [], []) - AX_CFLAGS_GCC_OPTION(-funroll-loops, PGO_USE_CFLAGS, [], []) - AX_CFLAGS_GCC_OPTION(-fpeel-loops, PGO_USE_CFLAGS, [], []) - AX_CFLAGS_GCC_OPTION(-ftracer, PGO_USE_CFLAGS, [], []) - fi - - if test -r "$enableval" ; then - PGO_EXPERIMENT_SCRIPT="$enableval" - else - AC_MSG_ERROR(cannot find PGO experiment script $enableval) - fi - - if test "x$samba_cv_have_pgo" = "xno" ; then - ifPGO="#" - else - # Enable PGO targets in Makefile - ifPGO="" - # System-specific profiling tweaks - case "$host_os" in - *irix*) PGO_LIBS="$PGO_LIBS -linstr" ;; - esac - fi -], -[ - ifPGO="#" -] -) +dnl Checks for programs. -AC_SUBST(ifPGO) -AC_SUBST(PGO_GENERATE_CFLAGS) -AC_SUBST(PGO_USE_CFLAGS) -AC_SUBST(PGO_EXPERIMENT_SCRIPT) -AC_SUBST(PGO_LIBS) +## +## for some reason this macro resets the CFLAGS +## so save and restore +## +OLD_CFLAGS=${CFLAGS} +AC_PROG_CC +CFLAGS=${OLD_CFLAGS} -dnl Checks for programs. +OLD_CFLAGS=${CFLAGS} +AC_PROG_CPP +CFLAGS=${OLD_CFLAGS} AC_PROG_INSTALL AC_PROG_AWK @@ -470,6 +350,10 @@ AC_PATH_PROG(PERL, perl) AC_CHECK_TOOL(AR, ar) +dnl Check if we use GNU ld +LD=ld +AC_PROG_LD_GNU + dnl Certain versions of GNU ld the default is not to have the dnl --allow-shlib-undefined flag defined. This causes a stackload of dnl warnings when building modules. @@ -518,10 +402,28 @@ fi AC_SUBST(BROKEN_CC) dnl Check if the C compiler understands -Werror -AX_CFLAGS_GCC_OPTION(-Werror, Werror_FLAGS) - +AC_CACHE_CHECK([that the C compiler understands -Werror],samba_cv_HAVE_Werror, [ + AC_TRY_RUN_STRICT([ + int main(void) + { + return 0; + }],[-Werror],[$CPPFLAGS],[$LDFLAGS], + samba_cv_HAVE_Werror=yes,samba_cv_HAVE_Werror=no,samba_cv_HAVE_Werror=cross)]) +if test x"$samba_cv_HAVE_Werror" = x"yes"; then + Werror_FLAGS="-Werror" +else dnl Check if the C compiler understands -w2 -AX_CFLAGS_IRIX_OPTION(-w2, Werror_FLAGS) +AC_CACHE_CHECK([that the C compiler understands -w2],samba_cv_HAVE_w2, [ + AC_TRY_RUN_STRICT([ + int main(void) + { + return 0; + }],[-w2],[$CPPFLAGS],[$LDFLAGS], + samba_cv_HAVE_w2=yes,samba_cv_HAVE_w2=no,samba_cv_HAVE_w2=cross)]) +if test x"$samba_cv_HAVE_w2" = x"yes"; then + Werror_FLAGS="-w2" +fi +fi dnl Check if the C compiler understands volatile (it should, being ANSI). AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [ @@ -531,6 +433,24 @@ if test x"$samba_cv_volatile" = x"yes"; then AC_DEFINE(HAVE_VOLATILE, 1, [Whether the C compiler understands volatile]) fi +UNAME_S=`(uname -s) 2>/dev/null` || UNAME_S="unknown" +AC_MSG_CHECKING(uname -s) +AC_MSG_RESULT(${UNAME_S}) + +UNAME_R=`(uname -r) 2>/dev/null` || UNAME_R="unknown" +AC_MSG_CHECKING(uname -r) +AC_MSG_RESULT(${UNAME_R}) + +UNAME_M=`(uname -m) 2>/dev/null` || UNAME_M="unknown" +AC_MSG_CHECKING(uname -m) +AC_MSG_RESULT(${UNAME_M}) + +UNAME_P=`(uname -p) 2>/dev/null` || UNAME_P="unknown" +AC_MSG_CHECKING(uname -p) +AC_MSG_RESULT(${UNAME_P}) + +AC_CANONICAL_SYSTEM + dnl Add #include for broken IRIX header files case "$host_os" in *irix6*) AC_ADD_INCLUDE(<standards.h>) @@ -562,11 +482,12 @@ case "$host_os" in # Try to work out if this is the native HPUX compiler that uses the -Ae flag. *hpux*) - AX_CFLAGS_HPUX_OPTION(Ae, CFLAGS, - [ac_cv_prog_cc_Ae=yes], [ac_cv_prog_cc_Ae=no]) + AC_PROG_CC_FLAG(Ae) # mmap on HPUX is completely broken... AC_DEFINE(MMAP_BLACKLIST, 1, [Whether MMAP is broken]) - + if test $ac_cv_prog_cc_Ae = yes; then + CPPFLAGS="$CPPFLAGS -Ae" + fi # # Defines needed for HPUX support. # HPUX has bigcrypt but (sometimes?) doesn't use it for |