pandora-build v0.45
authorMonty Taylor <mordred@inaugust.com>
Mon, 10 Aug 2009 21:04:49 +0000 (14:04 -0700)
committerMonty Taylor <mordred@inaugust.com>
Mon, 10 Aug 2009 21:04:49 +0000 (14:04 -0700)
24 files changed:
config/autorun.sh
m4/pandora_64bit.m4
m4/pandora_canonical.m4
m4/pandora_have_better_malloc.m4
m4/pandora_have_libdrizzle.m4
m4/pandora_have_libgearman.m4
m4/pandora_have_libmemcached.m4
m4/pandora_have_libpq.m4
m4/pandora_have_libsqlite3.m4 [new file with mode: 0644]
m4/pandora_have_protobuf.m4 [new file with mode: 0644]
m4/pandora_platform.m4 [new file with mode: 0644]
m4/pandora_plugins.m4 [new file with mode: 0644]
m4/pandora_pthread.m4 [new file with mode: 0644]
m4/pandora_swig.m4 [new file with mode: 0644]
m4/pandora_use_pipe.m4 [new file with mode: 0644]
m4/pandora_warnings.m4
m4/pandora_with_lua.m4 [new file with mode: 0644]
m4/pandora_with_perl.m4 [new file with mode: 0644]
m4/pandora_with_php.m4 [new file with mode: 0644]
m4/pandora_with_python.m4 [new file with mode: 0644]
m4/pandora_with_python3.m4 [new file with mode: 0644]
m4/pandora_with_r.m4 [new file with mode: 0644]
m4/pandora_with_ruby.m4 [new file with mode: 0644]
m4/pkg.m4 [new file with mode: 0644]

index 2e0d839f779d6ab50b5bc3195d64b37a81f5bd3b..bcf804278fcf5dae92cd5a4031ed1747b94ae56a 100755 (executable)
@@ -35,6 +35,12 @@ locate_binary() {
   return 1
 }
 
   return 1
 }
 
+
+if test -f config/pre_hook.sh
+then
+  . config/pre_hook.sh
+fi
+
 # Try to detect the supported binaries if the user didn't
 # override that by pushing the environment variable
 if test x$LIBTOOLIZE = x; then
 # Try to detect the supported binaries if the user didn't
 # override that by pushing the environment variable
 if test x$LIBTOOLIZE = x; then
@@ -78,6 +84,11 @@ run $AUTOHEADER || die "Can't execute autoheader"
 run $AUTOMAKE $AUTOMAKE_FLAGS  || die "Can't execute automake"
 run $AUTOCONF || die "Can't execute autoconf"
 
 run $AUTOMAKE $AUTOMAKE_FLAGS  || die "Can't execute automake"
 run $AUTOCONF || die "Can't execute autoconf"
 
+if test -f config/post_hook.sh
+then
+  . config/post_hook.sh
+fi
+
 echo "---"
 echo "Configured with the following tools:"
 echo "  * `$LIBTOOLIZE --version | head -1`"
 echo "---"
 echo "Configured with the following tools:"
 echo "  * `$LIBTOOLIZE --version | head -1`"
index 99db56e004cac6f309e563a4b95a42a5b9b34d7b..c1812f404ad5f1772023c2a893d0073d78429a4c 100644 (file)
@@ -9,12 +9,11 @@ dnl ---------------------------------------------------------------------------
 AC_DEFUN([PANDORA_64BIT],[
   AC_BEFORE([$0], [AC_LIB_PREFIX])
 
 AC_DEFUN([PANDORA_64BIT],[
   AC_BEFORE([$0], [AC_LIB_PREFIX])
 
-
-  AC_ARG_ENABLE([64bit],[
-    AS_HELP_STRING([--disable-64bit],
+  AC_ARG_ENABLE([64bit],
+    [AS_HELP_STRING([--disable-64bit],
       [Build 64 bit binary @<:@default=on@:>@])],
       [Build 64 bit binary @<:@default=on@:>@])],
-             [ac_enable_64bit="$enableval"],
-             [ac_enable_64bit="yes"])
+    [ac_enable_64bit="$enableval"],
+    [ac_enable_64bit="yes"])
 
   AC_CHECK_PROGS(ISAINFO, [isainfo], [no])
   AS_IF([test "x$ISAINFO" != "xno"],
 
   AC_CHECK_PROGS(ISAINFO, [isainfo], [no])
   AS_IF([test "x$ISAINFO" != "xno"],
@@ -26,23 +25,29 @@ AC_DEFUN([PANDORA_64BIT],[
     isainfo_k=`${ISAINFO} -k` 
     DTRACEFLAGS="${DTRACEFLAGS} -${isainfo_k}"
 
     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_enable_64bit" = "xyes"],[
 
 
-    AS_IF([test "x${ac_cv_env_LDFLAGS_set}" = "x"],[
-      LDFLAGS="-L/usr/local/lib/${isainfo_k} ${LDFLAGS}"
-    ])
+      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}"
       ])
 
       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 "x${ac_cv_env_CFLAGS_set}" = "x"],[
+        CFLAGS="${CFLAGS} -m64"
+        ac_cv_env_CFLAGS_set=set
+        ac_cv_env_CFLAGS_value='-m64'
+      ])
+      AS_IF([test "x${ac_cv_env_CXXFLAGS_set}" = "x"],[
+        CXXFLAGS="${CXXFLAGS} -m64"
+        ac_cv_env_CXXFLAGS_set=set
+        ac_cv_env_CXXFLAGS_value='-m64'
+      ])
+
       AS_IF([test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes"],[
         AM_CFLAGS="-xmemalign=8s ${AM_CFLAGS}"
         AM_CXXFLAGS="-xmemalign=8s ${AM_CXXFLAGS}"
       AS_IF([test "$target_cpu" = "sparc" -a "x$SUNCC" = "xyes"],[
         AM_CFLAGS="-xmemalign=8s ${AM_CFLAGS}"
         AM_CXXFLAGS="-xmemalign=8s ${AM_CXXFLAGS}"
index 90ea6da8a7c1f5dab97640ecc77bc25920217072..ec104b7d98b08b9a448437e1e12a9acfb5069ca6 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
 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.22])
+AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.45])
 
 AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[
   dnl Force dependency tracking on for Sun Studio builds
 
 AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[
   dnl Force dependency tracking on for Sun Studio builds
@@ -63,19 +63,17 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
 
   dnl Once we can use a modern autoconf, we can use this
   dnl AC_PROG_CC_C99
 
   dnl Once we can use a modern autoconf, we can use this
   dnl AC_PROG_CC_C99
-  AC_PROG_CXX
+  AC_REQUIRE([AC_PROG_CXX])
+  gl_USE_SYSTEM_EXTENSIONS
   AC_PROG_CPP
   AM_PROG_CC_C_O
 
 
   AC_PROG_CPP
   AM_PROG_CC_C_O
 
 
-  gl_USE_SYSTEM_EXTENSIONS
   m4_if(PCT_FORCE_GCC42, [yes], [
     AS_IF([test "$GCC" = "yes"], PANDORA_ENSURE_GCC_VERSION)
   ])
 
   m4_if(PCT_FORCE_GCC42, [yes], [
     AS_IF([test "$GCC" = "yes"], PANDORA_ENSURE_GCC_VERSION)
   ])
 
-  AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
-  AC_CHECK_DECL([__ICC], [INTELCC="yes"], [INTELCC="no"])
-  AS_IF([test "x$INTELCC" = "xyes"], [enable_rpath=no])
+  PANDORA_PLATFORM
 
   PANDORA_LIBTOOL
 
 
   PANDORA_LIBTOOL
 
@@ -140,6 +138,9 @@ AC_DEFUN([PANDORA_CANONICAL_TARGET],[
     ])
   ])
 
     ])
   ])
 
