Date: Wednesday, March 21, 2007 @ 18:03:24
  Author: marc
    Path: /cvsroot/carob/libmysequoia

Modified: configure.ac (1.35 -> 1.36)

Replaced manual carob detection using obsolete AC_TRY_LINK macro by
standard AC_CHECH_HEADER + AC_CHECK_LIB. 35 lines shorter. Carob
location may now be specified using CPPFLAGS and LDFLAGS (FLAGS
ordering problems are no more hidden under the carpet).


--------------+
 configure.ac |   63 +++++++++++++--------------------------------------------
 1 files changed, 15 insertions(+), 48 deletions(-)


Index: libmysequoia/configure.ac
diff -u libmysequoia/configure.ac:1.35 libmysequoia/configure.ac:1.36
--- libmysequoia/configure.ac:1.35      Mon Mar 19 14:36:37 2007
+++ libmysequoia/configure.ac   Wed Mar 21 18:03:24 2007
@@ -104,6 +104,7 @@
 
 
 # Check for log4cxx headers and library
+# TODO: simplify just like carob below
 AC_MSG_CHECKING([for log4cxx headers])
 log4cxx_header_dir="/usr/include"
 AC_ARG_WITH(log4cxx-headers,  
@@ -147,54 +148,20 @@
 
 
 # Check for Carob headers and library
-AC_MSG_CHECKING([for Carob])
-carob_header_dir="/usr/include"
-AC_ARG_WITH(carob-headers,  
-  [  --with-carob-headers=DIR   Carob header files directory.],
-  [
-    carob_header_dir="$withval"
-  ]
-)
-if test -f "$carob_header_dir/carob/ConnectionParameters.hpp"
-then : # OK
-else
-  AC_MSG_ERROR([You need to install the Carob development package or use 
--with-carob-headers=DIR if the headers are in an unusual place.])
-fi
-# absolute or relative path?
-if test "${carob_header_dir#/}" == "${carob_header_dir}"
-then CAROB_CFLAGS="-I../$carob_header_dir"
-else CAROB_CFLAGS="-I$carob_header_dir"
-fi
-AC_MSG_RESULT([$carob_header_dir])
-AC_SUBST(CAROB_CFLAGS)
-
-AC_MSG_CHECKING([for Carob library])
-case `uname -m` in
-    i?86 ) carob_lib_dir="/usr/lib";;
-  x86_64 ) carob_lib_dir="/usr/lib64";;
-esac
-AC_ARG_WITH(carob-lib,
-  [  --with-carob-lib=DIR   Carob library directory.],
-  [
-    carob_lib_dir="$withval"
-  ]
-)
-save_CXXFLAGS="$CXXFLAGS"
-save_LIBS="$LIBS"
-CXXFLAGS="-I$carob_header_dir"
-LIBS="-L$carob_lib_dir -lcarob -lpthread -L$log4cxx_lib_dir -llog4cxx"
-AC_TRY_LINK([#include <carob/ConnectionParameters.hpp>],
-                    [using namespace CarobNS; ControllerInfo ci; ],
-                    ,AC_MSG_ERROR([You need to install the Carob development 
packages or use --with-carob-lib=DIR if the library is in an unusual place.]))
-CXXFLAGS="$save_CXXFLAGS"
-LIBS="$save_LIBS"
-# absolute or relative path?
-if test "${carob_lib_dir#/}" == "${carob_lib_dir}"
-then CAROB_LDADD="-L../$carob_lib_dir -lcarob -lgmp" # (re-)link to gmp so we
-else CAROB_LDADD="-L$carob_lib_dir -lcarob -lgmp"    # can use libcarob.a
-fi
-AC_SUBST(CAROB_LDADD)
-AC_MSG_RESULT([yes])
+AC_CHECK_HEADER([carob/Common.hpp], ,
+                [AC_MSG_ERROR([[carob/Common.hpp not found. Try for instance:
+          ./configure CPPFLAGS="-I\`pwd\`/../carob/include"
+       or ./configure CPPFLAGS="-I/usr/local/include"]])])
+
+# link ourselves to libgmp so we can use libcarob.a
+AC_CHECK_LIB(gmp, main, ,
+       [AC_MSG_ERROR([[libgmp not found. Try ./configure LDFLAGS="-L..."]])])
+
+# AC_CHECK_LIB does not support namespaces
+AC_CHECK_LIB(carob, main, ,
+       [AC_MSG_ERROR([[libcarob not found. Try for instance:
+       ./configure LDFLAGS="-L`pwd`/../carob"
+    or ./configure LDFLAGS="-L/usr/local/lib"]])], -lgmp)
 
 
 # Check for mysql headers

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to