Commit 3d5a7a26e2f7aaddb888fdaa8a01711d69722885
1 parent
ec20e494
handle external libs in autoconf
git-svn-id: svn+q:///qpdf/trunk@764 71b93d88-0707-0410-a8cf-f5a4172ac649
Showing
6 changed files
with
69 additions
and
28 deletions
Makefile
| ... | ... | @@ -30,8 +30,7 @@ |
| 30 | 30 | # install to install in a separate location. This is useful for |
| 31 | 31 | # packagers. |
| 32 | 32 | |
| 33 | -#XXX | |
| 34 | -BUILD_ITEMS = manual external-libs libqpdf zlib-flate libtests qpdf examples | |
| 33 | +BUILD_ITEMS := manual libqpdf zlib-flate libtests qpdf examples | |
| 35 | 34 | OUTPUT_DIR = build |
| 36 | 35 | ALL_TARGETS = |
| 37 | 36 | |
| ... | ... | @@ -53,9 +52,9 @@ include autoconf.mk |
| 53 | 52 | |
| 54 | 53 | endif |
| 55 | 54 | |
| 56 | -#XXX | |
| 57 | -##BUILDRULES := libtool | |
| 58 | -BUILDRULES := gcc-linux | |
| 55 | +ifeq ($(BUILD_EXTERNAL_LIBS),1) | |
| 56 | + BUILD_ITEMS := external-libs $(BUILD_ITEMS) | |
| 57 | +endif | |
| 59 | 58 | |
| 60 | 59 | # Prevent gnu make from trying to rebuild .dep files |
| 61 | 60 | $(foreach B,$(BUILD_ITEMS),$(eval \ | ... | ... |
README.windows
| ... | ... | @@ -15,3 +15,5 @@ Basic procedure for building with mingw is to run configure and build |
| 15 | 15 | in msys and then run the test suite in cygwin with GENDEPS=0. |
| 16 | 16 | |
| 17 | 17 | Also have to deal with gcc runtime DLL. |
| 18 | + | |
| 19 | +./configure --disable-test-compare-images --enable-build-external-libs --with-buildrules=mingw | ... | ... |
autoconf.mk.in
configure.ac
| ... | ... | @@ -15,10 +15,29 @@ AC_HEADER_STDC |
| 15 | 15 | LT_INIT([win32-dll]) |
| 16 | 16 | AC_PROG_LIBTOOL |
| 17 | 17 | |
| 18 | -AC_CHECK_HEADER(zlib.h,,[MISSING_ZLIB_H=1; MISSING_ANY=1]) | |
| 19 | -AC_SEARCH_LIBS(deflate,z zlib,,[MISSING_ZLIB=1; MISSING_ANY=1]) | |
| 20 | -AC_CHECK_HEADER(pcre.h,,[MISSING_PCRE_H=1; MISSING_ANY=1]) | |
| 21 | -AC_SEARCH_LIBS(pcre_compile,pcre,,[MISSING_PCRE=1; MISSING_ANY=1]) | |
| 18 | +AC_SUBST(BUILD_EXTERNAL_LIBS) | |
| 19 | +BUILD_EXTERNAL_LIBS=0 | |
| 20 | +AC_MSG_CHECKING(for whether to build external libraries) | |
| 21 | +AC_ARG_ENABLE(build-external-libs, | |
| 22 | + AS_HELP_STRING([--enable-build-external-libs], | |
| 23 | + [whether to build external libraries]), | |
| 24 | + [if test "$enableval" = "yes"; then | |
| 25 | + BUILD_EXTERNAL_LIBS=1; | |
| 26 | + else | |
| 27 | + BUILD_EXTERNAL_LIBS=0; | |
| 28 | + fi], [BUILD_INTERNAL_LIBS=0]) | |
| 29 | +if test "$BUILD_INTERNAL_LIBS" = "0"; then | |
| 30 | + AC_MSG_RESULT(no) | |
| 31 | +else | |
| 32 | + AC_MSG_RESULT(yes) | |
| 33 | +fi | |
| 34 | + | |
| 35 | +if test "$BUILD_INTERNAL_LIBS" = "0"; then | |
| 36 | + AC_CHECK_HEADER(zlib.h,,[MISSING_ZLIB_H=1; MISSING_ANY=1]) | |
| 37 | + AC_SEARCH_LIBS(deflate,z zlib,,[MISSING_ZLIB=1; MISSING_ANY=1]) | |
| 38 | + AC_CHECK_HEADER(pcre.h,,[MISSING_PCRE_H=1; MISSING_ANY=1]) | |
| 39 | + AC_SEARCH_LIBS(pcre_compile,pcre,,[MISSING_PCRE=1; MISSING_ANY=1]) | |
| 40 | +fi | |
| 22 | 41 | |
| 23 | 42 | AC_TYPE_UINT16_T |
| 24 | 43 | AC_TYPE_UINT32_T |
| ... | ... | @@ -80,23 +99,34 @@ else |
| 80 | 99 | CFLAGS=$oCFLAGS |
| 81 | 100 | fi |
| 82 | 101 | |
| 83 | -AC_MSG_CHECKING(for whether to use -Werror) | |
| 84 | -AC_ARG_ENABLE(werror, | |
| 85 | - AS_HELP_STRING([--enable-werror], | |
| 86 | - [whether to use werror (default is yes if -Wall works)]), | |
| 87 | - [if test "$enableval" = "yes"; then | |
| 88 | - qpdf_USE_WERROR=1; | |
| 89 | - else | |
| 90 | - qpdf_USE_WERROR=0; | |
| 91 | - fi], [qpdf_USE_WERROR=$qpdf_USE_WALL]) | |
| 92 | -if test "$qpdf_USE_WERROR" = "1"; then | |
| 93 | - AC_MSG_RESULT(yes) | |
| 94 | - CFLAGS="$CFLAGS -Werror" | |
| 95 | - CXXFLAGS="$CXXFLAGS -Werror" | |
| 96 | -else | |
| 97 | - AC_MSG_RESULT(no) | |
| 102 | +if test "$BUILD_EXTERNAL_LIBS" = "0"; then | |
| 103 | + AC_MSG_CHECKING(for whether to use -Werror) | |
| 104 | + AC_ARG_ENABLE(werror, | |
| 105 | + AS_HELP_STRING([--enable-werror], | |
| 106 | + [whether to use werror (default is yes if -Wall works)]), | |
| 107 | + [if test "$enableval" = "yes"; then | |
| 108 | + qpdf_USE_WERROR=1; | |
| 109 | + else | |
| 110 | + qpdf_USE_WERROR=0; | |
| 111 | + fi], [qpdf_USE_WERROR=$qpdf_USE_WALL]) | |
| 112 | + if test "$qpdf_USE_WERROR" = "1"; then | |
| 113 | + AC_MSG_RESULT(yes) | |
| 114 | + CFLAGS="$CFLAGS -Werror" | |
| 115 | + CXXFLAGS="$CXXFLAGS -Werror" | |
| 116 | + else | |
| 117 | + AC_MSG_RESULT(no) | |
| 118 | + fi | |
| 98 | 119 | fi |
| 99 | 120 | |
| 121 | +AC_MSG_CHECKING(which build rules to use) | |
| 122 | +AC_SUBST(BUILDRULES) | |
| 123 | +AC_ARG_WITH(buildrules, | |
| 124 | + AS_HELP_STRING([--with-buildrules=rules], | |
| 125 | + [which build rules to use; see README]), | |
| 126 | + [BUILDRULES=$withval], | |
| 127 | + [BUILDRULES=libtool]) | |
| 128 | +AC_MSG_RESULT($BUILDRULES) | |
| 129 | + | |
| 100 | 130 | AC_SUBST(SKIP_TEST_COMPARE_IMAGES) |
| 101 | 131 | AC_ARG_ENABLE(test-compare-images, |
| 102 | 132 | AS_HELP_STRING([--enable-test-compare-images], |
| ... | ... | @@ -284,4 +314,13 @@ if test "$MISSING_ANY" = "1"; then |
| 284 | 314 | AC_MSG_ERROR(some required prerequisites were not found) |
| 285 | 315 | fi |
| 286 | 316 | |
| 317 | +# Do this last so it doesn't interfere with other tests. | |
| 318 | +if test "$BUILD_EXTERNAL_LIBS" = "1"; then | |
| 319 | + if test "$BUILDRULES" = "libtool"; then | |
| 320 | + AC_MSG_ERROR([BUILDRULES=libtool is not supported when building external libraries]) | |
| 321 | + fi | |
| 322 | + LDFLAGS="$LDFLAGS -Lexternal-libs/build" | |
| 323 | + LIBS="$LIBS -lexternal" | |
| 324 | +fi | |
| 325 | + | |
| 287 | 326 | AC_OUTPUT() | ... | ... |
external-libs/build.mk
| 1 | 1 | TARGETS_external-libs = external-libs/$(OUTPUT_DIR)/libexternal.a |
| 2 | -INCLUDES_external-libs = external-libs/zlib external-libs/pcre \ | |
| 3 | - external-libs/$(OUTPUT_DIR) | |
| 2 | +INCLUDES_external-libs = external-libs/zlib external-libs/pcre | |
| 4 | 3 | |
| 5 | 4 | SRCS_external-libs_zlib = \ |
| 6 | 5 | external-libs/zlib/adler32.c \ |
| ... | ... | @@ -51,7 +50,7 @@ $(OBJS_external-libs_zlib): external-libs/$(OUTPUT_DIR)/%.$(LOBJ): external-libs |
| 51 | 50 | $(call c_libcompile,$<,$(INCLUDES_external-libs)) |
| 52 | 51 | |
| 53 | 52 | $(OBJS_external-libs_pcre): external-libs/$(OUTPUT_DIR)/%.$(LOBJ): external-libs/pcre/%.c |
| 54 | - $(call c_libcompile,$<,$(INCLUDES_external-libs)) | |
| 53 | + $(call c_libcompile,$<,$(INCLUDES_external-libs) external-libs/$(OUTPUT_DIR)) | |
| 55 | 54 | |
| 56 | 55 | $(TARGETS_external-libs): $(OBJS_external-libs) |
| 57 | 56 | $(call makeslib,$(OBJS_external-libs),$(TARGETS_external-libs)) | ... | ... |
libqpdf/build.mk
| ... | ... | @@ -2,7 +2,7 @@ TARGETS_libqpdf = libqpdf/$(OUTPUT_DIR)/$(call libname,qpdf) |
| 2 | 2 | |
| 3 | 3 | $(TARGETS_libqpdf): $(TARGETS_external-libs) |
| 4 | 4 | |
| 5 | -INCLUDES_libqpdf = include libqpdf | |
| 5 | +INCLUDES_libqpdf = include libqpdf $(INCLUDES_external-libs) | |
| 6 | 6 | |
| 7 | 7 | SRCS_libqpdf = \ |
| 8 | 8 | libqpdf/BitStream.cc \ | ... | ... |