Casting fixes for linux.
[m6w6/libmemcached] / m4 / pandora_canonical.m4
index 5917d28f9cadc6925c5062b83e829fcbe05b80a2..ef5e1983df69d9f05cf9874ad840f4072801a623 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.74])
+AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.80])
 
 AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[
   dnl Force dependency tracking on for Sun Studio builds
@@ -24,6 +24,8 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
   m4_define([PCT_IGNORE_SHARED_PTR],[no])
   m4_define([PCT_FORCE_GCC42],[no])
   m4_define([PCT_SRC_IN_SRC],[no])
+  m4_define([PCT_VERSION_FROM_VC],[no])
+  m4_define([PCT_USE_VISIBILITY],[yes])
   m4_foreach([pct_arg],[$*],[
     m4_case(pct_arg,
       [use-gnulib], [
@@ -42,9 +44,17 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
         m4_undefine([PCT_FORCE_GCC42])
         m4_define([PCT_FORCE_GCC42],[yes])
       ],
+      [skip-visibility], [
+        m4_undefine([PCT_USE_VISIBILITY])
+        m4_define([PCT_USE_VISIBILITY],[no])
+      ],
       [src-in-src], [
         m4_undefine([PCT_SRC_IN_SRC])
         m4_define([PCT_SRC_IN_SRC],[yes])
+      ],
+      [version-from-vc], [
+        m4_undefine([PCT_VERSION_FROM_VC])
+        m4_define([PCT_VERSION_FROM_VC],[yes])
     ])
   ])
 
@@ -67,6 +77,11 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
   AC_REQUIRE([PANDORA_MAC_GCC42])
   AC_REQUIRE([PANDORA_64BIT])
 
+  m4_if(PCT_VERSION_FROM_VC,yes,[
+    PANDORA_VC_VERSION
+  ])
+  PANDORA_VERSION
+
   dnl Once we can use a modern autoconf, we can use this
   dnl AC_PROG_CC_C99
   AC_REQUIRE([AC_PROG_CXX])
@@ -82,6 +97,13 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
 
   PANDORA_LIBTOOL
 
+  AS_IF([test "$lt_cv_prog_gnu_ld" = "yes"],[
+    ${LD} --help | grep default-symver >/dev/null 2>&1
+    AS_IF([test $? -eq 0],[
+      AM_LDFLAGS="${AM_LDFLAGS} -Wl,--default-symver"
+    ])
+  ])
+
   dnl autoconf doesn't automatically provide a fail-if-no-C++ macro
   dnl so we check c++98 features and fail if we don't have them, mainly
   dnl for that reason
@@ -154,6 +176,18 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
   dnl alloca - but we need to know it anyway for check_stack_overrun.
   PANDORA_STACK_DIRECTION
 
+  save_LIBS="${LIBS}"
+  LIBS=""
+  AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
+  LIBM="${LIBS}"
+  LIBS="${save_LIBS}"
+  AC_SUBST([LIBM])
+  
+  AC_CHECK_FUNC(setsockopt, [], [AC_CHECK_LIB(socket, setsockopt)])
+  AC_CHECK_FUNC(bind, [], [AC_CHECK_LIB(bind, bind)])
+
+
+
   PANDORA_OPTIMIZE
 
   AC_LANG_PUSH(C++)
@@ -169,11 +203,13 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
 
   PANDORA_HAVE_GCC_ATOMICS
 
-  dnl We need to inject error into the cflags to test if visibility works or not
-  dnl save_CFLAGS="${CFLAGS}"
-  dnl CFLAGS="${CFLAGS} -Werror"
-  dnl gl_VISIBILITY
-  dnl CFLAGS="${save_CFLAGS}"
+  m4_if(PCT_USE_VISIBILITY,[yes],[
+    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_HEADER_ASSERT
 
@@ -208,5 +244,6 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
   AC_SUBST([AM_CFLAGS])
   AC_SUBST([AM_CXXFLAGS])
   AC_SUBST([AM_CPPFLAGS])
+  AC_SUBST([AM_LDFLAGS])
 
 ])