updated on Tue Jan 10 00:10:07 UTC 2012
[aur-mirror.git] / pdfedit-tools-nogui / configure.in
blob7d8381384784968ff6a6a79688c3310a618666f7
1 dnl                    -*- Autoconf -*-
2 dnl Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.61)
5 dnl TODO change for devel package
6 define([PDFEDIT_VERSION], patsubst(esyscmd(./getversion -v),[]))
7 AC_INIT([PDFedit], PDFEDIT_VERSION, 
8         [BUGTRACKER - http://pdfedit.petricek.net/bt/ ],[pdfedit])
9 AC_CONFIG_SRCDIR([src/gui/base.cc])
10 dnl FIXME what do we use src/utils/aconf.h for? No includes according to
11 dnl grep. Can we remove it?
12 AC_CONFIG_HEADERS(src/utils/aconf.h src/xpdf/xpdf-aconf.h)
14 m4_include([config/env.m4])
15 m4_include([config/macro.m4])
16 m4_include([config/boost_base.m4])
17 m4_include([config/cppunit.m4])
18 m4_include([config/freetype2.m4])
19 m4_include([config/ax_check_zlib.m4])
20 m4_include([config/ax_boost_program_options.m4])
22 m4_include([config/xpdf.m4])
24 dnl Checks for programs. (c++ compiler,...)
25 AC_LANG_CPLUSPLUS
26 AC_PROG_CXX
27 AC_PROG_CC
28 AC_PROG_MAKE_SET
29 AC_PROG_RANLIB
31 dnl This has problems with some autoconf versions which require and test
32 dnl install-sh script to be present in current directory. Actually we don't
33 dnl depend on it and it is one of just-to-be-sure tests. Maybe we can enable
34 dnl later if we find it necessary.
35 dnl AC_PROG_MKDIR_P
37 AC_PROG_LN_S
39 dnl Checks for header files.
40 AC_HEADER_STDC
41 AC_CHECK_HEADERS([limits.h stdlib.h string.h unistd.h])
43 dnl Checks for typedefs, structures, and compiler characteristics.
44 dnl TODO where do we use output?
45 AC_HEADER_STDBOOL
46 AC_C_CONST
47 AC_C_INLINE
48 AC_TYPE_SIZE_T
49 AC_STRUCT_TM
50 AX_CHECK_ZLIB
52 dnl Checks for boost
53 AX_BOOST_BASE
55 dnl fake-install-tools can be used to installation tools (COPY, DEL_*, 
56 dnl SYMLINK, etc) by those which are safe for testing - don't touch
57 dnl anything and instead logs all actions - tools/fake_install_tools.sh
58 dnl script with the first parameter as original operation
59 AC_ARG_WITH([fake-install],
60             AS_HELP_STRING([--with-fake-install=YES|NO],
61                            [Only log actions that would be done during make 
62                             {un}install, instead of doing them (to the 
63                             /tmp/fake_install_tools.log). This is only 
64                             for testing purposes.]
65              ),
66              [
67                 fake_install="$withval"
68              ],
69              [fake_install="NO"]
70               )
71 if test "x$fake_install" = "xYES"
72 then
73         AC_MSG_NOTICE("Using fake-install-tools.")
74         COPY='sh $(ROOT)/tools/fake_install_tools.sh COPY'
75         DEL_FILE='sh $(ROOT)/tools/fake_install_tools.sh DEL_FILE'
76         DEL_FORCE_DIR='sh $(ROOT)/tools/fake_install_tools.sh DEL_FORCE_DIR'
77         DEL_DIR='sh $(ROOT)/tools/fake_install_tools.sh DEL_DIR'
78         SYMLINK='sh $(ROOT)/tools/fake_install_tools.sh SYMLINK'
79         MKDIR='sh $(ROOT)/tools/fake_install_tools.sh MKDIR'
80         CHK_DIR_EXISTS='sh $(ROOT)/tools/fake_install_tools.sh CHK_DIR_EXISTS'
84 dnl Default (and configurable) values for files/directories manipulation 
85 dnl programs (you can overwrite them by ./configure NAME=value)
86 CHK_OR_DEFINE_VAR(COPY, "cp -f")
87 CHK_OR_DEFINE_VAR(DEL_FILE, "rm -f")
88 CHK_OR_DEFINE_VAR(DEL_DIR, "sh \$(ROOT)/tools/rmdir.sh")
89 CHK_OR_DEFINE_VAR(DEL_FORCE_DIR, "rm -rf")
90 CHK_OR_DEFINE_VAR(SYMLINK, "ln -s")
91 CHK_OR_DEFINE_VAR(MOVE, "mv -f")
92 CHK_OR_DEFINE_VAR(CHK_DIR_EXISTS, "test -d")
93 CHK_OR_DEFINE_VAR(MKDIR, "mkdir -p")
94 AC_SUBST(COPY)
95 AC_SUBST(DEL_FILE)
96 AC_SUBST(DEL_DIR)
97 AC_SUBST(DEL_FORCE_DIR)
98 AC_SUBST(SYMLINK)
99 AC_SUBST(MOVE)
100 AC_SUBST(CHK_DIR_EXISTS)
101 AC_SUBST(MKDIR)
104 dnl compiler options which might be set by environment viariable
105 dnl TODO check whether this is ok also for other platforms
106 CHK_OR_DEFINE_VAR(ARCH, "")
107 CHK_OR_DEFINE_VAR(C_EXTRA, "-fmessage-length=0 -D_FORTIFY_SOURCE=2 -fno-strict-aliasing")
108 CHK_OR_DEFINE_VAR(EXTRA_UTILS_CFLAGS, "")
109 CHK_OR_DEFINE_VAR(EXTRA_KERNEL_CFLAGS, "")
110 CHK_OR_DEFINE_VAR(EXTRA_TESTS_CFLAGS, "")
111 CHK_OR_DEFINE_VAR(EXTRA_XPDF_CFLAGS, "")
112 CHK_OR_DEFINE_VAR(CXX_EXTRA, "-fmessage-length=0 -D_FORTIFY_SOURCE=2 -fno-strict-aliasing -fexceptions")
113 CHK_OR_DEFINE_VAR(EXTRA_UTILS_CXXFLAGS, "")
114 CHK_OR_DEFINE_VAR(EXTRA_KERNEL_CXXFLAGS, "")
115 CHK_OR_DEFINE_VAR(EXTRA_TESTS_CXXFLAGS, "")
116 CHK_OR_DEFINE_VAR(EXTRA_GUI_CXXFLAGS, "")
117 CHK_OR_DEFINE_VAR(EXTRA_XPDF_CXXFLAGS, "")
118 AC_SUBST(ARCH)
119 AC_SUBST(C_EXTRA)
120 AC_SUBST(EXTRA_UTILS_CFLAGS)
121 AC_SUBST(EXTRA_KERNEL_CFLAGS)
122 AC_SUBST(EXTRA_TESTS_CFLAGS)
123 AC_SUBST(EXTRA_XPDF_CFLAGS)
124 AC_SUBST(CXX_EXTRA)
125 AC_SUBST(EXTRA_UTILS_CXXFLAGS)
126 AC_SUBST(EXTRA_KERNEL_CXXFLAGS)
127 AC_SUBST(EXTRA_TESTS_CXXFLAGS)
128 AC_SUBST(EXTRA_GUI_CXXFLAGS)
129 AC_SUBST(EXTRA_XPDF_CXXFLAGS)
131 AC_ARG_ENABLE(portability-flags,
132               [AS_HELP_STRING([--enable-portability-flags],
133                               [Turn on compilation flags which force the c/c++ standard constructs and proper portability (this includes -std=c99, -std=c++98, -ansi, -posix, -pedantic). Enabled by default])],
134                               ,
135                               [enable_portability_flags=yes])
136 AC_MSG_CHECKING(whether c/c++ and portability flags are forced)
137 if test "x$enable_portability_flags" = "xyes"
138 then
139         C_PORTABILITY_FLAGS="-posix -ansi -std=c99 -pedantic -D_XOPEN_SOURCE=500"
140         CXX_PORTABILITY_FLAGS="-posix -ansi -std=c++98 -D_XOPEN_SOURCE=500"
141         AC_MSG_RESULT(yes)
142 else
143         C_PORTABILITY_FLAGS=""
144         CXX_PORTABILITY_FLAGS=""
145         AC_MSG_RESULT(no)
147 AC_SUBST(C_PORTABILITY_FLAGS)
148 AC_SUBST(CXX_PORTABILITY_FLAGS)
150 dnl Default (and configurable) values for libraries
151 CHK_OR_DEFINE_VAR(AR, "ar cqs")
152 CHK_OR_DEFINE_VAR(LIBPREFIX, "lib")
153 AC_SUBST(AR)
154 AC_SUBST(LIBPREFIX)
157 AC_ARG_ENABLE(stack-protector,
158               [AS_HELP_STRING([--enable-stack-protector],
159                               [Turn on stack protector (disabled by default)])],
160                               ,
161                               [enable_stack_protector=no])
162 AC_MSG_CHECKING(whether we use stack protector)
163 if test "x$enable_stack_protector" != "xno"
164 then
165         STACK_PROTECTOR_FLAGS="-fstack-protector"
166         AC_MSG_RESULT(yes)
167 else
168         AC_MSG_RESULT(no)
169         STACK_PROTECTOR_FLAGS=""
171 AC_SUBST(STACK_PROTECTOR_FLAGS)
173 AC_ARG_ENABLE(release,
174               [AS_HELP_STRING([--enable-release],
175                               [Turn on compiler optimizations, turn off 
176                                debugging symbols (enabled by default, disable 
177                                                   with --disable-release)])],
178                               ,
179                               [enable_release=yes])
180 AC_SUBST(enable_release)
182 dnl if we want release then optimalization is turned on and we can optionally 
183 dnl add debug information. Otherwise we will turn off optimizations and allways
184 dnl get debug info
185 AC_ARG_ENABLE(debug-info,
186               [AS_HELP_STRING([--enable-debug-info],
187                               [Adds debug information (used only for release and
188                                it is disabled by default)])],
189                               ,
190                               [enable_debug_info=no])
191 AC_MSG_CHECKING(whether we are releasing)
192 E_RELEASE="no"
193 if test "x$enable_release" = "xyes"; then
194         AC_MSG_RESULT(true)
195         OPTIM="$OPTIM -O2"
196         AC_MSG_CHECKING(whether debug info is included)
197         if test "x$enable_debug_info" = "xyes"
198         then
199                 DEBUG="$DEBUG -g"
200                 AC_MSG_RESULT(yes)
201         else
202                 AC_MSG_RESULT(no)
203         fi
204         E_RELEASE="yes"
205         WARN=""
206 else
207         AC_MSG_RESULT(no)
208         OPTIM="$OPTIM -O0"
209         dnl maybe asserts and stuff like that?
210         DEBUG="$DEBUG -g -DDEBUG"
211         WARN="$WARN -W -Wall -Wconversion -Wno-unused-variable \
212            -Wunused-function -Wno-write-strings \
213            -Wunused-macros"
216 AC_SUBST(OPTIM)
217 AC_SUBST(DEBUG)
218 AC_SUBST(E_RELEASE)
219 AC_SUBST(WARN)
221 dnl Enable observer debugging (disabled by default)
222 AC_ARG_ENABLE(observer-debug,
223 [AS_HELP_STRING([--enable-observer-debug],
224                 [Turn on observer debugging (disabled by default)])],
225                 ,
226                 [enable_observer_debug=no])
227 AC_MSG_CHECKING(whether to enable observer debugging)
228 if test "x$enable_observer_debug" = "xyes"; then
229         OBSERVER_CFLAGS="$OBSERVER_CFLAGS -DOBSERVER_DEBUG"
230         OBSERVER_CXXFLAGS="$OBSERVER_CXXFLAGS -DOBSERVER_DEBUG"
231         AC_MSG_RESULT(yes)
232 else
233         AC_MSG_RESULT(no)
235 AC_SUBST(OBSERVER_CFLAGS)
236 AC_SUBST(OBSERVER_CXXFLAGS)
238 dnl Checks for library functions.
239 AC_FUNC_ERROR_AT_LINE
240 AC_FUNC_MALLOC
241 AC_FUNC_STAT
242 AC_FUNC_STRFTIME
243 AC_CHECK_FUNCS([atexit floor ftruncate localtime_r memset mkdir strdup strerror strpbrk strstr])
245 dnl XPdf code requires >=2.0.5
246 dnl TODO check for version
247 AC_CHECK_FT2
249 smr_CHECK_LIB(t1, t1, [Type 1 font rasterizer], 
250               T1_InitLib, t1lib.h,
251               -lm, $X_CFLAGS)
252 AC_SUBST(t1_LIBS)
253 AC_SUBST(t1_CFLAGS)
255 dnl We don't need to have explicit --enable-man-doc option so we keep it
256 dnl implicit and if some option want to include man pages, it simply sets
257 dnl this to true and the rest is done later in this script
258 enable_man_doc="no"
260 dnl TODO maybe be can add also generic pdfedit-dev package which will install
261 dnl pdfedit-core-dev and pdfedit-gui-dev (which will contain gui reusable code
262 dnl e.g. scripting)
264 dnl Sets DEV_TARGET for pdfedit-core-dev package
265 AC_ARG_ENABLE(pdfedit-core-dev,
266               AS_HELP_STRING([--enable-pdfedit-core-dev],
267                              [Builds and prepars PDFedit-core-dev package which can be
268                               used by 3rd party project separately from gui frontend
269                               (this includes static libraries and header files)]),
270                               ,
271                               [enable_pdfedit_core_dev=no])
272 AC_MSG_CHECKING(whether we want to prepare pdfedit-core-dev package)
273 if test "x$enable_pdfedit_core_dev" = "xyes"
274 then
275         AC_MSG_RESULT(yes)
276         INSTALL_TARGET="$INSTALL_TARGET install-core-dev"
277         UNINSTALL_TARGET="$UNINSTALL_TARGET uninstall-core-dev"
279 else
280         AC_MSG_RESULT(no)
283 dnl Sets GUI_TARGET and qt specific stuff
284 AC_ARG_ENABLE(gui,
285               [AS_HELP_STRING([--enable-gui],
286                               [Builds gui frontend (enabled by default, use 
287                                --disable-gui to disable it)])],
288                               ,
289                               [enable_gui=yes])
291 AC_MSG_CHECKING(whether we want to build PDFedit gui)
292 dnl Check QT environment if we want GUI
293 dnl QSA_DIR is set to qt3 by default. Note that this is important because
294 dnl we need at least some qsa directory for src/Makefile and its clean target
295 dnl gui implies also man pages
296 QSA_DIR="$QSA_DIR qsa"
297 if test "x$enable_gui" = "xyes"; then
298         AC_MSG_RESULT(yes)
299         GUI_TARGET="$GUI_TARGET pdfedit"
300         INSTALL_TARGET="$INSTALL_TARGET install-gui"
301         UNINSTALL_TARGET="$UNINSTALL_TARGET uninstall-gui"
303         dnl QTDIR is mandatory
304         CHK_ENV_VAR([QTDIR],
305                     [QTDIR environment variable must be set])
306         dnl QMAKESPEC is optional but recomended
307         CHK_ENV_VAR_NOTICE([QMAKESPEC],
308                            [QMAKESPEC environment variable is not set 
309                             - default will be used.])
311         AC_MSG_CHECKING(for QT qmake)
312         CHK_EXECUTABLE([qmake],[qmake qmake-qt3],[${QTDIR}/bin /usr/bin /usr/local/bin /usr/lib/qt3/bin],[
313                 dnl check the qmake we found is for correct QT version (3.x.x)
314                 isqmake3=`$testbin --version 2>&1 | grep '3\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*'`
315                 if test -z "$isqmake3"
316                 then
317                         testbin=""
318                 fi
319         ],[(only for platforms where qmake is not installed under QTDIR/bin, /usr/bin, /usr/local/bin, /usr/lib/qt3/bin or in PATH).])
320         if test -z "${qmake_bin}"
321         then
322                 AC_MSG_ERROR(unable to find qmake for QT3)
323         fi
324         QMAKE="$QMAKE ${qmake_bin}"
325         AC_MSG_RESULT(Using QT3 with qmake=${qmake_bin})
326         AC_SUBST(QMAKE)
328         dnl check for lrelease
329         AC_MSG_CHECKING(for QT lrelease)
330         CHK_EXECUTABLE([lrelease],[lrelease],[${QTDIR}/bin /usr/bin /usr/local/bin /usr/lib/qt3/bin],[],
331                        [(Only for platforms where lrelease is not installed under QTDIR/bin, /usr/bin, /usr/local/bin, /usr/lib/qt3/bin or in PATH).])
332         if test -z "${lrelease_bin}"
333         then
334                 AC_MSG_ERROR(unable to find lrelease localization binary for QT3)
335         fi
336         LRELEASE="$LRELEASE ${lrelease_bin}"
337         AC_MSG_RESULT(Using lrelease=${lrelease_bin})
338         AC_SUBST(LRELEASE)
340         dnl enable man pages
341         enable_man_doc="yes"
342 else
343         AC_MSG_RESULT(no)
345 AC_SUBST(GUI_TARGET)
346 AC_SUBST(QSA_DIR)
348 dnl Exports installation targets - install-no is used if no specific
349 dnl installation target was configured
350 if test "x$INSTALL_TARGET" = "x"
351 then
352         INSTALL_TARGET="$INSTALL_TARGET install-no"
354 if test "x$UNINSTALL_TARGET" = "x"
355 then
356         UNINSTALL_TARGET="$UNINSTALL_TARGET uninstall-no"
358 AC_SUBST(INSTALL_TARGET)
359 AC_SUBST(UNINSTALL_TARGET)
361 AC_ARG_WITH([root-dir],
362             AS_HELP_STRING([--with-root-dir=DIR], 
363                            [Install files under different root directory (path to prepend before
364                             the prefix, empty by default - use if you are packager and want to create
365                             package, or if you are installing into chrooted environment).]
366                            ),
367                            [
368                                 root_dir="$withval/"
369                            ],
370                            [root_dir=""]
371             )
372 AC_SUBST(root_dir)
374 AC_ARG_WITH([parallel-make],
375             AS_HELP_STRING([--with-parallel-make=auto|off|number],
376                      [Sets MAKEFLAGS so that make will use parallel building when possible. This option
377                      is useful when you have more CPUs/cores because each core can compile independently
378                      and the compilation will take shorter time. You can use auto (default) which will
379                      find out the number of CPU available and use this value, off for no parallelism
380                      or number to specify the value explicitly.]
381              ),
382              [
383                 parallel_make_set="$withval"
384              ],
385              [parallel_make_set="auto"]
386               )
388 parallel_make=""
389 if test "i$parallel_make_set" = "iauto"
390 then
392         AC_MSG_CHECKING(for /proc/cpuinfo )
393         if test -f /proc/cpuinfo
394         then
395         {
396                 dnl /proc/cpuinfo is available in Linux and cygwin systems
397                 CPU_NUM=`grep "^processor" /proc/cpuinfo | wc -l`
398                 if test $CPU_NUM -gt 1
399                 then
400                         AC_MSG_RESULT($CPU_NUM CPUs/Cores available - using $CPU_NUM parallel jobs)
401                         parallel_make="-j$CPU_NUM"
402                 else
403                         AC_MSG_RESULT(Only one CPU available - no parallelism)
404                 fi
405         }
406         else
407         {
408                 AC_MSG_RESULT(not available)
409                 AC_MSG_CHECKING(for sysctl )
410                 dnl sysctl is available on BSD systems
411                 CPU_NUM=`/bin/sh -c 'sysctl -n hw.ncpu' 2>/dev/null`
412                 if test -n "$CPU_NUM"
413                 then
414                 {
415                         if test $CPU_NUM -gt 1
416                         then
417                                 AC_MSG_RESULT($CPU_NUM CPUs/Cores available - using $CPU_NUM parallel jobs)
418                                 parallel_make="-j$CPU_NUM"
419                         else
420                                 AC_MSG_RESULT(Only one CPU available - no parallelism)
421                         fi
422                 }
423                 else
424                         AC_MSG_RESULT(not available)
425                         dnl TODO checks for other platforms
426                 fi
427         }
428         fi
430 else
432         AC_MSG_CHECKING(--with-parallel-make value)
433         if test "i$parallel_make_set" = "ioff"
434         then
435                 AC_MSG_RESULT(No parallelism)
436         else
437         {
438                 if echo $parallel_make_set | grep '^ *[[0-9]][[0-9]]* *$' >/dev/null 2>&1
439                 then
440                         AC_MSG_RESULT(Using $parallel_make_set)
441                         parallel_make="-j$parallel_make_set"
442                 else
443                         AC_MSG_ERROR($parallel_make_set is not valid)
444                 fi
445         }
446         fi
449 AC_SUBST(parallel_make)
451 dnl TODO handle also dev package (exclusive with gui case)
453 dnl Sets TESTS_TARGET and cppunit stuff, if we want to have 
454 dnl also kernel tests
455 AC_ARG_ENABLE(kernel-tests,
456               [AS_HELP_STRING([--enable-kernel-tests],
457                               [Compiles also kernel tests 
458                                (disabled by default)])],
459                               ,
460                               [enable_kernel_tests=no])
461 AC_MSG_CHECKING(whether we want to compile kernel tests too)
462 if test "x$enable_kernel_tests" = "xyes"; then
463         AC_MSG_RESULT(yes)
464         KERNEL_TESTS_TARGET="$KERNEL_TESTS_TARGET kernel_tests"
465         dnl FIXME check the version - it is required by macro - I have used some
466         dnl random one
467         AM_PATH_CPPUNIT(1.10.0)
468         if test "x${no_cppunit}" != "x"
469         then
470                 AC_MSG_ERROR(Unable to find CPPUnit required by --enable-kernel-tests)
471         fi
472 else
473         AC_MSG_RESULT(no)
475 AC_SUBST(KERNEL_TESTS_TARGET)
477 dnl add man pages creation and installation target only if requiered by others
478 dnl options
479 if test "x$enable_man_doc" = "xyes"
480 then
481         MAN_TARGET="$MAN_TARGET doc_man"
482         MAN_INSTALL_TARGET="$MAN_INSTALL_TARGET doc_man_install"
484 AC_SUBST(MAN_TARGET)
485 AC_SUBST(MAN_INSTALL_TARGET)
487 AC_ARG_ENABLE(doxygen-doc,
488               [AS_HELP_STRING([--enable-doxygen-doc],
489                               [Creates doxygen documentation (extracted from sources)])],
490                               ,
491                               [enable_doxygen_doc=no])
492 AC_MSG_CHECKING(whether we want to build doxygen documentation)
493 if test "x$enable_doxygen_doc" = "xyes"
494 then
495         AC_MSG_RESULT(yes)
496         AC_MSG_CHECKING(for doxygen binary)
497         CHK_EXECUTABLE(doxygen,doxygen,[/usr/bin /usr/local/bin],[])
498         if test -z ${doxygen_bin}
499         then
500                 AC_MSG_ERROR(unable to find doxygen binary)
501         fi
502         AC_MSG_RESULT(found at ${doxygen_bin})
503         DOXYGEN_BIN="$DOXYGEN_BIN ${doxygen_bin}"
504         DOXYGEN_TARGET="$DOXYGEN_TARGET doc_doxygen"
505         DOXYGEN_INSTALL_TARGET="$DOXYGEN_INSTALL_TARGET doc_doxygen_install"
506 else
507         AC_MSG_RESULT(no)
509 AC_SUBST(DOXYGEN_TARGET)
510 AC_SUBST(DOXYGEN_INSTALL_TARGET)
511 AC_SUBST(DOXYGEN_BIN)
513 dnl Enable building advanced documentation?
514 AC_ARG_ENABLE(advanced-doc,
515               [AS_HELP_STRING([--enable-advanced-doc],
516                               [Creates advanced documentation (advanced 
517                                programming and design description)])],
518                               ,
519                               [enable_advanced_doc=no])
520 AC_MSG_CHECKING(whether we want to build advanced documentation)
521 if test "x$enable_advanced_doc" = "xyes"
522 then
523         AC_MSG_RESULT(yes)
524         ADVANCED_TARGET="$ADVANCED_TARGET doc_advanced"
525         ADVANCED_INSTALL_TARGET="$ADVANCED_INSTALL_TARGET doc_advanced_install"
526         xsl_tools_required=yes
527 else
528         AC_MSG_RESULT(no)
530 AC_SUBST(ADVANCED_TARGET)
531 AC_SUBST(ADVANCED_INSTALL_TARGET)
533 dnl Enable building user manual?
534 AC_ARG_ENABLE(user-manual,
535               [AS_HELP_STRING([--enable-user-manual],
536                               [Creates user manual])],
537                               ,
538                               [enable_user_manual=no])
539 AC_MSG_CHECKING(whether we want to build user manual)
540 if test "x$enable_user_manual" = "xyes"
541 then
542         AC_MSG_RESULT(yes)
543         USER_MANUAL_TARGET="$USER_MANUAL_TARGET doc_user"
544         USER_MANUAL_INSTALL_TARGET="$USER_MANUAL_INSTALL_TARGET doc_user_install"
545         xsl_tools_required=yes
546 else
547         AC_MSG_RESULT(no)
549 AC_SUBST(USER_MANUAL_TARGET)
550 AC_SUBST(USER_MANUAL_INSTALL_TARGET)
552 if test "x$xsl_tools_required" = "xyes"
553 then
554         dnl check for xsltproc
555         AC_MSG_CHECKING(for xsltproc binary)
556         CHK_EXECUTABLE(xsltproc,xsltproc,[/usr/bin /usr/local/bin],[])
557         if test -z ${xsltproc_bin}
558         then
559                 AC_MSG_ERROR(unable to find xsltproc binary)
560         else 
561                 AC_MSG_RESULT(found at ${xsltproc_bin})
562         fi
564         dnl check for docbook xsl
565         dnl TODO create macro for detecting
566         AC_MSG_CHECKING(for docbook xsl)
567         docbook_xsl=""
568         for i in `cat doc/tools/docbook_xslt_paths`
569         do
570                 if test -f $i/docbook.xsl
571                 then
572                         docbook_xsl=$i/docbook.xsl
573                         break
574                 fi
575         done
576         if test -z ${docbook_xsl}
577         then
578                 AC_MSG_ERROR(unable to find docbook.xsl stylesheet)
579         else
580                 AC_MSG_RESULT(found at ${docbook_xsl})
581         fi
582         dnl TODO: if xsltproc and stylesheet is missing, docbook2html from jade can be used
585 dnl Enable building tools?
586 AC_ARG_ENABLE(tools,
587               [AS_HELP_STRING([--enable-tools],
588                               [Enables tools building])],
589                               ,
590                               [enable_tools=no])
591 AC_MSG_CHECKING(whether we want to build tools)
592 if test "x$enable_tools" = "xyes"
593 then
594         AC_MSG_RESULT(yes)
595         boost_program_options_required=yes
596         png_required=yes
597         if test "x$enable_pdfedit_core_dev" != "xyes"
598         then
599                 AC_MSG_ERROR(--enable pdfedit-core-dev is required for tools)
600         fi
601         TOOLS_TARGET="$TOOLS_TARGET tools"
602 else
603         AC_MSG_RESULT(no)
605 AC_SUBST(TOOLS_TARGET)
607 if test "x$boost_program_options_required" = "xyes"
608 then
609         AC_MSG_CHECKING(for boost-program-options library)
610         AX_BOOST_PROGRAM_OPTIONS
613 AC_CONFIG_FILES([Makefile.flags Makefile.rules])
616 dnl XPDF specific stuff taken from the original xpdf distribution
619 AC_PATH_XTRA
620 AC_HEADER_DIRENT
622 dnl ##### Switch over to C++.  This will make the checks below a little
623 dnl ##### bit stricter (requiring function prototypes in include files).
624 dnl ##### (99% of xpdf is written in C++.)
625 AC_LANG_CPLUSPLUS
627 dnl ##### Look for rewinddir.
628 AC_CHECK_FUNCS(rewinddir)
629 if test $ac_cv_func_rewinddir = no; then
630   AC_CHECK_LIB(cposix, rewinddir)
633 dnl ##### Checks for library functions.
634 AC_CHECK_FUNCS(popen)
635 dnl # This should use 'AC_CHECK_FUNCS(mkstemp)' but that fails if
636 dnl # the mkstemp exists in the library but isn't declared in the
637 dnl # include file (e.g., in cygwin 1.1.2).
638 AC_CACHE_CHECK([for mkstemp],
639 xpdf_cv_func_mkstemp,
640 [AC_TRY_LINK([#include <stdlib.h>
641 #include <unistd.h>],
642 [mkstemp("foo");],
643 xpdf_cv_func_mkstemp=yes, xpdf_cv_func_mkstemp=no)])
644 if test "$xpdf_cv_func_mkstemp" = yes; then
645   AC_DEFINE(HAVE_MKSTEMP)
647 dnl # Check for mkstemps, just like mkstemp.
648 AC_CACHE_CHECK([for mkstemps],
649 xpdf_cv_func_mkstemps,
650 [AC_TRY_LINK([#include <stdlib.h>
651 #include <unistd.h>],
652 [mkstemps("foo", 0);],
653 xpdf_cv_func_mkstemps=yes, xpdf_cv_func_mkstemps=no)])
654 if test "$xpdf_cv_func_mkstemps" = yes; then
655   AC_DEFINE(HAVE_MKSTEMPS)
658 dnl ##### Back to C for the library tests.
659 AC_LANG_C
661 dnl ##### Check for fseeko/ftello or fseek64/ftell64
662 dnl The LARGEFILE and FSEEKO macros have to be called in C, not C++, mode.
663 AC_SYS_LARGEFILE
664 AC_FUNC_FSEEKO
665 AC_CHECK_FUNCS(fseek64, xpdf_cv_func_fseek64=yes, xpdf_cv_func_fseek64=no)
666 AC_CHECK_FUNCS(ftell64, xpdf_cv_func_ftell64=yes, xpdf_cv_func_ftell64=no)
667 if test "$xpdf_cv_func_fseek64" = yes -a "$xpdf_cv_func_ftell64" = yes; then
668   AC_DEFINE(HAVE_FSEEK64)
671 if test "x${t1_LIBS}" != "x" 
672 then
673         AC_DEFINE(HAVE_T1LIB_H)
676 if test "x${FT2_LIBS}" != "x"
677 then
678   AC_DEFINE(HAVE_FREETYPE_FREETYPE_H)
679   AC_DEFINE(HAVE_SPLASH)
682 dnl ##### Write the makefiles.
683 AC_OUTPUT(src/xpdf/Makefile src/xpdf/goo/Makefile src/xpdf/fofi/Makefile src/xpdf/splash/Makefile src/xpdf/xpdf/Makefile )
685 echo ""
686 echo "Configuration complete"
687 echo " Building in release mode      : $enable_release"
688 if test  "$enable_release" = "yes"
689 then
690         echo " Include debugging information : $enable_debug_info"
692 echo " Enable observer debugging     : $enable_observer_debug"
693 echo " Build man pages               : $enable_man_doc"
694 echo " Build user manual             : $enable_user_manual"
695 echo " Build doxygen documentation   : $enable_doxygen_doc"
696 echo " Build advanced documentation  : $enable_advanced_doc"
697 echo " Build kernel tests            : $enable_kernel_tests"
698 echo " Build GUI                     : $enable_gui"
699 echo " Build pdfedit-core-dev        : $enable_pdfedit_core_dev"
700 echo " Build tools                   : $enable_tools"
701 echo
702 echo "Installation summary:"
703 echo " Root directory                : $root_dir"
704 echo " Install into                  : $prefix"
705 echo " Install pdfedit-core-dev      : $enable_pdfedit_core_dev"
706 echo " Install gui                   : $enable_gui"
707 echo ""
708 echo "Type 'make' to build $PACKAGE_STRING"
709 echo ""