Commit 444fab8f879f3c012668fadce3f27baf0c9d8942

Authored by Jay Berkenbilt
1 parent 2b5ac676

more build fixes

git-svn-id: svn+q:///qpdf/trunk@777 71b93d88-0707-0410-a8cf-f5a4172ac649
@@ -8,6 +8,9 @@ Artistic License which may be found in the source distribution as @@ -8,6 +8,9 @@ Artistic License which may be found in the source distribution as
8 "Artistic-2.0". It is provided "as is" without express or implied 8 "Artistic-2.0". It is provided "as is" without express or implied
9 warranty. 9 warranty.
10 10
  11 +Building on UNIX/Linux
  12 +======================
  13 +
11 For UNIX and UNIX-like systems, you can usually get by with just 14 For UNIX and UNIX-like systems, you can usually get by with just
12 15
13 ./configure 16 ./configure
@@ -17,8 +20,32 @@ make install @@ -17,8 +20,32 @@ make install
17 For more detailed general information, see the "INSTALL" file in this 20 For more detailed general information, see the "INSTALL" file in this
18 directory. 21 directory.
19 22
20 -For specific information about building qpdf on Windows, see  
21 -"README.windows". 23 +Building on Windows
  24 +===================
  25 +
  26 +QPDF is known to build and pass its test suite with mingw (gcc 4.4.0)
  27 +and Microsoft Visual C++ .NET 2008 Express. In both cases, cygwin is
  28 +required to run the test suite. Either cygwin or MSYS is required to
  29 +build as well in order to get make and other related tools. The MSVC
  30 +build has only been tested under cygwin. The mingw build requires
  31 +MSYS and will probably not work with cygwin.
  32 +
  33 +For details on how to build under Windows, see README.windows.
  34 +
  35 +
  36 +Additional Notes on Build
  37 +=========================
  38 +
  39 +QPDF's build system, inspired by abuild (http://www.abuild.org), can
  40 +optionally use its own built-in rules rather than using libtool and
  41 +obeying the compiler specified with configure. This can be enabled by
  42 +passing --with-buildrules=buildrules where buildrules corresponds to
  43 +one of the .mk files (other than rules.mk) in the make directory.
  44 +This should never be necessary on a UNIX system, but may be necessary
  45 +on a Windows system. See README.windows for details. There is a
  46 +gcc-linux.mk file enable "gcc-linux" build rules, but it is intended
  47 +to help test the build system; Linux users should build with the
  48 +"libtools" rules, which are enabled by default.
22 49
23 The QPDF package provides some executables and a software library. A 50 The QPDF package provides some executables and a software library. A
24 user's manual can be found in the "doc" directory. The docbook 51 user's manual can be found in the "doc" directory. The docbook
README.windows
@@ -21,9 +21,9 @@ If you have MSYS and Mingw installed, you can run configure as follows: @@ -21,9 +21,9 @@ If you have MSYS and Mingw installed, you can run configure as follows:
21 To build with msvc, you must be running in a shell environment that 21 To build with msvc, you must be running in a shell environment that
22 puts the MSVC tools in your path. Then you can run 22 puts the MSVC tools in your path. Then you can run
23 23
24 -XXX WHAT? 24 +CC=cl CXX="cl /TP /GR" CPPFLAGS=-DHAVE_VSNPRINTF ./configure --disable-test-compare-images --enable-build-external-libs --with-buildrules=msvc
25 25
26 -./configure --disable-test-compare-images --enable-build-external-libs --with-buildrules=msvc 26 +This is tested with MSVC .NET 2008 Express.
27 27
28 From there, run 28 From there, run
29 29
configure.ac
@@ -84,19 +84,30 @@ else @@ -84,19 +84,30 @@ else
84 AC_MSG_RESULT(no) 84 AC_MSG_RESULT(no)
85 fi 85 fi
86 86
87 -qpdf_USE_WALL=0  
88 -AC_MSG_CHECKING(for whether $CC supports -Wall)  
89 -oCFLAGS=$CFLAGS  
90 -CFLAGS="$CFLAGS -Wall"  
91 -AC_TRY_COMPILE([], [int a = 1; int b = a; a = b;],  
92 - qpdf_USE_WALL=1,  
93 - qpdf_USE_WALL=0)  
94 -if test "$qpdf_USE_WALL" = "1"; then  
95 - AC_MSG_RESULT(yes)  
96 - CXXFLAGS="$CXXFLAGS -Wall"  
97 -else  
98 - AC_MSG_RESULT(no)  
99 - CFLAGS=$oCFLAGS 87 +AC_MSG_CHECKING(which build rules to use)
  88 +AC_SUBST(BUILDRULES)
  89 +AC_ARG_WITH(buildrules,
  90 + AS_HELP_STRING([--with-buildrules=rules],
  91 + [which build rules to use; see README]),
  92 + [BUILDRULES=$withval],
  93 + [BUILDRULES=libtool])
  94 +AC_MSG_RESULT($BUILDRULES)
  95 +
  96 +if test "$BUILDRULES" != "msvc"; then
  97 + qpdf_USE_WALL=0
  98 + AC_MSG_CHECKING(for whether $CC supports -Wall)
  99 + oCFLAGS=$CFLAGS
  100 + CFLAGS="$CFLAGS -Wall"
  101 + AC_TRY_COMPILE([], [int a = 1; int b = a; a = b;],
  102 + qpdf_USE_WALL=1,
  103 + qpdf_USE_WALL=0)
  104 + if test "$qpdf_USE_WALL" = "1"; then
  105 + AC_MSG_RESULT(yes)
  106 + CXXFLAGS="$CXXFLAGS -Wall"
  107 + else
  108 + AC_MSG_RESULT(no)
  109 + CFLAGS=$oCFLAGS
  110 + fi
