pandora-build v0.13
authorMonty Taylor <mordred@inaugust.com>
Tue, 14 Jul 2009 19:12:08 +0000 (12:12 -0700)
committerMonty Taylor <mordred@inaugust.com>
Tue, 14 Jul 2009 19:12:08 +0000 (12:12 -0700)
m4/pandora_64bit.m4
m4/pandora_canonical.m4
m4/pandora_optimize.m4
m4/pandora_warnings.m4

index 06cc2b70ad0550819ea6fa31ed08e51dde8af8c4..44ec4c0064dd0a26b9b6893bf529ce452da76f52 100644 (file)
@@ -8,34 +8,45 @@ dnl Macro: PANDORA_64BIT
 dnl ---------------------------------------------------------------------------
 AC_DEFUN([PANDORA_64BIT],[
 
+  AC_ARG_ENABLE([64bit],[
+    AS_HELP_STRING([--disable-64bit],
+      [Build 64 bit binary @<:@default=on@:>@])],
+             [ac_enable_64bit="$enableval"],
+             [ac_enable_64bit="yes"])
+
   AC_CHECK_PROGS(ISAINFO, [isainfo], [no])
   AS_IF([test "x$ISAINFO" != "xno"],
         [isainfo_b=`${ISAINFO} -b`],
         [isainfo_b="x"])
 
-  AS_IF([test "$isainfo_b" != "x"],
-        [AC_ARG_ENABLE([64bit],
-             [AS_HELP_STRING([--disable-64bit],
-                [Build 64 bit binary @<:@default=on@:>@])],
-             [ac_enable_64bit="$enableval"],
-             [ac_enable_64bit="yes"])])
-
-  AS_IF([test "x$ac_enable_64bit" = "xyes"],[
-         if test "x$libdir" = "x\${exec_prefix}/lib" ; then
-           # The user hasn't overridden the default libdir, so we'll 
-           # the dir suffix to match solaris 32/64-bit policy
-           isainfo_k=`${ISAINFO} -k` 
-           libdir="${libdir}/${isainfo_k}"
-         fi
-         CPPFLAGS="-m64 ${CPPFLAGS}"
-         LDFLAGS="-m64 ${LDFLAGS}"
-         DTRACEFLAGS="${DTRACEFLAGS} -64"
-         if test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes"
-         then
-            AM_CFLAGS="-xmemalign=8s ${AM_CFLAGS}"
-            AM_CXXFLAGS="-xmemalign=8s ${AM_CXXFLAGS}"
-         fi
-       ],[DTRACEFLAGS="${DTRACEFLAGS} -32"])
+  AS_IF([test "$isainfo_b" != "x"],[
+
+    isainfo_k=`${ISAINFO} -k` 
+    DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_k}"
+
+    AS_IF([test "x${ac_cv_env_CPPFLAGS_set}" = "x"],[
+      CPPFLAGS="-I/usr/local ${CPPFLAGS}"
+    ])
+
+    AS_IF([test "x${ac_cv_env_LDFLAGS_set}" = "x"],[
+      LDFLAGS="-L/usr/local/lib/${isainfo_k} ${LDFLAGS}"
+    ])
+
+    AS_IF([test "x$ac_enable_64bit" = "xyes"],[
+      AS_IF([test "x$libdir" = "x\${exec_prefix}/lib"],[
+       dnl The user hasn't overridden the default libdir, so we'll 
+       dnl the dir suffix to match solaris 32/64-bit policy
+       libdir="${libdir}/${isainfo_k}"
+      ])
+
+      CPPFLAGS="-m64 ${CPPFLAGS}"
+      LDFLAGS="-m64 ${LDFLAGS}"
+      AS_IF([test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes"],[
+        AM_CFLAGS="-xmemalign=8s ${AM_CFLAGS}"
+        AM_CXXFLAGS="-xmemalign=8s ${AM_CXXFLAGS}"
+      ])
+    ])
+  ])
 ])
 dnl ---------------------------------------------------------------------------
 dnl End Macro: PANDORA_64BIT
