configure.ac 10.7 KB
Newer Older
Kristian Høgsberg's avatar
Kristian Høgsberg committed
1
AC_PREREQ(2.59)
Albert Astals Cid's avatar
Albert Astals Cid committed
2
AC_INIT(poppler, 0.5.9)
Kristian Høgsberg's avatar
Kristian Høgsberg committed
3
4
5
6
7
8
9
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AM_CONFIG_HEADER(config.h)
AM_CONFIG_HEADER(poppler/poppler-config.h)

dnl ##### Checks for programs.
AC_PROG_LIBTOOL
AC_PROG_CC
10
AC_PROG_CXX
Kristian Høgsberg's avatar
Kristian Høgsberg committed
11
12
13
14
15
16
17
AC_ISC_POSIX
AC_PROG_CC_STDC
#if test -z "$CXX" -a "$CC" = "gcc"; then
#  CXX="gcc"
#fi
AC_PROG_CXX
AC_PROG_INSTALL
18
AC_CHECK_FUNC(gettimeofday, AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Defines if gettimeofday is available on your system]))
Kristian Høgsberg's avatar
Kristian Høgsberg committed
19
20

dnl Enable these unconditionally.
21
AC_DEFINE([OPI_SUPPORT], [1], [Generate OPI comments in PS output.])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
22
23
24
AC_DEFINE([MULTITHREADED], [1], [Enable multithreading support.])
AC_DEFINE([TEXTOUT_WORD_LIST], [1], [Enable word list support.])

25
26
27
28
29
30
31
32
dnl Install xpdf headers
AC_ARG_ENABLE(xpdf-headers,
	      AC_HELP_STRING([--enable-xpdf-headers],
	                     [Install unsupported xpdf headers.]),
              enable_xpdf_headers=$enableval,
              enable_xpdf_headers="no")
AM_CONDITIONAL(ENABLE_XPDF_HEADERS, test x$enable_xpdf_headers = xyes)

33
34
AC_ARG_ENABLE(fixedpoint,
[  --enable-fixedpoint     use fixed point (instead of floating point) arithmetic],
35
AC_DEFINE(USE_FIXEDPOINT, [1], [Use fixed point arithmetic]))
36

37
AC_DEFINE_DIR(POPPLER_DATADIR, "{datarootdir}/poppler", [Poppler data dir])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
38
39
40
41
42

dnl ##### Checks for header files.
AC_PATH_XTRA
AC_HEADER_DIRENT

43
44
45
46
AC_ARG_ENABLE(exceptions,
	      [  --enable-exceptions     use C++ exceptions],
	      AC_DEFINE([USE_EXCEPTIONS], [], [Throw exceptions to deal with not enough memory and similar problems]))

Kristian Høgsberg's avatar
Kristian Høgsberg committed
47
48
49
50
51
52
53
54
55
56
57
58
dnl ##### Switch over to C++.  This will make the checks below a little
dnl ##### bit stricter (requiring function prototypes in include files).
dnl ##### (99% of xpdf is written in C++.)
AC_LANG_CPLUSPLUS

