pandora-build v0.74
authorMonty Taylor <mordred@inaugust.com>
Wed, 2 Dec 2009 02:57:53 +0000 (20:57 -0600)
committerMonty Taylor <mordred@inaugust.com>
Wed, 2 Dec 2009 02:57:53 +0000 (20:57 -0600)
31 files changed:
clients/Makefile.am
configure.ac
m4/pandora_canonical.m4
m4/pandora_cinttypes.m4 [new file with mode: 0644]
m4/pandora_cstdint.m4 [new file with mode: 0644]
m4/pandora_drizzle_build.m4 [new file with mode: 0644]
m4/pandora_fdatasync.m4 [new file with mode: 0644]
m4/pandora_have_better_malloc.m4
m4/pandora_have_gcc_atomics.m4 [new file with mode: 0644]
m4/pandora_have_libavahi.m4 [new file with mode: 0644]
m4/pandora_have_libbdb.m4 [new file with mode: 0644]
m4/pandora_have_libdl.m4 [new file with mode: 0644]
m4/pandora_have_libevent.m4 [new file with mode: 0644]
m4/pandora_have_libgearman.m4
m4/pandora_have_libmemcached.m4
m4/pandora_have_libpcre.m4 [new file with mode: 0644]
m4/pandora_have_libreadline.m4 [new file with mode: 0644]
m4/pandora_have_libtokyocabinet.m4 [new file with mode: 0644]
m4/pandora_have_libuuid.m4 [new file with mode: 0644]
m4/pandora_have_libxml2.m4 [new file with mode: 0644]
m4/pandora_have_libz.m4 [new file with mode: 0644]
m4/pandora_plugins.m4
m4/pandora_pthread.m4
m4/pandora_run_cpplint.m4 [new file with mode: 0644]
m4/pandora_sasl.m4 [new file with mode: 0644]
m4/pandora_stack_direction.m4 [new file with mode: 0644]
m4/pandora_stl_hash.m4 [new file with mode: 0644]
m4/pandora_vc_build.m4
m4/pandora_warnings.m4
m4/pandora_with_gettext.m4 [new file with mode: 0644]
m4/pandora_with_memcached.m4

index 26b08e64dd32179fc2b3d8e35209b884704aca72..1c5a2075b4f72eaa32a17602af40f092bec631f0 100644 (file)
@@ -1,6 +1,10 @@
 LDADDS = libutilities.la $(top_builddir)/libmemcached/libmemcached.la
 
-bin_PROGRAMS = memcat memdump memcp memstat memrm memflush memslap memerror memcapable
+bin_PROGRAMS = memcat memdump memcp memstat memrm memflush memerror memcapable
+
+if HAVE_LIBEVENT
+  bin_PROGRAMS += memslap
+endif
 
 noinst_HEADERS = client_options.h \
                utilities.h \
@@ -41,8 +45,7 @@ memslap_SOURCES = \
                ms_stats.c \
                ms_task.c \
                ms_thread.c
-memslap_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-memslap_LDADD = $(PTHREAD_LIBS) libgenexec.la $(LDADDS)
+memslap_LDADD = $(LTLIBEVENT) libgenexec.la $(LDADDS)
 
 memcapable_SOURCES = memcapable.c
 if BUILD_BYTEORDER
index 1bcf1ae201a0aca3bd7544db1cf71ef1e19ca219..5198402bd1eb5adb1500792a7791380a49c34aff 100644 (file)
@@ -44,122 +44,15 @@ AC_SUBST(LD_VERSION_SCRIPT)
 AC_SUBST(LD_UTIL_VERSION_SCRIPT)
 AC_SUBST(LD_PROTOCOL_VERSION_SCRIPT)
 
-
-
-#--------------------------------------------------------------------
-# Check for libevent
-#--------------------------------------------------------------------
-trylibeventdir=""
-AC_ARG_WITH(libevent,
-       [  --with-libevent=PATH     Specify path to libevent installation ],
-       [
-                if test "x$withval" != "xno" ; then
-                        trylibeventdir=$withval
-                fi
-       ]
-)
-
-dnl ------------------------------------------------------
-dnl libevent detection.  swiped from Tor.  modified a bit.
-
-LIBEVENT_URL=http://www.monkey.org/~provos/libevent/
-
-AC_CACHE_CHECK([for libevent directory], ac_cv_libevent_dir, [
-  saved_LIBS="$LIBS"
-  saved_LDFLAGS="$LDFLAGS"
-  saved_CPPFLAGS="$CPPFLAGS"
-  le_found=no
-  for ledir in $trylibeventdir "" $prefix /usr/local ; do
-    LDFLAGS="$saved_LDFLAGS"
-    LIBS="$saved_LIBS -levent"
-
-    # Skip the directory if it isn't there.
-    if test ! -z "$ledir" -a ! -d "$ledir" ; then
-       continue;
-    fi
-    if test ! -z "$ledir" ; then
-      if test -d "$ledir/lib" ; then
-        LDFLAGS="-L$ledir/lib $LDFLAGS"
-      else
-        LDFLAGS="-L$ledir $LDFLAGS"
-      fi
-      if test -d "$ledir/include" ; then
-        CPPFLAGS="-I$ledir/include $CPPFLAGS"
-      else
-        CPPFLAGS="-I$ledir $CPPFLAGS"
-      fi
-    fi
-    # Can I compile and link it?
-    AC_TRY_LINK([#include <sys/time.h>
-#include <sys/types.h>
-#include <event.h>], [ event_init(); ],
-       [ libevent_linked=yes ], [ libevent_linked=no ])
-    if test $libevent_linked = yes; then
-       if test ! -z "$ledir" ; then
-         ac_cv_libevent_dir=$ledir
-       else
-        ac_cv_libevent_dir="(system)"
-       fi
-       le_found=yes
-       break
-    fi
-  done
-  LIBS="$saved_LIBS"
-  LDFLAGS="$saved_LDFLAGS"
-  CPPFLAGS="$saved_CPPFLAGS"
-  if test $le_found = no ; then
-    AC_MSG_ERROR([libevent is required.  You can get it from $LIBEVENT_URL
-
-      If it's already installed, specify its path using --with-libevent=/dir/
-])
-  fi
-])
-LIBS="$LIBS -levent"
-if test $ac_cv_libevent_dir != "(system)"; then
-  if test -d "$ac_cv_libevent_dir/lib" ; then
-    LDFLAGS="-L$ac_cv_libevent_dir/lib $LDFLAGS"
-    le_libdir="$ac_cv_libevent_dir/lib"
-  else
-    LDFLAGS="-L$ac_cv_libevent_dir $LDFLAGS"
-    le_libdir="$ac_cv_libevent_dir"
-  fi
-  if test -d "$ac_cv_libevent_dir/include" ; then
-    CPPFLAGS="-I$ac_cv_libevent_dir/include $CPPFLAGS"
-  else
-    CPPFLAGS="-I$ac_cv_libevent_dir $CPPFLAGS"
-  fi
-fi
-
-
-#--------------------------------------------------------------------
-# Check for libpthread
-#--------------------------------------------------------------------
-
-ACX_PTHREAD(,AC_MSG_ERROR(could not find libpthread))
-LIBS="${PTHREAD_LIBS} ${LIBS}"
-CFLAGS="${PTHREAD_CFLAGS} ${CFLAGS}"
-CC="$PTHREAD_CC"
+PANDORA_HAVE_LIBEVENT
+PANDORA_REQUIRE_PTHREAD
 
 
 AC_SEARCH_LIBS(getopt_long, gnugetopt)
 AC_SEARCH_LIBS(socket, socket)
 AC_SEARCH_LIBS(gethostbyname, nsl)
 
-save_LIBS="$LIBS"
-LIBS="$LIBS -lm"
-AC_LINK_IFELSE(
-  [AC_LANG_PROGRAM(
-    [[
-#include <stdlib.h>
-    ]],[[
-      float f= floorf((float) 1.0);
-    ]],
-    [LIBM="-lm"],[LIBM=""])])
-
-AC_SUBST(LIBM)
-LIBS="$save_LIBS"
-
-AC_SEARCH_LIBS(floorf, m)
+AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
 
 dnl Specialty checks
 DETECT_BYTEORDER
index 0084b43850cde559fe63b9941f54e59ef035e063..5917d28f9cadc6925c5062b83e829fcbe05b80a2 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.62])
+AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.74])
 
 AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[
   dnl Force dependency tracking on for Sun Studio builds
@@ -58,7 +58,7 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
   
   AC_CANONICAL_TARGET
   
-  AM_INIT_AUTOMAKE(-Wall -Werror nostdinc subdir-objects)
+  AM_INIT_AUTOMAKE(-Wall -Werror nostdinc subdir-objects foreign)
   m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
 
   m4_if(PCT_USE_GNULIB,yes,[ gl_EARLY ])
@@ -90,6 +90,7 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
     AS_IF([test "$ac_cv_cxx_stdcxx_98" = "no"],[
       AC_MSG_ERROR([No working C++ Compiler has been found. ${PACKAGE} requires a C++ compiler that can handle C++98])
     ])
+
   ])
   
   PANDORA_SHARED_PTR
@@ -104,6 +105,9 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
     AC_CONFIG_LIBOBJ_DIR([gnulib])
   ])
 
+  PANDORA_CHECK_C_VERSION
+  PANDORA_CHECK_CXX_VERSION
+
   AC_C_BIGENDIAN
   AC_C_CONST
   AC_C_INLINE
@@ -114,17 +118,62 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
   AC_TYPE_SIZE_T
   AC_SYS_LARGEFILE
 
+  # off_t is not a builtin type
+  AC_CHECK_SIZEOF(off_t, 4)
+  AS_IF([test "$ac_cv_sizeof_off_t" -eq 0],[
+    AC_MSG_ERROR("${PACKAGE} needs an off_t type.")
+  ])
 
-  PANDORA_CHECK_C_VERSION
-  PANDORA_CHECK_CXX_VERSION
+  AC_CHECK_SIZEOF(size_t)
+  AS_IF([test "$ac_cv_sizeof_size_t" -eq 0],[
+    AC_MSG_ERROR("${PACKAGE} needs an size_t type.")
+  ])
+
+  AC_DEFINE_UNQUOTED([SIZEOF_SIZE_T],[$ac_cv_sizeof_size_t],[Size of size_t as computed by sizeof()])
+  AC_CHECK_SIZEOF(long long)
+  AC_DEFINE_UNQUOTED([SIZEOF_LONG_LONG],[$ac_cv_sizeof_long_long],[Size of long long as computed by sizeof()])
+  AC_CACHE_CHECK([if time_t is unsigned], [ac_cv_time_t_unsigned],[
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+      [[
+#include <time.h>
+      ]],
+      [[
+      int array[(((time_t)-1) > 0) ? 1 : -1];
+      ]])
+    ],[
+      ac_cv_time_t_unsigned=yes
+    ],[
+      ac_cv_time_t_unsigned=no
+    ])
+  ])
+  AS_IF([test "$ac_cv_time_t_unsigned" = "yes"],[
+    AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned])
+  ])
+
+  dnl AC_FUNC_ALLOCA would test for stack direction if we didn't have a working
+  dnl alloca - but we need to know it anyway for check_stack_overrun.
+  PANDORA_STACK_DIRECTION
 
   PANDORA_OPTIMIZE
 