+  PANDORA_USE_PIPE
+
+
   AM_CPPFLAGS="-I\${top_srcdir} -I\${top_builddir} ${AM_CPPFLAGS}"
   AM_CFLAGS="${AM_CFLAGS} ${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
   AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
   AM_CPPFLAGS="-I\${top_srcdir} -I\${top_builddir} ${AM_CPPFLAGS}"
   AM_CFLAGS="${AM_CFLAGS} ${CC_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
   AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS} ${CC_PROFILING} ${CC_COVERAGE}"
index 4563e3b5496298f6f27464c7d998e7098152ea12..18b474806331984b7818a96d8d6e66e970105920 100644 (file)
@@ -11,8 +11,16 @@ AC_DEFUN([PANDORA_HAVE_BETTER_MALLOC],[
   AC_ARG_ENABLE([umem],
     [AS_HELP_STRING([--enable-umem],
        [Enable linking with libumem @<:@default=off@:>@])],
   AC_ARG_ENABLE([umem],
     [AS_HELP_STRING([--enable-umem],
        [Enable linking with libumem @<:@default=off@:>@])],
-    [ac_enable_umem="$enableval"],
-    [ac_enable_umem="no"])
+    [ac_enable_umem="$enableval"],[
+      case "$target_os" in
+        *solaris*)
+          ac_enable_umem="yes"
+        ;;
+        *)
+          ac_enable_umem="no"
+        ;;
+      esac
+    ])
   
   AC_ARG_ENABLE([tcmalloc],
     [AS_HELP_STRING([--enable-tcmalloc],
   
   AC_ARG_ENABLE([tcmalloc],
     [AS_HELP_STRING([--enable-tcmalloc],
index ea86dd160d9525f67cb031d723084b13b34b33e2..218d1fad37f8ae49fc68d4410d11964f14789a69 100644 (file)
@@ -9,16 +9,25 @@ AC_DEFUN([_PANDORA_SEARCH_LIBDRIZZLE],[
   dnl --------------------------------------------------------------------
   dnl  Check for libdrizzle
   dnl --------------------------------------------------------------------
   dnl --------------------------------------------------------------------
   dnl  Check for libdrizzle
   dnl --------------------------------------------------------------------
-  
-  AC_LIB_HAVE_LINKFLAGS(drizzle,,[
-    #include <libdrizzle/drizzle_client.h>
+
+  AC_ARG_ENABLE([libdrizzle],
+    [AS_HELP_STRING([--disable-libdrizzle],
+      [Build with libdrizzle support @<:@default=on@:>@])],
+    [ac_enable_libdrizzle="$enableval"],
+    [ac_enable_libdrizzle="yes"])
+
+  AS_IF([test "x$ac_enable_libdrizzle" = "xyes"],[
+    AC_LIB_HAVE_LINKFLAGS(drizzle,,[
+      #include <libdrizzle/drizzle_client.h>
+    ],[
+      drizzle_st drizzle;
+      drizzle_version();
+    ])
   ],[
   ],[
-    drizzle_st drizzle;
-    drizzle_version();
+    ac_cv_libdrizzle="no"
   ])
   
   AM_CONDITIONAL(HAVE_LIBDRIZZLE, [test "x${ac_cv_libdrizzle}" = "xyes"])
   ])
   
   AM_CONDITIONAL(HAVE_LIBDRIZZLE, [test "x${ac_cv_libdrizzle}" = "xyes"])
-
 ])
 
 AC_DEFUN([PANDORA_HAVE_LIBDRIZZLE],[
 ])
 
 AC_DEFUN([PANDORA_HAVE_LIBDRIZZLE],[
@@ -27,7 +36,7 @@ AC_DEFUN([PANDORA_HAVE_LIBDRIZZLE],[
 
 AC_DEFUN([PANDORA_REQUIRE_LIBDRIZZLE],[
   AC_REQUIRE([PANDORA_HAVE_LIBDRIZZLE])
 
 AC_DEFUN([PANDORA_REQUIRE_LIBDRIZZLE],[
   AC_REQUIRE([PANDORA_HAVE_LIBDRIZZLE])
-  AS_IF([test x$ac_cv_libdrizzle = xno],
+  AS_IF([test "x${ac_cv_libdrizzle}" = "xno"],
       AC_MSG_ERROR([libdrizzle is required for ${PACKAGE}]))
 ])
 
       AC_MSG_ERROR([libdrizzle is required for ${PACKAGE}]))
 ])
 
index fc0def74595d3ef06c0a228ce4f539b87a79e255..2387bed9bc52dbe125ed07d14dffbe85bf4895c8 100644 (file)
@@ -10,14 +10,24 @@ AC_DEFUN([_PANDORA_SEARCH_LIBGEARMAN],[
   dnl  Check for libgearman
   dnl --------------------------------------------------------------------
 
   dnl  Check for libgearman
   dnl --------------------------------------------------------------------
 
-  AC_LIB_HAVE_LINKFLAGS(gearman,, 
-    [#include <libgearman/gearman.h>],[ 
-      gearman_client_st gearman_client; 
-      gearman_version(); 
-    ]) 
+  AC_ARG_ENABLE([libgearman],
+    [AS_HELP_STRING([--disable-libgearman],
+      [Build with libgearman support @<:@default=on@:>@])],
+    [ac_enable_libgearman="$enableval"],
+    [ac_enable_libgearman="yes"])
+
+  AS_IF([test "x$ac_enable_libgearman" = "xyes"],[
+    AC_LIB_HAVE_LINKFLAGS(gearman,,[
+      #include <libgearman/gearman.h>
+    ],[
+      gearman_client_st gearman_client;
+      gearman_version();
+    ])
+  ],[
+    ac_cv_libgearman="no"
+  ])
 
   AM_CONDITIONAL(HAVE_LIBGEARMAN, [test "x${ac_cv_libgearman}" = "xyes"])
 
   AM_CONDITIONAL(HAVE_LIBGEARMAN, [test "x${ac_cv_libgearman}" = "xyes"])
-  
 ])
 
 AC_DEFUN([PANDORA_HAVE_LIBGEARMAN],[
 ])
 
 AC_DEFUN([PANDORA_HAVE_LIBGEARMAN],[
@@ -26,6 +36,6 @@ AC_DEFUN([PANDORA_HAVE_LIBGEARMAN],[
 
 AC_DEFUN([PANDORA_REQUIRE_LIBGEARMAN],[
   AC_REQUIRE([PANDORA_HAVE_LIBGEARMAN])
 
 AC_DEFUN([PANDORA_REQUIRE_LIBGEARMAN],[
   AC_REQUIRE([PANDORA_HAVE_LIBGEARMAN])
-  AS_IF([test x$ac_cv_libgearman = xno],
+  AS_IF([test "x${ac_cv_libgearman}" = "xno"],
       AC_MSG_ERROR([libgearman is required for ${PACKAGE}]))
 ])
       AC_MSG_ERROR([libgearman is required for ${PACKAGE}]))
 ])
index d4bebf53eb508b29ac3ea61e1ce119e3f4372cbb..d1a44c60e04c5cbf512f16a72e673839d2384c9c 100644 (file)
@@ -10,18 +10,27 @@ AC_DEFUN([_PANDORA_SEARCH_LIBMEMCACHED],[
   dnl  Check for libmemcached
   dnl --------------------------------------------------------------------
 
   dnl  Check for libmemcached
   dnl --------------------------------------------------------------------
 
-  AC_LIB_HAVE_LINKFLAGS(memcached,,[
-    #include <libmemcached/memcached.h>
-  ], [
-    memcached_st memc;
-    memcached_dump_func *df;
-    memcached_version();
+  AC_ARG_ENABLE([libmemcached],
+    [AS_HELP_STRING([--disable-libmemcached],
+      [Build with libmemcached support @<:@default=on@:>@])],
+    [ac_enable_libmemcached="$enableval"],
+    [ac_enable_libmemcached="yes"])
+
+  AS_IF([test "x$ac_enable_libmemcached" = "xyes"],[
+    AC_LIB_HAVE_LINKFLAGS(memcached,,[
+      #include <libmemcached/memcached.h>
+    ],[
+      memcached_st memc;
+      memcached_dump_func *df;
+      memcached_lib_version();
+    ])
+  ],[
+    ac_cv_libmemcached="no"
   ])
   
   AM_CONDITIONAL(HAVE_LIBMEMCACHED, [test "x${ac_cv_libmemcached}" = "xyes"])
   
   AS_IF([test "x${ac_cv_libmemcached}" = "xyes"], [ PANDORA_WITH_MEMCACHED ])
   ])
   
   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],[
 ])
 
 AC_DEFUN([PANDORA_HAVE_LIBMEMCACHED],[
index 86ccb49520cfdab1e71b4012feb5237596552d8b..3812dc594496226501813ab42d263c2f88734bcb 100644 (file)
@@ -10,11 +10,26 @@ AC_DEFUN([_PANDORA_SEARCH_LIBPQ],[
   dnl  Check for libpq
   dnl --------------------------------------------------------------------
 
   dnl  Check for libpq
   dnl --------------------------------------------------------------------
 
-  AC_LIB_HAVE_LINKFLAGS(pq,,[
-    #include <libpq-fe.h>
-  ], [
-    PGconn *conn;
-    conn = PQconnectdb(NULL);
+  AC_ARG_ENABLE([libpq],
+    [AS_HELP_STRING([--disable-libpq],
+      [Build with libpq support @<:@default=on@:>@])],
+    [ac_enable_libpq="$enableval"],
+    [ac_enable_libpq="yes"])
+
+  AS_IF([test "x$ac_enable_libpq" = "xyes"],[
+    AC_CHECK_HEADERS([libpq-fe.h])
+    AC_LIB_HAVE_LINKFLAGS(pq,,[
+      #ifdef HAVE_LIBPQ_FE_H
+      # include <libpq-fe.h>
+      #else
+      # include <postgresql/libpq-fe.h>
+      #endif
+    ], [
+      PGconn *conn;
+      conn = PQconnectdb(NULL);
+    ])
+  ],[
+    ac_cv_libpq="no"
   ])
   
   AM_CONDITIONAL(HAVE_LIBPQ, [test "x${ac_cv_libpq}" = "xyes"])
   ])
   
   AM_CONDITIONAL(HAVE_LIBPQ, [test "x${ac_cv_libpq}" = "xyes"])
@@ -26,6 +41,6 @@ AC_DEFUN([PANDORA_HAVE_LIBPQ],[
 
 AC_DEFUN([PANDORA_REQUIRE_LIBPQ],[
   AC_REQUIRE([PANDORA_HAVE_LIBPQ])
 
 AC_DEFUN([PANDORA_REQUIRE_LIBPQ],[
   AC_REQUIRE([PANDORA_HAVE_LIBPQ])
-  AS_IF([test x$ac_cv_libpq = xno],
-      AC_MSG_ERROR([libpq is required for ${PACKAGE}]))
+  AS_IF([test "x${ac_cv_libpq}" = "xno"],
+    AC_MSG_ERROR([libpq is required for ${PACKAGE}]))
 ])
 ])
diff --git a/m4/pandora_have_libsqlite3.m4 b/m4/pandora_have_libsqlite3.m4
new file mode 100644 (file)
index 0000000..15e0195
--- /dev/null
@@ -0,0 +1,42 @@
+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_LIBSQLITE3],[
+  AC_REQUIRE([AC_LIB_PREFIX])
+
+  dnl --------------------------------------------------------------------
+  dnl  Check for libsqlite3
+  dnl --------------------------------------------------------------------
+
+  AC_ARG_ENABLE([libsqlite3],
+    [AS_HELP_STRING([--disable-libsqlite3],
+      [Build with libsqlite3 support @<:@default=on@:>@])],
+    [ac_enable_libsqlite3="$enableval"],
+    [ac_enable_libsqlite3="yes"])
+
+  AS_IF([test "x$ac_enable_libsqlite3" = "xyes"],[
+    AC_LIB_HAVE_LINKFLAGS(sqlite3,,[
+      #include <stdio.h>
+      #include <sqlite3.h>
+    ],[
+      sqlite3 *db;
+      sqlite3_open(NULL, &db);
+    ])
+  ],[
+    ac_cv_libsqlite3="no"
+  ])
+
+  AM_CONDITIONAL(HAVE_LIBSQLITE3, [test "x${ac_cv_libsqlite3}" = "xyes"])
+])
+
+AC_DEFUN([PANDORA_HAVE_LIBSQLITE3],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBSQLITE3])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBSQLITE3],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBSQLITE3])
+  AS_IF([test "x${ac_cv_libsqlite3}" = "xno"],
+    AC_MSG_ERROR([libsqlite3 is required for ${PACKAGE}]))
+])
diff --git a/m4/pandora_have_protobuf.m4 b/m4/pandora_have_protobuf.m4
new file mode 100644 (file)
index 0000000..3b1652e
--- /dev/null
@@ -0,0 +1,80 @@
+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; the Free Software Foundation
+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
+
+dnl --------------------------------------------------------------------
+dnl  Check for Google Proto Buffers
+dnl --------------------------------------------------------------------
+
+AC_DEFUN([_PANDORA_SEARCH_LIBPROTOBUF],[
+  AC_REQUIRE([PANDORA_HAVE_PTHREAD])
+
+  AC_LANG_PUSH([C++])
+  save_CXXFLAGS="${CXXFLAGS}"
+  CXXFLAGS="${PTHREAD_CFLAGS} ${CXXFLAGS}"
+  AC_LIB_HAVE_LINKFLAGS(protobuf,,
+    [#include <google/protobuf/descriptor.h>],
+    [google::protobuf::FileDescriptor* file;],
+    [system])
+  CXXFLAGS="${save_CXXFLAGS}"
+  AC_LANG_POP()
+])
+
+AC_DEFUN([PANDORA_HAVE_LIBPROTOBUF],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBPROTOBUF])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_LIBPROTOBUF],[
+  AC_REQUIRE([PANDORA_HAVE_LIBPROTOBUF])
+  AS_IF([test x$ac_cv_libprotobuf = xno],
+      AC_MSG_ERROR([libprotobuf is required for ${PACKAGE}. On Debian this can be found in libprotobuf-dev. On RedHat this can be found in protobuf-devel.]))
+])
+
+AC_DEFUN([PANDORA_PROTOBUF_REQUIRE_VERSION],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBPROTOBUF])
+  p_recent_ver=$1
+  p_recent_ver_major=`echo $p_recent_ver | cut -f1 -d.`
+  p_recent_ver_minor=`echo $p_recent_ver | cut -f2 -d.`
+  p_recent_ver_patch=`echo $p_recent_ver | cut -f3 -d.`
+  p_recent_ver_hex=`printf "%d%03d%03d" $p_recent_ver_major $p_recent_ver_minor $p_recent_ver_patch` 
+  AC_LANG_PUSH([C++])
+  AC_CACHE_CHECK([for protobuf >= $p_recent_ver],
+    [drizzle_cv_protobuf_recent],
+    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <google/protobuf/descriptor.h>
+#if GOOGLE_PROTOBUF_VERSION < $p_recent_ver_hex
+# error Your version of Protobuf is too old
+#endif
+      ]])],
+    [drizzle_cv_protobuf_recent=yes],
+    [drizzle_cv_protobuf_recent=no])])
+  AS_IF([test "$drizzle_cv_protobuf_recent" = "no"],[
+    AC_MSG_ERROR([Your version of Google Protocol Buffers is too old. ${PACKAGE} requires at least version $p_recent_ver])
+  ])
+  AC_LANG_POP()
+])
+
+AC_DEFUN([_PANDORA_SEARCH_PROTOC],[
+  AC_REQUIRE([_PANDORA_SEARCH_LIBPROTOBUF])
+  AC_PATH_PROG([PROTOC],[protoc],[no],[$LIBPROTOBUF_PREFIX/bin:$PATH])
+])
+
+AC_DEFUN([PANDORA_HAVE_PROTOC],[
+  AC_REQUIRE([_PANDORA_SEARCH_PROTOC])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_PROTOC],[
+  AC_REQUIRE([PANDORA_HAVE_PROTOC])
+  AS_IF([test "x$PROTOC" = "xno"],[
+    AC_MSG_ERROR([Couldn't find the protoc compiler. On Debian this can be found in protobuf-compiler. On RedHat this can be found in protobuf-compiler.])
+  ])
+])
+
+
diff --git a/m4/pandora_platform.m4 b/m4/pandora_platform.m4
new file mode 100644 (file)
index 0000000..76ef66b
--- /dev/null
@@ -0,0 +1,68 @@
+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; the Free Software Foundation
+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_PLATFORM],[
+
+  dnl Canonicalize the configuration name.
+
+  AC_DEFINE_UNQUOTED([HOST_VENDOR], ["$host_vendor"],[Vendor of Build System])
+  AC_DEFINE_UNQUOTED([HOST_OS], ["$host_os"], [OS of Build System])
+  AC_DEFINE_UNQUOTED([HOST_CPU], ["$host_cpu"], [CPU of Build System])
+
+  AC_DEFINE_UNQUOTED([TARGET_VENDOR], ["$target_vendor"],[Vendor of Target System])
+  AC_DEFINE_UNQUOTED([TARGET_OS], ["$target_os"], [OS of Target System])
+  AC_DEFINE_UNQUOTED([TARGET_CPU], ["$target_cpu"], [CPU of Target System])
+
+
+  case "$host_os" in
+    *solaris*|*freebsd*)
+    AS_IF([test "x${ac_cv_env_CPPFLAGS_set}" = "x"],[
+      CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
+    ])
+
+    AS_IF([test "x${ac_cv_env_LDFLAGS_set}" = "x"],[
+      LDFLAGS="${LDFLAGS} -L/usr/local/lib"
+    ])
+    ;;
+  esac
+
+  case "$target_os" in
+    *linux*)
+    TARGET_LINUX="true"
+    AC_SUBST(TARGET_LINUX)
+    AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
+      ;;
+    *darwin*)
+      TARGET_OSX="true"
+      AC_SUBST(TARGET_OSX)
+      AC_DEFINE([TARGET_OS_OSX], [1], [Whether we build for OSX])
+      ;;
+    *solaris*)
+      TARGET_SOLARIS="true"
+      AC_SUBST(TARGET_SOLARIS)
+      AC_DEFINE([TARGET_OS_SOLARIS], [1], [Whether we are building for Solaris])
+      ;;
+    *freebsd*)
+      TARGET_FREEBSD="true"
+      AC_SUBST(TARGET_FREEBSD)
+      AC_DEFINE([TARGET_OS_FREEBSD], [1], [Whether we are building for FreeBSD])
+      AC_DEFINE([__APPLE_CC__],[1],[Workaround for bug in FreeBSD headers])
+      ;;
+    *)
+      ;;
+  esac
+
+  AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
+  AC_CHECK_DECL([__ICC], [INTELCC="yes"], [INTELCC="no"])
+
+  AS_IF([test "x$INTELCC" = "xyes"], [enable_rpath=no])
+
+])
diff --git a/m4/pandora_plugins.m4 b/m4/pandora_plugins.m4
new file mode 100644 (file)
index 0000000..c4df08d
--- /dev/null
@@ -0,0 +1,34 @@
+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--------------------------------------------------------------------
+dnl PANDORA_PLUGINS
+dnl Declare our plugin modules
+dnl--------------------------------------------------------------------
+
+AC_DEFUN([PANDORA_PLUGINS],[
+
+  m4_include(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])
+
+  pandora_builtin_list=`echo $pandora_builtin_list | sed 's/, *$//'`
+  AC_DEFINE_UNQUOTED([PANDORA_BUILTIN_LIST],[$pandora_builtin_list],
+                     [List of plugins to be built in])
+
+  AC_SUBST(pandora_plugin_test_list)
+  AC_SUBST(pandora_plugin_libs)
+
+  pandora_plugin_defs=`echo $pandora_plugin_defs | sed 's/, *$//'`
+  AC_SUBST(pandora_plugin_defs)
+
+  AC_SUBST(PANDORA_PLUGIN_DEP_LIBS)
+  AC_SUBST(pkgplugindir,"\$(pkglibdir)/plugin")
+])
+
+AC_DEFUN([PANDORA_ADD_PLUGIN_DEP_LIB],[
+  PANDORA_PLUGIN_DEP_LIBS="${PANDORA_PLUGIN_DEP_LIBS} $*"
+])
\ No newline at end of file
diff --git a/m4/pandora_pthread.m4 b/m4/pandora_pthread.m4
new file mode 100644 (file)
index 0000000..92bdfc4
--- /dev/null
@@ -0,0 +1,34 @@
+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; the Free Software Foundation
+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
+
+
+dnl --------------------------------------------------------------------
+dnl  Check for libpthread
+dnl --------------------------------------------------------------------
+
+AC_DEFUN([_PANDORA_SEARCH_PTHREAD],[
+  ACX_PTHREAD
+  LIBS="${PTHREAD_LIBS} ${LIBS}"
+  AM_CFLAGS="${PTHREAD_CFLAGS} ${AM_CFLAGS}"
+  AM_CXXFLAGS="${PTHREAD_CFLAGS} ${AM_CXXFLAGS}"
+  CC="$PTHREAD_CC"
+])
+
+
+AC_DEFUN([PANDORA_HAVE_PTHREAD],[
+  AC_REQUIRE([_PANDORA_SEARCH_PTHREAD])
+])
+
+AC_DEFUN([PANDORA_REQUIRE_PTHREAD],[
+  AC_REQUIRE([PANDORA_HAVE_PTHREAD])
+  AS_IF([test "x$acx_pthread_ok" != "xyes"],[
+    AC_MSG_ERROR(could not find libpthread)])
+])
diff --git a/m4/pandora_swig.m4 b/m4/pandora_swig.m4
new file mode 100644 (file)
index 0000000..07f57e2
--- /dev/null
@@ -0,0 +1,32 @@
+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; the Free Software Foundation
+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_SWIG],[
+
+  AC_PROG_SWIG(1.3.36)
+  AC_DEFINE([SWIG_TYPE_TABLE],
+    [libgearman],
+    [Type Table name for SWIG symbol table])
+
+  dnl Have to hard-code /usr/local/include and /usr/include into the path.
+  dnl I hate this. Why is swig sucking me
+  SWIG="$SWIG \${DEFS} -I\${top_srcdir} -I\${top_builddir} -I/usr/local/include -I/usr/include"
+  AC_SUBST([SWIG])
+
+
+  AC_CACHE_CHECK([if swig supports Python3],
+    [ac_cv_swig_has_python3_],
+    [
+      AS_IF([swig -python3 2>&1 | grep "Unable to find" > /dev/null],
+        [ac_cv_swig_has_python3_=no],
+        [ac_cv_swig_has_python3_=yes])
+    ])
+])
diff --git a/m4/pandora_use_pipe.m4 b/m4/pandora_use_pipe.m4
new file mode 100644 (file)
index 0000000..8e8c28a
--- /dev/null
@@ -0,0 +1,36 @@
+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; the Free Software Foundation
+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
+dnl
+dnl Test if we can Use -pipe to avoid making temp files during the compile.
+dnl Should speed up compile on slower disks
+
+AC_DEFUN([PANDORA_USE_PIPE],[
+
+  AS_IF([test "$GCC" = "yes"],[
+    AC_CACHE_CHECK([for working -pipe], [pandora_cv_use_pipe], [
+      AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <stdio.h>
+
+int main(int argc, char** argv)
+{
+  (void) argc; (void) argv;
+  return 0;
+}
+      ]])],
+      [pandora_cv_use_pipe=yes],
+      [pandora_cv_use_pipe=no])
+    ])
+    AS_IF([test "$pandora_cv_use_pipe" = "yes"],[
+      AM_CFLAGS="-pipe ${AM_CFLAGS}"
+      AM_CXXFLAGS="-pipe ${AM_CXXFLAGS}"
+    ])
+  ])
+])
index 46d752eab63883fcc3611076d72fef40cf85219c..9ccb95bd9d4ea5ad325d07d9776c4ed358049218 100644 (file)
@@ -206,7 +206,10 @@ template <> void C<int>::foo();
             [CXX_WARNINGS="${CXX_WARNINGS} -Wno-redundant-decls"])
   
       NO_REDUNDANT_DECLS="-Wno-redundant-decls"
             [CXX_WARNINGS="${CXX_WARNINGS} -Wno-redundant-decls"])
   
       NO_REDUNDANT_DECLS="-Wno-redundant-decls"
