[ulogd2 PATCH 02/10] build: use pkg-config for libdbi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



libdbi introduced pkg-config support in 0.9.0, which was released in
2013.  Use it.

Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx>
---
 acinclude.m4           | 84 ------------------------------------------
 configure.ac           |  6 +--
 output/dbi/Makefile.am |  4 +-
 3 files changed, 5 insertions(+), 89 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 8388c452aade..c7a1c67280f7 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -265,87 +265,3 @@ fi
 
 ])
 
-dnl @synopsis CT_CHECK_DBI
-dnl
-dnl This macro tries to find the headers and libraries for libdbi.
-dnl
-dnl If includes are found, the variable DBI_INC will be set. If
-dnl libraries are found, the variable DBI_LIB will be set. if no check
-dnl was successful, the script exits with a error message.
-dnl
-dnl @category InstalledPackages
-dnl @author Pierre Chifflier <chifflier@xxxxxx>
-dnl @version 2008-10-30
-dnl @license AllPermissive
-
-AC_DEFUN([CT_CHECK_DBI], [
-
-AC_ARG_WITH(dbi,
-	[  --with-dbi=PREFIX		Prefix of your libdbi installation],
-	[dbi=$withval], [dbi_prefix=])
-AC_ARG_WITH(dbi-inc,
-	[  --with-dbi-inc=PATH		Path to the include directory of dbi],
-	[dbi_inc=$withval], [dbi_inc=/usr/include])
-AC_ARG_WITH(dbi-lib,
-	[  --with-dbi-lib=PATH		Path to the libraries of dbi],
-	[dbi_lib=$withval], [dbi_lib=/usr/lib])
-
-
-AC_SUBST(DBI_INC)
-AC_SUBST(DBI_LIB)
-
-if test "$dbi_prefix" != "no"; then
-
-if test "$dbi_prefix" != ""; then
-   AC_MSG_CHECKING([for libdbi includes in $dbi_prefix/include])
-   if test -f "$dbi_prefix/include/dbi.h" ; then
-      DBI_INC="-I$dbi_prefix/include"
-      AC_MSG_RESULT([yes])
-   elif test -f "$dbi_prefix/include/dbi/dbi.h" ; then
-      DBI_INC="-I$dbi_prefix/include/dbi"
-      AC_MSG_RESULT([yes])
-   else
-      AC_MSG_WARN(dbi.h not found)
-   fi
-   AC_MSG_CHECKING([for libdbi in $dbi_prefix/lib])
-   if test -f "$dbi_prefix/lib/libdbi.so" ; then
-      DBI_LIB="-L$dbi_prefix/lib -ldbi";
-      AC_MSG_RESULT([yes])
-   else
-      AC_MSG_WARN(libdbi.so not found)
-   fi
-else
-  if test "$dbi_inc" != ""; then
-    AC_MSG_CHECKING([for libdbi includes in $dbi_inc])
-    if test -f "$dbi_inc/dbi.h" ; then
-      DBI_INC="-I$dbi_inc"
-      AC_MSG_RESULT([yes])
-    elif test -f "$dbi_inc/dbi/dbi.h" ; then
-      DBI_INC="-I$dbi_inc/dbi"
-      AC_MSG_RESULT([yes])
-    else
-      AC_MSG_WARN(dbi.h not found)
-    fi
-  fi
-  if test "$dbi_lib" != ""; then
-    AC_MSG_CHECKING([for libdbi in $dbi_lib])
-    if test -f "$dbi_lib/libdbi.so" ; then
-      DBI_LIB="-L$dbi_lib -ldbi";
-      AC_MSG_RESULT([yes])
-    else
-      AC_MSG_WARN(libdbi.so not found)
-    fi
-  fi
-fi
-
-if test "$DBI_INC" = "" ; then
-  AC_CHECK_HEADER([dbi.h], [], AC_MSG_WARN(dbi.h not found))
-fi
-if test "$DBI_LIB" = "" ; then
-  AC_CHECK_LIB(dbi, dbi_close, [], AC_MSG_WARN(libdbi.so not found))
-fi
-
-fi
-
-])
-
diff --git a/configure.ac b/configure.ac
index b24357dcd4b4..a3ad198a1d33 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,9 +102,9 @@ AM_CONDITIONAL([HAVE_SQLITE3], [test "x$libsqlite3_LIBS" != "x"])
 AC_ARG_ENABLE([dbi],
               [AS_HELP_STRING([--enable-dbi], [Enable DBI output plugin [default=test]])])
 AS_IF([test "x$enable_dbi" != "xno"],
-      [CT_CHECK_DBI()])
-AS_IF([test "x$DBI_LIB" != "x"], [enable_dbi=yes], [enable_dbi=no])
-AM_CONDITIONAL(HAVE_DBI, [test "x$DBI_LIB" != "x"])
+      [PKG_CHECK_MODULES([libdbi], [dbi], [], [:])])
+AS_IF([test "x$libdbi_LIBS" != "x"], [enable_dbi=yes], [enable_dbi=no])
+AM_CONDITIONAL([HAVE_DBI], [test "x$libdbi_LIBS" != "x"])
 
 AC_ARG_ENABLE([pcap],
               [AS_HELP_STRING([--enable-pcap], [Enable PCAP output plugin [default=test]])])
diff --git a/output/dbi/Makefile.am b/output/dbi/Makefile.am
index f8b0a9c68c78..9a618b160559 100644
--- a/output/dbi/Makefile.am
+++ b/output/dbi/Makefile.am
@@ -1,9 +1,9 @@
 include $(top_srcdir)/Make_global.am
 
-AM_CPPFLAGS += $(DBI_INC)
+AM_CPPFLAGS += $(libdbi_CFLAGS)
 
 pkglib_LTLIBRARIES = ulogd_output_DBI.la
 
 ulogd_output_DBI_la_SOURCES = ulogd_output_DBI.c ../../util/db.c
-ulogd_output_DBI_la_LIBADD  = ${DBI_LIB}
+ulogd_output_DBI_la_LIBADD  = $(libdbi_LIBS)
 ulogd_output_DBI_la_LDFLAGS = -avoid-version -module
-- 
2.34.1




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux