svn commit: samba r13419 - in trunk/source: .

jpeach at samba.org jpeach at samba.org
Thu Feb 9 23:22:52 GMT 2006


Author: jpeach
Date: 2006-02-09 23:22:51 +0000 (Thu, 09 Feb 2006)
New Revision: 13419

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13419

Log:
svn merge -r 13417:13418 ../branches/SAMBA_3_0

Formalise support for checking compiler options.

Added:
   trunk/source/compiler.m4
Modified:
   trunk/source/aclocal.m4
   trunk/source/configure.in


Changeset:
Modified: trunk/source/aclocal.m4
===================================================================
--- trunk/source/aclocal.m4	2006-02-09 23:04:38 UTC (rev 13418)
+++ trunk/source/aclocal.m4	2006-02-09 23:22:51 UTC (rev 13419)
@@ -76,18 +76,6 @@
     	ifelse([$2], , :, [rm -f $2])
 ])
 
-dnl AC_PROG_CC_FLAG(flag)
-AC_DEFUN(AC_PROG_CC_FLAG,
-[AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_cv_prog_cc_$1,
-[echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then
-  ac_cv_prog_cc_$1=yes
-else
-  ac_cv_prog_cc_$1=no
-fi
-rm -f conftest*
-])])
-
 dnl see if a declaration exists for a function or variable
 dnl defines HAVE_function_DECL if it exists
 dnl AC_HAVE_DECL(var, includes)

Copied: trunk/source/compiler.m4 (from rev 13418, branches/SAMBA_3_0/source/compiler.m4)

Modified: trunk/source/configure.in
===================================================================
--- trunk/source/configure.in	2006-02-09 23:04:38 UTC (rev 13418)
+++ trunk/source/configure.in	2006-02-09 23:22:51 UTC (rev 13419)
@@ -5,9 +5,6 @@
 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}"
 
@@ -17,6 +14,31 @@
 fi
 
 #################################################
+# 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...
@@ -290,34 +312,34 @@
   CFLAGS="-O"
 fi
 
-CFLAGS="${CFLAGS} -D_SAMBA_BUILD_"
+CPPFLAGS="${CPPFLAGS} -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
-    	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
+	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"
     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
-	CFLAGS="${CFLAGS} -gstabs -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -DDEBUG_PASSWORD -DDEVELOPER"
+	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"
     fi])
 
 AC_ARG_ENABLE(dmalloc, [  --enable-dmalloc        Enable heap debugging [default=no]])
@@ -332,28 +354,12 @@
 
 dnl Checks for programs.
 
-##
-## 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}
-
 AC_PROG_INSTALL
 AC_PROG_AWK
 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.
@@ -402,28 +408,10 @@
 AC_SUBST(BROKEN_CC)
 
 dnl Check if the C compiler understands -Werror
-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 
+AX_CFLAGS_GCC_OPTION(-Werror, Werror_FLAGS)
+
 dnl Check if the C compiler understands -w2
-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
+AX_CFLAGS_IRIX_OPTION(-w2, Werror_FLAGS)
 
 dnl Check if the C compiler understands volatile (it should, being ANSI).
 AC_CACHE_CHECK([that the C compiler understands volatile],samba_cv_volatile, [
@@ -482,12 +470,11 @@
 # Try to work out if this is the native HPUX compiler that uses the -Ae flag.
     *hpux*)
     
-      AC_PROG_CC_FLAG(Ae)
+      AX_CFLAGS_HPUX_OPTION(Ae, CFLAGS,
+	      [ac_cv_prog_cc_Ae=yes], [ac_cv_prog_cc_Ae=no])
       # 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



More information about the samba-cvs mailing list