build system: (Hopefully) added support for libtool 1.5 _and_ 2.2.
authorSebastian Harl <sh@tokkee.org>
Wed, 13 May 2009 09:43:36 +0000 (09:43 +0000)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Fri, 22 May 2009 15:39:47 +0000 (17:39 +0200)
The macro LT_PACKAGE_VERSION (which appeared in libtool 2.2) is used to check
weather we're using libtool 2.2.

Makefile.am
configure.in

index b52b0e9..9e3feac 100644 (file)
@@ -1,3 +1,5 @@
+ACLOCAL_AMFLAGS = -I libltdl/m4
+
 SUBDIRS = libltdl src bindings
 
 INCLUDES = $(LTDLINCL)
index 2d3d803..0fd6e78 100644 (file)
@@ -2,6 +2,25 @@ dnl Process this file with autoconf to produce a configure script.
 AC_INIT(collectd, m4_esyscmd(./version-gen.sh))
 AC_CONFIG_SRCDIR(src/collectd.c)
 AC_CONFIG_HEADERS(src/config.h)
+
+m4_ifdef([LT_PACKAGE_VERSION],
+       # libtool >= 2.2
+       [
+        LT_CONFIG_LTDL_DIR([libltdl])
+        LT_INIT([dlopen])
+        LTDL_INIT([convenience])
+       ]
+,
+       # libtool <= 1.5
+       [
+        AC_LIBLTDL_CONVENIENCE
+        AC_SUBST(LTDLINCL)
+        AC_SUBST(LIBLTDL)
+        AC_LIBTOOL_DLOPEN
+        AC_CONFIG_SUBDIRS(libltdl)
+       ]
+)
+
 AM_INIT_AUTOMAKE(dist-bzip2)
 AC_LANG(C)
 
@@ -20,17 +39,11 @@ AC_PROG_MAKE_SET
 AM_PROG_CC_C_O
 AM_CONDITIONAL(COMPILER_IS_GCC, test "x$GCC" = "xyes")
 
-dnl configure libtool
 AC_DISABLE_STATIC
-AC_LIBLTDL_CONVENIENCE
-AC_SUBST(LTDLINCL)
-AC_SUBST(LIBLTDL)
-AC_LIBTOOL_DLOPEN
 AC_PROG_LIBTOOL
 AC_PROG_LEX
 AC_PROG_YACC
 PKG_PROG_PKG_CONFIG
-AC_CONFIG_SUBDIRS(libltdl)
 
 AC_MSG_CHECKING([for kernel type ($host_os)])
 case $host_os in