fix up the autoconf checking for liboauth and other libraries
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 18 Aug 2010 00:00:33 +0000 (17:00 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 18 Aug 2010 00:00:33 +0000 (17:00 -0700)
Start using pkg-config as its supposed to be used (hopefully)

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Makefile.am
configure.ac

index 1e8f12f..46ccbba 100644 (file)
@@ -7,6 +7,18 @@ bin_SCRIPTS = \
 bti_SOURCES = \
        bti.c
 
+bti_CPPFLAGS =
+       $(LIBCURL_CPPFLAGS) \
+       $(XML_CPPFLAGS) \
+       $(LIBPCRE_CPPFLAGS) \
+       $(LIBOAUTH_CPPFLAGS)
+
+bti_LDADD = \
+       $(LIBCURL_LIBS) \
+       $(XML_LIBS) \
+       $(LIBPCRE_LIBS) \
+       $(LIBOAUTH_LIBS)
+
 dist_man_MANS = \
        bti.1 \
        bti-shrink-urls.1
index afeba02..c97c260 100644 (file)
@@ -16,33 +16,31 @@ AC_PATH_PROG([XSLTPROC], [xsltproc])
 dnl FIXME: Replace `main' with a function in `-lnsl':
 AC_CHECK_LIB([nsl], [main])
 
-AC_CHECK_LIB([pcre], [main])
+PKG_PROG_PKG_CONFIG()
+
+PKG_CHECK_MODULES(LIBOAUTH, oauth)
+AC_SUBST(LIBOAUTH_CFLAGS)
+AC_SUBST(LIBOAUTH_LIBS)
+
+PKG_CHECK_MODULES(LIBPCRE, libpcre)
+AC_SUBST(LIBPCRE_CFLAGS)
+AC_SUBST(LIBPCRE_LIBS)
 
-AC_CHECK_LIB(oauth, main, [], [
-       echo "Error, you need liboauth to build properly."
-       exit -1
-       ])
 
 # CURL
 LIBCURL_CHECK_CONFIG([yes], [], [have_libcurl="yes"], [have_libcurl="no"])
 if test "${have_libcurl}" != yes; then
        AC_MSG_ERROR([libcurl library not found, please install it])
-else
-       CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS"
-       LIBS="${LIBS} ${LIBCURL}"
 fi
 
 # libxml2
 AM_PATH_XML2([], [have_libxml="yes"], [have_libxml="no"])
 if test "${have_libxml}" != yes; then
        AC_MSG_ERROR([libxml not found, please install it])
-else
-       CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
-       LIBS="$LIBS $XML_LIBS"
 fi
 
 # explicitly link DSOs
-LIBS="$LIBS -ldl -loauth"
+LIBS="$LIBS -ldl"
 
 
 dnl Checks for header files.