* configure.ac: Here.
Use autotroll.m4's features instead of duplicating them.
---
ChangeLog | 7 +++++++
configure.ac | 21 ++++++---------------
2 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 37071a7..cb5d835 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2010-10-21 Roland Levillain <roland(a)lrde.epita.fr>
+ Revamp the handling of Qt.
+
+ * configure.ac: Here.
+ Use autotroll.m4's features instead of duplicating them.
+
+2010-10-21 Roland Levillain <roland(a)lrde.epita.fr>
+
Revamp the handling of Boost libraries.
* configure.ac: Here.
diff --git a/configure.ac b/configure.ac
index de405e9..30064c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -228,23 +228,14 @@ AM_CONDITIONAL(HAVE_MAGICKXX, test "x$oln_have_magickxx" = xyes)
## Qt. ##
## --- ##
-oln_have_qt=no
-
-if test "x$with_qt" != xno; then
- AT_WITH_QT([+xml], [], [],
- AC_MSG_WARN([Qt dependent programs will be disabled.]))
-
- if test "x$QT_VERSION_MAJOR" != x; then
- AT_REQUIRE_QT_VERSION([4], AC_MSG_WARN([Your Qt version is too old! Qt dependent programs will be disabled.]),
- AC_DEFINE([HAVE_QT], 1,
- [Define to 1 if we can use Qt]) oln_have_qt=yes)
- if test "x$QT_VERSION_MAJOR" = x4; then
- oln_have_qt=yes
- fi
- fi
+AT_WITH_QT([xml], [], [], [], [oln_have_qt=yes])
+if test $oln_have_qt = yes; then
+ AT_REQUIRE_QT_VERSION([4],
+ AC_MSG_WARN([Qt-dependent programs will be disabled.]),
+ oln_have_expected_qt_version=yes)
fi
+AM_CONDITIONAL([HAVE_QT], [test "x$oln_have_expected_qt_version" = xyes])
-AM_CONDITIONAL([HAVE_QT], [test "x$oln_have_qt" = xyes])
## ---------- ##
--
1.5.6.5
* configure.ac: Here.
Use boost.m4's features instead of duplicating them.
Do not explictly look for the Boost Preprocessor (Boost.PP)
Library, as we do not directly use it.
---
ChangeLog | 9 +++++++++
configure.ac | 35 +++--------------------------------
2 files changed, 12 insertions(+), 32 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 76dbf12..37071a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2010-10-21 Roland Levillain <roland(a)lrde.epita.fr>
+ Revamp the handling of Boost libraries.
+
+ * configure.ac: Here.
+ Use boost.m4's features instead of duplicating them.
+ Do not explictly look for the Boost Preprocessor (Boost.PP)
+ Library, as we do not directly use it.
+
+2010-10-21 Roland Levillain <roland(a)lrde.epita.fr>
+
Revamp the handling of Magick++.
* m4/oln-with-lib.m4 (_OLN_WITH_LIB): Make all arguments
diff --git a/configure.ac b/configure.ac
index 02cd8bd..de405e9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -199,38 +199,10 @@ AM_CONDITIONAL([DARWIN], [echo "$host_os" | grep '^darwin'])
## Boost ##
## ----- ##
-oln_have_boost_preprocessor=no
-oln_have_boost_tuple=no
-
-if test "x$with_boost" != xno; then
- # Is Boost installed?
- BOOST_REQUIRE([], oln_have_boost=no)
-
- if test "x$oln_have_boost" != xno; then
-
- # Preprocessor
- BOOST_FIND_HEADER([boost/preprocessor/repetition/repeat.hpp],
- oln_have_boost_preprocessor=no,
- oln_have_boost_preprocessor=yes)
- if test "x$oln_have_boost_preprocessor" = xyes; then
- AC_DEFINE([HAVE_BOOST_PREPROCESSOR], 1,
- [Define to 1 if we can use Boost Preprocessor.])
- fi
-
- # Tuple
- BOOST_FIND_HEADER([boost/tuple/tuple.hpp],
- oln_have_boost_tuple=no,
- oln_have_boost_tuple=yes)
- if test "x$oln_have_boost_tuple" = xyes; then
- AC_DEFINE([HAVE_BOOST_TUPLE], 1,
- [Define to 1 if we can use Boost Tuple.])
- fi
- fi
-fi
+BOOST_TUPLE
+AM_CONDITIONAL([HAVE_BOOST_TUPLE],
+ [test "x$ac_cv_header_boost_tuple_tuple_hpp" = xyes])
-AM_CONDITIONAL([HAVE_BOOST_PREPROCESSOR],
- [test "x$oln_have_boost_preprocessor" = xyes])
-AM_CONDITIONAL([HAVE_BOOST_TUPLE], [test "x$oln_have_boost_tuple" = xyes])
## ---------------- ##
@@ -669,7 +641,6 @@ Build system type: $build
Option Enabled and available
-------------------------------------------------------------------------------
-Boost Preprocessor --with-boost=@<:@=DIR@:>@ $oln_have_boost_preprocessor
Boost Tuple --with-boost=@<:@=DIR@:>@ $oln_have_boost_tuple
CFITSIO --with-cfitsio@<:@=DIR@:>@ $oln_have_cfitsio
GDCM --with-gdcm@<:@=DIR@:>@ $oln_have_gdcm
--
1.5.6.5
* m4/oln-with-lib.m4 (_OLN_WITH_LIB): Make all arguments
mandatory.
(OLN_WITH_LIB_PKG_CONFIG, _OLN_WITH_LIB_PKG_CONFIG): New macros.
* configure.ac: Use OLN_WITH_LIB_PKG_CONFIG to handle Magick++
---
ChangeLog | 9 +++++
configure.ac | 44 +-----------------------
m4/oln-with-lib.m4 | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 105 insertions(+), 44 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e62355c..76dbf12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-10-21 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Revamp the handling of Magick++.
+
+ * m4/oln-with-lib.m4 (_OLN_WITH_LIB): Make all arguments
+ mandatory.
+ (OLN_WITH_LIB_PKG_CONFIG, _OLN_WITH_LIB_PKG_CONFIG): New macros.
+ * configure.ac: Use OLN_WITH_LIB_PKG_CONFIG to handle Magick++
+
2010-10-20 Roland Levillain <roland(a)lrde.epita.fr>
Have configure be terser.
diff --git a/configure.ac b/configure.ac
index 09b1fa4..02cd8bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -191,9 +191,6 @@ AM_CONDITIONAL([DARWIN], [echo "$host_os" | grep '^darwin'])
## External libraries. ##
## -------------------- ##
-# Prepare calls to pkg-config
-PKG_PROG_PKG_CONFIG
-
### Support for FreeImagePlus has been disabled for Olena 1.0.
## OLN_WITH_LIB([FreeImagePlus], [FreeImagePlus.h], [freeimageplus])
@@ -249,45 +246,8 @@ OLN_WITH_LIB([CFITSIO], [fitsio.h], [cfitsio])
## Magick++. ##
## --------- ##
-# FIXME: We should handle Magick++ both with Magick++-config and
-# pkg-config? instead of OLN_WITH_LIB. See how other projects handle
-# this.
-
-
-AC_ARG_WITH([magickxx],
- [AC_HELP_STRING([--with-magickxx],
- [enable magickxx support (default)])],
- [with_magickxx=$withval],
- [with_magickxx='yes'])
-
-oln_have_magickxx=no
-
-if test "x$with_magickxx" != xno; then
- # Try to use ImageMagick from a specified path.
- if test "x$with_magickxx" != xyes; then
- AC_MSG_CHECKING([with given path $with_magickxx])
- OLN_WITH_LIB([Magick++], [Magick++.h], [Magick++], [magickxx],
- [MAGICKXX])
- fi
-
- # Check with pkg-config if previous test failed or if no path have
- # been passed through --with-magickxx argument.
- if test "x$oln_have_magickxx" = xno; then
- PKG_CHECK_MODULES(MAGICKXX,[ImageMagick++], oln_have_magickxx=yes,
- oln_have_magickxx=no)
-
- if test "x$oln_have_magickxx" = xyes; then
- AC_DEFINE([HAVE_MAGICKXX], 1,
- [Define to 1 if we can use libMagick++])
- # Use standard variable names.
- MAGICKXX_CPPFLAGS="$MAGICKXX_CFLAGS"
- MAGICKXX_LDFLAGS="$MAGICKXX_LIBS"
- AC_SUBST(MAGICKXX_CPPFLAGS)
- AC_SUBST(MAGICKXX_LDFLAGS)
- fi
- fi
-fi
-
+OLN_WITH_LIB_PKG_CONFIG([Magick++], [Magick++.h], [Magick++], [magickxx],
+ [MAGICKXX], [], [ImageMagick++])
AM_CONDITIONAL(HAVE_MAGICKXX, test "x$oln_have_magickxx" = xyes)
#------------------------------------------------------------
diff --git a/m4/oln-with-lib.m4 b/m4/oln-with-lib.m4
index 780923c..01530b9 100644
--- a/m4/oln-with-lib.m4
+++ b/m4/oln-with-lib.m4
@@ -1,6 +1,7 @@
# -*- Autoconf -*-
-# Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+# Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+# (LRDE)
#
# This file is part of Olena.
#
@@ -61,7 +62,7 @@ m4_default([$5], m4_toupper([$3])),dnl
# _OLN_WITH_LIB(PACKAGE, HEADER, LIBRARY, SHELL_NAME, CPP_NAME,
-# [OTHER-LIBRARIES])
+# OTHER-LIBRARIES)
# -------------------------------------------------------------
# Actual implementation of OLN_WITH_LIB.
AC_DEFUN([_OLN_WITH_LIB],
@@ -101,3 +102,94 @@ AC_DEFUN([_OLN_WITH_LIB],
AM_CONDITIONAL([HAVE_$5], [test x$oln_have_$4 = xyes])
AC_LANG_POP([C++])
])# _OLN_WITH_LIB
+
+
+
+# FIXME: Factor the following macros with the previous ones.
+
+
+# OLN_WITH_LIB_PKG_CONFIG(PACKAGE, HEADER, LIBRARY, [SHELL_NAME], [CPP_NAME],
+# [OTHER-LIBRARIES], [MODULE])
+# ---------------------------------------------------------------------------
+# Like OLN_WITH_LIB, except that `pkg-config' is first tried to look
+# for the module (library) named MODULE. If this first step fails
+# (because `pkg-config' is missing, or not working, or cannot find
+# MODULE), use a fall-back code similar to OLN_WITH_LIB's.
+#
+# If not given, MODULE defaults to PACKAGE.
+#
+# Example of use:
+#
+# OLN_WITH_LIB_PKG_CONFIG([Magick++], [Magick++.h], [Magick++], [magickxx],
+# [MAGICKXX], [], [ImageMagick++])
+#
+AC_DEFUN([OLN_WITH_LIB_PKG_CONFIG],
+[dnl Do some sanity checking of the arguments.
+m4_if([$1], , [AC_FATAL([$0: missing argument 1])])dnl
+m4_if([$2], , [AC_FATAL([$0: missing argument 2])])dnl
+m4_if([$3], , [AC_FATAL([$0: missing argument 3])])dnl
+_OLN_WITH_LIB_PKG_CONFIG([$1], [$2], [$3],dnl
+dnl Process optional arguments.
+m4_default([$4], m4_tolower([$3])),dnl
+m4_default([$5], m4_toupper([$3])),dnl
+[$6],dnl
+m4_default([$7], [$1]))dnl
+])# OLN_WITH_LIB_PKG_CONFIG
+
+# _OLN_WITH_LIB_PKG_CONFIG(PACKAGE, HEADER, LIBRARY, SHELL_NAME, CPP_NAME,
+# OTHER-LIBRARIES, MODULE)
+# ------------------------------------------------------------------------
+# Actual implementation of OLN_WITH_LIB_PKG_CONFIG.
+AC_DEFUN([_OLN_WITH_LIB_PKG_CONFIG],
+[dnl
+ AC_REQUIRE([AC_PROG_CXX])
+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+ AC_LANG_PUSH([C++])
+ AC_ARG_WITH([$4],
+ [AC_HELP_STRING([--with-$4@<:@=DIR@:>@],
+ [use $1 (DIR = prefix for $1 installation)])])
+ $5_CPPFLAGS=''
+ $5_LDFLAGS=''
+ if test "x$with_$4" != xno; then
+ # First try with pkg-config.
+ PKG_CHECK_EXISTS([$7], [oln_with_lib_$4_uses_pkg_config=yes])
+ if test x$oln_with_lib_$4_uses_pkg_config = xyes; then
+ # `pkg-config' seems to work and has been able to find the library;
+ # use it.
+ PKG_CHECK_MODULES([$5], [$7],
+ [oln_have_$4=yes
+ AC_DEFINE([HAVE_$5], 1, [Define to 1 if we can use $1])
+ # Define CPPFLAGS and LDFLAGS.
+ $5_CPPFLAGS="$$5_CFLAGS"
+ $5_LDFLAGS="$$5_LIBS"])
+ else
+ # `pkg-config' is absent, unusable or is unable to find the library;
+ # use our fall-back code.
+ if test -n "$with_$4"; then
+ $5_CPPFLAGS="-I${with_$4}/include"
+ $5_LDFLAGS="-L${with_$4}/lib"
+ fi
+ oln_save_CPPFLAGS=$CPPFLAGS
+ oln_save_LDFLAGS=$LDFLAGS
+ CPPFLAGS="$$5_CPPFLAGS $CPPFLAGS"
+ LDFLAGS="$$5_LDFLAGS $LDFLAGS"
+ oln_have_$4=no
+ AC_CHECK_HEADER([$2],
+ [AC_CHECK_LIB([$3],
+ [main],
+ [oln_have_$4=yes
+ $5_LDFLAGS="$$5_LDFLAGS -l$3 $6"
+ AC_DEFINE([HAVE_$5], 1, [Define to 1 if we can use $1])],
+ [], [$6]
+ )]
+ )
+ CPPFLAGS=$oln_save_CPPFLAGS
+ LDFLAGS=$oln_save_LDFLAGS
+ TOOLS_LDFLAGS="$TOOLS_LDFLAGS $$5_LDFLAGS"
+ fi
+ fi
+ AC_SUBST([$5_CPPFLAGS])
+ AC_SUBST([$5_LDFLAGS])
+ AM_CONDITIONAL([HAVE_$5], [test x$oln_have_$4 = xyes])
+ AC_LANG_POP([C++])
+])# _OLN_WITH_LIB_PKG_CONFIG
--
1.5.6.5