Check cunit and openssl in configure and set substitute variables.

This commit is contained in:
Tatsuhiro Tsujikawa 2012-02-08 23:11:06 +09:00
parent 580a2b1b1e
commit fa312caa06
3 changed files with 26 additions and 6 deletions

View File

@ -44,14 +44,32 @@ AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG([0.20]) PKG_PROG_PKG_CONFIG([0.20])
# Checks for libraries. # Checks for libraries.
# zlib
PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3]) PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3])
LIBS=$ZLIB_LIBS $LIBS LIBS=$ZLIB_LIBS $LIBS
CFLAGS=$CFLAGS $ZLIB_CFLAGS CFLAGS=$CFLAGS $ZLIB_CFLAGS
# 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], AC_CHECK_LIB([cunit], [CU_initialize_registry],
[have_cunit=yes], [have_cunit=no]) [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" ]) AM_CONDITIONAL([HAVE_CUNIT], [ test "x${have_cunit}" = "xyes" ])
# openssl (for examples)
PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.0.0])
# Checks for header files. # Checks for header files.
AC_CHECK_HEADERS([ \ AC_CHECK_HEADERS([ \
arpa/inet.h \ arpa/inet.h \

View File

@ -22,8 +22,9 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AM_CFLAGS = -Wall AM_CFLAGS = -Wall
AM_CPPFLAGS = -I$(srcdir)/../lib/includes -I$(builddir)/../lib/includes `pkg-config --cflags libssl libcrypto` AM_CPPFLAGS = -I$(srcdir)/../lib/includes -I$(builddir)/../lib/includes \
AM_LDFLAGS = `pkg-config --libs libssl libcrypto` @OPENSSL_CFLAGS@
AM_LDFLAGS = @OPENSSL_LIBS@
LDADD = $(top_builddir)/lib/libspdylay.la LDADD = $(top_builddir)/lib/libspdylay.la
bin_PROGRAMS = spdycat spdyd bin_PROGRAMS = spdycat spdyd

View File

@ -36,8 +36,9 @@ HFILES = spdylay_pq_test.h spdylay_map_test.h spdylay_queue_test.h \
main_SOURCES = $(HFILES) $(OBJECTS) main_SOURCES = $(HFILES) $(OBJECTS)
main_LDADD = ${top_builddir}/lib/libspdylay.la main_LDADD = ${top_builddir}/lib/libspdylay.la
main_LDFLAGS = -static -lcunit -lncurses main_LDFLAGS = -static @CUNIT_LIBS@ -lncurses
AM_CFLAGS = -Wall -g -O2 -I${top_srcdir}/lib -I${top_srcdir}/lib/includes AM_CFLAGS = -Wall -g -O2 -I${top_srcdir}/lib -I${top_srcdir}/lib/includes \
@CUNIT_CFLAGS@
TESTS = main TESTS = main