From fa312caa069e45994cee32920d2de62ff009b80b Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 8 Feb 2012 23:11:06 +0900 Subject: [PATCH] Check cunit and openssl in configure and set substitute variables. --- configure.ac | 22 ++++++++++++++++++++-- examples/Makefile.am | 5 +++-- tests/Makefile.am | 5 +++-- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index fadf0c93..448998f0 100644 --- a/configure.ac +++ b/configure.ac @@ -44,14 +44,32 @@ AC_PROG_MAKE_SET PKG_PROG_PKG_CONFIG([0.20]) # Checks for libraries. + +# zlib PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3]) LIBS=$ZLIB_LIBS $LIBS CFLAGS=$CFLAGS $ZLIB_CFLAGS -AC_CHECK_LIB([cunit], [CU_initialize_registry], - [have_cunit=yes], [have_cunit=no]) +# cunit +PKG_CHECK_MODULES([CUNIT], [cunit >= 2.1], [have_cunit=yes], [have_cunit=no]) +# If pkg-config does not find cunit, check it using AC_CHECK_LIB. We +# do this because Debian (Ubuntu) lacks pkg-config file for cunit. +if test "x${have_cunit}" = "xno"; then + AC_MSG_WARN([${CUNIT_PKG_ERRORS}]) + AC_CHECK_LIB([cunit], [CU_initialize_registry], + [have_cunit=yes], [have_cunit=no]) + if test "x${have_cunit}" = "xyes"; then + CUNIT_LIBS="-lcunit" + CUNIT_CFLAGS="" + AC_SUBST([CUNIT_LIBS]) + AC_SUBST([CUNIT_CFLAGS]) + fi +fi AM_CONDITIONAL([HAVE_CUNIT], [ test "x${have_cunit}" = "xyes" ]) +# openssl (for examples) +PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.0]) + # Checks for header files. AC_CHECK_HEADERS([ \ arpa/inet.h \ diff --git a/examples/Makefile.am b/examples/Makefile.am index 2017f8d6..480c455d 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -22,8 +22,9 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. AM_CFLAGS = -Wall -AM_CPPFLAGS = -I$(srcdir)/../lib/includes -I$(builddir)/../lib/includes `pkg-config --cflags libssl libcrypto` -AM_LDFLAGS = `pkg-config --libs libssl libcrypto` +AM_CPPFLAGS = -I$(srcdir)/../lib/includes -I$(builddir)/../lib/includes \ + @OPENSSL_CFLAGS@ +AM_LDFLAGS = @OPENSSL_LIBS@ LDADD = $(top_builddir)/lib/libspdylay.la bin_PROGRAMS = spdycat spdyd diff --git a/tests/Makefile.am b/tests/Makefile.am index 18b4a779..0e247b9b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -36,8 +36,9 @@ HFILES = spdylay_pq_test.h spdylay_map_test.h spdylay_queue_test.h \ main_SOURCES = $(HFILES) $(OBJECTS) main_LDADD = ${top_builddir}/lib/libspdylay.la -main_LDFLAGS = -static -lcunit -lncurses -AM_CFLAGS = -Wall -g -O2 -I${top_srcdir}/lib -I${top_srcdir}/lib/includes +main_LDFLAGS = -static @CUNIT_LIBS@ -lncurses +AM_CFLAGS = -Wall -g -O2 -I${top_srcdir}/lib -I${top_srcdir}/lib/includes \ + @CUNIT_CFLAGS@ TESTS = main