+  AC_LANG_PUSH(C++)
+  # Test whether madvise() is declared in C++ code -- it is not on some
+  # systems, such as Solaris
+  AC_CHECK_DECLS([madvise], [], [], [AC_INCLUDES_DEFAULT[
+  #if HAVE_SYS_MMAN_H
+  #include <sys/types.h>
+  #include <sys/mman.h>
+  #endif
+  ]])
+  AC_LANG_POP()
+
+  PANDORA_HAVE_GCC_ATOMICS
+
   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}"
+  dnl save_CFLAGS="${CFLAGS}"
+  dnl CFLAGS="${CFLAGS} -Werror"
+  dnl gl_VISIBILITY
+  dnl CFLAGS="${save_CFLAGS}"
 
   PANDORA_HEADER_ASSERT
 
diff --git a/m4/pandora_cinttypes.m4 b/m4/pandora_cinttypes.m4
new file mode 100644 (file)
index 0000000..562fd0d
--- /dev/null
@@ -0,0 +1,31 @@
+# We check two things: where the include file is for cinttypes. We
+# include AC_TRY_COMPILE for all the combinations we've seen in the
+# wild.  We define one of HAVE_CINTTYPES or HAVE_TR1_CINTTYPES or 
+# HAVE_BOOST_CINTTYPES depending
+# on location.
+
+AC_DEFUN([PANDORA_CXX_CINTTYPES],
+  [AC_REQUIRE([PANDORA_CXX_CSTDINT])
+   AC_MSG_CHECKING(the location of cinttypes)
+   AC_LANG_PUSH(C++)
+   ac_cv_cxx_cinttypes=""
+   for location in tr1/cinttypes boost/cinttypes cinttypes; do
+     if test -z "$ac_cv_cxx_cinttypes"; then
+       AC_TRY_COMPILE([#include $ac_cv_cxx_cstdint;
+                       #include <$location>],
+                      [uint32_t foo= UINT32_C(1)],
+                      [ac_cv_cxx_cinttypes="<$location>";])
+     fi
+   done
+   AC_LANG_POP()
+   if test -n "$ac_cv_cxx_cinttypes"; then
+      AC_MSG_RESULT([$ac_cv_cxx_cinttypes])
+   else
+      AC_DEFINE([__STDC_LIMIT_MACROS],[1],[Use STDC Limit Macros in C++])
+      ac_cv_cxx_cinttypes="<inttypes.h>"
+      AC_MSG_RESULT()
+      AC_MSG_WARN([Could not find a cinttypes header.])
+   fi
+   AC_DEFINE_UNQUOTED(CINTTYPES_H,$ac_cv_cxx_cinttypes,
+                      [the location of <cinttypes>])
+])
diff --git a/m4/pandora_cstdint.m4 b/m4/pandora_cstdint.m4
new file mode 100644 (file)
index 0000000..619dd32
--- /dev/null
@@ -0,0 +1,30 @@
+# We check two things: where the include file is for cstdint. We
+# include AC_TRY_COMPILE for all the combinations we've seen in the
+# wild.  We define one of HAVE_CSTDINT or HAVE_TR1_CSTDINT or 
+# HAVE_BOOST_CSTDINT depending
+# on location.
+
+AC_DEFUN([PANDORA_CXX_CSTDINT],
+  [AC_MSG_CHECKING(the location of cstdint)
+   AC_LANG_PUSH(C++)
+   ac_cv_cxx_cstdint=""
+   for location in tr1/cstdint boost/cstdint cstdint; do
+     if test -z "$ac_cv_cxx_cstdint"; then
+       AC_TRY_COMPILE([#include <$location>],
+                      [uint32_t t],
+                      [ac_cv_cxx_cstdint="<$location>";])
+     fi
+   done
+   AC_LANG_POP()
+   if test -n "$ac_cv_cxx_cstdint"; then
+      AC_MSG_RESULT([$ac_cv_cxx_cstdint])
+   else
+      AC_DEFINE([__STDC_CONSTANT_MACROS],[1],[Use STDC Constant Macros in C++])
+      AC_DEFINE([__STDC_FORMAT_MACROS],[1],[Use STDC Format Macros in C++])
+      ac_cv_cxx_cstdint="<stdint.h>"
+      AC_MSG_RESULT()
+      AC_MSG_WARN([Could not find a cstdint header.])
+   fi
+   AC_DEFINE_UNQUOTED(CSTDINT_H,$ac_cv_cxx_cstdint,
+                      [the location of <cstdint>])
+])
diff --git a/m4/pandora_drizzle_build.m4 b/m4/pandora_drizzle_build.m4
new file mode 100644 (file)
index 0000000..5794105
--- /dev/null
@@ -0,0 +1,96 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Check for all of the headers and libs that Drizzle needs. We check all
+dnl of these for plugins too, to ensure that all of the appropriate defines
+dnl are set.
+
+AC_DEFUN([PANDORA_DRIZZLE_BUILD],[
+
+  dnl We need to turn on our CXXFLAGS to make sure it shows up correctly
+  save_CXXFLAGS="${CXXFLAGS}"
+  CXXFLAGS="${CXXFLAGS} ${AM_CXXFLAGS}"
+  PANDORA_CXX_STL_HASH
+  CXXFLAGS="${save_CXXFLAGS}"
+
+  PANDORA_CXX_CSTDINT
+  PANDORA_CXX_CINTTYPES
+
+  AC_STRUCT_TM
+
+  AC_FUNC_ALLOCA
+  AC_FUNC_UTIME_NULL
+  AC_FUNC_VPRINTF
+
+  PANDORA_WORKING_FDATASYNC
+
+  AC_CHECK_FUNCS(\
+    gethrtime \
+    setupterm \
+    backtrace \
+    backtrace_symbols \
+    backtrace_symbols_fd)
+
+  AC_HEADER_STAT
+  AC_HEADER_DIRENT
+  AC_HEADER_STDC
+  AC_HEADER_SYS_WAIT
+  AC_HEADER_STDBOOL
+
+  AC_CHECK_HEADERS(sys/fpu.h fpu_control.h ieeefp.h)
+  AC_CHECK_HEADERS(select.h sys/select.h)
+  AC_CHECK_HEADERS(utime.h sys/utime.h )
+  AC_CHECK_HEADERS(synch.h sys/mman.h sys/socket.h)
+  AC_CHECK_HEADERS(sched.h)
+  AC_CHECK_HEADERS(sys/prctl.h)
+  AC_CHECK_HEADERS(execinfo.h)
+  AC_CHECK_HEADERS(locale.h)
+  AC_CHECK_HEADERS(termcap.h termio.h termios.h asm/termbits.h)
+  AC_CHECK_HEADERS(paths.h)
+
+  
+  #--------------------------------------------------------------------
+  # Check for system libraries. Adds the library to $LIBS
+  # and defines HAVE_LIBM etc
+  #--------------------------------------------------------------------
+  
+  AC_CHECK_LIB(m, floor, [], AC_CHECK_LIB(m, __infinity))
+  
+  AC_CHECK_FUNC(setsockopt, [], [AC_CHECK_LIB(socket, setsockopt)])
+  # This may get things to compile even if bind-8 is installed
+  AC_CHECK_FUNC(bind, [], [AC_CHECK_LIB(bind, bind)])
+  
+  # For the sched_yield() function on Solaris
+  AC_CHECK_FUNC(sched_yield, [],
+    [AC_CHECK_LIB(posix4, [sched_yield],
+      [AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield function]) LIBS="$LIBS -lposix4"])])
+  
+  AS_IF([test "$ac_cv_header_termio_h" = "no" -a "$ac_cv_header_termios_h" = "no"],[
+    AC_CHECK_FUNC(gtty, [], [AC_CHECK_LIB(compat, gtty)])
+  ])
+  
+  AC_CHECK_HEADERS([curses.h term.h],[],[],[[
+    #ifdef HAVE_CURSES_H
+    # include <curses.h>
+    #endif
+  ]])
+  AC_CHECK_TYPES([ulong])
+
+  AC_LANG_PUSH([C++])
+  AC_CHECK_HEADERS(cxxabi.h)
+  AC_CACHE_CHECK([checking for abi::__cxa_demangle], pandora_cv_cxa_demangle,
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cxxabi.h>]], [[
+    char *foo= 0; int bar= 0;
+    foo= abi::__cxa_demangle(foo, foo, 0, &bar);
+  ]])],[pandora_cv_cxa_demangle=yes],[pandora_cv_cxa_demangle=no])])
+  AC_LANG_POP([])
+
+  AS_IF([test "x$pandora_cv_cxa_demangle" = xyes],[
+    AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
+              [Define to 1 if you have the `abi::__cxa_demangle' function.])
+  ])
+
+
+])
diff --git a/m4/pandora_fdatasync.m4 b/m4/pandora_fdatasync.m4
new file mode 100644 (file)
index 0000000..3b9461e
--- /dev/null
@@ -0,0 +1,25 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+#--------------------------------------------------------------------
+# Check for a working fdatasync call
+#--------------------------------------------------------------------
+
+
+AC_DEFUN([PANDORA_WORKING_FDATASYNC],[
+  AC_CACHE_CHECK([working fdatasync],[ac_cv_func_fdatasync],[
+    AC_LANG_PUSH(C++)
+    AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <unistd.h>
+      ]],[[
+fdatasync(4);
+      ]])],
+    [ac_cv_func_fdatasync=yes],
+    [ac_cv_func_fdatasync=no])
+    AC_LANG_POP()
+  ])
+  AS_IF([test "x${ac_cv_func_fdatasync}" = "xyes"],
+    [AC_DEFINE([HAVE_FDATASYNC],[1],[If the system has a working fdatasync])])
+])
\ No newline at end of file
index 18b474806331984b7818a96d8d6e66e970105920..ac70019795fbc91668e8311bf33ee0f3534c43df 100644 (file)
@@ -60,3 +60,8 @@ AC_DEFUN([PANDORA_HAVE_BETTER_MALLOC],[
   AC_SUBST([BETTER_MALLOC_LIBS])
 
 ])
+
+AC_DEFUN([PANDORA_USE_BETTER_MALLOC],[
+  AC_REQUIRE([PANDORA_HAVE_BETTER_MALLOC])
+  LIBS="${LIBS} ${BETTER_MALLOC_LIBS}"
+])
\ No newline at end of file
diff --git a/m4/pandora_have_gcc_atomics.m4 b/m4/pandora_have_gcc_atomics.m4
new file mode 100644 (file)
index 0000000..5b3b21a
--- /dev/null
@@ -0,0 +1,37 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+#--------------------------------------------------------------------
+# Check for GCC Atomic Support
+#--------------------------------------------------------------------
+
+
+AC_DEFUN([PANDORA_HAVE_GCC_ATOMICS],[
+       
+  AC_CACHE_CHECK(
+    [whether the compiler provides atomic builtins],
+    [ac_cv_gcc_atomic_builtins],
+    [AC_RUN_IFELSE(
+      [AC_LANG_PROGRAM([],[[
+        int foo= -10; int bar= 10;
+        if (!__sync_fetch_and_add(&foo, bar) || foo)
+          return -1;
+        bar= __sync_lock_test_and_set(&foo, bar);
+        if (bar || foo != 10)
+          return -1;
+        bar= __sync_val_compare_and_swap(&bar, foo, 15);
+        if (bar)
+          return -1;
+        return 0;
+        ]])],
+      [ac_cv_gcc_atomic_builtins=yes],
+      [ac_cv_gcc_atomic_builtins=no])])
+
+  AS_IF([test "x$ac_cv_gcc_atomic_builtins" = "xyes"],[
+    AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1,
+              [Define to 1 if compiler provides atomic builtins.])
+  ])
+
+])
\ No newline at end of file
diff --git a/m4/pandora_have_libavahi.m4 b/m4/pandora_have_libavahi.m4
new file mode 100644 (file)
index 0000000..72c274f
--- /dev/null
@@ -0,0 +1,41 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([_PANDORA_SEARCH_LIBAVAHI],[
+  AC_REQUIRE([AC_LIB_PREFIX])
+
+  dnl --------------------------------------------------------------------
+  dnl  Check for libavahi
+  dnl --------------------------------------------------------------------
+
+  AC_ARG_ENABLE([libavahi],
+    [AS_HELP_STRING([--disable-libavahi],
+      [Build with libavahi support @<:@default=on@:>@])],
+    [ac_enable_libavahi="$enableval"],
+    [ac_enable_libavahi="yes"])
+
+  AS_IF([test "x$ac_enable_libavahi" = "xyes"],[
+    AC_LIB_HAVE_LINKFLAGS(avahi-client,avahi-common,[
+      #include <avahi-client/client.h>
+      #include <avahi-common/simple-watch.h>
+    ],[
+      AvahiSimplePoll *simple_poll= avahi_simple_poll_new();
+    ])
+  ],[
+    ac_cv_libavahi="no"
+  ])
+
+  AM_CONDITIONAL(HAVE_LIBAVAHI, [test "x${ac_cv_libavahi}" = "xyes"])
+])
+
+AC_DEFUN([PANDORA_HAVE_LIBAVAHI],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBAVAHI])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBAVAHI],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBAVAHI])
+  AS_IF([test "x${ac_cv_libavahi}" = "xno"],
+    AC_MSG_ERROR([libavahi is required for ${PACKAGE}]))
+])
diff --git a/m4/pandora_have_libbdb.m4 b/m4/pandora_have_libbdb.m4
new file mode 100644 (file)
index 0000000..3e2d144
--- /dev/null
@@ -0,0 +1,40 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([_PANDORA_SEARCH_LIBBDB],[
+  AC_REQUIRE([AC_LIB_PREFIX])
+
+  dnl --------------------------------------------------------------------
+  dnl  Check for bekerely db
+  dnl --------------------------------------------------------------------
+
+  AC_ARG_ENABLE([libbdb],
+    [AS_HELP_STRING([--disable-libbdb],
+      [Build with libbdb support @<:@default=on@:>@])],
+    [ac_enable_libbdb="$enableval"],
+    [ac_enable_libbdb="yes"])
+
+  AS_IF([test "x$ac_enable_libbdb" = "xyes"],[
+    AC_LIB_HAVE_LINKFLAGS(db,,[
+      #include <db.h>
+    ],[
+      const char *test= DB_VERSION_STRING;
+    ])
+  ],[
+    ac_cv_libbdb="no"
+  ])
+
+  AM_CONDITIONAL(HAVE_LIBBDB, [test "x${ac_cv_libbdb}" = "xyes"])
+])
+
+AC_DEFUN([PANDORA_HAVE_LIBBDB],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBBDB])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBBDB],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBBDB])
+  AS_IF([test "x${ac_cv_libbdb}" = "xno"],
+    AC_MSG_ERROR([libbdb is required for ${PACKAGE}]))
+])
diff --git a/m4/pandora_have_libdl.m4 b/m4/pandora_have_libdl.m4
new file mode 100644 (file)
index 0000000..c28b2f0
--- /dev/null
@@ -0,0 +1,51 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+#--------------------------------------------------------------------
+# Check for libdl
+#--------------------------------------------------------------------
+
+
+AC_DEFUN([_PANDORA_SEARCH_LIBDL],[
+
+  save_LIBS="$LIBS"
+  LIBS=""
+  AC_CHECK_LIB(dl,dlopen)
+  AC_CHECK_FUNCS(dlopen)
+  LIBDL_LIBS="$LIBS"
+  LIBS="$my_save_LIBS"
+  AC_SUBST(LIBDL_LIBS)
+
+  AM_CONDITIONAL(HAVE_LIBDL, [test "x${ac_cv_func_dlopen}" = "xyes"])
+])
+
+AC_DEFUN([_PANDORA_HAVE_LIBDL],[
+
+  AC_ARG_ENABLE([libdl],
+    [AS_HELP_STRING([--disable-libdl],
+      [Build with libdl support @<:@default=on@:>@])],
+    [ac_enable_libdl="$enableval"],
+    [ac_enable_libdl="yes"])
+
+  _PANDORA_SEARCH_LIBDL
+])
+
+
+AC_DEFUN([PANDORA_HAVE_LIBDL],[
+  AC_REQUIRE([_PANDORA_HAVE_LIBDL])
+])
+
+AC_DEFUN([_PANDORA_REQUIRE_LIBDL],[
+  ac_enable_libdl="yes"
+  _PANDORA_SEARCH_LIBDL
+
+  AS_IF([test "$ac_cv_func_dlopen" != "yes"],[
+    AC_MSG_ERROR([libdl/dlopen() is required for ${PACKAGE}. On Debian this can be found in libc6-dev. On RedHat this can be found in glibc-devel.])
+  ])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBDL],[
+  AC_REQUIRE([_PANDORA_REQUIRE_LIBDL])
+])
diff --git a/m4/pandora_have_libevent.m4 b/m4/pandora_have_libevent.m4
new file mode 100644 (file)
index 0000000..3c15e3c
--- /dev/null
@@ -0,0 +1,57 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+#--------------------------------------------------------------------
+# Check for libevent
+#--------------------------------------------------------------------
+
+
+AC_DEFUN([_PANDORA_SEARCH_LIBEVENT],[
+  AC_REQUIRE([AC_LIB_PREFIX])
+
+  AC_LIB_HAVE_LINKFLAGS(event,,
+  [
+    #include <sys/types.h>
+    #include <sys/time.h>
+    #include <stdlib.h>
+    #include <event.h>
+  ],[
+    struct bufferevent bev;
+    bufferevent_settimeout(&bev, 1, 1);
+    event_init();
+    event_loop(EVLOOP_ONCE);
+  ]) 
+
+  AM_CONDITIONAL(HAVE_LIBEVENT, [test "x${ac_cv_libevent}" = "xyes"])
+])
+
+AC_DEFUN([_PANDORA_HAVE_LIBEVENT],[
+
+  AC_ARG_ENABLE([libevent],
+    [AS_HELP_STRING([--disable-libevent],
+      [Build with libevent support @<:@default=on@:>@])],
+    [ac_enable_libevent="$enableval"],
+    [ac_enable_libevent="yes"])
+
+  _PANDORA_SEARCH_LIBEVENT
+])
+
+
+AC_DEFUN([PANDORA_HAVE_LIBEVENT],[
+  AC_REQUIRE([_PANDORA_HAVE_LIBEVENT])
+])
+
+AC_DEFUN([_PANDORA_REQUIRE_LIBEVENT],[
+  ac_enable_libevent="yes"
+  _PANDORA_SEARCH_LIBEVENT
+
+  AS_IF([test x$ac_cv_libevent = xno],[
+    AC_MSG_ERROR([libevent is required for ${PACKAGE}. On Debian this can be found in libevent-dev. On RedHat this can be found in libevent-devel.])
+  ])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBEVENT],[
+  AC_REQUIRE([_PANDORA_REQUIRE_LIBEVENT])
+])
index 2387bed9bc52dbe125ed07d14dffbe85bf4895c8..d66a9e45289901229f9b3491e8c0447d3739d76c 100644 (file)
@@ -21,7 +21,7 @@ AC_DEFUN([_PANDORA_SEARCH_LIBGEARMAN],[
       #include <libgearman/gearman.h>
     ],[
       gearman_client_st gearman_client;
-      gearman_version();
+      gearman_client_context(&gearman_client);
     ])
   ],[
     ac_cv_libgearman="no"
@@ -37,5 +37,5 @@ AC_DEFUN([PANDORA_HAVE_LIBGEARMAN],[
 AC_DEFUN([PANDORA_REQUIRE_LIBGEARMAN],[
   AC_REQUIRE([PANDORA_HAVE_LIBGEARMAN])
   AS_IF([test "x${ac_cv_libgearman}" = "xno"],
-      AC_MSG_ERROR([libgearman is required for ${PACKAGE}]))
+      AC_MSG_ERROR([At least version 0.10 of libgearman is required for ${PACKAGE}]))
 ])
index d1a44c60e04c5cbf512f16a72e673839d2384c9c..0c0289997877a37065bdece9105ae0c1bceffa2a 100644 (file)
@@ -30,7 +30,6 @@ AC_DEFUN([_PANDORA_SEARCH_LIBMEMCACHED],[
   
   AM_CONDITIONAL(HAVE_LIBMEMCACHED, [test "x${ac_cv_libmemcached}" = "xyes"])
   
-  AS_IF([test "x${ac_cv_libmemcached}" = "xyes"], [ PANDORA_WITH_MEMCACHED ])
 ])
 
 AC_DEFUN([PANDORA_HAVE_LIBMEMCACHED],[
diff --git a/m4/pandora_have_libpcre.m4 b/m4/pandora_have_libpcre.m4
new file mode 100644 (file)
index 0000000..64c649b
--- /dev/null
@@ -0,0 +1,73 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+#--------------------------------------------------------------------
+# Check for libpcre
+#--------------------------------------------------------------------
+
+
+AC_DEFUN([_PANDORA_SEARCH_LIBPCRE],[
+  AC_REQUIRE([AC_LIB_PREFIX])
+
+  AC_LIB_HAVE_LINKFLAGS(pcre,,
+  [#include <pcre.h>],
+  [
+    pcre *re= NULL;
+    pcre_version();
+  ])
+  AS_IF([test "x$ac_cv_libpcre" = "xno"],
+  [
+    unset ac_cv_libpcre
+    unset HAVE_LIBPCRE
+    unset LIBPCRE
+    unset LIBPCRE_PREFIX
+    unset LTLIBPCRE
+    AC_LIB_HAVE_LINKFLAGS(pcre,,
+    [#include <pcre/pcre.h>],
+    [
+      pcre *re= NULL;
+      pcre_version();
+    ])
+    AS_IF([test "x$ac_cv_libpcre" = "xyes"], [
+      ac_cv_pcre_location="<pcre/pcre.h>"
+    ])
+  ],[
+    ac_cv_pcre_location="<pcre.h>"
+  ])
+
+  AM_CONDITIONAL(HAVE_LIBPCRE, [test "x${ac_cv_libpcre}" = "xyes"])
+])
+
+AC_DEFUN([_PANDORA_HAVE_LIBPCRE],[
+
+  AC_ARG_ENABLE([libpcre],
+    [AS_HELP_STRING([--disable-libpcre],
+      [Build with libpcre support @<:@default=on@:>@])],
+    [ac_enable_libpcre="$enableval"],
+    [ac_enable_libpcre="yes"])
+
+  _PANDORA_SEARCH_LIBPCRE
+])
+
+
+AC_DEFUN([PANDORA_HAVE_LIBPCRE],[
+  AC_REQUIRE([_PANDORA_HAVE_LIBPCRE])
+])
+
+AC_DEFUN([_PANDORA_REQUIRE_LIBPCRE],[
+  ac_enable_libpcre="yes"
+  _PANDORA_SEARCH_LIBPCRE
+
+  AS_IF([test x$ac_cv_libpcre = xno],[
+    AC_MSG_ERROR([libpcre is required for ${PACKAGE}. On Debian this can be found in libpcre3-dev. On RedHat this can be found in pcre-devel.])
+  ],[
+    AC_DEFINE_UNQUOTED(PCRE_HEADER,[${ac_cv_pcre_location}],
+                       [Location of pcre header])
+  ])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBPCRE],[
+  AC_REQUIRE([_PANDORA_REQUIRE_LIBPCRE])
+])
diff --git a/m4/pandora_have_libreadline.m4 b/m4/pandora_have_libreadline.m4
new file mode 100644 (file)
index 0000000..1f04cd4
--- /dev/null
@@ -0,0 +1,242 @@
+#
+# SYNOPSIS
+#
+#   PANDORA_HAVE_LIBREADLINE
+#
+# DESCRIPTION
+#
+#   Searches for a readline compatible library. If found, defines
+#   `HAVE_LIBREADLINE'. If the found library has the `add_history'
+#   function, sets also `HAVE_READLINE_HISTORY'. Also checks for the
+#   locations of the necessary include files and sets `HAVE_READLINE_H'
+#   or `HAVE_READLINE_READLINE_H' and `HAVE_READLINE_HISTORY_H' or
+#   'HAVE_HISTORY_H' if the corresponding include files exists.
+#
+#   The libraries that may be readline compatible are `libedit',
+#   `libeditline' and `libreadline'. Sometimes we need to link a
+#   termcap library for readline to work, this macro tests these cases
+#   too by trying to link with `libtermcap', `libcurses' or
+#   `libncurses' before giving up.
+#
+#   Here is an example of how to use the information provided by this
+#   macro to perform the necessary includes or declarations in a C
+#   file:
+#
+#     #ifdef HAVE_LIBREADLINE
+#     #  if defined(HAVE_READLINE_READLINE_H)
+#     #    include <readline/readline.h>
+#     #  elif defined(HAVE_READLINE_H)
+#     #    include <readline.h>
+#     #  else /* !defined(HAVE_READLINE_H) */
+#     extern char *readline ();
+#     #  endif /* !defined(HAVE_READLINE_H) */
+#     char *cmdline = NULL;
+#     #else /* !defined(HAVE_READLINE_READLINE_H) */
+#       /* no readline */
+#     #endif /* HAVE_LIBREADLINE */
+#
+#     #ifdef HAVE_READLINE_HISTORY
+#     #  if defined(HAVE_READLINE_HISTORY_H)
+#     #    include <readline/history.h>
+#     #  elif defined(HAVE_HISTORY_H)
+#     #    include <history.h>
+#     #  else /* !defined(HAVE_HISTORY_H) */
+#     extern void add_history ();
+#     extern int write_history ();
+#     extern int read_history ();
+#     #  endif /* defined(HAVE_READLINE_HISTORY_H) */
+#       /* no history */
+#     #endif /* HAVE_READLINE_HISTORY */
+#
+# LAST MODIFICATION
+#
+#   2009-11-17
+#
+# Based on VL_LIB_READLINE from  Ville Laurikari
+#
+# COPYLEFT
+#
+#   Copyright (c) 2009 Monty Taylor
+#   Copyright (c) 2002 Ville Laurikari <vl@iki.fi>
+#
+#   Copying and distribution of this file, with or without
+#   modification, are permitted in any medium without royalty provided
+#   the copyright notice and this notice are preserved.
+
+AC_DEFUN([PANDORA_CHECK_TIOCGWINSZ],[
+  AC_CACHE_CHECK([for TIOCGWINSZ in sys/ioctl.h],
+    [pandora_cv_tiocgwinsz_in_ioctl],[
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#include <sys/ioctl.h>
+      ]],[[
+int x= TIOCGWINSZ;
+      ]])
+    ],[
+      pandora_cv_tiocgwinsz_in_ioctl=yes
+    ],[
+      pandora_cv_tiocgwinsz_in_ioctl=no
+    ])
+  ])
+  AS_IF([test "$pandora_cv_tiocgwinsz_in_ioctl" = "yes"],[   
+    AC_DEFINE([GWINSZ_IN_SYS_IOCTL], [1],
+              [READLINE: your system defines TIOCGWINSZ in sys/ioctl.h.])
+  ])
+])
+
+AC_DEFUN([PANDORA_CHECK_RL_COMPENTRY], [
+  AC_CACHE_CHECK([defined rl_compentry_func_t], [pandora_cv_rl_compentry],[
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+#include "stdio.h"
+#include "readline/readline.h"
+      ]],[[
+rl_compentry_func_t *func2= (rl_compentry_func_t*)0;
+      ]])
+    ],[
+      pandora_cv_rl_compentry=yes
+    ],[
+      pandora_cv_rl_compentry=no
+    ])
+  ])
+  AS_IF([test "$pandora_cv_rl_compentry" = "yes"],[
+    AC_DEFINE([HAVE_RL_COMPENTRY], [1],
+              [Does system provide rl_compentry_func_t])
+  ])
+
+  AC_LANG_PUSH(C++)
+  save_CXXFLAGS="${CXXFLAGS}"
+  CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}"
+  AC_CACHE_CHECK([rl_compentry_func_t works], [pandora_cv_rl_compentry_works],[
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+#include "stdio.h"
+#include "readline/readline.h"
+      ]],[[
+rl_completion_entry_function= (rl_compentry_func_t*)NULL;
+      ]])
+    ],[
+      pandora_cv_rl_compentry_works=yes
+    ],[
+      pandora_cv_rl_compentry_works=no
+    ])
+  ])
+  AS_IF([test "$pandora_cv_rl_compentry_works" = "yes"],[
+    AC_DEFINE([HAVE_WORKING_RL_COMPENTRY], [1],
+              [Does system provide an rl_compentry_func_t that is usable])
+  ])
+  CXXFLAGS="${save_CXXFLAGS}"
+  AC_LANG_POP()
+])
+
+
+AC_DEFUN([PANDORA_CHECK_RL_COMPLETION_FUNC], [
+  AC_CACHE_CHECK([defined rl_completion_func_t], [pandora_cv_rl_completion],[
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([[
+#include "stdio.h"
+#include "readline/readline.h"
+      ]],[[
+rl_completion_func_t *func1= (rl_completion_func_t*)0;
+      ]])
+    ],[
+      pandora_cv_rl_completion=yes
+    ],[
+      pandora_cv_rl_completion=no
+    ])
+  ])
+  AS_IF([test "$pandora_cv_rl_completion" = "yes"],[
+    AC_DEFINE([HAVE_RL_COMPLETION], [1],
+              [Does system provide rl_completion_func_t])
+  ])
+])
+
+AC_DEFUN([_PANDORA_SEARCH_LIBREADLINE], [
+
+  save_LIBS="${LIBS}"
+  LIBS=""
+
+  AC_CACHE_CHECK([for a readline compatible library],
+                 ac_cv_libreadline, [
+    ORIG_LIBS="$LIBS"
+    for readline_lib in readline edit editline; do
+      for termcap_lib in "" termcap curses ncurses; do
+        if test -z "$termcap_lib"; then
+          TRY_LIB="-l$readline_lib"
+        else
+          TRY_LIB="-l$readline_lib -l$termcap_lib"
+        fi
+        LIBS="$ORIG_LIBS $TRY_LIB"
+        AC_TRY_LINK_FUNC(readline, ac_cv_libreadline="$TRY_LIB")
+        if test -n "$ac_cv_libreadline"; then
+          break
+        fi
+      done
+      if test -n "$ac_cv_libreadline"; then
+        break
+      fi
+    done
+    if test -z "$ac_cv_libreadline"; then
+      ac_cv_libreadline="no"
+      LIBS="$ORIG_LIBS"
+    fi
+  ])
+
+  if test "$ac_cv_libreadline" != "no"; then
+    AC_DEFINE(HAVE_LIBREADLINE, 1,
+              [Define if you have a readline compatible library])
+    AC_CHECK_HEADERS(readline.h readline/readline.h)
+    AC_CACHE_CHECK([whether readline supports history],
+                   ac_cv_libreadline_history, [
+      ac_cv_libreadline_history="no"
+      AC_TRY_LINK_FUNC(add_history, ac_cv_libreadline_history="yes")
+    ])
+    if test "$ac_cv_libreadline_history" = "yes"; then
+      AC_DEFINE(HAVE_READLINE_HISTORY, 1,
+                [Define if your readline library has \`add_history'])
+      AC_CHECK_HEADERS(history.h readline/history.h)
+    fi
+  fi
+  PANDORA_CHECK_RL_COMPENTRY  
+  PANDORA_CHECK_RL_COMPLETION_FUNC
+  PANDORA_CHECK_TIOCGWINSZ
+
+
+  READLINE_LIBS="${LIBS}"
+  LIBS="${save_LIBS}"
+  AC_SUBST(READLINE_LIBS)
+
+  AM_CONDITIONAL(HAVE_LIBREADLINE, [test "x${ac_cv_libreadline}" = "xyes"])
+])
+
+AC_DEFUN([_PANDORA_HAVE_LIBREADLINE],[
+
+  AC_ARG_ENABLE([libreadline],
+    [AS_HELP_STRING([--disable-libreadline],
+      [Build with libreadline support @<:@default=on@:>@])],
+    [ac_enable_libreadline="$enableval"],
+    [ac_enable_libreadline="yes"])
+
+  _PANDORA_SEARCH_LIBREADLINE
+])
+
+
+AC_DEFUN([PANDORA_HAVE_LIBREADLINE],[
+  AC_REQUIRE([_PANDORA_HAVE_LIBREADLINE])
+])
+
+AC_DEFUN([_PANDORA_REQUIRE_LIBREADLINE],[
+  ac_enable_libreadline="yes"
+  _PANDORA_SEARCH_LIBREADLINE
+
+  AS_IF([test "x$ac_cv_libreadline" = "xno"],
+    AC_MSG_ERROR([libreadline is required for ${PACKAGE}. On Debian this can be found in libreadline5-dev. On RedHat this can be found in readline-devel.]))
+
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBREADLINE],[
+  AC_REQUIRE([_PANDORA_REQUIRE_LIBREADLINE])
+])
+
+
diff --git a/m4/pandora_have_libtokyocabinet.m4 b/m4/pandora_have_libtokyocabinet.m4
new file mode 100644 (file)
index 0000000..cc4d887
--- /dev/null
@@ -0,0 +1,52 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl Provides support for finding libtokyocabinet.
+dnl LIBTOKYOCABINET_CFLAGS will be set, in addition to LIBTOKYOCABINET and LTLIBTOKYOCABINET
+
+AC_DEFUN([_PANDORA_SEARCH_LIBTOKYOCABINET],[
+  AC_REQUIRE([AC_LIB_PREFIX])
+
+  dnl --------------------------------------------------------------------
+  dnl  Check for libtokyocabinet
+  dnl --------------------------------------------------------------------
+
+  AC_ARG_ENABLE([libtokyocabinet],
+    [AS_HELP_STRING([--disable-libtokyocabinet],
+      [Build with libtokyocabinet support @<:@default=on@:>@])],
+    [ac_enable_libtokyocabinet="$enableval"],
+    [ac_enable_libtokyocabinet="yes"])
+
+  AS_IF([test "x$ac_enable_libtokyocabinet" = "xyes"],[
+    AC_LIB_HAVE_LINKFLAGS(tokyocabinet,,[
+#include <tcutil.h>
+    ],[
+const char *test= tcversion;
+    ])
+  ],[
+    ac_cv_libtokyocabinet="no"
+  ])
+
+  AS_IF([test "${ac_cv_libtokyocabinet}" = "no" -a "${ac_enable_libtokyocabinet}" = "yes"],[
+
+    PKG_CHECK_MODULES([LIBTOKYOCABINET], [libtokyocabinet], [
+      ac_cv_libtokyocabinet=yes
+      LTLIBTOKYOCABINET=${LIBTOKYOCABINET_LIBS}
+      LIBTOKYOCABINET=${LIBTOKYOCABINET_LIBS}
+    ],[])
+  ])
+
+  AM_CONDITIONAL(HAVE_LIBTOKYOCABINET, [test "${ac_cv_libtokyocabinet}" = "yes"])
+])
+
+AC_DEFUN([PANDORA_HAVE_LIBTOKYOCABINET],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBTOKYOCABINET])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBTOKYOCABINET],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBTOKYOCABINET])
+  AS_IF([test "x${ac_cv_libtokyocabinet}" = "xno"],
+    AC_MSG_ERROR([libtokyocabinet is required for ${PACKAGE}. On Debian systems this is found in libtokyocabinet-dev. On RedHat, in tokyocabinet-devel.]))
+])
diff --git a/m4/pandora_have_libuuid.m4 b/m4/pandora_have_libuuid.m4
new file mode 100644 (file)
index 0000000..5ba66d7
--- /dev/null
@@ -0,0 +1,55 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+#--------------------------------------------------------------------
+# Check for libuuid
+#--------------------------------------------------------------------
+
+
+AC_DEFUN([_PANDORA_SEARCH_LIBUUID],[
+  AC_REQUIRE([AC_LIB_PREFIX])
+
+  dnl Do this by hand. Need to check for uuid/uuid.h, but uuid may or may
+  dnl not be a lib is weird.
+  AC_CHECK_HEADERS(uuid/uuid.h)
+  AC_LIB_HAVE_LINKFLAGS(uuid,,
+  [
+    #include <uuid/uuid.h>
+  ],
+  [
+    uuid_t uout;
+    uuid_generate(uout);
+  ])
+
+  AM_CONDITIONAL(HAVE_LIBUUID, [test "x${ac_cv_libuuid}" = "xyes"])
+])
+
+AC_DEFUN([_PANDORA_HAVE_LIBUUID],[
+
+  AC_ARG_ENABLE([libuuid],
+    [AS_HELP_STRING([--disable-libuuid],
+      [Build with libuuid support @<:@default=on@:>@])],
+    [ac_enable_libuuid="$enableval"],
+    [ac_enable_libuuid="yes"])
+
+  _PANDORA_SEARCH_LIBUUID
+])
+
+
+AC_DEFUN([PANDORA_HAVE_LIBUUID],[
+  AC_REQUIRE([_PANDORA_HAVE_LIBUUID])
+])
+
+AC_DEFUN([_PANDORA_REQUIRE_LIBUUID],[
+  ac_enable_libuuid="yes"
+  _PANDORA_SEARCH_LIBUUID
+  AS_IF([test "x$ac_cv_header_uuid_uuid_h" = "xno"],[
+    AC_MSG_ERROR([Couldn't find uuid/uuid.h. On Debian this can be found in uuid-dev. On Redhat this can be found in e2fsprogs-devel.])
+  ])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBUUID],[
+  AC_REQUIRE([_PANDORA_REQUIRE_LIBUUID])
+])
diff --git a/m4/pandora_have_libxml2.m4 b/m4/pandora_have_libxml2.m4
new file mode 100644 (file)
index 0000000..eabd0f3
--- /dev/null
@@ -0,0 +1,52 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl Provides support for finding libxml2.
+dnl LIBXML2_CFLAGS will be set, in addition to LIBXML2 and LTLIBXML2
+
+AC_DEFUN([_PANDORA_SEARCH_LIBXML2],[
+  AC_REQUIRE([AC_LIB_PREFIX])
+
+  dnl --------------------------------------------------------------------
+  dnl  Check for libxml2
+  dnl --------------------------------------------------------------------
+
+  AC_ARG_ENABLE([libxml2],
+    [AS_HELP_STRING([--disable-libxml2],
+      [Build with libxml2 support @<:@default=on@:>@])],
+    [ac_enable_libxml2="$enableval"],
+    [ac_enable_libxml2="yes"])
+
+  AS_IF([test "x$ac_enable_libxml2" = "xyes"],[
+    AC_LIB_HAVE_LINKFLAGS(xml2,,[
+#include <libxml/xmlversion.h>
+    ],[
+const char *test= LIBXML_DOTTED_VERSION;
+    ])
+  ],[
+    ac_cv_libxml2="no"
+  ])
+
+  AS_IF([test "${ac_cv_libxml2}" = "no" -a "${ac_enable_libxml2}" = "yes"],[
+
+    PKG_CHECK_MODULES([LIBXML2], [libxml-2.0], [
+      ac_cv_libxml2=yes
+      LTLIBXML2=${LIBXML2_LIBS}
+      LIBXML2=${LIBXML2_LIBS}
+    ],[])
+  ])
+
+  AM_CONDITIONAL(HAVE_LIBXML2, [test "${ac_cv_libxml2}" = "yes"])
+])
+
+AC_DEFUN([PANDORA_HAVE_LIBXML2],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBXML2])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBXML2],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBXML2])
+  AS_IF([test "x${ac_cv_libxml2}" = "xno"],
+    AC_MSG_ERROR([libxml2 is required for ${PACKAGE}. On Debian systems this is found in libxml2-dev. On RedHat, libxml2-devel.]))
+])
diff --git a/m4/pandora_have_libz.m4 b/m4/pandora_have_libz.m4
new file mode 100644 (file)
index 0000000..823cb4e
--- /dev/null
@@ -0,0 +1,51 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+#--------------------------------------------------------------------
+# Check for libz
+#--------------------------------------------------------------------
+
+
+AC_DEFUN([_PANDORA_SEARCH_LIBZ],[
+  AC_REQUIRE([AC_LIB_PREFIX])
+
+  AC_LIB_HAVE_LINKFLAGS(z,,
+  [
+    #include <zlib.h>
+  ],[
+    crc32(0, Z_NULL, 0);
+  ])
+
+  AM_CONDITIONAL(HAVE_LIBZ, [test "x${ac_cv_libz}" = "xyes"])
+])
+
+AC_DEFUN([_PANDORA_HAVE_LIBZ],[
+
+  AC_ARG_ENABLE([libz],
+    [AS_HELP_STRING([--disable-libz],
+      [Build with libz support @<:@default=on@:>@])],
+    [ac_enable_libz="$enableval"],
+    [ac_enable_libz="yes"])
+
+  _PANDORA_SEARCH_LIBZ
+])
+
+
+AC_DEFUN([PANDORA_HAVE_LIBZ],[
+  AC_REQUIRE([_PANDORA_HAVE_LIBZ])
+])
+
+AC_DEFUN([_PANDORA_REQUIRE_LIBZ],[
+  ac_enable_libz="yes"
+  _PANDORA_SEARCH_LIBZ
+
+  AS_IF([test x$ac_cv_libz = xno],[
+    AC_MSG_ERROR([libz is required for ${PACKAGE}. On Debian this can be found in zlib1g-dev. On RedHat this can be found in zlib-devel.])
+  ])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBZ],[
+  AC_REQUIRE([_PANDORA_REQUIRE_LIBZ])
+])
index 75e3732959f491b5ee2870b5d5b02d9d633c7b0a..25ed1e9153d7b523c53864cede292f3644eab017 100644 (file)
@@ -9,20 +9,32 @@ dnl--------------------------------------------------------------------
 
 AC_DEFUN([PANDORA_PLUGINS],[
 
-  m4_sinclude(config/plugin.ac)
-  dnl Add code here to read set plugin lists and  set drizzled_default_plugin_list
-  AC_DEFINE_UNQUOTED([PANDORA_PLUGIN_LIST],[$pandora_default_plugin_list],
-                     [List of plugins that should be loaded on startup if no
-                      value is given for --plugin-load])
+  dnl We do this to prime the files from a fresh checkout. Normally we want
+  dnl these commands to be executed by make. Perhaps we should split them into
+  dnl a few shell script snippets in config and make Make call them... we're
+  dnl going to get there...
+  dnl ANYWAY - syscmd gets called during aclocal - so before automake. It will
+  dnl get called probably during autoconf too, so it's important to protect
+  dnl with test -f ... if the files exist, we don't have the chicken/egg 
+  dnl problem and therefore don't need to do anything here
+  m4_syscmd([python config/pandora-plugin > /dev/null])
+  m4_syscmd([test -f config/plugin.stamp || touch config/plugin.stamp aclocal.m4])
+
+  m4_sinclude(config/pandora-plugin.ac)
 
+  dnl Add code here to read set plugin lists and  set drizzled_default_plugin_list
   pandora_builtin_list=`echo $pandora_builtin_list | sed 's/, *$//'`
   AS_IF([test "x$pandora_builtin_list" = "x"], pandora_builtin_list="NULL")
   AC_SUBST([PANDORA_BUILTIN_LIST],[$pandora_builtin_list])
+  AC_SUBST([PANDORA_PLUGIN_LIST],[$pandora_default_plugin_list])
   m4_ifval(m4_normalize([$1]),[
     AC_CONFIG_FILES($*)
     ],[
     AC_DEFINE_UNQUOTED([PANDORA_BUILTIN_LIST],[$pandora_builtin_list],
                        [List of plugins to be built in])
+    AC_DEFINE_UNQUOTED([PANDORA_PLUGIN_LIST],["$pandora_default_plugin_list"],
+                       [List of plugins that should be loaded on startup if no
+                        value is given for --plugin-load])
   ])
 
 
index 75b00fc35550fe9dc3b1927dc391657e7c866b59..a41111661547e2f545b48ac9344b02265021c6e3 100644 (file)
@@ -53,6 +53,186 @@ AC_DEFUN([PANDORA_PTHREAD_YIELD],[
               [pthread_yield function with one argument])
   ])
 
+  AC_CHECK_FUNCS(pthread_attr_getstacksize pthread_attr_setprio \
+    pthread_attr_setschedparam \
+    pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
+    pthread_key_delete pthread_rwlock_rdlock pthread_setprio \
+    pthread_setprio_np pthread_setschedparam pthread_sigmask \
+    pthread_attr_create rwlock_init
+)
+
+
+
+# Check definition of pthread_getspecific
+AC_CACHE_CHECK([args to pthread_getspecific], [pandora_cv_getspecific_args],
+  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if !defined(_REENTRANT)
+#define _REENTRANT
+#endif
+#ifndef _POSIX_PTHREAD_SEMANTICS 
+#define _POSIX_PTHREAD_SEMANTICS 
+#endif
+#include <pthread.h>
+   ]], [[
+void *pthread_getspecific(pthread_key_t key);
+pthread_getspecific((pthread_key_t) NULL);
+   ]])],
+    [pandora_cv_getspecific_args=POSIX],
+    [pandora_cv_getspecific_args=other])])
+  if test "$pandora_cv_getspecific_args" = "other"
+  then
+    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_GETSPECIFIC], [1],
+              [For some non posix threads])
+  fi
+
+  # Check definition of pthread_mutex_init
+  AC_CACHE_CHECK([args to pthread_mutex_init], [pandora_cv_mutex_init_args],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#ifndef _REENTRANT
+#define _REENTRANT
+#endif
+#ifndef _POSIX_PTHREAD_SEMANTICS
+#define _POSIX_PTHREAD_SEMANTICS 
+#endif
+#include <pthread.h> ]], [[ 
+  pthread_mutexattr_t attr;
+  pthread_mutex_t mp;
+  pthread_mutex_init(&mp,&attr); ]])],
+      [pandora_cv_mutex_init_args=POSIX],
+      [pandora_cv_mutex_init_args=other])])
+  if test "$pandora_cv_mutex_init_args" = "other"
+  then
+    AC_DEFINE([HAVE_NONPOSIX_PTHREAD_MUTEX_INIT], [1],
+              [For some non posix threads])
+  fi
+#---END:
+
+#---START: Used in for client configure
+# Check definition of readdir_r
+AC_CACHE_CHECK([args to readdir_r], [pandora_cv_readdir_r],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#ifndef _REENTRANT
+#define _REENTRANT
+#endif
+#ifndef _POSIX_PTHREAD_SEMANTICS 
+#define _POSIX_PTHREAD_SEMANTICS 
+#endif
+#include <pthread.h>
+#include <dirent.h>]], [[ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result);
+readdir_r((DIR *) NULL, (struct dirent *) NULL, (struct dirent **) NULL); ]])],
+    [pandora_cv_readdir_r=POSIX],
+    [pandora_cv_readdir_r=other])])
+if test "$pandora_cv_readdir_r" = "POSIX"
+then
+  AC_DEFINE([HAVE_READDIR_R], [1], [POSIX readdir_r])
+fi
+
+# Check definition of posix sigwait()
+AC_CACHE_CHECK([style of sigwait], [pandora_cv_sigwait],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#ifndef _REENTRANT
+#define _REENTRANT
+#endif
+#ifndef _POSIX_PTHREAD_SEMANTICS
+#define _POSIX_PTHREAD_SEMANTICS 
+#endif
+#include <pthread.h>
+#include <signal.h>
+      ]], [[
+#ifndef _AIX
+sigset_t set;
+int sig;
+sigwait(&set,&sig);
+#endif
+      ]])],
+    [pandora_cv_sigwait=POSIX],
+    [pandora_cv_sigwait=other])])
+if test "$pandora_cv_sigwait" = "POSIX"
+then
+  AC_DEFINE([HAVE_SIGWAIT], [1], [POSIX sigwait])
+fi
+
+if test "$pandora_cv_sigwait" != "POSIX"
+then
+unset pandora_cv_sigwait
+# Check definition of posix sigwait()
+AC_CACHE_CHECK([style of sigwait], [pandora_cv_sigwait],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#ifndef _REENTRANT
+#define _REENTRANT
+#endif
+#ifndef _POSIX_PTHREAD_SEMANTICS
+#define _POSIX_PTHREAD_SEMANTICS 
+#endif
+#include <pthread.h>
+#include <signal.h>
+      ]], [[
+sigset_t set;
+int sig;
+sigwait(&set);
+      ]])],
+    [pandora_cv_sigwait=NONPOSIX],
+    [pandora_cv_sigwait=other])])
+if test "$pandora_cv_sigwait" = "NONPOSIX"
+then
+  AC_DEFINE([HAVE_NONPOSIX_SIGWAIT], [1], [sigwait with one argument])
+fi
+fi
+#---END:
+
+# Check if pthread_attr_setscope() exists
+AC_CACHE_CHECK([for pthread_attr_setscope], [pandora_cv_pthread_attr_setscope],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#ifndef _REENTRANT
+#define _REENTRANT
+#endif
+#ifndef _POSIX_PTHREAD_SEMANTICS
+#define _POSIX_PTHREAD_SEMANTICS 
+#endif
+#include <pthread.h>
+      ]], [[
+pthread_attr_t thr_attr;
+pthread_attr_setscope(&thr_attr,0);
+      ]])],
+    [pandora_cv_pthread_attr_setscope=yes],
+    [pandora_cv_pthread_attr_setscope=no])])
+if test "$pandora_cv_pthread_attr_setscope" = "yes"
+then
+  AC_DEFINE([HAVE_PTHREAD_ATTR_SETSCOPE], [1], [pthread_attr_setscope])
+fi
+
+
+AC_CACHE_CHECK([if pthread_yield takes zero arguments], ac_cv_pthread_yield_zero_arg,
+[AC_TRY_LINK([#define _GNU_SOURCE
+#include <pthread.h>
+#ifdef __cplusplus
+extern "C"
+#endif
+],
+[
+  pthread_yield();
+], ac_cv_pthread_yield_zero_arg=yes, ac_cv_pthread_yield_zero_arg=yeso)])
+if test "$ac_cv_pthread_yield_zero_arg" = "yes"
+then
+  AC_DEFINE([HAVE_PTHREAD_YIELD_ZERO_ARG], [1],
+            [pthread_yield that doesn't take any arguments])
+fi
+AC_CACHE_CHECK([if pthread_yield takes 1 argument], ac_cv_pthread_yield_one_arg,
+[AC_TRY_LINK([#define _GNU_SOURCE
+#include <pthread.h>
+#ifdef __cplusplus
+extern "C"
+#endif
+],
+[
+  pthread_yield(0);
+], ac_cv_pthread_yield_one_arg=yes, ac_cv_pthread_yield_one_arg=no)])
+if test "$ac_cv_pthread_yield_one_arg" = "yes"
+then
+  AC_DEFINE([HAVE_PTHREAD_YIELD_ONE_ARG], [1],
+            [pthread_yield function with one argument])
+fi
+
   CFLAGS="${save_CFLAGS}"
   CXXFLAGS="${save_CXXFLAGS}"
 ])
diff --git a/m4/pandora_run_cpplint.m4 b/m4/pandora_run_cpplint.m4
new file mode 100644 (file)
index 0000000..5099acf
--- /dev/null
@@ -0,0 +1,8 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([PANDORA_RUN_CPPLINT],[
+  m4_syscmd([python config/make-lint.py])
+])
diff --git a/m4/pandora_sasl.m4 b/m4/pandora_sasl.m4
new file mode 100644 (file)
index 0000000..75513d1
--- /dev/null
@@ -0,0 +1,133 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([_PANDORA_SEARCH_SASL],[
+  AC_REQUIRE([AC_LIB_PREFIX])
+
+  dnl --------------------------------------------------------------------
+  dnl  Check for sasl
+  dnl --------------------------------------------------------------------
+  AC_ARG_ENABLE([sasl],
+    [AS_HELP_STRING([--disable-sasl],
+      [Build with sasl support @<:@default=on@:>@])],
+    [ac_enable_sasl="$enableval"],
+    [ac_enable_sasl="yes"])
+
+  AS_IF([test "x$ac_enable_sasl" = "xyes"],
+    [
+      AC_LIB_HAVE_LINKFLAGS(sasl,,[
+        #include <stdlib.h>
+        #include <sasl/sasl.h>
+      ],[
+        sasl_server_init(NULL, NULL);
+      ])
+
+      AS_IF([test "x${ac_cv_libsasl}" != "xyes" ],
+            [
+              AC_LIB_HAVE_LINKFLAGS(sasl2,,[
+                #include <stdlib.h>
+                #include <sasl/sasl.h>
+              ],[
+                sasl_server_init(NULL, NULL);
+              ])
+              HAVE_LIBSASL="$HAVE_LIBSASL2"
+              LIBSASL="$LIBSASL2"
+              LIBSASL_PREFIX="$LIBSASL2_PREFIX"
+             LTLIBSASL="$LT_LIBSASL2"
+            ])
+    ])
+
+  AS_IF([test "x${ac_cv_libsasl}" = "xyes" -o "x${ac_cv_libsasl2}" = "xyes"],
+        [ac_cv_sasl=yes],
+        [ac_cv_sasl=no])
+
+  AM_CONDITIONAL(HAVE_LIBSASL, [test "x${ac_cv_libsasl}" = "xyes"])
+  AM_CONDITIONAL(HAVE_LIBSASL2, [test "x${ac_cv_libsasl2}" = "xyes"])
+  AM_CONDITIONAL(HAVE_SASL, [test "x${ac_cv_sasl}" = "xyes"])
+])
+
+AC_DEFUN([PANDORA_HAVE_SASL],[
+  AC_REQUIRE([_PANDORA_SEARCH_SASL])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_SASL],[
+  AC_REQUIRE([_PANDORA_SEARCH_SASL])
+  AS_IF([test "x${ac_cv_sasl}" = "xno"],
+    AC_MSG_ERROR([SASL (libsasl or libsasl2) is required for ${PACKAGE}]))
+])
+
+AC_DEFUN([_PANDORA_SEARCH_LIBSASL],[
+  AC_REQUIRE([AC_LIB_PREFIX])
+
+  dnl --------------------------------------------------------------------
+  dnl  Check for libsasl
+  dnl --------------------------------------------------------------------
+
+  AC_ARG_ENABLE([libsasl],
+    [AS_HELP_STRING([--disable-libsasl],
+      [Build with libsasl support @<:@default=on@:>@])],
+    [ac_enable_libsasl="$enableval"],
+    [ac_enable_libsasl="yes"])
+
+  AS_IF([test "x$ac_enable_libsasl" = "xyes"],[
+    AC_LIB_HAVE_LINKFLAGS(sasl,,[
+      #include <stdlib.h>
+      #include <sasl/sasl.h>
+    ],[
+      sasl_server_init(NULL, NULL);
+    ])
+  ],[
+    ac_cv_libsasl="no"
+  ])
+
+  AM_CONDITIONAL(HAVE_LIBSASL, [test "x${ac_cv_libsasl}" = "xyes"])
+])
+
+AC_DEFUN([PANDORA_HAVE_LIBSASL],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBSASL])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBSASL],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBSASL])
+  AS_IF([test "x${ac_cv_libsasl}" = "xno"],
+    AC_MSG_ERROR([libsasl is required for ${PACKAGE}]))
+])
+
+AC_DEFUN([_PANDORA_SEARCH_LIBSASL2],[
+  AC_REQUIRE([AC_LIB_PREFIX])
+
+  dnl --------------------------------------------------------------------
+  dnl  Check for libsasl2
+  dnl --------------------------------------------------------------------
+
+  AC_ARG_ENABLE([libsasl2],
+    [AS_HELP_STRING([--disable-libsasl2],
+      [Build with libsasl2 support @<:@default=on@:>@])],
+    [ac_enable_libsasl2="$enableval"],
+    [ac_enable_libsasl2="yes"])
+
+  AS_IF([test "x$ac_enable_libsasl2" = "xyes"],[
+    AC_LIB_HAVE_LINKFLAGS(sasl2,,[
+      #include <stdlib.h>
+      #include <sasl2/sasl2.h>
+    ],[
+      sasl2_server_init(NULL, NULL);
+    ])
+  ],[
+    ac_cv_libsasl2="no"
+  ])
+
+  AM_CONDITIONAL(HAVE_LIBSASL2, [test "x${ac_cv_libsasl2}" = "xyes"])
+])
+
+AC_DEFUN([PANDORA_HAVE_LIBSASL2],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBSASL2])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBSASL2],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBSASL2])
+  AS_IF([test "x${ac_cv_libsasl2}" = "xno"],
+    AC_MSG_ERROR([libsasl2 is required for ${PACKAGE}]))
+])
diff --git a/m4/pandora_stack_direction.m4 b/m4/pandora_stack_direction.m4
new file mode 100644 (file)
index 0000000..635586a
--- /dev/null
@@ -0,0 +1,39 @@
+dnl  Copyright (C) 2009 Sun Microsystems
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+#--------------------------------------------------------------------
+# Check what direction the stack runs in
+#--------------------------------------------------------------------
+
+AC_DEFUN([PANDORA_STACK_DIRECTION],[
+ AC_REQUIRE([AC_FUNC_ALLOCA])
+ AC_CACHE_CHECK([stack direction], [ac_cv_c_stack_direction],[
+  AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <stdlib.h>
+ int find_stack_direction ()
+ {
+   static char *addr = 0;
+   auto char dummy;
+   if (addr == 0)
+     {
+       addr = &dummy;
+       return find_stack_direction ();
+     }
+   else
+     return (&dummy > addr) ? 1 : -1;
+ }
+  ]],[[
+    exit (find_stack_direction() < 0);
+  ]])],[
+   ac_cv_c_stack_direction=1
+  ],[
+   ac_cv_c_stack_direction=-1
+  ])
+ ])
+ AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction)
+])
+
+
+
diff --git a/m4/pandora_stl_hash.m4 b/m4/pandora_stl_hash.m4
new file mode 100644 (file)
index 0000000..adf2561
--- /dev/null
@@ -0,0 +1,75 @@
+# We check two things: where the include file is for hash_map, and
+# what namespace hash_map lives in within that include file.  We
+# include AC_COMPILE_IFELSE for all the combinations we've seen in the
+# wild.  We define one of HAVE_HASH_MAP or HAVE_EXT_HASH_MAP depending
+# on location, and HASH_NAMESPACE to be the namespace hash_map is
+# defined in.
+#
+# Ideally we'd use AC_CACHE_CHECK, but that only lets us store one value
+# at a time, and we need to store two (filename and namespace).
+# prints messages itself, so we have to do the message-printing ourselves
+# via AC_MSG_CHECKING + AC_MSG_RESULT.  (TODO(csilvers): can we cache?)
+
+AC_DEFUN([PANDORA_CXX_STL_HASH],
+  [AC_MSG_CHECKING(the location of hash_map)
+   AC_LANG_PUSH(C++)
+   ac_cv_cxx_hash_map=""
+   for location in "" "ext/" "tr1/" ; do
+     for namespace in __gnu_cxx "" std stdext; do
+       for classprefix in unordered hash; do
+         if test -z "$ac_cv_cxx_hash_map"; then
+           AC_COMPILE_IFELSE(
+             [AC_LANG_PROGRAM([[#include <${location}${classprefix}_map>]],
+                           [[${namespace}::${classprefix}_map<int, int> t]])],
+             [ac_cv_cxx_hash_map="<${location}${classprefix}_map>";
+              ac_cv_cxx_hash_set="<${location}${classprefix}_set>";
+              ac_cv_cxx_hash_namespace="$namespace";
+              ac_cv_cxx_hash_map_class="${classprefix}_map";
+              ac_cv_cxx_hash_set_class="${classprefix}_set"])
+
+         fi
+       done
+     done
+   done
+
+   if test -n "$ac_cv_cxx_hash_map"; then
+      AC_DEFINE(HAVE_HASH_MAP, 1, [define if the compiler has hash_map])
+      AC_DEFINE(HAVE_HASH_SET, 1, [define if the compiler has hash_set])
+      AC_DEFINE_UNQUOTED(HASH_MAP_H,$ac_cv_cxx_hash_map,
+                         [the location of <hash_map>])
+      AC_DEFINE_UNQUOTED(HASH_SET_H,$ac_cv_cxx_hash_set,
+                         [the location of <hash_set>])
+      AC_DEFINE_UNQUOTED(HASH_NAMESPACE,$ac_cv_cxx_hash_namespace,
+                         [the namespace of hash_map/hash_set])
+      AC_DEFINE_UNQUOTED(HASH_MAP_CLASS,$ac_cv_cxx_hash_map_class,
+                         [the classname of hash_map])
+      AC_DEFINE_UNQUOTED(HASH_SET_CLASS,$ac_cv_cxx_hash_set_class,
+                         [the classname of hash_set])
+      AC_MSG_RESULT([$ac_cv_cxx_hash_map])
+   else
+      AC_MSG_RESULT()
+      AC_MSG_WARN([could not find an STL hash_map])
+   fi
+   AC_CACHE_CHECK(
+     [whether to redefine hash<string>],
+     [ac_cv_redefine_hash_string],
+     [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([[
+#include HASH_SET_H
+#include <string>
+using namespace HASH_NAMESPACE;
+using namespace std;
+          ]],[[
+string teststr("test");
+HASH_SET_CLASS<string> test_hash;
+HASH_SET_CLASS<string>::iterator iter= test_hash.find(teststr);
+if (iter != test_hash.end())
+  return 1;
+          ]])],
+       [ac_cv_redefine_hash_string=no],
+       [ac_cv_redefine_hash_string=yes])])
+   AS_IF([test $ac_cv_redefine_hash_string = yes],[
+      AC_DEFINE(REDEFINE_HASH_STRING, 1, [if hash<string> needs to be defined])
+   ])
+   AC_LANG_POP()
+])
index d84b96767f3b499619c57c8e677eb2433c1e16ed..9bff083511ab34fa50f1327b392094bc7f374e7e 100644 (file)
@@ -52,6 +52,72 @@ AC_DEFUN([PANDORA_EXPORT_BZR_INFO],[
   AC_DEFINE(PEBI_PREFIX[RELEASE_VERSION], ["RELEASE_VERSION"], [$1 version number formatted for display])
   AC_DEFINE(PEBI_PREFIX[RELEASE_COMMENT], ["RELEASE_COMMENT"], [Set to trunk if the branch is the main $1 branch])
   AC_DEFINE(PEBI_PREFIX[RELEASE_ID], [RELEASE_ID], [$1 version number formatted for numerical comparison])
 ])
 
+AC_DEFUN([_PANDORA_READ_FROM_FILE],[
+  $1=`grep $1 $2 | cut -f2 -d=`
+])
+
+AC_DEFUN([PANDORA_VC_VERSION],[
+  AC_REQUIRE([PANDORA_BUILDING_FROM_VC])
+
+  PANDORA_RELEASE_DATE=`date +%Y.%m`
+  PANDORA_RELEASE_NODOTS_DATE=`date +%Y%m`
+
+  dnl Set some defaults
+  PANDORA_VC_REVNO="0"
+  PANDORA_VC_REVID="unknown"
+  PANDORA_VC_BRANCH="bzr-export"
+
+  AS_IF([test -f ${srcdir}/config/bzr_revinfo],[
+    _PANDORA_READ_FROM_FILE([PANDORA_VC_REVNO],${srcdir}/config/bzr_revinfo)
+    _PANDORA_READ_FROM_FILE([PANDORA_VC_REVID],${srcdir}/config/bzr_revinfo)
+    _PANDORA_READ_FROM_FILE([PANDORA_VC_BRANCH],
+                            ${srcdir}/config/bzr_revinfo)
+    _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_DATE],
+                            ${srcdir}/config/bzr_revinfo)
+    _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_NODOTS_DATE],
+                            ${srcdir}/config/bzr_revinfo)
+    _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_COMMENT],
+                            ${srcdir}/config/bzr_revinfo)
+  ])
+  AS_IF([test "${ac_cv_building_from_bzr}" = "yes"],[
+dnl  echo "Grabbing changelog and version information from bzr"
+dnl  bzr log --short > ChangeLog || touch ChangeLog
+    PANDORA_BZR_REVNO=`bzr revno`
+    AS_IF([test "x$PANDORA_BZR_REVNO" != "${PANDORA_VC_REVNO}"],[
+      PANDORA_VC_REVNO="${PANDORA_BZR_REVNO}"
+      PANDORA_VC_REVID=`bzr log -r-1 --show-ids | grep revision-id | awk '{print $[]2}' | head -1`
+      PANDORA_VC_BRANCH=`bzr nick`
+      AS_IF([test "x${PANDORA_VC_BRANCH}" != "${PACKAGE}"],[
+        PANDORA_RELEASE_COMMENT="${PANDORA_VC_BRANCH}"
+      ],[
+        PANDORA_RELEASE_COMMENT="trunk"
+      ])
+    ])
+  ])
+  AS_IF([! test -d config],[mkdir -p config])
+  cat > "config/bzr_revinfo" <<EOF
+PANDORA_VC_REVNO=${PANDORA_VC_REVNO}
+PANDORA_VC_REVID=${PANDORA_VC_REVID}
+PANDORA_VC_BRANCH=${PANDORA_VC_BRANCH}
+PANDORA_RELEASE_DATE=${PANDORA_RELEASE_DATE}
+PANDORA_RELEASE_NODOTS_DATE=${PANDORA_RELEASE_NODOTS_DATE}
+PANDORA_RELEASE_COMMENT=${PANDORA_RELEASE_COMMENT}
+EOF
+    
+  PANDORA_RELEASE_VERSION="${PANDORA_RELEASE_DATE}.${PANDORA_VC_REVNO}"
+  PANDORA_RELEASE_ID="${PANDORA_RELEASE_NODOTS_DATE}${PANDORA_VC_REVNO}"
+
+  VERSION="${PANDORA_RELEASE_VERSION}"
+  AC_DEFINE_UNQUOTED([PANDORA_RELEASE_VERSION],["${PANDORA_RELEASE_VERSION}"],
+                     [The real version of the software])
+  AC_SUBST(PANDORA_VC_REVNO)
+  AC_SUBST(PANDORA_VC_REVID)
+  AC_SUBST(PANDORA_VC_BRANCH)
+  AC_SUBST(PANDORA_RELEASE_DATE)
+  AC_SUBST(PANDORA_RELEASE_NODOTS_DATE)
+  AC_SUBST(PANDORA_RELEASE_COMMENT)
+  AC_SUBST(PANDORA_RELEASE_VERSION)
+  AC_SUBST(PANDORA_RELEASE_ID)
+])
index 7241ba7cb9d7f611951d9bdc6511e3add4efa29b..6054320ae9ad667988c2d3c2dd076414486a383b 100644 (file)
@@ -147,7 +147,25 @@ uint16_t x= htons(80);
       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}"
+      AC_CACHE_CHECK([whether it is safe to use -Wextra],
+        [ac_cv_safe_to_use_Wextra_],
+        [save_CFLAGS="$CFLAGS"
+         CFLAGS="${W_FAIL} -pedantic -Wextra ${AM_CFLAGS} ${CFLAGS}"
+         AC_COMPILE_IFELSE([
+           AC_LANG_PROGRAM(
+           [[
+#include <stdio.h>
+           ]], [[]])
+        ],
+        [ac_cv_safe_to_use_Wextra_=yes],
+        [ac_cv_safe_to_use_Wextra_=no])
+      CFLAGS="$save_CFLAGS"])
+
+      BASE_WARNINGS="${W_FAIL} -pedantic -Wall -Wundef -Wshadow ${NO_UNUSED} ${F_DIAGNOSTICS_SHOW_OPTION} ${CFLAG_VISIBILITY} ${BASE_WARNINGS_FULL}"
+      AS_IF([test "$ac_cv_safe_to_use_Wextra_" = "yes"],
+            [BASE_WARNINGS="${BASE_WARNINGS} -Wextra"],
+            [BASE_WARNINGS="${BASE_WARNINGS} -W"])
+  
       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}"
 
@@ -240,13 +258,31 @@ inline const EnumDescriptor* GetEnumDescriptor<Table_TableOptions_RowType>() {
             [ac_cv_safe_to_use_Wattributes_=no])
           CXXFLAGS="${save_CXXFLAGS}"
           AC_LANG_POP()])
-      AS_IF([test "$ac_cv_safe_to_use_Wattributes_" = "yes"],
-            [],
-            [CXX_WARNINGS="${CXX_WARNINGS} -Wno-attributes"])
+      AC_CACHE_CHECK([whether it is safe to use -Wno-attributes],
+        [ac_cv_safe_to_use_Wno_attributes_],
+        [save_CFLAGS="$CFLAGS"
+         CFLAGS="${W_FAIL} -pedantic -Wno_attributes_ ${AM_CFLAGS} ${CFLAGS}"
+         AC_COMPILE_IFELSE([
+           AC_LANG_PROGRAM(
+           [[
+#include <stdio.h>
+           ]], [[]])
+        ],
+        [ac_cv_safe_to_use_Wno_attributes_=yes],
+        [ac_cv_safe_to_use_Wno_attributes_=no])
+      CFLAGS="$save_CFLAGS"])
+
+      dnl GCC 3.4 doesn't have -Wno-attributes, so we can't turn them off
+      dnl by using that. 
+      AS_IF([test "$ac_cv_safe_to_use_Wattributes_" != "yes"],[
+        AS_IF([test "$ac_cv_safe_to_use_Wno_attributes_" = "yes"],[
+          CC_WARNINGS="${CC_WARNINGS} -Wno-attributes"
+          NO_ATTRIBUTES="-Wno-attributes"])])
+  
   
       NO_REDUNDANT_DECLS="-Wno-redundant-decls"
       dnl TODO: Figure out a better way to deal with this:
-      PROTOSKIP_WARNINGS="-Wno-effc++ -Wno-shadow -Wno-missing-braces -Wno-attributes"
+      PROTOSKIP_WARNINGS="-Wno-effc++ -Wno-shadow -Wno-missing-braces ${NO_ATTRIBUTES}"
       NO_WERROR="-Wno-error"
       INNOBASE_SKIP_WARNINGS="-Wno-shadow -Wno-cast-align"
       
diff --git a/m4/pandora_with_gettext.m4 b/m4/pandora_with_gettext.m4
new file mode 100644 (file)
index 0000000..2b22d1b
--- /dev/null
@@ -0,0 +1,41 @@
+dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*-
+dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+dnl   
+dnl pandora-build: A pedantic build system
+dnl Copyright (C) 2009 Sun Microsystems, Inc.
+dnl This file is free software; Sun Microsystems
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl
+dnl From Monty Taylor
+
+AC_DEFUN([PANDORA_WITH_GETTEXT],[
+
+  m4_syscmd([if test -d po ; then
+    echo "# This file is auto-generated from configure. Do not edit directly" > po/POTFILES.in.stamp
+    PACKAGE=`grep ^AC_INIT configure.ac | cut -f2-3 -d[ | cut -f1 -d]`
+    for f in `find . | grep -v "${PACKAGE}-" | egrep '\.(cc|c|h|yy)$' | cut -c3- | sort`
+    do
+      if grep gettext.h "$f" | grep include >/dev/null 2>&1
+      then
+        echo "$f" >> po/POTFILES.in.stamp
+      fi
+    done
+    if diff po/POTFILES.in.stamp po/POTFILES.in >/dev/null 2>&1
+    then
+      rm po/POTFILES.in.stamp
+    else
+      mv po/POTFILES.in.stamp po/POTFILES.in
+    fi
+  fi])
+
+  AM_GNU_GETTEXT(external, need-formatstring-macros)
+  AM_GNU_GETTEXT_VERSION([0.17])
+  AS_IF([test "x$MSGMERGE" = "x" -o "x$MSGMERGE" = "x:"],[
+    AM_PATH_PROG_WITH_TEST(GMSGMERGE, gmsgmerge,
+      [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
+    MSGMERGE="${GMSGMERGE}"
+  ])
+  AM_CONDITIONAL([BUILD_GETTEXT],[test "x$MSGMERGE" != "x" -a "x$MSGMERGE" != "x:"])
+
+])
index 8797393b258519eb736f901e49951554848b7fa7..4aa1f2a02fe06e94296e83870ae2595e2686d1d0 100644 (file)
@@ -3,7 +3,7 @@ dnl This file is free software; Sun Microsystems
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
-AC_DEFUN([PANDORA_WITH_MEMCACHED],[
+AC_DEFUN([_PANDORA_SEARCH_MEMCACHED],[
 
   AC_ARG_WITH([memcached],
     [AS_HELP_STRING([--with-memcached],
@@ -13,21 +13,28 @@ AC_DEFUN([PANDORA_WITH_MEMCACHED],[
 
   # just ignore the user if --without-memcached is passed.. it is
   # only used by make test
-  AS_IF([test "x$withval" = "xno"],[
+  AS_IF([test "x$ac_cv_with_memcached" = "xno"],[
     ac_cv_with_memcached=memcached
     MEMCACHED_BINARY=memcached
   ],[
-    AS_IF([test -f "$withval"],[
-      ac_cv_with_memcached=$withval
-      MEMCACHED_BINARY=$withval
+    AS_IF([test -f "$ac_cv_with_memcached"],[
+      MEMCACHED_BINARY=$ac_cv_with_memcached
     ],[
       AC_PATH_PROG([MEMCACHED_BINARY], [$ac_cv_with_memcached], "no")
-      AS_IF([test "x$MEMCACHED_BINARY" = "xno"],[
-        AC_MSG_ERROR(["could not find memcached binary"])
-      ])
     ])
   ])
   AC_DEFINE_UNQUOTED([MEMCACHED_BINARY], "$MEMCACHED_BINARY", 
             [Name of the memcached binary used in make test])
+])
 
+AC_DEFUN([PANDORA_HAVE_MEMCACHED],[
+  AC_REQUIRE([_PANDORA_SEARCH_MEMCACHED])
 ])
+
+AC_DEFUN([PANDORA_REQUIRE_MEMCACHED],[
+  AC_REQUIRE([PANDORA_HAVE_MEMCACHED])
+  AS_IF([test "x$MEMCACHED_BINARY" = "xno"],[
+    AC_MSG_ERROR(["could not find memcached binary"])
+  ])
+])
+