summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2013-08-31 12:17:38 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-09-09 16:32:12 +0200
commita31df2979265339f71fe3e2d587c4176375b1eff (patch)
tree00c2824900da10f8c1b31471deca139520467ac2 /src
parent84ef91035f36ca6aed70d17da170d323880c5393 (diff)
downloadsssd-a31df2979265339f71fe3e2d587c4176375b1eff.tar.gz
sssd-a31df2979265339f71fe3e2d587c4176375b1eff.tar.xz
sssd-a31df2979265339f71fe3e2d587c4176375b1eff.zip
AUTOTOOLS: Use pkg-config to detect libraries.
We used pkg-config only as a fallback if header files was not found, but detection of library failed in case of available header file and linking problem (missing -Ldir). This patch prefers pkg-config.
Diffstat (limited to 'src')
-rw-r--r--src/external/libcares.m419
-rw-r--r--src/external/libpcre.m414
-rw-r--r--src/external/libpopt.m414
-rw-r--r--src/external/libtalloc.m415
-rw-r--r--src/external/libtdb.m414
-rw-r--r--src/external/libtevent.m421
6 files changed, 70 insertions, 27 deletions
diff --git a/src/external/libcares.m4 b/src/external/libcares.m4
index 5b8a35875..e2a56f157 100644
--- a/src/external/libcares.m4
+++ b/src/external/libcares.m4
@@ -2,9 +2,17 @@ AC_SUBST(CARES_OBJ)
AC_SUBST(CARES_LIBS)
AC_SUBST(CARES_CFLAGS)
-AC_CHECK_HEADERS(ares.h,
- [AC_CHECK_LIB([cares], [ares_init], [ CARES_LIBS="-lcares" ], [AC_MSG_ERROR([No usable c-ares library found])])],
- [AC_MSG_ERROR([c-ares header files are not installed])]
+PKG_CHECK_MODULES([CARES], [libcares], [found_libcares=yes], [found_libcares=no])
+
+SSS_AC_EXPAND_LIB_DIR()
+AS_IF([test x"$found_libcares" != xyes],
+ [AC_CHECK_HEADERS([ares.h],
+ [AC_CHECK_LIB([cares],
+ [ares_init],
+ [CARES_LIBS="-L$sss_extra_libdir -lcares"],
+ [AC_MSG_ERROR([No usable c-ares library found])],
+ [-L$sss_extra_libdir])],
+ [AC_MSG_ERROR([c-ares header files are not installed])])]
)
dnl Check if this particular version of c-ares supports the generic ares_free_data function
@@ -12,9 +20,8 @@ AC_CHECK_LIB([cares],
[ares_free_data],
[AC_DEFINE([HAVE_ARES_DATA], 1, [Does c-ares have ares_free_data()?])
],
- [
- ares_data=1
- ]
+ [ares_data=1],
+ [$CARES_LIBS]
)
AM_CONDITIONAL(BUILD_ARES_DATA, test x$ares_data = x1)
diff --git a/src/external/libpcre.m4 b/src/external/libpcre.m4
index 5917c8cfd..8df860904 100644
--- a/src/external/libpcre.m4
+++ b/src/external/libpcre.m4
@@ -3,7 +3,7 @@ AC_SUBST(PCRE_OBJ)
AC_SUBST(PCRE_LIBS)
AC_SUBST(PCRE_CFLAGS)
-PKG_CHECK_MODULES(PCRE, libpcre)
+PKG_CHECK_MODULES([PCRE], [libpcre], [found_libpcre=yes], [found_libpcre=no])
PKG_CHECK_EXISTS(libpcre >= 7,
[AC_MSG_NOTICE([PCRE version is 7 or higher])],
[AC_MSG_NOTICE([PCRE version is below 7])
@@ -11,5 +11,13 @@ PKG_CHECK_EXISTS(libpcre >= 7,
1,
[Define if libpcre version is less than 7])])
-AC_CHECK_HEADERS(pcre.h)
-AC_CHECK_LIB(pcre, pcre_compile, [ PCRE_LIBS="-lpcre" ], [AC_MSG_ERROR([PCRE is required])])
+SSS_AC_EXPAND_LIB_DIR()
+AS_IF([test x"$found_libpcre" != xyes],
+ [AC_CHECK_HEADERS([pcre.h],
+ [AC_CHECK_LIB([pcre],
+ [pcre_compile],
+ [PCRE_LIBS="-L$sss_extra_libdir -lpcre"],
+ [AC_MSG_ERROR([No usable PCRE library found])],
+ [-L$sss_extra_libdir])],
+ [AC_MSG_ERROR([pcre header files are not installed])])]
+)
diff --git a/src/external/libpopt.m4 b/src/external/libpopt.m4
index e59b2610e..a3681ead6 100644
--- a/src/external/libpopt.m4
+++ b/src/external/libpopt.m4
@@ -3,7 +3,15 @@ AC_SUBST(POPT_OBJ)
AC_SUBST(POPT_LIBS)
AC_SUBST(POPT_CFLAGS)
-AC_CHECK_HEADERS([popt.h],
- [AC_CHECK_LIB(popt, poptGetContext, [ POPT_LIBS="-lpopt" ], [AC_MSG_ERROR([POPT must support poptGetContext])])],
- [AC_MSG_ERROR([POPT development libraries not installed])]
+PKG_CHECK_MODULES([POPT], [popt], [found_popt=yes], [found_popt=no])
+
+SSS_AC_EXPAND_LIB_DIR()
+AS_IF([test x"$found_popt" != xyes],
+ [AC_CHECK_HEADERS([popt.h],
+ [AC_CHECK_LIB([popt],
+ [poptGetContext],
+ [POPT_LIBS="-L$sss_extra_libdir -lpopt"],
+ [AC_MSG_ERROR([POPT library must support poptGetContext])],
+ [-L$sss_extra_libdir])],
+ [AC_MSG_ERROR([POPT header files are not installed])])]
)
diff --git a/src/external/libtalloc.m4 b/src/external/libtalloc.m4
index a4c5b8a9d..a26cb8853 100644
--- a/src/external/libtalloc.m4
+++ b/src/external/libtalloc.m4
@@ -2,6 +2,15 @@ AC_SUBST(TALLOC_OBJ)
AC_SUBST(TALLOC_CFLAGS)
AC_SUBST(TALLOC_LIBS)
-AC_CHECK_HEADER(talloc.h,
- [AC_CHECK_LIB(talloc, talloc_init, [TALLOC_LIBS="-ltalloc"]) ],
- [PKG_CHECK_MODULES(TALLOC, talloc)])
+PKG_CHECK_MODULES([TALLOC], [talloc], [found_talloc=yes], [found_talloc=no])
+
+SSS_AC_EXPAND_LIB_DIR()
+AS_IF([test x"$found_talloc" != xyes],
+ [AC_CHECK_HEADER([talloc.h],
+ [AC_CHECK_LIB([talloc],
+ [talloc_init],
+ [TALLOC_LIBS="-L$sss_extra_libdir -ltalloc"],
+ [AC_MSG_ERROR([libtalloc missing talloc_init])],
+ [-L$sss_extra_libdir])],
+ [AC_MSG_ERROR([libtalloc header files are not installed])])]
+)
diff --git a/src/external/libtdb.m4 b/src/external/libtdb.m4
index 196bc5ccb..04ac71d6b 100644
--- a/src/external/libtdb.m4
+++ b/src/external/libtdb.m4
@@ -2,7 +2,15 @@ AC_SUBST(TDB_OBJ)
AC_SUBST(TDB_CFLAGS)
AC_SUBST(TDB_LIBS)
-AC_CHECK_HEADERS([tdb.h],
- [AC_CHECK_LIB(tdb, tdb_repack, [TDB_LIBS="-ltdb"], [AC_MSG_ERROR([TDB must support tdb_repack])]) ],
- [PKG_CHECK_MODULES(TDB, tdb >= 1.1.3)]
+PKG_CHECK_MODULES([TDB], [tdb >= 1.1.3], [found_tdb=yes], [found_tdb=no])
+
+SSS_AC_EXPAND_LIB_DIR()
+AS_IF([test x"$found_tdb" != xyes],
+ [AC_CHECK_HEADERS([tdb.h],
+ [AC_CHECK_LIB([tdb],
+ [tdb_repack],
+ [TDB_LIBS="-L$sss_extra_libdir -ltdb"],
+ [AC_MSG_ERROR([library TDB must support tdb_repack])],
+ [-L$sss_extra_libdir])],
+ [AC_MSG_ERROR([tdb header files are not installed])])]
)
diff --git a/src/external/libtevent.m4 b/src/external/libtevent.m4
index f19f27bf2..d40b9d423 100644
--- a/src/external/libtevent.m4
+++ b/src/external/libtevent.m4
@@ -2,12 +2,15 @@ AC_SUBST(TEVENT_OBJ)
AC_SUBST(TEVENT_CFLAGS)
AC_SUBST(TEVENT_LIBS)
-AC_CHECK_HEADER(tevent.h,
- [AC_CHECK_LIB(
- tevent,
- tevent_context_init,
- [TEVENT_LIBS="-ltevent -ltalloc"],
- [AC_MSG_ERROR([libtevent missing tevent_context_init])],
- [-ltalloc]) ],
- [PKG_CHECK_MODULES(TEVENT, tevent)],
- )
+PKG_CHECK_MODULES([TEVENT], [tevent], [found_tevent=yes], [found_tevent=no])
+
+SSS_AC_EXPAND_LIB_DIR()
+AS_IF([test x"$found_tevent" != xyes],
+ [AC_CHECK_HEADER([tevent.h],
+ [AC_CHECK_LIB([tevent],
+ [tevent_context_init],
+ [TEVENT_LIBS="-L$sss_extra_libdir -ltevent -ltalloc"],
+ [AC_MSG_ERROR([libtevent missing tevent_context_init])],
+ [-L$sss_extra_libdir -ltalloc])],
+ [AC_MSG_ERROR([tevent header files are not installed])])]
+)