dnl ##### Check for extra libraries needed by X.  (LynxOS needs this.)
AC_CHECK_FUNC(gethostbyname)
if test $ac_cv_func_gethostbyname = no; then
  AC_CHECK_LIB(bsd, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd")
fi

dnl ##### Checks for library functions.
59
AC_CHECK_FUNCS(popen mkstemp mkstemps)
Kristian Høgsberg's avatar
Kristian Høgsberg committed
60
61
62
63
64
65
66
67
68
69
70
71
72
73

dnl ##### Back to C for the library tests.
AC_LANG_C

dnl ##### Check for fseeko/ftello or fseek64/ftell64
dnl The LARGEFILE and FSEEKO macros have to be called in C, not C++, mode.
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
AC_CHECK_FUNCS(fseek64, xpdf_cv_func_fseek64=yes, xpdf_cv_func_fseek64=no)
AC_CHECK_FUNCS(ftell64, xpdf_cv_func_ftell64=yes, xpdf_cv_func_ftell64=no)
if test "$xpdf_cv_func_fseek64" = yes -a "$xpdf_cv_func_ftell64" = yes; then
  AC_DEFINE(HAVE_FSEEK64)
fi

74
dnl Test for zlib
75
76
77
AC_ARG_ENABLE([zlib],
  [AS_HELP_STRING([--enable-zlib],[Build with zlib])],
  [],[enable_zlib="no"])
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
if test x$enable_zlib = xyes; then
  AC_CHECK_LIB([z], [inflate],,
	       AC_MSG_ERROR("*** zlib library not found ***"))
  AC_CHECK_HEADERS([zlib.h],,
		   AC_MSG_ERROR("*** zlib headers not found ***"))
elif test x$enable_zlib = xtry; then
  AC_CHECK_LIB([z], [inflate],
               [enable_zlib="yes"],
	       [enable_zlib="no"])
  AC_CHECK_HEADERS([zlib.h],,
		   [enable_zlib="no"])
fi

if test x$enable_zlib = xyes; then
  ZLIB_LIBS="-lz"
  AC_SUBST(ZLIB_LIBS)
  AC_DEFINE(ENABLE_ZLIB)
fi

AM_CONDITIONAL(BUILD_ZLIB, test x$enable_zlib = xyes)
AH_TEMPLATE([ENABLE_ZLIB],
	    [Use zlib instead of builtin zlib decoder.])
100
101
102
103
104
105
106

dnl Test for libjpeg
AC_ARG_ENABLE(libjpeg,
	      AC_HELP_STRING([--disable-libjpeg],
	                     [Don't build against libjpeg.]),
              enable_libjpeg=$enableval,
              enable_libjpeg="try")
107
if test x$enable_libjpeg != xno; then
108
  POPPLER_FIND_JPEG
109
110
111
112
113
114
115
fi

AM_CONDITIONAL(BUILD_LIBJPEG, test x$enable_libjpeg = xyes)
AH_TEMPLATE([ENABLE_LIBJPEG],
            [Use libjpeg instead of builtin jpeg decoder.])


Kristian Høgsberg's avatar
Kristian Høgsberg committed
116
117
118
dnl Check for freetype headers
FREETYPE_LIBS=
FREETYPE_CFLAGS=
119

120
PKG_CHECK_MODULES(FREETYPE, freetype2,
121
122
123
124
                  [freetype_pkgconfig=yes], [freetype_pkgconfig=no])

if test "x$freetype_pkgconfig" = "xyes"; then

Kristian Høgsberg's avatar
Kristian Høgsberg committed
125
126
  AC_DEFINE(HAVE_FREETYPE_H, 1, [Have FreeType2 include files])

127
128
129
130
else

  AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
  if test "x$FREETYPE_CONFIG" != "xno" ; then
131

132
133
134
    FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
    FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
    AC_DEFINE(HAVE_FREETYPE_H, 1, [Have FreeType2 include files])
135

Kristian Høgsberg's avatar
Kristian Høgsberg committed
136
137
138
139
140
141
142
  fi

fi

AC_SUBST(FREETYPE_CFLAGS)
AC_SUBST(FREETYPE_LIBS)

143
144
PKG_CHECK_MODULES(FONTCONFIG, fontconfig)

Kristian Høgsberg's avatar
Kristian Høgsberg committed
145
146
147
148
149
AC_ARG_ENABLE(splash-output,
              AC_HELP_STRING([--disable-splash-output],
	                     [Don't build the Splash graphics backend.]),,
              enable_splash_output="yes")
AM_CONDITIONAL(BUILD_SPLASH_OUTPUT, test x$enable_splash_output = xyes)
150
151
152
153
AH_TEMPLATE([HAVE_SPLASH], [Use splash for rendering.])
if test x$enable_splash_output = xyes; then
  AC_DEFINE(HAVE_SPLASH)
fi
Kristian Høgsberg's avatar
Kristian Høgsberg committed
154

155
156
CAIRO_VERSION="0.5"
AC_SUBST(CAIRO_VERSION)
Kristian Høgsberg's avatar
Kristian Høgsberg committed
157
158
AC_ARG_ENABLE(cairo-output,
              AC_HELP_STRING([--disable-cairo-output],
159
160
161
                             [Don't build the cairo graphics backend.]),
              enable_cairo_output=$enableval,
              enable_cairo_output="try")
Kristian Høgsberg's avatar
Kristian Høgsberg committed
162
if test x$enable_cairo_output = xyes; then
163
  PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
164
elif test x$enable_cairo_output = xtry; then
165
  PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION,
166
167
                    [enable_cairo_output="yes"],
                    [enable_cairo_output="no"])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
168
169
fi

170
171
172
173
AM_CONDITIONAL(BUILD_CAIRO_OUTPUT, test x$enable_cairo_output = xyes)
AH_TEMPLATE([HAVE_CAIRO], [Use cairo for rendering.])
if test x$enable_cairo_output = xyes; then
  AC_DEFINE(HAVE_CAIRO)
174
175
176
177
178
  CAIRO_FEATURE="#define POPPLER_HAS_CAIRO 1"
  CAIRO_REQ="cairo"
else
  CAIRO_FEATURE="#undef POPPLER_HAS_CAIRO"
  CAIRO_REQ=""
179
fi
180
181
AC_SUBST(CAIRO_FEATURE)
AC_SUBST(CAIRO_REQ)
182

183
AC_ARG_ENABLE(poppler-glib,
184
185
186
187
188
              AC_HELP_STRING([--disable-poppler-glib],
	                     [Don't compile poppler glib wrapper.]),
              enable_poppler_glib=$enableval,
              enable_poppler_glib="try")
if test x$enable_poppler_glib = xyes; then
189
  PKG_CHECK_MODULES(POPPLER_GLIB, gdk-2.0 >= 2.4.0 glib >= 2.6)
190
elif test x$enable_poppler_glib = xtry; then
191
  PKG_CHECK_MODULES(POPPLER_GLIB, gdk-2.0 >= 2.4.0,
192
193
194
                    [enable_poppler_glib="yes"],
                    [enable_poppler_glib="no"])
fi
195
196
197
if test x$enable_poppler_glib = xyes; then
  AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
fi
198
199
AM_CONDITIONAL(BUILD_POPPLER_GLIB, test x$enable_poppler_glib = xyes)

200
201
GTK_DOC_CHECK([1.0])

202
203
204
205
206
207
208
AC_ARG_ENABLE(poppler-qt,
	      AC_HELP_STRING([--disable-poppler-qt],
			     [Don't compile poppler qt wrapper.]),
	      enable_poppler_qt=$enableval,
	      enable_poppler_qt="try")

if test x$enable_poppler_qt = xyes; then
209
  POPPLER_FIND_QT(POPPLER_QT,,)
210
elif test x$enable_poppler_qt = xtry; then
211
212
213
  POPPLER_FIND_QT(POPPLER_QT,
		  [enable_poppler_qt="yes"],
                  [enable_poppler_qt="no"])
214
fi
215
216
AC_SUBST(POPPLER_QT_CXXFLAGS)
AC_SUBST(POPPLER_QT_LIBS)
217

218
AM_CONDITIONAL(BUILD_POPPLER_QT, test "x$enable_poppler_qt" = "xyes")
219

220
221
222
223
dnl 
dnl Try Qt4
dnl

224
225
226
227
228
AC_ARG_ENABLE(poppler-qt4,
              AC_HELP_STRING([--disable-poppler-qt4],
	                     [Don't compile poppler Qt4 wrapper.]),
              enable_poppler_qt4=$enableval,
              enable_poppler_qt4="try")
229
if test x$enable_poppler_qt4 = xyes; then
230
231
  PKG_CHECK_MODULES(POPPLER_QT4, 
	            QtCore >= 4.1.0 QtGui >= 4.1.0 QtXml >= 4.1.0 QtTest >= 4.1.0)
232
elif test x$enable_poppler_qt4 = xtry; then
233
234
235
236
  PKG_CHECK_MODULES(POPPLER_QT4,
		    QtCore >= 4.1.0 QtGui >= 4.1.0 QtXml >= 4.1.0 QtTest >= 4.1.0,
                    [enable_poppler_qt4="yes"],
                    [enable_poppler_qt4="no"])
237
fi
238
239
240
241

AC_SUBST(POPPLER_QT4_CXXFLAGS)
AC_SUBST(POPPLER_QT4_LIBS)

242
AM_CONDITIONAL(BUILD_POPPLER_QT4, test "x$enable_poppler_qt4" = "xyes")
243

Kristian Høgsberg's avatar
Kristian Høgsberg committed
244
245
AC_ARG_ENABLE(gtk-test,
              AC_HELP_STRING([--disable-gtk-test],
246
247
248
	                     [Don't compile GTK+ test program.]),
              enable_gtk_test=$enableval,
              enable_gtk_test="try")
Kristian Høgsberg's avatar
Kristian Høgsberg committed
249
if test x$enable_gtk_test = xyes; then
250
  PKG_CHECK_MODULES(GTK_TEST, gtk+-2.0 >= 2.8.0 gdk-pixbuf-2.0 libglade-2.0)
251
elif test x$enable_gtk_test = xtry; then
252
  PKG_CHECK_MODULES(GTK_TEST, gtk+-2.0 >= 2.8.0 gdk-pixbuf-2.0 libglade-2.0,
253
254
                    [enable_gtk_test="yes"],
                    [enable_gtk_test="no"])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
255
fi
256
AM_CONDITIONAL(BUILD_GTK_TEST, test x$enable_gtk_test = xyes)
Kristian Høgsberg's avatar
Kristian Høgsberg committed
257

258
259
260
261
262
263
264
265
266
267
268
269
270
271
AC_ARG_ENABLE(abiword-output,
              AC_HELP_STRING([--disable-abiword-output],
                             [Don't build the abiword backend.]),
              enable_abiword_output=$enableval,
              enable_abiword_output="try")
if test x$enable_abiword_output = xyes; then
  PKG_CHECK_MODULES(ABIWORD, libxml-2.0)
elif test x$enable_abiword_output = xtry; then
  PKG_CHECK_MODULES(ABIWORD, libxml-2.0,
                    [enable_abiword_output="yes"],
                    [enable_abiword_output="no"])
fi

AM_CONDITIONAL(BUILD_ABIWORD_OUTPUT, test x$enable_abiword_output = xyes)
272

273
274
275
276
277
278
279
AC_ARG_ENABLE(utils,
              AC_HELP_STRING([--disable-utils],
	                     [Don't compile poppler command line utils.]),
              enable_utils=$enableval,
              enable_utils="yes")
AM_CONDITIONAL(BUILD_UTILS, test x$enable_utils = xyes)

280
281
282
283
284
285
286
287
288
AC_ARG_ENABLE(compile-warnings,
              AC_HELP_STRING([--enable-compile-warnings=@<:@no/yes/kde@:>@]
                             [Turn on compiler warnings.]),,
              [enable_compile_warnings="yes"])

if test "x$GCC" != xyes; then
  enable_compile_warnings=no
fi
case "$enable_compile_warnings" in
289
  no)	;;
290
  yes)	CXXFLAGS="-Wall -Wno-unused $CXXFLAGS" ;;
291
292
293
294
295
296
297
298
  kde)	CXXFLAGS="-Wnon-virtual-dtor -Wno-long-long -Wundef -ansi \
		-D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align \
		-Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith \
		-Wwrite-strings -O2 -Wformat-security \
		-Wmissing-format-attribute -fno-exceptions -fno-check-new \
		-fno-common $CXXFLAGS" ;;
esac

299
300
301
302
303
304
305
306
307
308
309
case $($PKG_CONFIG --version) in
  0.?|0.1[0-7])
    PC_REQUIRES_PRIVATE="";
    PC_REQUIRES="poppler = $VERSION";;
  *)
    PC_REQUIRES_PRIVATE="Requires.private: poppler = $VERSION";
    PC_REQUIRES="";;
esac

AC_SUBST(PC_REQUIRES)
AC_SUBST(PC_REQUIRES_PRIVATE)
310

Kristian Høgsberg's avatar
Kristian Høgsberg committed
311
312
313
314
315
316
AC_OUTPUT([
Makefile
goo/Makefile
fofi/Makefile
splash/Makefile
poppler/Makefile
317
utils/Makefile
318
glib/Makefile
319
glib/poppler-features.h
320
glib/reference/Makefile
Kristian Høgsberg's avatar
Kristian Høgsberg committed
321
test/Makefile
322
qt/Makefile
323
324
325
qt4/Makefile
qt4/src/Makefile
qt4/tests/Makefile
Kristian Høgsberg's avatar
Kristian Høgsberg committed
326
327
poppler.pc
poppler-cairo.pc
328
poppler-splash.pc
329
poppler-glib.pc
330
331
poppler-qt.pc
poppler-qt4.pc])
332
333
334
335


echo ""
echo "Building poppler with support for:"
336
337
echo "  splash output:      $enable_splash_output"
echo "  cairo output:       $enable_cairo_output"
338
echo "  abiword output:     $enable_abiword_output"
339
340
341
echo "  qt wrapper:         $enable_poppler_qt"
echo "  qt4 wrapper:        $enable_poppler_qt4"
echo "  glib wrapper:       $enable_poppler_glib"
342
echo "  use gtk-doc:        $enable_gtk_doc"
343
344
echo "  use libjpeg:        $enable_libjpeg"
echo "  use zlib:           $enable_zlib"
Albert Astals Cid's avatar
   
Albert Astals Cid committed
345
echo "  command line utils: $enable_utils"