index 22930bf741f29b83abc883c6896088999de5f9fc..fc77522f015cb046f2e5280b476d0316f89821f2 100644 (file)
@@ -4,7 +4,7 @@ dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 dnl Which version of the canonical setup we're using
-AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.3])
+AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.13])
 
 AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[
   dnl Force dependency tracking on for Sun Studio builds
@@ -22,7 +22,8 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
   m4_define([PCT_USE_GNULIB],[no])
   m4_define([PCT_REQUIRE_CXX],[no])
   m4_define([PCT_IGNORE_SHARED_PTR],[no])
-  m4_foreach([pct_arg],$*,[
+  m4_define([PCT_FORCE_GCC42],[no])
+  m4_foreach([pct_arg],[$*],[
     m4_case(pct_arg,
       [use-gnulib], [
         m4_undefine([PCT_USE_GNULIB])
@@ -35,6 +36,10 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
       [ignore-shared-ptr], [
         m4_undefine([PCT_IGNORE_SHARED_PTR])
         m4_define([PCT_IGNORE_SHARED_PTR],[yes])
+      ],
+      [force-gcc42], [
+        m4_undefine([PCT_FORCE_GCC42])
+        m4_define([PCT_FORCE_GCC42],[yes])
     ])
   ])
 
@@ -53,6 +58,7 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
   m4_if(PCT_USE_GNULIB,yes,[ gl_EARLY ])
   
   AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([PANDORA_MAC_GCC42])
 
   dnl Once we can use a modern autoconf, we can use this
   dnl AC_PROG_CC_C99
@@ -61,6 +67,9 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
   AM_PROG_CC_C_O
 
   gl_USE_SYSTEM_EXTENSIONS
+  m4_if(PCT_FORCE_GCC42, [yes], [
+    AS_IF([test "$GCC" = "yes"], PANDORA_ENSURE_GCC_VERSION)
+  ])
   
 
   PANDORA_LIBTOOL
@@ -99,20 +108,25 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
 
   AC_SYS_LARGEFILE
 
-  AS_IF([test "$GCC" = "yes"], PANDORA_ENSURE_GCC_VERSION)
 
   PANDORA_CHECK_C_VERSION
   PANDORA_CHECK_CXX_VERSION
 
   PANDORA_OPTIMIZE
   PANDORA_64BIT
-  PANDORA_WARNINGS(PCT_ALL_ARGS)
 
+  dnl We need to inject error into the cflags to test if visibility works or not
+  save_CFLAGS="${CFLAGS}"
+  CFLAGS="${CFLAGS} -Werror"
   gl_VISIBILITY
+  CFLAGS="${save_CFLAGS}"
 
-  PANDORA_ENABLE_DTRACE
   PANDORA_HEADER_ASSERT
 
+  PANDORA_WARNINGS(PCT_ALL_ARGS)
+
+  PANDORA_ENABLE_DTRACE
+
   AC_CHECK_PROGS([DOXYGEN], [doxygen])
   AC_CHECK_PROGS([PERL], [perl])
 
index c255f2586abcd2b17b8402e717db866d60f64307..f38d9bb50708fa9be7304cc093b614a87f2cfe20 100644 (file)
@@ -8,8 +8,6 @@ AC_DEFUN([PANDORA_OPTIMIZE],[
   dnl First check for gcc and g++
   AS_IF([test "$GCC" = "yes"],[
 
-    AC_DEFINE([_GNU_SOURCE],[1],[Fix problem with S_ISLNK() on Linux])
-
     dnl The following is required for portable results of floating point 
     dnl calculations on PowerPC. The same must also be done for IA-64, but 
     dnl this options is missing in the IA-64 gcc backend.
@@ -39,12 +37,15 @@ AC_DEFUN([PANDORA_OPTIMIZE],[
     CXX="${CXX} -xlang=c99"
 
     AM_CFLAGS="-g -mt -xstrconst -Xa ${AM_CFLAGS}"
-    AM_CXXFLAGS="-g -mt -compat=5 -library=stlport4 -template=no%extdef ${AM_CXXFLAGS}"
+    AM_CXXFLAGS="-mt -compat=5 -library=stlport4 -template=no%extdef ${AM_CXXFLAGS}"
+
+    DEBUG_CXXFLAGS="-g"
 
     dnl TODO: Make a test for -xO4 usability here
     OPTIMIZE_FLAGS="-xO3 -xlibmil -xdepend -xbuiltin"
     OPTIMIZE_CFLAGS="${OPTIMIZE_FLAGS}"
-    OPTIMIZE_CXXFLAGS="${OPTIMIZE_FLAGS}"
+    OPTIMIZE_CXXFLAGS="-g0 ${OPTIMIZE_FLAGS}"
+
   ])
 
   AC_ARG_WITH([debug],
index fef7bd74bd6261926e8ab05c93c73faa0c3880bc..81795a5c692869c20cea5003843050fe77cbf55c 100644 (file)
@@ -15,7 +15,7 @@ AC_DEFUN([PANDORA_WARNINGS],[
   m4_define([PW_WARN_ALWAYS_ON],[no])
   ifdef([m4_define],,[define([m4_define],   defn([define]))])
   ifdef([m4_undefine],,[define([m4_undefine],   defn([undefine]))])
-  m4_foreach([pw_arg],$*,[
+  m4_foreach([pw_arg],[$*],[
     m4_case(pw_arg,
       [less-warnings],[
         m4_undefine([PW_LESS_WARNINGS])
@@ -69,7 +69,7 @@ AC_DEFUN([PANDORA_WARNINGS],[
     AC_CACHE_CHECK([whether it is safe to use -fdiagnostics-show-option],
       [ac_cv_safe_to_use_fdiagnostics_show_option_],
       [save_CFLAGS="$CFLAGS"
-       CFLAGS="-fdiagnostics-show-option ${AM_CFLAGS}"
+       CFLAGS="-fdiagnostics-show-option ${AM_CFLAGS} ${CFLAGS}"
        AC_COMPILE_IFELSE(
          [AC_LANG_PROGRAM([],[])],
          [ac_cv_safe_to_use_fdiagnostics_show_option_=yes],
@@ -86,7 +86,7 @@ AC_DEFUN([PANDORA_WARNINGS],[
       [save_CFLAGS="$CFLAGS"
        dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
        dnl conversion warnings to all the tarball folks
-       CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS}"
+       CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
        AC_COMPILE_IFELSE(
          [AC_LANG_PROGRAM([[
 #include <stdbool.h>
@@ -108,7 +108,7 @@ foo(0);
         [save_CFLAGS="$CFLAGS"
          dnl Use -Werror here instead of ${W_FAIL} so that we don't spew
          dnl conversion warnings to all the tarball folks
-         CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS}"
+         CFLAGS="-Wconversion -Werror -pedantic ${AM_CFLAGS} ${CFLAGS}"
          AC_COMPILE_IFELSE(
            [AC_LANG_PROGRAM(
              [[
@@ -129,13 +129,16 @@ uint16_t x= htons(80);
 
     m4_if(PW_LESS_WARNINGS,[no],[
       BASE_WARNINGS_FULL="-Wformat=2 ${W_CONVERSION} -Wstrict-aliasing"
-      CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum"
+      CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum -Wwrite-strings"
       CXX_WARNINGS_FULL="-Weffc++ -Wold-style-cast"
     ],[
       BASE_WARNINGS_FULL="-Wformat ${NO_STRICT_ALIASING}"
     ])
 
-    BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wextra -Wundef -Wshadow -Wstrict-aliasing ${F_DIAGNOSTICS_SHOW_OPTION} ${CFLAG_VISIBILITY} ${BASE_WARNINGS_FULL}"
+    AS_IF([test "${ac_cv_assert}" = "no"],
+          [NO_UNUSED="-Wno-unused-variable -Wno-unused-parameter"])
+
+    BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wextra -Wundef -Wshadow ${NO_UNUSED} ${F_DIAGNOSTICS_SHOW_OPTION} ${CFLAG_VISIBILITY} ${BASE_WARNINGS_FULL}"
     CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align ${CC_WARNINGS_FULL}"
     CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wno-long-long ${CXX_WARNINGS_FULL}"
 
@@ -161,7 +164,7 @@ uint16_t x= htons(80);
     AC_CACHE_CHECK([whether it is safe to use -Wlogical-op],
       [ac_cv_safe_to_use_Wlogical_op_],
       [save_CFLAGS="$CFLAGS"
-       CFLAGS="${W_FAIL} -pedantic -Wlogical-op ${AM_CFLAGS}"
+       CFLAGS="${W_FAIL} -pedantic -Wlogical-op ${AM_CFLAGS} ${CFLAGS}"
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM(
          [[