Further merging from libdrizzle and gearman.
[m6w6/libmemcached] / configure.ac
index 80b63da746e0950d84af55d5db3bef3e2e0c5a44..81602f828161db903d76a8a2a0481b040df78ca3 100644 (file)
@@ -116,7 +116,7 @@ then
    OPTIMIZE_CFLAGS="-xO4 -xlibmil -xdepend -Xa -xstrconst"
 fi
 
-SOLARIS_64BIT
+ENABLE_64BIT
 
 #--------------------------------------------------------------------
 # Check for libpthread
@@ -207,6 +207,63 @@ W_STRICT_ALIASING="-Wno-strict-aliasing"
 if test "$GCC" = "yes"
 then
 
+  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 ${CFLAGS}"
+     AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([],[])],
+       [ac_cv_safe_to_use_fdiagnostics_show_option_=yes],
+       [ac_cv_safe_to_use_fdiagnostics_show_option_=no])
+     CFLAGS="$save_CFLAGS"])
+
+  AS_IF([test "$ac_cv_safe_to_use_fdiagnostics_show_option_" = "yes"],
+        [
+          F_DIAGNOSTICS_SHOW_OPTION="-fdiagnostics-show-option"
+        ])
+
+
+  AC_CACHE_CHECK([whether it is safe to use -Wconversion],
+    [ac_cv_safe_to_use_wconversion_],
+    [save_CFLAGS="$CFLAGS"
+     CFLAGS="-Werror -Wconversion ${CFLAGS}"
+     AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[
+#include <stdbool.h>
+void foo(bool a)
+{
+  (void)a;
+}
+       ]],[[
+foo(0);
+       ]])],
+       [ac_cv_safe_to_use_wconversion_=yes],
+       [ac_cv_safe_to_use_wconversion_=no])
+     CFLAGS="$save_CFLAGS"])
+  AS_IF([test "$ac_cv_safe_to_use_wconversion_" = "yes"],
+    [W_CONVERSION="-Wconversion"
+    AC_CACHE_CHECK([whether it is safe to use -Wconversion with htons],
+      [ac_cv_safe_to_use_Wconversion_],
+      [save_CFLAGS="$CFLAGS"
+       CFLAGS="-Werror -Wconversion ${CFLAGS}"
+       AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+           [[
+#include <netinet/in.h>
+           ]],[[
+uint16_t x= htons(80);
+           ]])],
+         [ac_cv_safe_to_use_Wconversion_=yes],
+         [ac_cv_safe_to_use_Wconversion_=no])
+       CFLAGS="$save_CFLAGS"])
+
+    AS_IF([test "$ac_cv_safe_to_use_Wconversion_" = "no"],
+          [
+            NO_CONVERSION="-Wno-conversion"
+          ])
+    ])
+
+  W_STRICT_ALIASING="-Wno-strict-aliasing"
 
   AS_IF([test "$ac_profiling" = "yes"],
         [CC_PROFILING="-pg"])
@@ -217,31 +274,10 @@ then
   AS_IF([test "$building_from_bzr" = "yes"],
         [W_FAIL="-Werror"])
 
-  BASE_WARNINGS="-pedantic -W -Wall -Wextra ${W_FAIL} -Wundef  -Wshadow -Wmissing-declarations ${W_STRICT_ALIASING} -fdiagnostics-show-option" 
+  BASE_WARNINGS="-pedantic -W -Wall -Wextra ${W_FAIL} -Wundef -Wshadow -Wmissing-declarations ${W_STRICT_ALIASING} ${F_DIAGNOSTICS_SHOW_OPTION} ${W_CONVERSION}"
   CC_WARNINGS="${BASE_WARNINGS} -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wswitch-default -Wswitch-enum -Wcast-align -Wconversion"
   CXX_WARNINGS="${BASE_WARNINGS} -Woverloaded-virtual  -Wnon-virtual-dtor -Wctor-dtor-privacy  -Wold-style-cast -Weffc++ -Wno-long-long -Wconversion"
 
-  AC_CACHE_CHECK([whether it is safe to use -Wconversion with htons],
-    [ac_cv_safe_to_use_Wconversion_],
-    [save_CFLAGS="$CFLAGS"
-     CFLAGS="-Wconversion -Werror ${CFLAGS}"
-     AC_COMPILE_IFELSE(
-       [AC_LANG_PROGRAM(
-         [[
-#include <arpa/inet.h>
-#include <netinet/in.h>
-         ]],[[
-uint16_t x= htons(80);
-         ]])],
-       [ac_cv_safe_to_use_Wconversion_=yes],
-       [ac_cv_safe_to_use_Wconversion_=no])
-     CFLAGS="$save_CFLAGS"])
-
-  AS_IF([test "$ac_cv_safe_to_use_Wconversion_" = "no"],
-        [
-          NO_CONVERSION="-Wno-conversion"
-        ])
-
 
   AC_CACHE_CHECK([whether it is safe to use -Wlogical-op],
     [ac_cv_safe_to_use_Wlogical_op_],