2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-11-11 07:30:57 +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 # install to install in a separate location. This is useful for
# packagers. # packagers.
#XXX BUILD_ITEMS := manual libqpdf zlib-flate libtests qpdf examples
BUILD_ITEMS = manual external-libs libqpdf zlib-flate libtests qpdf examples
OUTPUT_DIR = build OUTPUT_DIR = build
ALL_TARGETS = ALL_TARGETS =
@ -53,9 +52,9 @@ include autoconf.mk
endif endif
#XXX ifeq ($(BUILD_EXTERNAL_LIBS),1)
##BUILDRULES := libtool BUILD_ITEMS := external-libs $(BUILD_ITEMS)
BUILDRULES := gcc-linux endif
# Prevent gnu make from trying to rebuild .dep files # Prevent gnu make from trying to rebuild .dep files
$(foreach B,$(BUILD_ITEMS),$(eval \ $(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. in msys and then run the test suite in cygwin with GENDEPS=0.
Also have to deal with gcc runtime DLL. 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@ BUILD_PDF=@BUILD_PDF@
VALIDATE_DOC=@VALIDATE_DOC@ VALIDATE_DOC=@VALIDATE_DOC@
SKIP_TEST_COMPARE_IMAGES=@SKIP_TEST_COMPARE_IMAGES@ 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]) LT_INIT([win32-dll])
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
AC_CHECK_HEADER(zlib.h,,[MISSING_ZLIB_H=1; MISSING_ANY=1]) AC_SUBST(BUILD_EXTERNAL_LIBS)
AC_SEARCH_LIBS(deflate,z zlib,,[MISSING_ZLIB=1; MISSING_ANY=1]) BUILD_EXTERNAL_LIBS=0
AC_CHECK_HEADER(pcre.h,,[MISSING_PCRE_H=1; MISSING_ANY=1]) AC_MSG_CHECKING(for whether to build external libraries)
AC_SEARCH_LIBS(pcre_compile,pcre,,[MISSING_PCRE=1; MISSING_ANY=1]) 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_UINT16_T
AC_TYPE_UINT32_T AC_TYPE_UINT32_T
@ -80,8 +99,9 @@ else
CFLAGS=$oCFLAGS CFLAGS=$oCFLAGS
fi fi
AC_MSG_CHECKING(for whether to use -Werror) if test "$BUILD_EXTERNAL_LIBS" = "0"; then
AC_ARG_ENABLE(werror, AC_MSG_CHECKING(for whether to use -Werror)
AC_ARG_ENABLE(werror,
AS_HELP_STRING([--enable-werror], AS_HELP_STRING([--enable-werror],
[whether to use werror (default is yes if -Wall works)]), [whether to use werror (default is yes if -Wall works)]),
[if test "$enableval" = "yes"; then [if test "$enableval" = "yes"; then
@ -89,14 +109,24 @@ AC_ARG_ENABLE(werror,
else else
qpdf_USE_WERROR=0; qpdf_USE_WERROR=0;
fi], [qpdf_USE_WERROR=$qpdf_USE_WALL]) fi], [qpdf_USE_WERROR=$qpdf_USE_WALL])
if test "$qpdf_USE_WERROR" = "1"; then if test "$qpdf_USE_WERROR" = "1"; then
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -Werror" CFLAGS="$CFLAGS -Werror"
CXXFLAGS="$CXXFLAGS -Werror" CXXFLAGS="$CXXFLAGS -Werror"
else else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi
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_SUBST(SKIP_TEST_COMPARE_IMAGES)
AC_ARG_ENABLE(test-compare-images, AC_ARG_ENABLE(test-compare-images,
AS_HELP_STRING([--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) AC_MSG_ERROR(some required prerequisites were not found)
fi 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() AC_OUTPUT()

View File

@ -1,6 +1,5 @@
TARGETS_external-libs = external-libs/$(OUTPUT_DIR)/libexternal.a TARGETS_external-libs = external-libs/$(OUTPUT_DIR)/libexternal.a
INCLUDES_external-libs = external-libs/zlib external-libs/pcre \ INCLUDES_external-libs = external-libs/zlib external-libs/pcre
external-libs/$(OUTPUT_DIR)
SRCS_external-libs_zlib = \ SRCS_external-libs_zlib = \
external-libs/zlib/adler32.c \ 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)) $(call c_libcompile,$<,$(INCLUDES_external-libs))
$(OBJS_external-libs_pcre): external-libs/$(OUTPUT_DIR)/%.$(LOBJ): external-libs/pcre/%.c $(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) $(TARGETS_external-libs): $(OBJS_external-libs)
$(call makeslib,$(OBJS_external-libs),$(TARGETS_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) $(TARGETS_libqpdf): $(TARGETS_external-libs)
INCLUDES_libqpdf = include libqpdf INCLUDES_libqpdf = include libqpdf $(INCLUDES_external-libs)
SRCS_libqpdf = \ SRCS_libqpdf = \
libqpdf/BitStream.cc \ libqpdf/BitStream.cc \