2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

handle external libs in autoconf

git-svn-id: svn+q:///qpdf/trunk@764 71b93d88-0707-0410-a8cf-f5a4172ac649
This commit is contained in:
Jay Berkenbilt 2009-10-10 17:32:34 +00:00
parent ec20e49450
commit 3d5a7a26e2
6 changed files with 69 additions and 28 deletions

View File

@ -30,8 +30,7 @@
# install to install in a separate location. This is useful for
# packagers.
#XXX
BUILD_ITEMS = manual external-libs libqpdf zlib-flate libtests qpdf examples
BUILD_ITEMS := manual libqpdf zlib-flate libtests qpdf examples
OUTPUT_DIR = build
ALL_TARGETS =
@ -53,9 +52,9 @@ include autoconf.mk
endif
#XXX
##BUILDRULES := libtool
BUILDRULES := gcc-linux
ifeq ($(BUILD_EXTERNAL_LIBS),1)
BUILD_ITEMS := external-libs $(BUILD_ITEMS)
endif
# Prevent gnu make from trying to rebuild .dep files
$(foreach B,$(BUILD_ITEMS),$(eval \

View File

@ -15,3 +15,5 @@ Basic procedure for building with mingw is to run configure and build
in msys and then run the test suite in cygwin with GENDEPS=0.
Also have to deal with gcc runtime DLL.
./configure --disable-test-compare-images --enable-build-external-libs --with-buildrules=mingw

View File

@ -30,3 +30,5 @@ BUILD_HTML=@BUILD_HTML@
BUILD_PDF=@BUILD_PDF@
VALIDATE_DOC=@VALIDATE_DOC@
SKIP_TEST_COMPARE_IMAGES=@SKIP_TEST_COMPARE_IMAGES@
BUILD_EXTERNAL_LIBS=@BUILD_EXTERNAL_LIBS@
BUILDRULES=@BUILDRULES@

View File

@ -15,10 +15,29 @@ AC_HEADER_STDC
LT_INIT([win32-dll])
AC_PROG_LIBTOOL
AC_CHECK_HEADER(zlib.h,,[MISSING_ZLIB_H=1; MISSING_ANY=1])
AC_SEARCH_LIBS(deflate,z zlib,,[MISSING_ZLIB=1; MISSING_ANY=1])
AC_CHECK_HEADER(pcre.h,,[MISSING_PCRE_H=1; MISSING_ANY=1])
AC_SEARCH_LIBS(pcre_compile,pcre,,[MISSING_PCRE=1; MISSING_ANY=1])
AC_SUBST(BUILD_EXTERNAL_LIBS)
BUILD_EXTERNAL_LIBS=0
AC_MSG_CHECKING(for whether to build external libraries)
AC_ARG_ENABLE(build-external-libs,
AS_HELP_STRING([--enable-build-external-libs],
[whether to build external libraries]),
[if test "$enableval" = "yes"; then
BUILD_EXTERNAL_LIBS=1;
else
BUILD_EXTERNAL_LIBS=0;
fi], [BUILD_INTERNAL_LIBS=0])
if test "$BUILD_INTERNAL_LIBS" = "0"; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
if test "$BUILD_INTERNAL_LIBS" = "0"; then
AC_CHECK_HEADER(zlib.h,,[MISSING_ZLIB_H=1; MISSING_ANY=1])
AC_SEARCH_LIBS(deflate,z zlib,,[MISSING_ZLIB=1; MISSING_ANY=1])
AC_CHECK_HEADER(pcre.h,,[MISSING_PCRE_H=1; MISSING_ANY=1])
AC_SEARCH_LIBS(pcre_compile,pcre,,[MISSING_PCRE=1; MISSING_ANY=1])
fi
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
@ -80,23 +99,34 @@ else
CFLAGS=$oCFLAGS
fi
AC_MSG_CHECKING(for whether to use -Werror)
AC_ARG_ENABLE(werror,
AS_HELP_STRING([--enable-werror],
[whether to use werror (default is yes if -Wall works)]),
[if test "$enableval" = "yes"; then
qpdf_USE_WERROR=1;
else
qpdf_USE_WERROR=0;
fi], [qpdf_USE_WERROR=$qpdf_USE_WALL])
if test "$qpdf_USE_WERROR" = "1"; then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -Werror"
CXXFLAGS="$CXXFLAGS -Werror"
else
AC_MSG_RESULT(no)
if test "$BUILD_EXTERNAL_LIBS" = "0"; then
AC_MSG_CHECKING(for whether to use -Werror)
AC_ARG_ENABLE(werror,
AS_HELP_STRING([--enable-werror],
[whether to use werror (default is yes if -Wall works)]),
[if test "$enableval" = "yes"; then
qpdf_USE_WERROR=1;
else
qpdf_USE_WERROR=0;
fi], [qpdf_USE_WERROR=$qpdf_USE_WALL])
if test "$qpdf_USE_WERROR" = "1"; then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -Werror"
CXXFLAGS="$CXXFLAGS -Werror"
else
AC_MSG_RESULT(no)
fi
fi
AC_MSG_CHECKING(which build rules to use)
AC_SUBST(BUILDRULES)
AC_ARG_WITH(buildrules,
AS_HELP_STRING([--with-buildrules=rules],
[which build rules to use; see README]),
[BUILDRULES=$withval],
[BUILDRULES=libtool])
AC_MSG_RESULT($BUILDRULES)
AC_SUBST(SKIP_TEST_COMPARE_IMAGES)
AC_ARG_ENABLE(test-compare-images,
AS_HELP_STRING([--enable-test-compare-images],
@ -284,4 +314,13 @@ if test "$MISSING_ANY" = "1"; then
AC_MSG_ERROR(some required prerequisites were not found)
fi
# Do this last so it doesn't interfere with other tests.
if test "$BUILD_EXTERNAL_LIBS" = "1"; then
if test "$BUILDRULES" = "libtool"; then
AC_MSG_ERROR([BUILDRULES=libtool is not supported when building external libraries])
fi
LDFLAGS="$LDFLAGS -Lexternal-libs/build"
LIBS="$LIBS -lexternal"
fi
AC_OUTPUT()

View File

@ -1,6 +1,5 @@
TARGETS_external-libs = external-libs/$(OUTPUT_DIR)/libexternal.a
INCLUDES_external-libs = external-libs/zlib external-libs/pcre \
external-libs/$(OUTPUT_DIR)
INCLUDES_external-libs = external-libs/zlib external-libs/pcre
SRCS_external-libs_zlib = \
external-libs/zlib/adler32.c \
@ -51,7 +50,7 @@ $(OBJS_external-libs_zlib): external-libs/$(OUTPUT_DIR)/%.$(LOBJ): external-libs
$(call c_libcompile,$<,$(INCLUDES_external-libs))
$(OBJS_external-libs_pcre): external-libs/$(OUTPUT_DIR)/%.$(LOBJ): external-libs/pcre/%.c
$(call c_libcompile,$<,$(INCLUDES_external-libs))
$(call c_libcompile,$<,$(INCLUDES_external-libs) external-libs/$(OUTPUT_DIR))
$(TARGETS_external-libs): $(OBJS_external-libs)
$(call makeslib,$(OBJS_external-libs),$(TARGETS_external-libs))

View File

@ -2,7 +2,7 @@ TARGETS_libqpdf = libqpdf/$(OUTPUT_DIR)/$(call libname,qpdf)
$(TARGETS_libqpdf): $(TARGETS_external-libs)
INCLUDES_libqpdf = include libqpdf
INCLUDES_libqpdf = include libqpdf $(INCLUDES_external-libs)
SRCS_libqpdf = \
libqpdf/BitStream.cc \