-      PROTOSKIP_WARNINGS="-Wno-effc++ -Wno-shadow"
+      dnl TODO: Figure out a better way to deal with this:
+      PROTOSKIP_WARNINGS="-Wno-effc++ -Wno-shadow -Wno-missing-braces"
+      NO_WERROR="-Wno-error"
+      INNOBASE_SKIP_WARNINGS="-Wno-shadow -Wno-cast-align"
       
     ])
   ])
       
     ])
   ])
@@ -247,8 +250,9 @@ template <> void C<int>::foo();
 
     CC_WARNINGS="-v -errtags=yes ${W_FAIL} ${CC_WARNINGS_FULL}"
     CXX_WARNINGS="+w +w2 -xwe -xport64 -errtags=yes ${CXX_WARNINGS_FULL} ${W_FAIL}"
 
     CC_WARNINGS="-v -errtags=yes ${W_FAIL} ${CC_WARNINGS_FULL}"
     CXX_WARNINGS="+w +w2 -xwe -xport64 -errtags=yes ${CXX_WARNINGS_FULL} ${W_FAIL}"
-    PROTOSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,wbadinitl,identexpected,inllargeuse,truncwarn1,signextwarn"
+    PROTOSKIP_WARNINGS="-erroff=attrskipunsup,doubunder,reftotemp,wbadinitl,identexpected,inllargeuse,truncwarn1,signextwarn,partinit,notused,badargtype2w,wbadinit"
     NO_UNREACHED="-erroff=E_STATEMENT_NOT_REACHED"
     NO_UNREACHED="-erroff=E_STATEMENT_NOT_REACHED"