100 fi 111 fi
101 112
102 if test "$BUILD_EXTERNAL_LIBS" = "0"; then 113 if test "$BUILD_EXTERNAL_LIBS" = "0"; then
@@ -118,15 +129,6 @@ if test "$BUILD_EXTERNAL_LIBS" = "0"; then @@ -118,15 +129,6 @@ if test "$BUILD_EXTERNAL_LIBS" = "0"; then
118 fi 129 fi
119 fi 130 fi
120 131
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 -  
130 AC_SUBST(SKIP_TEST_COMPARE_IMAGES) 132 AC_SUBST(SKIP_TEST_COMPARE_IMAGES)
131 AC_ARG_ENABLE(test-compare-images, 133 AC_ARG_ENABLE(test-compare-images,
132 AS_HELP_STRING([--enable-test-compare-images], 134 AS_HELP_STRING([--enable-test-compare-images],
make/msvc.mk
@@ -40,27 +40,26 @@ define makeslib @@ -40,27 +40,26 @@ define makeslib
40 lib /nologo /OUT:$(2) $(1) 40 lib /nologo /OUT:$(2) $(1)
41 endef 41 endef
42 42
43 -# 1 2 3 4 5 6 7  
44 -# Usage: $(call makelib,objs,library,ldflags,libs,current,revision,age) 43 +# 1 2 3 4 5
  44 +# Usage: $(call makelib,objs,library,current,revision,age)
45 define makelib 45 define makelib
46 - cl /nologo /Zi /Gy /EHsc /MD /LD /Fe$(basename $(2))$(5).dll $(1) \ 46 + cl /nologo /Zi /Gy /EHsc /MD /LD /Fe$(basename $(2))$(3).dll $(1) \
47 /link /incremental:no \ 47 /link /incremental:no \
48 - $(foreach L,$(subst -L,,$(3)),/LIBPATH:$(L)) \  
49 - $(foreach L,$(subst -l,,$(4)),$(L).lib)  
50 - if [ -f $(basename $(2))$(5).dll.manifest ]; then \  
51 - mt.exe -nologo -manifest $(basename $(2))$(5).dll.manifest \  
52 - -outputresource:$(basename $(2))$(5).dll\;2; \ 48 + $(foreach L,$(subst -L,,$(LDFLAGS)),/LIBPATH:$(L)) \
  49 + $(foreach L,$(subst -l,,$(LIBS)),$(L).lib)
  50 + if [ -f $(basename $(2))$(3).dll.manifest ]; then \
  51 + mt.exe -nologo -manifest $(basename $(2))$(3).dll.manifest \
  52 + -outputresource:$(basename $(2))$(3).dll\;2; \
53 fi 53 fi
54 - mv $(2)$(5).lib $(2).lib  
55 endef 54 endef
56 55
57 -# 1 2 3 4  
58 -# Usage: $(call makebin,objs,binary,ldflags,libs) 56 +# 1 2
  57 +# Usage: $(call makebin,objs,binary)
59 define makebin 58 define makebin
60 cl /nologo /Zi /Gy /EHsc /MD $(1) \ 59 cl /nologo /Zi /Gy /EHsc /MD $(1) \
61 /link /incremental:no /OUT:$(2) \ 60 /link /incremental:no /OUT:$(2) \
62 - $(foreach L,$(subst -L,,$(3)),/LIBPATH:$(L)) \  
63 - $(foreach L,$(subst -l,,$(4)),$(L).lib) 61 + $(foreach L,$(subst -L,,$(LDFLAGS)),/LIBPATH:$(L)) \
  62 + $(foreach L,$(subst -l,,$(LIBS)),$(L).lib)
64 if [ -f $(2).manifest ]; then \ 63 if [ -f $(2).manifest ]; then \
65 mt.exe -nologo -manifest $(2).manifest \ 64 mt.exe -nologo -manifest $(2).manifest \
66 -outputresource:$(2)\;2; \ 65 -outputresource:$(2)\;2; \