Refactored configure.ac, added pkg-config support
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -25,6 +25,7 @@ examples/*.o
|
|||||||
tests/*.o
|
tests/*.o
|
||||||
tests/check_parser
|
tests/check_parser
|
||||||
*.a
|
*.a
|
||||||
|
*.pc
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
*.zip
|
*.zip
|
||||||
docs/html
|
docs/html
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ endif
|
|||||||
include_HEADERS = strophe.h
|
include_HEADERS = strophe.h
|
||||||
noinst_HEADERS = strophepp.h
|
noinst_HEADERS = strophepp.h
|
||||||
|
|
||||||
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
|
pkgconfig_DATA = libstrophe.pc
|
||||||
|
|
||||||
EXTRA_DIST = docs
|
EXTRA_DIST = docs
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|||||||
60
configure.ac
60
configure.ac
@@ -12,8 +12,14 @@ AS_CASE([$host_os],
|
|||||||
[freebsd*], [PLATFORM="freebsd"],
|
[freebsd*], [PLATFORM="freebsd"],
|
||||||
[PLATFORM="nix"])
|
[PLATFORM="nix"])
|
||||||
|
|
||||||
PKG_CHECK_MODULES([openssl], [openssl], [],
|
PKG_CHECK_MODULES([openssl], [openssl], [PC_REQUIRES+=(openssl)],
|
||||||
[AC_CHECK_HEADER(openssl/ssl.h, [openssl_LIBS="-lssl -lcrypto"], [AC_MSG_ERROR([openssl not found; openssl required])])])
|
[AC_CHECK_HEADER([openssl/ssl.h],
|
||||||
|
[
|
||||||
|
openssl_LIBS="-lssl -lcrypto"
|
||||||
|
PC_LIBS+=($openssl_LIBS)
|
||||||
|
],
|
||||||
|
[AC_MSG_ERROR([openssl not found; openssl required])]
|
||||||
|
)])
|
||||||
|
|
||||||
PKG_CHECK_MODULES([check], [check >= 0.9.4], [], [AC_MSG_WARN([libcheck not found; unit tests will not be compilable])])
|
PKG_CHECK_MODULES([check], [check >= 0.9.4], [], [AC_MSG_WARN([libcheck not found; unit tests will not be compilable])])
|
||||||
|
|
||||||
@@ -24,18 +30,35 @@ AC_ARG_WITH([libxml2],
|
|||||||
|
|
||||||
if test "x$with_libxml2" != xno; then
|
if test "x$with_libxml2" != xno; then
|
||||||
PKG_CHECK_MODULES([libxml2], [libxml-2.0 >= 2.7],
|
PKG_CHECK_MODULES([libxml2], [libxml-2.0 >= 2.7],
|
||||||
[with_libxml2=yes], [dummy=1])
|
[
|
||||||
if test "x$with_libxml2" != xyes; then
|
with_libxml2=yes
|
||||||
old_CFLAGS=$CFLAGS
|
PC_REQUIRES+=(libxml-2.0)
|
||||||
CFLAGS="-I${includedir}/libxml2"
|
],
|
||||||
AC_CHECK_HEADER([libxml/parser.h],
|
[
|
||||||
[with_libxml2=yes; libxml2_CFLAGS="-I${includedir}/libxml2"; libxml2_LIBS="-lxml2"],
|
old_CFLAGS=$CFLAGS
|
||||||
[AC_MSG_ERROR([libxml2 not found.])])
|
CFLAGS="-I${includedir}/libxml2"
|
||||||
CFLAGS=$old_CFLAGS
|
AC_CHECK_HEADER([libxml/parser.h],
|
||||||
fi
|
[
|
||||||
|
with_libxml2=yes
|
||||||
|
libxml2_CFLAGS="-I${includedir}/libxml2"
|
||||||
|
libxml2_LIBS="-lxml2"
|
||||||
|
PC_LIBS+=($libxml2_LIBS)
|
||||||
|
PC_CFLAGS+=($libxml2_CFLAGS)
|
||||||
|
],
|
||||||
|
[AC_MSG_ERROR([libxml2 not found.])])
|
||||||
|
CFLAGS=$old_CFLAGS
|
||||||
|
])
|
||||||
else
|
else
|
||||||
PKG_CHECK_MODULES([expat], [expat >= 2.0.0], [],
|
PKG_CHECK_MODULES([expat], [expat >= 2.0.0],
|
||||||
[AC_CHECK_HEADER(expat.h, [expat_LIBS="-lexpat"], [AC_MSG_ERROR([expat not found; expat required.])])])
|
[PC_REQUIRES+=(expat)],
|
||||||
|
[AC_CHECK_HEADER([expat.h],
|
||||||
|
[
|
||||||
|
expat_LIBS="-lexpat"
|
||||||
|
PC_LIBS+=($expat_LIBS)
|
||||||
|
],
|
||||||
|
[AC_MSG_ERROR([expat not found; expat required.])]
|
||||||
|
)
|
||||||
|
])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$with_libxml2" = xyes; then
|
if test "x$with_libxml2" = xyes; then
|
||||||
@@ -54,8 +77,8 @@ AC_MSG_NOTICE([libstrophe will use the $with_parser XML parser])
|
|||||||
AC_SEARCH_LIBS([socket], [socket])
|
AC_SEARCH_LIBS([socket], [socket])
|
||||||
|
|
||||||
if test "x$PLATFORM" != xfreebsd; then
|
if test "x$PLATFORM" != xfreebsd; then
|
||||||
AC_CHECK_LIB([resolv], [res_query], [],
|
AC_CHECK_LIB([resolv], [res_query], [LIBS="-lresolv $LIBS"; PC_LIBS+=(-lresolv)],
|
||||||
[AC_CHECK_LIB([resolv], [__res_query], [],
|
[AC_CHECK_LIB([resolv], [__res_query], [LIBS="-lresolv $LIBS"; PC_LIBS+=(-lresolv)],
|
||||||
[AC_MSG_ERROR([libresolv not found; libresolv required. ])])])
|
[AC_MSG_ERROR([libresolv not found; libresolv required. ])])])
|
||||||
else
|
else
|
||||||
AC_MSG_NOTICE([skipping libresolv checks for freebsd])
|
AC_MSG_NOTICE([skipping libresolv checks for freebsd])
|
||||||
@@ -64,8 +87,13 @@ fi
|
|||||||
AC_CHECK_HEADERS([arpa/nameser_compat.h])
|
AC_CHECK_HEADERS([arpa/nameser_compat.h])
|
||||||
|
|
||||||
AM_CONDITIONAL([PARSER_EXPAT], [test x$with_parser != xlibxml2])
|
AM_CONDITIONAL([PARSER_EXPAT], [test x$with_parser != xlibxml2])
|
||||||
|
|
||||||
|
AC_SUBST([PC_REQUIRES], [${PC_REQUIRES[[@]]}])
|
||||||
|
AC_SUBST([PC_CFLAGS], [${PC_CFLAGS[[@]]}])
|
||||||
|
AC_SUBST([PC_LIBS], [${PC_LIBS[[@]]}])
|
||||||
|
|
||||||
AC_SUBST(PARSER_NAME)
|
AC_SUBST(PARSER_NAME)
|
||||||
AC_SUBST(PARSER_CFLAGS)
|
AC_SUBST(PARSER_CFLAGS)
|
||||||
AC_SUBST(PARSER_LIBS)
|
AC_SUBST(PARSER_LIBS)
|
||||||
AC_CONFIG_FILES([Makefile])
|
AC_CONFIG_FILES([Makefile libstrophe.pc])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|||||||
14
libstrophe.pc.in
Normal file
14
libstrophe.pc.in
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
prefix=@prefix@
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
libdir=@libdir@
|
||||||
|
includedir=@includedir@
|
||||||
|
|
||||||
|
Name: libstrophe
|
||||||
|
Description: A simple, lightweight C library for writing XMPP clients
|
||||||
|
URL: http://strophe.im/libstrophe/
|
||||||
|
Version: @VERSION@
|
||||||
|
Requires:
|
||||||
|
Requires.private: @PC_REQUIRES@
|
||||||
|
Libs: -L${libdir} -lstrophe
|
||||||
|
Libs.private: @PC_LIBS@
|
||||||
|
Cflags: -I${includedir} @PC_CFLAGS@
|
||||||
Reference in New Issue
Block a user