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 8 "Artistic-2.0". It is provided "as is" without express or implied
9 9 warranty.
10 10  
  11 +Building on UNIX/Linux
  12 +======================
  13 +
11 14 For UNIX and UNIX-like systems, you can usually get by with just
12 15  
13 16 ./configure
... ... @@ -17,8 +20,32 @@ make install
17 20 For more detailed general information, see the "INSTALL" file in this
18 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 50 The QPDF package provides some executables and a software library. A
24 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 21 To build with msvc, you must be running in a shell environment that
22 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 28 From there, run
29 29  
... ...
configure.ac
... ... @@ -84,19 +84,30 @@ else
84 84 AC_MSG_RESULT(no)
85 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 111 fi
101 112  
102 113 if test "$BUILD_EXTERNAL_LIBS" = "0"; then
... ... @@ -118,15 +129,6 @@ if test "$BUILD_EXTERNAL_LIBS" = "0"; then
118 129 fi
119 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 132 AC_SUBST(SKIP_TEST_COMPARE_IMAGES)
131 133 AC_ARG_ENABLE(test-compare-images,
132 134 AS_HELP_STRING([--enable-test-compare-images],
... ...
make/msvc.mk
... ... @@ -40,27 +40,26 @@ define makeslib
40 40 lib /nologo /OUT:$(2) $(1)
41 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 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 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 53 fi
54   - mv $(2)$(5).lib $(2).lib
55 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 58 define makebin
60 59 cl /nologo /Zi /Gy /EHsc /MD $(1) \
61 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 63 if [ -f $(2).manifest ]; then \
65 64 mt.exe -nologo -manifest $(2).manifest \
66 65 -outputresource:$(2)\;2; \
... ...