+    NO_WERROR="-errwarn=%none"
 
   ])
 
 
   ])
 
@@ -258,5 +262,7 @@ template <> void C<int>::foo();
   AC_SUBST(NO_SHADOW)
   AC_SUBST(NO_STRICT_ALIASING)
   AC_SUBST(PROTOSKIP_WARNINGS)
   AC_SUBST(NO_SHADOW)
   AC_SUBST(NO_STRICT_ALIASING)
   AC_SUBST(PROTOSKIP_WARNINGS)
+  AC_SUBST(INNOBASE_SKIP_WARNINGS)
+  AC_SUBST(NO_WERROR)
 
 ])
 
 ])
diff --git a/m4/pandora_with_lua.m4 b/m4/pandora_with_lua.m4
new file mode 100644 (file)
index 0000000..6e4a96f
--- /dev/null
@@ -0,0 +1,45 @@
+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; the Free Software Foundation
+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_LUA],[
+    dnl Check for lua
+    AC_ARG_WITH([lua], 
+    [AS_HELP_STRING([--with-lua],
+      [Build Lua Bindings @<:@default=yes@:>@])],
+    [with_lua=$withval], 
+    [with_lua=yes])
+
+  AS_IF([test "x$with_lua" != "xno"],[
+    AS_IF([test "x$with_lua" = "xyes"],
+      [LUAPC=lua],
+      [LUAPC=$with_lua])
+
+    PKG_CHECK_MODULES([LUA], $LUAPC >= 5.1, [
+      AC_DEFINE([HAVE_LUA], [1], [liblua])
+      AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
+      with_lua=yes
+    ],[
+      PKG_CHECK_MODULES([LUA], lua5.1 >= 5.1, [
+        AC_DEFINE([HAVE_LUA], [1], [liblua])
+        AC_DEFINE([HAVE_LUA_H], [1], [lua.h])
+       with_lua=yes
+      ],[
+        AC_DEFINE([HAVE_LUA],["x"],["x"])
+        with_lua=no
+      ])
+    ])
+
+   AC_SUBST(LUA_CFLAGS)
+   AC_SUBST(LUA_LIBS)
+  ])
+  AM_CONDITIONAL(BUILD_LUA, test "$with_lua" = "yes")
+
+])
diff --git a/m4/pandora_with_perl.m4 b/m4/pandora_with_perl.m4
new file mode 100644 (file)
index 0000000..e3fd50a
--- /dev/null
@@ -0,0 +1,38 @@
+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; the Free Software Foundation
+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_PERL], [
+
+  AC_ARG_WITH([perl], 
+    [AS_HELP_STRING([--with-perl],
+      [Build Perl Bindings @<:@default=yes@:>@])],
+    [with_perl=$withval], 
+    [with_perl=yes])
+
+
+  AS_IF([test "x$with_perl" != "xno"],[
+    AS_IF([test "x$with_perl" != "xyes"],
+      [ac_chk_perl=$with_perl],
+      [ac_chk_perl=perl])
+    AC_CHECK_PROGS(PERL,$ac_chk_perl)
+  ])
+
+  AM_CONDITIONAL(BUILD_PERL, [test "$with_perl" = "yes"])
+
+dnl Don't think we need these anymore, but it's a good reference
+dnl if test "x$PERL" != "x"; then
+dnl  PERLCCFLAGS=`$PERL -MConfig -e 'print $Config{ccflags};'`
+dnl  PERLCPPFLAGS=`$PERL -MConfig -e 'print $Config{cppflags};'`
+dnl  PERLLIBS=`$PERL -MConfig -e 'print $Config{perllibs};'`
+dnl fi 
+
+])
diff --git a/m4/pandora_with_php.m4 b/m4/pandora_with_php.m4
new file mode 100644 (file)
index 0000000..4e163fd
--- /dev/null
@@ -0,0 +1,56 @@
+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; the Free Software Foundation
+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_PHP],[
+
+  AC_ARG_WITH([php],
+    [AS_HELP_STRING([--with-php],
+      [Build NDB/PHP @<:@default=no@:>@])],
+    [with_php=$withval],
+    [with_php=no])
+
+  AS_IF([test "x$with_php" != "xno"],[
+    dnl We explicitly requested PHP build. Fail on too-young SWIG.
+    AS_IF([test "x$SWIG_CAN_BUILD_PHP" != "xyes"],
+      [AC_MSG_ERROR("Your version of SWIG is too young to build NDB/PHP. >=1.3.33 is required!")])
+    AS_IF([test "x$with_php" != "xyes"],
+      [ac_check_php_config=$with_php],
+      [ac_check_php_config="php-config php-config5"])
+      AC_CHECK_PROGS(PHP_CONFIG, [$ac_check_php_config])
+    ])
+
+  AS_IF([test "x$PHP_CONFIG" != "x"],[
+    PHP_CFLAGS=`$PHP_CONFIG --includes`
+    PHP_CPPFLAGS=`$PHP_CONFIG --includes`
+    PHP_LDFLAGS=`$PHP_CONFIG --ldflags`
+    PHP_EXTDIR=`$PHP_CONFIG --extension-dir`
+    strip_php_prefix=`$PHP_CONFIG --prefix | sed 's/\//./g'`
+    PHP_ARCH_DIR=`echo $PHP_EXTDIR | sed "s/$strip_php_prefix//"`
+  ],[
+    PHP_CFLAGS=
+    PHP_CPPFLAGS=
+    PHP_LDFLAGS=
+    PHP_EXTDIR=
+    PHP_ARCH_DIR=
+    with_php=no
+  ])
+
+  AC_SUBST(PHP_CFLAGS)
+  AC_SUBST(PHP_CPPFLAGS)
+  AC_SUBST(PHP_LDFLAGS)
+  AC_SUBST(PHP_EXTDIR)
+  AC_SUBST(PHP_ARCH_DIR)
+
+  AM_CONDITIONAL(BUILD_PHP, test "$with_php" = "yes")
+  
+])
+
diff --git a/m4/pandora_with_python.m4 b/m4/pandora_with_python.m4
new file mode 100644 (file)
index 0000000..97aa57f
--- /dev/null
@@ -0,0 +1,28 @@
+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; the Free Software Foundation
+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_PYTHON], [
+
+  AC_ARG_WITH([python], 
+    [AS_HELP_STRING([--with-python],
+      [Build Python Bindings @<:@default=yes@:>@])],
+    [with_python=$withval], 
+    [with_python=yes])
+
+  AS_IF([test "x$with_python" != "xno"],[
+    AS_IF([test "x$with_python" != "xyes"],[PYTHON=$with_python])
+    AM_PATH_PYTHON([2.4],,[with_python="no"])
+    AC_PYTHON_DEVEL()
+    AS_IF([test "x$pythonexists" = "xno"],[with_python="no"])
+  ])
+  AM_CONDITIONAL(BUILD_PYTHON, [test "$with_python" = "yes"])
+])
diff --git a/m4/pandora_with_python3.m4 b/m4/pandora_with_python3.m4
new file mode 100644 (file)
index 0000000..1b964ff
--- /dev/null
@@ -0,0 +1,35 @@
+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; the Free Software Foundation
+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_PYTHON3], [
+
+  AC_REQUIRE([PANDORA_SWIG])
+
+  AC_ARG_WITH([python3], 
+    [AS_HELP_STRING([--with-python3],
+      [Build Python3 Bindings @<:@default=yes@:>@])],
+    [with_python3=$withval], 
+    [with_python3=yes])
+
+  AS_IF([test "x$ac_cv_swig_has_python3_" != "xno"],[
+   AS_IF([test "x$with_python3" != "xno"],[
+     AS_IF([test "x$with_python3" != "xyes"],
+       [PYTHON3=$with_python3],
+       [AC_PATH_PROG([PYTHON3],[python3],[no])
+        AS_IF([test "x$PYTHON3" = "xno"],
+          [with_python3=no])
+     ]) 
+   ])
+  ],[
+     with_python3=no
+  ])
+AM_CONDITIONAL(BUILD_PYTHON3, [test "$with_python3" = "yes"])
+])
diff --git a/m4/pandora_with_r.m4 b/m4/pandora_with_r.m4
new file mode 100644 (file)
index 0000000..cc6dc59
--- /dev/null
@@ -0,0 +1,33 @@
+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; the Free Software Foundation
+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_R],[
+    dnl Check for GNU R
+    AC_ARG_WITH([r], 
+    [AS_HELP_STRING([--with-r],
+      [Build R Bindings @<:@default=yes@:>@])],
+    [with_r=$withval], 
+    [with_r=yes])
+
+  AS_IF([test "x$with_r" != "xno"],[
+
+    PKG_CHECK_MODULES([R], [libR], [
+      with_r=yes
+    ],[
+      with_r=no
+    ])
+
+   AC_SUBST(R_CFLAGS)
+   AC_SUBST(R_LIBS)
+  ])
+  AM_CONDITIONAL(BUILD_R, test "$with_r" = "yes")
+
+])
diff --git a/m4/pandora_with_ruby.m4 b/m4/pandora_with_ruby.m4
new file mode 100644 (file)
index 0000000..63b4263
--- /dev/null
@@ -0,0 +1,79 @@
+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; the Free Software Foundation
+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_RUBY], [
+
+  AC_ARG_WITH([ruby],
+    [AS_HELP_STRING([--with-ruby],
+      [Build Ruby Bindings @<:@default=yes@:>@])],
+      [with_ruby=$withval],
+      [with_ruby=ruby])
+
+  AS_IF([test "x$with_ruby" != "xno"],[
+    AS_IF([test "x$with_ruby" != "xyes"],
+      [ac_chk_ruby=$with_ruby],
+      [ac_chk_ruby=ruby1.8 ruby])
+    AC_CHECK_PROGS(RUBY,$ac_chk_ruby)
+  ])
+
+  AS_IF([test "x$RUBY" != "x"],[
+
+    AC_MSG_CHECKING(for ruby devel)
+
+    dnl need to change quotes to allow square brackets
+    changequote(<<, >>)dnl
+    ruby_prefix=`$RUBY -rrbconfig -e "print Config::CONFIG['archdir']"`
+    strip_ruby_prefix=`$RUBY -rrbconfig -e "print Config::CONFIG['prefix']" | sed 's/\//./g'`
+    
+    RUBY_LIB=`$RUBY -rrbconfig -e "puts Config::CONFIG['ruby_install_name']"`
+    LIBRUBYARG_SHARED=`$RUBY -rrbconfig -e "puts Config::CONFIG['LIBRUBYARG_SHARED']"`
+    RUBY_DIR=`$RUBY -rrbconfig -e "puts Config::CONFIG['archdir']"`
+    RUBY_ARCH_DIR=`echo $RUBY_DIR | sed "s/$strip_ruby_prefix//"`
+    RUBY_LIBDIR=`$RUBY -rrbconfig -e "puts Config::CONFIG['rubylibdir']"`
+    RUBY_INCLUDES="-I$ruby_prefix"
+    changequote([, ])dnl
+
+    ac_save_CFLAGS="$CFLAGS"
+    ac_save_CPPFLAGS="$CPPFLAGS"
+    ac_save_LDFLAGS="$LDFLAGS"
+    CFLAGS="$ac_save_CFLAGS $RUBY_INCLUDES"
+    CPPFLAGS="$ac_save_CPPFLAGS $RUBY_INCLUDES"
+    LDFLAGS="$ac_save_LDFLAGS $LIBRUBYARG_SHARED"
+    
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ruby.h>]], [[VALUE rb_ac_test = rb_define_module("actest");]])],[with_ruby="yes";AC_MSG_RESULT(found)],[with_ruby="no";AC_MSG_RESULT(missing)])
+
+    CPPFLAGS="$ac_save_CPPFLAGS"
+    CFLAGS="$ac_save_CFLAGS"
+    LDFLAGS="$ac_save_LDFLAGS"
+  ],[
+    # This allows 'make clean' in the ruby directory to work when
+    # ruby isn't available
+    RUBY=
+    RUBY_INCLUDES=
+    LIBRUBYARG_SHARED=
+    RUBY_LIB=
+    RUBY_DIR=
+    RUBY_LIBDIR=
+    RUBY_ARCH_DIR=
+    with_ruby="no"
+  ])
+
+  AC_SUBST(RUBY_INCLUDES)
+  AC_SUBST(LIBRUBYARG_SHARED)
+  AC_SUBST(RUBY_LIB)
+  AC_SUBST(RUBY_DIR)
+  AC_SUBST(RUBY_LIBDIR)
+  AC_SUBST(RUBY_ARCH_DIR)
+
+  AS_IF([test "x$RUBY_DIR" = "x"],[with_ruby="no"])
+  AM_CONDITIONAL(BUILD_RUBY, test "$with_ruby" = "yes")
+])
diff --git a/m4/pkg.m4 b/m4/pkg.m4
new file mode 100644 (file)
index 0000000..0048a3f
--- /dev/null
+++ b/m4/pkg.m4
@@ -0,0 +1,157 @@
+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
+# 
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+       AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+       _pkg_min_version=m4_default([$1], [0.9.0])
+       AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+       if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+               AC_MSG_RESULT([yes])
+       else
+               AC_MSG_RESULT([no])
+               PKG_CONFIG=""
+       fi
+               
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists.  Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+#
+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
+# this or PKG_CHECK_MODULES is called, or make sure to call
+# PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+  m4_ifval([$2], [$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$PKG_CONFIG"; then
+    if test -n "$$1"; then
+        pkg_cv_[]$1="$$1"
+    else
+        PKG_CHECK_EXISTS([$3],
+                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+                        [pkg_failed=yes])
+    fi
+else
+       pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
+        else 
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+        fi
+       # Put the nasty error message in config.log where it belongs
+       echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+       ifelse([$4], , [AC_MSG_ERROR(dnl
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT
+])],
+               [AC_MSG_RESULT([no])
+                $4])
+elif test $pkg_failed = untried; then
+       ifelse([$4], , [AC_MSG_FAILURE(dnl
+[The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
+               [$4])
+else
+       $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+       $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+       ifelse([$3], , :, [$3])
+fi[]dnl
+])# PKG_CHECK_MODULES