xref: /trunk/main/configure.ac (revision aaf4fffac3204386b10ccf29c83fe901258f7398)
1dnl * *************************************************************
2dnl *
3dnl *  Licensed to the Apache Software Foundation (ASF) under one
4dnl *  or more contributor license agreements.  See the NOTICE file
5dnl *  distributed with this work for additional information
6dnl *  regarding copyright ownership.  The ASF licenses this file
7dnl *  to you under the Apache License, Version 2.0 (the
8dnl *  "License"); you may not use this file except in compliance
9dnl *  with the License.  You may obtain a copy of the License at
10dnl *
11dnl *    http://www.apache.org/licenses/LICENSE-2.0
12dnl *
13dnl *  Unless required by applicable law or agreed to in writing,
14dnl *  software distributed under the License is distributed on an
15dnl *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16dnl *  KIND, either express or implied.  See the License for the
17dnl *  specific language governing permissions and limitations
18dnl *  under the License.
19dnl *
20dnl * *************************************************************
21AC_REVISION( $Revision$ )
22AC_PREREQ([2.73])
23AC_INIT
24echo "$@" >config.parms
25AC_ARG_WITH(dmake-path,
26[  --with-dmake-path=<PATH TO EXECUTABLE>   Specify the location of dmake ],
27[  DMAKE_PATH="$withval"
28])
29AC_ARG_WITH(dmake-url,
30[  --with-dmake-url=<URL>   Specify the location of downloadable dmake source code. For example:
31                          https://github.com/jimjag/dmake/archive/v4.13.1/dmake-4.13.1.tar.gz
32                          Note that dmake is under GPL license.],
33[  DMAKE_URL="$withval"
34])
35AC_ARG_WITH(packager-list,
36[  --with-packager-list=<PATH TO PACK LIST>   Specify a file to drive the packaging process.
37                          The file must follow the format explained in
38                          instsetoo_native/util/pack.lst
39],,)
40AC_ARG_WITH(gnu-patch,
41[  --with-gnu-patch        Specify location of GNU patch on Solaris or FreeBSD
42],,)
43AC_ARG_WITH(gnu-cp,
44[  --with-gnu-cp           Specify location of GNU cp on Solaris
45],,)
46AC_ARG_WITH(gperf,
47[  --with-gperf           Specify location of gperf on Solaris or FreeBSD
48],,)
49AC_ARG_ENABLE(graphite,
50[  --enable-graphite       Enables the compilation of Graphite smart font rendering
51],,)
52AC_ARG_WITH(system-graphite,
53[  --with-system-graphite    use graphite library already installed on system
54],,)
55AC_ARG_WITH(system-apache-commons,
56[  --with-system-apache-commons    use apache-commons jar files already installed on system
57],,)
58AC_ARG_ENABLE(online-update,
59[  --disable-online-update Disables the Online Update feature.
60],,enable_online_update=yes)
61AC_ARG_ENABLE(unit-tests,
62[  --disable-unit-tests    Disables default unit tests (eg. unit tests using Google test, ...).
63],,enable_unit_tests=yes)
64AC_ARG_ENABLE(ldap,
65[  --disable-ldap          Disables the use of LDAP backend via OpenLDAP
66],,)
67AC_ARG_ENABLE(fetch-external,
68[  --disable-fetch-external Disables fetching external tarballs from web sources.
69],,)
70AC_ARG_WITH(external-tar,
71[  --with-external-tar=<TARFILE PATH>   Specify path to tarfiles manually ],
72[ TARFILE_LOCATION="$withval"
73])
74AC_ARG_WITH(openldap,
75[  --with-openldap         Enables the use of the OpenLDAP
76],,)
77AC_ARG_ENABLE(lockdown,
78[  --enable-lockdown       Enables the gconf integration work in AOO
79],,)
80AC_ARG_ENABLE(vba,
81[  --disable-vba           disables the vba compatibility feature
82],,)
83AC_ARG_WITH(vba-package-format,
84[  --with-vba-package-format   specify package format for vba compatibility api.
85                          Specifying "builtin" means the api component and
86                          associated type library are part of the installation set.
87                          Specifying "extn" creates an uno extension that is
88                          part of the installation set ( located in the program
89                          directory ) that MUST be optionly registered using
90                          either the unopkg executeable or the extension manager
91                          gui.
92
93                          Note: "builtin" is the default, "extn" can cause
94                          problems.
95                          Usage: --with-vba-package-format="builtin" or
96                                 --with-vba-package-format="extn"
97],,)
98AC_ARG_ENABLE(pch,
99[  --enable-pch            EXPERIMENTAL: Enables precompiled header support for C++.
100],,)
101AC_ARG_WITH(fonts,
102[  --without-fonts         AOO includes some third-party fonts to provide a reliable
103                          basis for help content, templates, samples, etc.
104                          When these fonts are already known to be available on the
105                          system then you should use this option.
106],,)
107AC_ARG_WITH(ppds,
108[  --without-ppds          Removes Postscript Printer definition files from
109                          Apache OpenOffice installation set, for people building
110                          for specific distributions where PPDs are known to be
111                          already available (every recent distro with CUPS
112                          backend)
113],,)
114AC_ARG_WITH(afms,
115[  --without-afms          Removes bitmap font files from Apache Openoffice
116                          installation set, for people building for specific
117                          distributions where AFM files or TrueType Fonts
118                          are known to be available.
119],,)
120AC_ARG_ENABLE(epm,
121[  --disable-epm           AOO includes self-packaging code, that requires EPM.
122],,enable_epm="yes")
123AC_ARG_WITH(epm,
124[  --with-epm         Decides which EPM to use. Default is to use
125              the one installed on the system if one is there. When
126              either this is not there or you say =internal
127              EPM will be built.
128],,)
129AC_ARG_WITH(epm-url,
130[  --with-epm-url=<URL>    Specify the location of downloadable epm source code. For example:
131                            https://github.com/jimjag/epm/archive/v5.0.0/epm-5.0.0.tar.gz
132                          Version 5.0.0 or later is required.
133],[  EPM_URL="$withval"
134])
135AC_ARG_WITH(package-format,
136[  --with-package-format   specify package format(s) for AOO installsets.
137                          Default is "normal" one of the OS/Distribution.
138
139                          Usage: --with-package-format="foo bar"
140],,)
141AC_ARG_ENABLE(odk,
142[  --disable-odk           AOO includes an ODK, office development kit
143                          which some packagers may want to build without
144],,enable_odk="yes")
145AC_ARG_ENABLE(mathmldtd,
146[  --disable-mathmldtd     disable mathmldtd
147                          (useful for distributions that want to avoid packaging
148                          it)
149],,enable_mathmldtd="yes")
150AC_ARG_ENABLE(evolution2,
151[  --enable-evolution2     Allows the built-in evolution 2 addressbook
152                          connectivity build to be enabled.
153],,)
154AC_ARG_WITH(system-stdlibs,
155[  --with-system-stdlibs   use libstdc++/libgcc_s already on system
156],,)
157AC_ARG_ENABLE(cups,
158[  --disable-cups          disable CUPS support (for printing on UNIX)
159],,enable_cups=yes)
160AC_ARG_ENABLE(fontconfig,
161[  --disable-fontconfig    disable support for the fontconfig library
162],,enable_fontconfig=yes)
163AC_ARG_ENABLE(directx,
164[  --disable-directx       Remove DirectX implementation for the new XCanvas
165                          interface. The DirectX support requires more stuff
166                          installed on Windows to compile.
167                          (DirectX SDK, GDI+ libs)
168],,enable_directx=yes)
169AC_ARG_ENABLE(activex,
170[  --disable-activex       Disable the use of ActiveX for Windows build.
171                          This switch is mandatory when using VC++ 2005/2008 Express.
172                          Alternatively you can use the Windows Driver Kit (WDK) and
173                          configure with the following switches:
174                          --with-atl-include-dir=$WDK_HOME\inc\atl71
175                          --with-atl-lib-dir=$WDK_HOME\lib\ATL\i386
176                          --with-mfc-include-dir=$WDK_HOME\inc\mfc42
177                          --with-mfc-lib-dir=$WDK_HOME\lib\Mfc\i386
178],,)
179
180AC_ARG_ENABLE(atl,
181[  --disable-atl          Disable the use of ATL for Windows build.
182                          This switch is mandatory when using VC++ 2005/2008 Express.
183                          Alternatively you can use the Windows Driver Kit (WDK) and
184                          configure with the following switches:
185                          --with-atl-include-dir=$WDK_HOME\inc\atl71
186                          --with-atl-lib-dir=$WDK_HOME\lib\ATL\i386
187                          --with-mfc-include-dir=$WDK_HOME\inc\mfc42
188                          --with-mfc-lib-dir=$WDK_HOME\lib\Mfc\i386
189],,)
190
191AC_ARG_WITH(atl-include-dir,
192[  --with-atl-include-dir      Path to ATL include directory for Windows build.
193                          This switch is mandatory when using VC++ 2008 Express
194                          and configuring with ATL/ActiveX enabled.
195                          You can use the Windows Driver Kit (WDK) and
196                          configure with the following switch:
197                          --with-atl-include-dir=$WDK_HOME\inc\atl71
198],,)
199
200AC_ARG_WITH(atl-lib-dir,
201[  --with-atl-lib-dir          Path to ATL libraries directory for Windows build.
202                          This switch is mandatory when using VC++ 2008 Express
203                          and configuring with ATL/ActiveX enabled.
204                          You can use the Windows Driver Kit (WDK) and
205                          configure with the following switch:
206                          --with-atl-lib-dir=$WDK_HOME\lib\ATL\i386
207],,)
208
209AC_ARG_WITH(mfc-include-dir,
210[  --with-mfc-include-dir       Path to MFC include directory for Windows build.
211                          This switch is mandatory when using VC++ 2008 Express
212                          and configuring with ATL/ActiveX enabled.
213                          You can use the Windows Driver Kit (WDK) and
214                          configure with the following switch:
215                          --with-mfc-include-dir=$WDK_HOME\inc\mfc42
216],,)
217
218AC_ARG_WITH(mfc-lib-dir,
219[  --with-mfc-lib-dir          Path to MFC libraries directory for Windows build.
220                          This switch is mandatory when using VC++ 2008 Express
221                          and configuring with ATL/ActiveX enabled.
222                          You can use the Windows Driver Kit (WDK) and
223                          configure with the following switch:
224                          --with-mfc-lib-dir=$WDK_HOME\lib\Mfc\i386
225],,)
226
227
228AC_ARG_ENABLE(symbols,
229[  --enable-symbols        Include debugging symbols in output.
230                          WARNING - a complete build needs 8 Gb of space and
231                          takes much longer. (enables -g compiler flag)
232
233                          --enable-symbols=SMALL sets the gcc -g1 setting
234                          which is smaller.
235
236                          Enabling symbols disables the stripping of the solver
237                          (--disable-strip-solver).
238],,)
239AC_ARG_ENABLE(strip-solver,
240[  --disable-strip-solver  Disable the stripping of the solver.
241                          By default the solver is stripped unless a build with
242                          debugging symbols (--enable-symbols) is requested.
243
244                          This switch allows to override this setting.
245],,)
246AC_ARG_ENABLE(werror,
247[  --enable-werror         Turn warnings to errors. (Has no effect in modules
248                          where the treating of warnings as errors is disabled
249                          explicitly)
250],,)
251AC_ARG_ENABLE(debug,
252[  --enable-debug          Include debugging symbols from --enable-symbols
253                          plus extra debugging code. Extra large build!
254                          (enables -g compiler flag and dmake debug=true)
255],,)
256AC_ARG_ENABLE(dbgutil,
257[  --enable-dbgutil        Include additional debugging utilities, such as
258                          assertions, object counting, etc. Larger build.
259                          Independent from --enable-debug
260],,)
261AC_ARG_ENABLE(crashdump,
262[  --enable-crashdump      Enable the crashdump feature code.
263],,)
264AC_ARG_ENABLE(cl-standard,
265[  --enable-cl-standard    For Microsoft C/C++ compiler users, use non-optimizing
266                          standard compiler. ( This just disables optimization
267                          options and therefore removes a lot of warnings when
268                          using the cheaper standard compiler. )
269],,)
270AC_ARG_ENABLE(win64,
271[  --enable-win64          Enable building 64 bit OpenOffice on 64 bit Windows, (as
272                          opposed to 32 bit OpenOffice that is usually built there).
273                          This is a temporary option during the transition,
274                          as 64 bit OpenOffice doesn't fully build on Windows yet.
275],,enable_win64=no)
276AC_ARG_ENABLE(win-x64-shellext,
277[  --enable-win-x64-shellext    Enable the build/usage of Windows 64bit shell extensions.
278                          These extensions are used for the system integration on
279              Windows 64bit systems. For example supporting the search
280              in ODF files with the standard Windows search feature.
281],,)
282AC_ARG_ENABLE(gtk,
283[  --disable-gtk           Determines whether to use Gtk+ vclplug on platforms
284                          where Gtk+ is available.
285],,enable_gtk=yes)
286AC_ARG_ENABLE(gstreamer,
287[  --enable-gstreamer      Determines whether to use the GStreamer media
288                          backend on platforms where GStreamer is available.
289],,enable_gstreamer=no)
290AC_ARG_ENABLE(systray,
291[  --disable-systray       Determines whether to build the systray quickstarter.
292],,enable_systray=yes)
293AC_ARG_ENABLE(cairo,
294[  --enable-cairo          Determines whether to use Cairo library on
295                          platforms where Cairo is available.
296],,enable_cairo=no)
297AC_ARG_WITH(system-cairo,
298[  --with-system-cairo      Use Cairo libraries already on system
299],,)
300AC_ARG_ENABLE(cairo-canvas,
301[  --disable-cairo-canvas  Determines whether to build the Cairo canvas on
302                          platforms where Cairo is available.
303],,enable_cairo_canvas=yes)
304AC_ARG_ENABLE(opengl,
305[  --enable-opengl         Determines whether to build the OpenGL 3D slide
306                          transitions component
307],,enable_opengl=no)
308AC_ARG_ENABLE(dbus,
309[  --enable-dbus           Determines whether to enable presentation mode
310                          screensaver control under GNOME via DBUS
311],,enable_dbus=no)
312AC_ARG_ENABLE(gconf,
313[  --disable-gconf         Determines whether to use the GConf support
314],,enable_gconf=yes)
315AC_ARG_ENABLE(gnome-vfs,
316[  --disable-gnome-vfs     Determines whether to use the Gnome Virtual Filing
317                          System on platforms where that VFS is available
318],,enable_gnome_vfs=no)
319AC_ARG_ENABLE(gio,
320[  --enable-gio            Determines whether to use the GIO support
321],,enable_gio=yes)
322AC_ARG_ENABLE(static-gtk,
323[  --enable-static-gtk     Modules that are linked against gtk libraries use
324                          the static libraries instead of the dynamic ones.
325                          (enables -Bstatic linker flag for gtk libraries)
326],,)
327AC_ARG_ENABLE(layout,
328[  --enable-layout         Enable the compilation and use of layout dialogs
329],,)
330AC_ARG_ENABLE(nss-module,
331[  --disable-nss-module    Whether to use the NSS module that is used for xml-security
332],,enable_nss_module=yes)
333AC_ARG_ENABLE(kde,
334[  --enable-kde            Determines whether to use Qt/KDE vclplug on platforms
335                          where Qt and KDE are available.
336],,)
337AC_ARG_ENABLE(kde4,
338[  --enable-kde4            Determines whether to use Qt4/KDE4 vclplug on platforms
339                          where Qt4 and KDE4 are available. May be used with --enable-kde
340                          if you want to support both KDE3 and KDE4.
341],,)
342AC_ARG_ENABLE(rpath,
343[  --disable-rpath         Disable the use of relative paths in shared libraries
344],,)
345AC_ARG_ENABLE(pam,
346[  --disable-pam           Disable pam support.
347],,)
348AC_ARG_ENABLE(pam-link,
349[  --enable-pam-link       link with libpam instead of dynamically open it
350],,)
351AC_ARG_ENABLE(crypt-link,
352[  --disable-crypt-link    disable linking with libcrypt instead of dynamically
353                          open it (needed for ancient GNU/Linux distributions
354                          without crypt()/libcrypt)
355],,enable_crypt_link=yes)
356AC_ARG_ENABLE(xrender-link,
357[  --enable-xrender-link   link with libXrender instead of dynamically open it
358],,)
359AC_ARG_ENABLE(randr,
360[  --disable-randr         disable RandR support in the vcl project
361],,enable_randr=yes)
362AC_ARG_ENABLE(randr-link,
363[  --disable-randr-link    disable linking with libXrandr, instead dynamically
364                           open it at runtime
365],,enable_randr_link=yes)
366AC_ARG_WITH(bundled-extension-blobs,
367[  --with-bundled-extension-blobs Whitespace separated list of files in the tarball directory
368                          that are to be bundled as-is for installation as extensions
369                          at the first program start. Make sure to only bundle extensions
370                          which can be installed without requiring a license dialog
371                          and comply with their distribution requirements by updating the
372                          files LICENSE_aggregated and NOTICE_aggregated accordingly
373],,)
374#AC_ARG_WITH(bundled-prereg-extensions,
375#[  --with-bundled-prereg-extensions Whitespace separated list of files in the tarball directory that
376#                          are to be bundled as pre-registered extensions. Make sure to only bundle
377#                          extensions which can be installed without requiring a license dialog
378#],,)
379AC_ARG_ENABLE(bundled-dictionaries,
380[  --enable-bundled-dictionaries  Download dictionaries (spelling, hyphenation, thesaurus)
381                           according to main/extensions.lst and bundle them. Make sure to
382                           comply with their distribution requirements and update the
383                           files LICENSE_aggregated and NOTICE_aggregated accordingly
384],,enable_bundled_dictionaries=no)
385
386# Remove the following switches when not in release mode.
387AC_ARG_WITH(system-dicts,
388[  --with-system-dicts    Use dictionaries from system paths- Specify
389                         them via --with-{dict,hyph,thes}-path=/path
390                        if you want to override the default ones
391],,)
392AC_ARG_WITH(external-dict-dir,
393[  --with-external-dict-dir Specify external dictionary dir
394],,)
395AC_ARG_WITH(external-hyph-dir,
396[  --with-external-hyph-dir Specify external hyphenation pattern dir
397],,)
398AC_ARG_WITH(external-thes-dir,
399[  --with-external-thes-dir Specify external thesaurus dir
400],,)
401# End of remove.
402
403
404AC_ARG_WITH(system-libs,
405[  --with-system-libs      Use libs already on system -- enables all
406                          --with-system-* flags except
407                          odbc/sane/xrender-header(s)
408],,)
409AC_ARG_WITH(system-headers,
410[  --with-system-headers   Use headers already on system -- enables all
411                          --with-system-* flags for external packages
412                          whose headers are the only entities used i.e.
413                          boost/vigra/odbc/sane/xrender-header(s)
414],,)
415AC_ARG_WITH(system-jars,
416[  --without-system-jars   When building with --with-system-libs, also the
417                          needed jars are expected on the system. Use this to
418                          disable that.
419                          (except for the db case where --with-system-db
420                          *has to* imply using the db.jar from there, too)
421],,)
422AC_ARG_WITH(system-zlib,
423[  --with-system-zlib      Use zlib already on system
424],,)
425AC_ARG_WITH(system-nss,
426[  --with-system-nss       Use NSS already on system
427],,)
428AC_ARG_WITH(system-openssl,
429[  --with-system-openssl   Use OpenSSL already on system
430],,)
431AC_ARG_WITH(system-jpeg,
432[  --with-system-jpeg      Use jpeg already on system
433],,)
434AC_ARG_WITH(system-expat,
435[  --with-system-expat     Use expat already on system
436],,)
437AC_ARG_WITH(system-libxml,
438[  --with-system-libxml    Use libxml already on system
439],,)
440AC_ARG_WITH(system-python,
441[  --with-system-python    Use python already on system
442],,)
443AC_ARG_WITH(system-icu,
444[  --with-system-icu       Use icu already on system
445],,)
446AC_ARG_WITH(system-poppler,
447[  --with-system-poppler   Use poppler already on system
448],,)
449AC_ARG_WITH(system-lucene,
450[  --with-system-lucene    Use lucene already on system
451],,)
452AC_ARG_WITH(lucene-core-jar,
453[  --with-lucene-core-jar=JARFILE   Specify path to jarfile manually ],
454[ LUCENE_CORE_JAR="$withval"
455])
456AC_ARG_WITH(lucene-analyzers-jar,
457[  --with-lucene-analyzers-jar=JARFILE   Specify path to jarfile manually ],
458[ LUCENE_ANALYZERS_JAR="$withval"
459])
460AC_ARG_ENABLE(mysql-connector,
461[  --enable-mysql-connector     enables the build of the MySQL Connector/OOo extension.
462                                This requires access to the MySQL Connector/C (aka libmysql) to be given, too, with
463                                either the --with-system-mysql or --with-libmysql-path option.
464],,)
465AC_ARG_WITH(system-mysql,
466[  --with-system-mysql          Use MySQL libraries already on system, for building the MySQL Connector/OOo extension.
467                                Requires MYSQLCONFIG to point to the mysql_config executable.
468],,)
469AC_ARG_WITH(libmysql-path,
470[  --with-libmysql-path         Use Connector/C (libmysql) installation for building the MySQL Connector/OOo extension.
471
472                                Usage: --with-libmysql-path=<absolute path to your Connector/C installation>
473],,)
474AC_ARG_WITH(system-mysql-cppconn,
475[  --with-system-mysql-cppconn  Use MySQL C++ Connector libraries already on system
476],,)
477AC_ARG_WITH(system-hsqldb,
478[  --with-system-hsqldb    Use hsqldb already on system
479],,)
480AC_ARG_WITH(hsqldb-jar,
481[  --with-hsqldb-jar=JARFILE   Specify path to jarfile manually ],
482[ HSQLDB_JAR="$withval"
483])
484AC_ARG_WITH(system-beanshell,
485[  --with-system-beanshell Use beanshell already on system (default)
486],,)
487AC_ARG_ENABLE(beanshell,
488[  --enable-beanshell     Enable the use of beanshell.
489],,)
490AC_ARG_WITH(beanshell-jar,
491[  --with-beanshell-jar=JARFILE   Specify path to jarfile manually ],
492[ BSH_JAR="$withval"
493])
494AC_ARG_ENABLE(pdfimport,
495[  --enable-pdfimport          enables the build of the PDF Import extension
496],,)
497AC_ARG_ENABLE(wiki-publisher,
498[  --enable-wiki-publisher      enables the build of the Wiki Publisher extension
499],,)
500AC_ARG_WITH(commons-codec-jar,
501[  --with-commons-codec-jar=JARFILE   Specify path to jarfile manually ],
502[ COMMONS_CODEC_JAR="$withval"
503])
504AC_ARG_WITH(commons-lang-jar,
505[  --with-commons-lang-jar=JARFILE   Specify path to jarfile manually ],
506[ COMMONS_LANG_JAR="$withval"
507])
508AC_ARG_WITH(commons-httpclient-jar,
509[  --with-commons-httpclient-jar=JARFILE   Specify path to jarfile manually ],
510[ COMMONS_HTTPCLIENT_JAR="$withval"
511])
512AC_ARG_WITH(commons-logging-jar,
513[  --with-commons-logging-jar=JARFILE   Specify path to jarfile manually ],
514[ COMMONS_LOGGING_JAR="$withval"
515])
516AC_ARG_WITH(servlet-api-jar,
517[  --servlet-api-jar=JARFILE   Specify path to jarfile manually ],
518[ SERVLETAPI_JAR="$withval"
519])
520AC_ARG_ENABLE(report-builder,
521[  --enable-report-builder  enables the build of the Report Builder extension
522],,)
523AC_ARG_WITH(sac-jar,
524[  --with-sac-jar=JARFILE   Specify path to jarfile manually (for Report Builder extension) ],
525[ SAC_JAR="$withval"
526])
527AC_ARG_WITH(libxml-jar,
528[  --with-libxml-jar=JARFILE   Specify path to jarfile manually (for Report Builder extension) ],
529[ LIBXML_JAR="$withval"
530])
531AC_ARG_WITH(flute-jar,
532[  --with-flute-jar=JARFILE   Specify path to jarfile manually (for Report Builder extension) ],
533[ FLUTE_JAR="$withval"
534])
535AC_ARG_WITH(jfreereport-jar,
536[  --with-jfreereport-jar=JARFILE   Specify path to jarfile manually (for Report Builder extension) ],
537[ JFREEREPORT_JAR="$withval"
538])
539AC_ARG_WITH(liblayout-jar,
540[  --with-liblayout-jar=JARFILE   Specify path to jarfile manually (for Report Builder extension) ],
541[ LIBLAYOUT_JAR="$withval"
542])
543AC_ARG_WITH(libloader-jar,
544[  --with-libloader-jar=JARFILE   Specify path to jarfile manually (for Report Builder extension) ],
545[ LIBLOADER_JAR="$withval"
546])
547AC_ARG_WITH(libformula-jar,
548[  --with-libformula-jar=JARFILE   Specify path to jarfile manually (for Report Builder extension) ],
549[ LIBFORMULA_JAR="$withval"
550])
551AC_ARG_WITH(librepository-jar,
552[  --with-librepository-jar=JARFILE   Specify path to jarfile manually (for Report Builder extension) ],
553[ LIBREPOSITORY_JAR="$withval"
554])
555AC_ARG_WITH(libfonts-jar,
556[  --with-libfonts-jar=JARFILE   Specify path to jarfile manually (for Report Builder extension) ],
557[ LIBFONTS_JAR="$withval"
558])
559AC_ARG_WITH(libserializer-jar,
560[  --with-libserializer-jar=JARFILE   Specify path to jarfile manually (for Report Builder extension) ],
561[ LIBSERIALIZER_JAR="$withval"
562])
563AC_ARG_WITH(libbase-jar,
564[  --with-libbase-jar=JARFILE   Specify path to jarfile manually (for Report Builder extension) ],
565[ LIBBASE_JAR="$withval"
566])
567AC_ARG_WITH(system-saxon,
568[  --with-system-saxon     Use saxon already on system (default)
569],,)
570AC_ARG_ENABLE(saxon,
571[  --disable-saxon         Disable use of saxon
572],,)
573AC_ARG_WITH(saxon-jar,
574[  --with-saxon-jar=JARFILE   Specify path to jarfile manually. This implies --with-system-saxon ],
575[ SAXON_JAR="$withval"
576])
577AC_ARG_WITH(system-libxslt,
578[  --with-system-libxslt   Use libxslt already on system
579],,)
580AC_ARG_WITH(system-odbc,
581[  --with-system-odbc-headers     Use the odbc headers already on system
582],,)
583AC_ARG_WITH(system-sane,
584[  --with-system-sane-header      Use sane.h already on system
585],,)
586AC_ARG_WITH(system-xrender,
587[  --with-system-xrender-headers  Use XRender headers already on system
588],,)
589AC_ARG_WITH(system-curl,
590[  --with-system-curl      Use curl already on system
591],,)
592AC_ARG_WITH(system-boost,
593[  --with-system-boost     Use boost already on system
594],,)
595AC_ARG_WITH(system-mdds,
596[  --with-system-mdds      Use mdds already on system
597],,)
598AC_ARG_WITH(system-vigra,
599[  --with-system-vigra     Use vigra already on system
600],,)
601AC_ARG_ENABLE(hunspell,
602[  --enable-hunspell       Determines whether to enable the Hunspell library.
603                          If enabled, the library will be built unless you
604                          specify --with-system-hunspell to use the library
605                          already present on your system.
606                          If disabled, the Spell Checking component will also
607                          be disabled.
608                          (Default: hunspell disabled)
609],,enable_hunspell=no)
610AC_ARG_WITH(system-hunspell,
611[  --with-system-hunspell  Use libhunspell already on system
612],,)
613AC_ARG_WITH(system-mythes,
614[  --with-system-mythes    Use mythes already on system
615],,)
616AC_ARG_ENABLE(hyphen,
617[  --enable-hyphen         Determines whether to enable the Hyphen library.
618                          If enabled, the library will be built unless you
619                          specify --with-system-hyphen to use the library
620                          already present on your system.
621                          If disabled, the Hyphenator component will also
622                          be disabled.
623                          (Default: hyphen disabled)
624],,enable_hyphen=no)
625AC_ARG_WITH(system-hyphen,
626[  --with-system-hyphen    Use libhypeh already on system
627],,)
628AC_ARG_WITH(system-libtextcat,
629[  --with-system-libtextcat      Use libtextcat already on system
630],,)
631AC_ARG_WITH(external-libtextcat-data,
632[  --with-system-libtextcat-data Use libtextcat data already on system
633],,)
634AC_ARG_WITH(system-redland,
635[  --with-system-redland   Use redland library already on system
636],,)
637AC_ARG_WITH(stlport,
638[  --with-stlport         Only building --without-stlport is supported.
639], WITH_STLPORT=$withval , WITH_STLPORT=no)
640AC_ARG_WITH(jdk-home,
641[  --with-jdk-home         if you have installed JDK 1.3 or later on your system
642                          please supply the path here.
643                          Note that this is not the location of the Java binary
644                          but the location of the entire distribution.
645
646                          Usage: --with-jdk-home=<absolute path to JDK home>
647],,)
648AC_ARG_WITH(java,
649[  --with-java             Build with[[out]] Java support. If you use
650                          --without-java/--with-java=no then the build will have
651                          no support for Java components, applets, accessibility
652                          or XML filters.
653], if test "$withval" = "yes"; then WITH_JAVA=java; else WITH_JAVA=$withval; fi, WITH_JAVA=java)
654AC_ARG_ENABLE(gcjaot,
655[  --enable-gcjaot         Build with[[out]] using Ahead of Time java compilation
656                          support to speed up buildsi by compiling the jars also
657                          to native code..
658                          --enable-gcjaot is only known to work with bytecode
659                          created with gcj or ecj
660],,)
661AC_ARG_WITH(ant-home,
662[  --with-ant-home         If you have installed Apache Ant on your system,
663                          please supply the path here.
664                          Note that this is not the location of the Ant binary
665                          but the location of the entire distribution.
666
667                          Usage: --with-ant-home=<absolute path to Ant home>
668],,)
669AC_ARG_WITH(junit,
670[  --with-junit            Specifies the JUnit 4 jar file to use for JUnit-based
671                          tests.  --without-junit disables those tests.  Not
672                          relevant in the --without-java case.
673
674                          Usage: --with-junit=<absolute path to JUnit 4 jar>
675],,with_junit=yes)
676AC_ARG_WITH(hamcrest-core,
677[  --with-hamcrest-core    Specifies the hamcrest-core jar file to use for
678                          JUnit-based tests.  --without-junit disables those
679                          tests.  Not relevant in the --without-java or
680                          --without-junit cases, and only needed for JUnit
681                          >= 4.11.
682],,with_hamcrest_core=yes)
683AC_ARG_WITH(perl-home,
684[  --with-perl-home        If you have installed the Perl 5 Distribution, on your
685                          system, please supply the path here.
686                          Note that this is not the location of the Perl binary
687                          but the location of the entire distribution.
688
689                          Usage: --with-perl-home=<absolute path to Perl 5 home>
690],,)
691AC_ARG_WITH(cl-home,
692[  --with-cl-home          For Windows NT users, please supply the path
693                          for the Microsoft C/C++ compiler.
694                          Note that this is not the location of the compiler
695                          binary but the location of the entire distribution.
696
697                          Usage: --with-cl-home=<absolute path to Microsoft C/C++ compiler home>
698],,)
699AC_ARG_WITH(mspdb-path,
700[  --with-mspdb-path       For Microsoft C/C++ compiler users, please supply the
701                          path pointing to the mspdb71.dll (.NET 2003).
702
703                          Usage: --with-mspdb-path=<absolute path to mspdb71.dll>
704],,)
705AC_ARG_WITH(midl-path,
706[  --with-midl-path        For Microsoft C/C++ .NET compiler users, please supply
707                          the path pointing to the midl.exe.
708
709                          Usage: --with-midl-path=<absolute path to midl.exe>
710],,)
711AC_ARG_WITH(csc-path,
712[  --with-csc-path         For Microsoft C/C++ .NET compiler users, please supply
713                          the path pointing to the csc.exe.
714
715                          Usage: --with-csc-path=<absolute path to csc.exe>
716],,)
717AC_ARG_WITH(nsis-path,
718[  --with-nsis-path        For Windows users, please supply the path to the
719                          "Nullsoft Scriptable Install System" (NSIS). If NSIS
720                          is found in the path or this option is supplied a self
721                          contained executable installer for Apache OpenOffice
722                          will be created.
723
724                          Usage: --with-nsis-path=<absolute path to nsis.exe>
725],,)
726AC_ARG_WITH(frame-home,
727[  --with-frame-home       For Microsoft C/C++ .NET compiler users, please supply
728                          the path pointing to lib/mscoree.lib, usually
729                          something like:
730                          "/cygdrive/c/Program Files/Microsoft Visual Studio .NET/FrameworkSDK"
731
732                          MS Visual Toolkit compiler users, please supply the
733                          path pointing to lib/msvcrt.lib, usually something
734                          like:
735                          "/cygdrive/c/Program Files/Microsoft Visual Studio .NET 2003/Vc7"
736
737                          Usage: --with-frame-home=<absolute path to Framework SDK [[home]]>
738],,)
739AC_ARG_WITH(psdk-home,
740[  --with-psdk-home        For Windows users, please supply the path to the
741                          Microsoft Platform SDK.
742
743                          Usage: --with-psdk-home=<absolute path to Microsoft Platform SDK>
744],,)
745AC_ARG_WITH(directx-home,
746[  --with-directx-home     For Windows users, please supply the path to the
747                          Microsoft DirectX SDK.
748
749                          Usage: --with-directx-home=<absolute path to Microsoft DirectX SDK>
750],,)
751AC_ARG_WITH(mozilla-build,
752[  --with-mozilla-build    For Windows users, please supply the path to the
753                          mozilla build tools.
754
755                          Usage: --with-mozilla-build=<absolute path to mozilla build tools>
756
757                          At the moment of this writing, an installer for the mozilla build tools
758                          can be obtained from https://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/.
759],[MOZILLABUILD=$withval],)
760AC_ARG_WITH(local-solenv,
761[  --with-local-solenv     If you have solenv in a location other than ./solenv,
762                          please supply the path here.
763
764                          Usage: --with-local-solenv=<absolute path to solenv>
765],,)
766AC_ARG_WITH(local-solver,
767[  --with-local-solver     if you have solver in a location other than ./solver,
768                          please supply the path here.
769
770                          Usage: --with-local-solver=<absolute path to solver>
771],,)
772AC_ARG_ENABLE(javascript,
773[  --disable-javascript    Disables support for JavaScript macros.
774],,)
775AC_ARG_WITH(system-coinmp,
776[  --with-system-coinmp    Use CoinMP library already installed on the system
777],,)
778AC_ARG_ENABLE(coinmp,
779[  --disable-coinmp        Do not use CoinMP as the Calc solver.
780],,)
781AC_ARG_ENABLE(check-only,
782[  --enable-check-only     Use this option option if you just want to check your
783                          environment. This option stops the generation of an
784                          ????env.set
785
786                          Usage: --enable-check-only=yes
787],,)
788AC_ARG_ENABLE(ccache-skip,
789[[  --enable-ccache-skip    [default=auto] allow the use of --ccache-skip to
790                          escape compiler flags that would otherwise prevent
791                          caching of the result (currently used on Mac only)
792                          NOTE: requires patched version because of a bug in
793                          ccache (see issue 104567 for details and patch)
794                          explicitly enable if your version of ccache does not
795                          identify as version 2.4_OOo
796]],,enable_ccache_skip=auto)
797AC_ARG_WITH(lang,
798[  --with-lang             Use this option to build Apache OpenOffice with
799                          additional language support. English (US) is always
800                          included by default. Separate multiple languages with
801                          space. For all languages, use --with-lang=ALL.
802
803                          Usage: --with-lang="es sw tu cs sk"
804],,)
805AC_ARG_WITH(poor-help-localizations,
806[  --with-poor-help-localizations
807                           Use this option to specify which languages have
808                          unusable help localizations. Separate multiple
809                          languages with space.
810
811                          Usage: --with-poor-help-localizations="af ar be-BY ca"
812],,)
813AC_ARG_WITH(dict,
814[  --with-dict             Use this option to build Apache OpenOffice with
815                          dictionary support. ALL dictionaries are always
816                          included by default unless overridden with
817                          this option. Separate multiple dictionaries with
818                          commas. For all dictionaries, use --with-dict=ALL.
819
820                          Usage: --with-dict=ENGB,ENUS,ITIT
821],,)
822AC_ARG_WITH(intro-bitmaps,
823[  --with-intro-bitmaps    Prefer the specified intro bitmaps over the
824                          the default one. Can be more than one (separated by
825                          commas), the order means priority of fallback if the
826                          first does not exist (in the installed tree).
827
828                          Usage: --with-intro-bitmaps=/path/my_ooo_intro.png
829],,)
830AC_ARG_WITH(about-bitmaps,
831[  --with-about-bitmaps    Similarly to --with-intro-bitmaps, this allows
832                          specification of bitmaps for the About box.
833
834                          Usage: --with-about-bitmaps=/path/my_ooo_about.png
835],,)
836AC_ARG_WITH(vendor,
837[  --with-vendor           Set vendor of the build.
838
839                          Usage: --with-vendor="John the Builder"
840],,)
841AC_ARG_WITH(unix-wrapper,
842[  --with-unix-wrapper    Redefines the name of the UNIX wrapper that will be used
843                          in the desktop files and in the desktop-integration RPMs.
844
845                          Usage: --with-unix-wrapper=ooffice
846],,)
847AC_ARG_WITH(asm-home,
848[  --with-asm-home         For Windows users, please supply the path for the
849                          ml.exe assembler.
850
851                          Usage: --with-asm-home=<path to ml.exe directory>
852],,)
853AC_ARG_WITH(nasm-home,
854[  --with-nasm-home        For Windows users, please supply the path for the
855                          nasm.exe assembler.
856
857                          Usage: --with-nasm-home=<path to nasm.exe directory>
858],,)
859AC_ARG_WITH(os-version,
860[  --with-os-version       For FreeBSD users, use this option option to override
861                          the detected OSVERSION.
862
863                          Usage: --with-os-version=<OSVERSION>
864],,)
865AC_ARG_WITH(unzip-home,
866[  --with-unzip-home       Deprecated: use --with-zip-home instead],,)
867AC_ARG_WITH(zip-home,
868[  --with-zip-home         If you use a non standard zip, for example Windows
869                          please supply the path for zip
870
871                          Usage: --with-zip-home=<path to zip executable>
872],,)
873AC_ARG_WITH(mingwin,
874[  --with-mingwin          For Windows users, use the mingwin32 compiler within
875                          cygwin environment
876
877                          Usage: --with-mingwin=yes
878
879                          For !Windows use, use the mingw32 C++ compiler to
880                          (re-) build unowinreg.dll. Specify the MinGW C++
881                          Compilers name.
882
883                          Usage: --with-mingwin=i586-mingw32msvc-g++
884],WITH_MINGWIN=$withval,WITH_MINGWIN=0)
885AC_ARG_WITH(build-version,
886[  --with-build-version    Allows the builder to add a custom version tag
887                          that will appear in the Help/About box for QA
888                          purposes.
889
890                          Usage: --with-build-version="Built by Jim"
891],with_build_version=$withval)
892AC_ARG_WITH(alloc,
893[  --with-alloc            Define which allocator to build with
894                          (choices are oo, system, tcmalloc, jemalloc)
895
896                          Note that on FreeBSD/NetBSD system==jemalloc
897],,)
898AC_ARG_ENABLE(verbose,
899[  --enable-verbose        Increase build verbosity.
900  --disable-verbose       Decrease build verbosity.
901],,)
902AC_ARG_ENABLE(dependency-tracking,
903[  --disable-dependency-tracking  Disables generation of dependency information.
904],,)
905AC_ARG_ENABLE(category-b,
906[  --enable-category-b     Activate components under a category B license
907                          (see https://www.apache.org/legal/3party.html#category-b):
908                          MPL (hunspell, hyphen, nss, saxon, rhino),
909                          CPL (silgraphite), CPL/EPL (CoinMP), OFL (fonts).
910                          Flags for individual libraries override this one.
911],,)
912AC_ARG_WITH(arm-target,
913[  --arm-target            The minimal targeted arm processor
914                              used for the build environment.
915                              Cases :
916                                arm-target < 6 : armv4t compatibility
917                                arm-target = 6 : exact armv6 compatibility
918                                arm-target > 6 : armv7-a compatibility
919
920                              Usage: --with-arm-target=7
921],with_arm_target=$withval,with_arm_target=4)
922AC_ARG_WITH(macosx-target,
923[  --macosx-target            The minimal macOS/OSX deployment and build target
924
925                              Usage: --with-macosx-target=11.0
926],with_macosx_target=$withval,with_macosx_target=11.0)
927AC_ARG_WITH(macosx-sdk,
928[  --macosx-sdk            The macOS SDK to build against
929
930                              Usage: --with-macosx-sdk=10.11
931                              (or full path: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk)
932],with_macosx_sdk=$withval,)
933AC_ARG_WITH(rat-scan,
934[  --with-rat-scan         Scan source code for license headers.
935                          Use as --with-rat-scan to automatically download pre-built Rat binaries.
936                          Alternatively use as --with-rat-scan=<path-to-rat-direcetory> to use
937                          a separately installed library.
938],with_rat_scan=$withval,)
939
940BUILD_TYPE="OOo"
941ADDITIONAL_REPOSITORIES="../ext_libraries"
942SCPDEFS=""
943
944dnl ===================================================================
945dnl Check configure script vs. configure.ac
946dnl ===================================================================
947AC_MSG_CHECKING([whether configure is up-to-date])
948if test "configure" -ot "configure.ac"; then
949   AC_MSG_RESULT([no])
950   AC_MSG_ERROR([configure is not up-to-date, run autoconf first!])
951else
952   AC_MSG_RESULT([yes])
953fi
954dnl ===================================================================
955dnl Message.
956dnl ===================================================================
957echo "********************************************************************"
958echo "*                                                                  *"
959echo "*   Apache OpenOffice build configuration.                         *"
960echo "*                                                                  *"
961echo "*   The configure process checks your platform to see whether      *"
962echo "*   you can build Apache OpenOffice on it.                         *"
963echo "*   This process checks all pre-requisites and generates a file    *"
964echo "*   containing the necessary environment variables.                *"
965echo "*   Source this file after configure has ended successfully.       *"
966echo "*                                                                  *"
967echo "*   Warnings that are generated during the configure process       *"
968echo "*   must be taken into account since it can be a reason for        *"
969echo "*   an unsuccessful build of Apache OpenOffice.                    *"
970echo "*                                                                  *"
971echo "********************************************************************"
972echo ""
973echo "********************************************************************"
974echo "*                                                                  *"
975echo "*   Checking the platform pre-requisites.                          *"
976echo "*                                                                  *"
977echo "********************************************************************"
978echo ""
979dnl ===================================================================
980dnl Configure pre-requisites.
981dnl ===================================================================
982cat /dev/null > warn
983
984AC_PROG_EGREP
985if test -z "$GREP"; then
986GREP=$EGREP
987fi
988AC_PROG_AWK
989AC_PATH_PROG( AWK, $AWK)
990if test -z "$AWK"; then
991   AC_MSG_ERROR([install awk to run this script])
992fi
993
994AC_PATH_PROGS(SED, sed )
995if test -z "$SED"; then
996   AC_MSG_ERROR([install sed to run this script])
997fi
998
999AC_MSG_CHECKING([for solenv environment])
1000if test -z "$with_local_solenv"; then
1001   LOCAL_SOLENV="DEFAULT"
1002   AC_MSG_RESULT([default])
1003else
1004   LOCAL_SOLENV=$with_local_solenv
1005   AC_MSG_RESULT([$with_local_solenv])
1006fi
1007AC_SUBST(LOCAL_SOLENV)
1008
1009if test "$LOCAL_SOLENV" = "DEFAULT"; then
1010  _solenv="./solenv"
1011else
1012  _solenv="$LOCAL_SOLENV"
1013fi
1014AC_SUBST(_solenv)
1015
1016if test -e $_solenv/inc/minor.mk; then
1017   # Get UPD number from ./solenv/inc/minor.mk
1018   UPD="`$GREP RSCVERSION= $_solenv/inc/minor.mk | $AWK -F"=" '{ print $2 }'`"
1019   AC_SUBST(UPD)
1020   SOURCEVERSION="`$GREP SOURCEVERSION= $_solenv/inc/minor.mk | $AWK -F"=" '{ print $2 }'`"
1021   AC_SUBST(SOURCEVERSION)
1022else
1023   AC_MSG_ERROR([$_solenv/inc/minor.mk missing but needed for architecture/os detecion and proper environment script generation...])
1024fi
1025
1026
1027dnl ==================================================================
1028dnl Checks for custom pack.lst
1029dnl ==================================================================
1030AC_MSG_CHECKING([for custom pack.lst])
1031CUSTOM_PACK_LIST=
1032USE_PACKAGER=
1033if test -n "$with_packager_list" ; then
1034    if test -e $with_packager_list; then
1035      CUSTOM_PACK_LIST=$with_packager_list
1036      USE_PACKAGER=YES
1037    fi
1038fi
1039if test -n "$CUSTOM_PACK_LIST"; then
1040   AC_MSG_RESULT([$CUSTOM_PACK_LIST])
1041else
1042   AC_MSG_RESULT([no])
1043fi
1044AC_SUBST(CUSTOM_PACK_LIST)
1045AC_SUBST(USE_PACKAGER)
1046
1047
1048dnl ===================================================================
1049dnl Checks for the operating system and processor.
1050dnl ===================================================================
1051AC_CANONICAL_TARGET
1052if test "$build" != "$host" -o "$build" != "$target" \
1053  -o "$host" != "$target"; then
1054    AC_MSG_WARN([cross-compiling by any means is not supported (yet)!])
1055    echo "cross-compiling by any means is not supported (yet)!" >> warn
1056fi
1057
1058if echo "$build_os" | $GREP cygwin; then
1059   AC_MSG_CHECKING([Cygwin version])
1060   CygwinVer=`uname -r`
1061   AC_MSG_RESULT([$CygwinVer])
1062   if test "`echo $CygwinVer | $AWK -F . '{ print $1$2 }'`" -lt "15"; then
1063      AC_MSG_ERROR([You need at least Cygwin V1.5.x])
1064   fi
1065else
1066   CygwinVer="false"
1067fi
1068
1069# get info about the system provided release/version details
1070head /etc/*-release
1071uname -a
1072
1073dnl ===================================================================
1074dnl The following is a list of supported systems.
1075dnl Sequential to keep the logic very simple
1076dnl These values may be checked and reset later.
1077dnl ===================================================================
1078case "$build_os" in
1079    solaris*)
1080        test_gtk=yes
1081        test_cairo=yes
1082        test_kde=yes
1083        test_cups=yes
1084            test_randr=yes
1085        test_freetype=yes
1086            test_gstreamer=yes
1087        _os=SunOS
1088        AC_PATH_PROG( GNUTAR, gtar,,$PATH:/usr/sfw/bin)
1089        if test -z "$GNUTAR"; then
1090            AC_MSG_ERROR([gtar (gnu tar) not found but needed. Install it (SUN Freeware package).])
1091        fi
1092        AC_SUBST(GNUTAR)
1093
1094        dnl ===========================================================
1095        dnl check whether we're using solaris 6,7,8 - sparc or intel.
1096        dnl ===========================================================
1097        AC_MSG_CHECKING([the Solaris operating system release])
1098        _os_release=`echo $build_os | $SED -e s/solaris2\.//`
1099        if test "$_os_release" -lt "6"; then
1100                AC_MSG_ERROR([use solaris >= 6 to build Apache OpenOffice])
1101        else
1102                AC_MSG_RESULT([ok ($_os_release)])
1103        fi
1104
1105        dnl check whether we're using a sparc or i386 processor
1106        AC_MSG_CHECKING([the processor type])
1107        if test "$build_cpu" = "sparc" -o "$build_cpu" = "i386"; then
1108                AC_MSG_RESULT([ok ($build_cpu)])
1109        else
1110                AC_MSG_ERROR([only sparc and i386 processors are supported])
1111        fi
1112        ;;
1113    linux-gnu*|k*bsd*-gnu*)
1114        test_gtk=yes
1115        test_cairo=yes
1116        test_kde=yes
1117        test_kde4=yes
1118        test_cups=yes
1119            test_randr=yes
1120        test_freetype=yes
1121            test_gstreamer=yes
1122            _os=Linux
1123        ;;
1124    gnu)
1125        test_cups=no
1126        _os=GNU
1127        ;;
1128    cygwin*) # Windows
1129        test_cups=no
1130        test_cairo=yes
1131        test_freetype=no
1132            test_gstreamer=no
1133        _os=WINNT
1134        ;;
1135    darwin*) # Mac OS X
1136        test_cups=yes
1137        test_gtk=yes
1138        test_cairo=yes
1139            test_randr=no
1140        test_freetype=no
1141            test_gstreamer=no
1142        _os=Darwin
1143            if test "$enable_systray" = "yes" && test "$enable_gtk" != "no"; then
1144               AC_MSG_WARN([Disabling gtk-quickstarter - not supported on Mac. Use --disable-systray])
1145               echo "Disabling gtk-quickstarter - not supported on Mac. Use --disable-systray" >>warn
1146               enable_systray=no
1147            fi
1148        SDKROOT="`xcrun --sdk macosx --show-sdk-path`"
1149        if test ! -n "$CC"; then
1150           CC="`xcrun -f clang`"
1151        fi
1152        if test ! -n "$CXX"; then
1153           CXX="`xcrun -f clang++` -std=c++11"
1154           macos_c11=`pwd`/macos_c11
1155           echo "#!/bin/sh" > $macos_c11
1156           echo "$CXX \"\$@\"" >> $macos_c11
1157           chmod 755 $macos_c11
1158           CXX="$macos_c11"
1159        fi
1160        # Don't use OSVERSION until we know no conflicts result from it
1161        _darwin_version="`uname -r | $AWK -F . '{ print $1 }'`"
1162        # Map the Darwin (XNU) major version to the macOS version.
1163        # Darwin 6..19  => macOS 10.(darwin-4)   (10.2 .. 10.15)
1164        # Darwin 20+    => macOS (darwin-9)       (11, 12, 13, ...)
1165        if test "$_darwin_version" -ge 20; then
1166           _osx_version="`expr $_darwin_version - 9`"
1167        else
1168           _osx_version="10.`expr $_darwin_version - 4`"
1169        fi
1170        AC_MSG_NOTICE([Detected Darwin version: $_darwin_version ($_osx_version)])
1171        # Detect the build CPU architecture. Apple Silicon (arm64) reports
1172        # "arm64" from uname -m and maps to the aarch64 toolchain/bridge.
1173        _darwin_cpu="`uname -m`"
1174        case "$_darwin_cpu" in
1175           arm64|aarch64)
1176              AC_MSG_NOTICE([Detected Apple Silicon (arm64) build host])
1177              ;;
1178           x86_64|i*86)
1179              AC_MSG_NOTICE([Detected Intel (x86_64) build host])
1180              ;;
1181           *)
1182              AC_MSG_ERROR([Unsupported macOS CPU architecture: $_darwin_cpu])
1183              ;;
1184        esac
1185        ;;
1186    os2*)
1187        test_x=no
1188        test_cups=no
1189            test_randr=no
1190        test_gtk=no
1191        test_freetype=no
1192            test_gstreamer=no
1193        test_cairo=yes
1194        _os=OS2
1195        ;;
1196    freebsd*)
1197        test_gtk=yes
1198        test_cairo=yes
1199        test_kde=yes
1200        test_kde4=yes
1201        test_cups=yes
1202            test_randr=yes
1203        test_freetype=yes
1204            test_gstreamer=yes
1205        AC_MSG_CHECKING([the FreeBSD operating system release])
1206        if test -n "$with_os_version"; then
1207            OSVERSION="$with_os_version"
1208        else
1209            OSVERSION=`/sbin/sysctl -n kern.osreldate`
1210        fi
1211        AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1212        AC_MSG_CHECKING([which thread library to use])
1213        if test "$OSVERSION" -lt "500016"; then
1214            PTHREAD_CFLAGS="-D_THREAD_SAFE"
1215            PTHREAD_LIBS="-pthread"
1216        elif test "$OSVERSION" -lt "502102"; then
1217            PTHREAD_CFLAGS="-D_THREAD_SAFE"
1218            PTHREAD_LIBS="-lc_r"
1219        else
1220            PTHREAD_CFLAGS=""
1221            PTHREAD_LIBS="-pthread"
1222        fi
1223        AC_MSG_RESULT([$PTHREAD_LIBS])
1224        _os=FreeBSD
1225        ;;
1226    osf)
1227        test_cups=no
1228            test_randr=no
1229        _os=OSF1
1230        ;;
1231    netbsd)
1232        test_gtk=yes
1233        test_cairo=yes
1234        test_kde=yes
1235        test_kde4=yes
1236        test_cups=no
1237            test_randr=yes
1238        test_freetype=yes
1239            test_gstreamer=yes
1240        PTHREAD_CFLAGS="-pthread"
1241        PTHREAD_LIBS="-pthread -lpthread"
1242        _os=NetBSD
1243        ;;
1244    aix*)
1245        test_cups=no
1246            test_randr=no
1247        test_freetype=yes
1248            test_gstreamer=yes
1249        PTHREAD_LIBS=-pthread
1250        echo "AIX is an alpha port --- Use at own risk" >> warn
1251        _os=AIX
1252        ;;
1253   *)
1254   AC_MSG_ERROR([$_os operating system is not suitable to build Apache OpenOffice!])
1255   ;;
1256esac
1257
1258AC_SUBST(OSVERSION)
1259AC_SUBST(PTHREAD_CFLAGS)
1260AC_SUBST(PTHREAD_LIBS)
1261
1262
1263dnl Ensure pkg-config is initialized before any possible use
1264PKG_PROG_PKG_CONFIG
1265
1266
1267dnl ===================================================================
1268dnl Set the ENABLE_CRASHDUMP variable.
1269dnl ===================================================================
1270AC_MSG_CHECKING([whether to enable crashdump feature])
1271if test "$enable_crashdump" = "yes"; then
1272   ENABLE_CRASHDUMP="TRUE"
1273   BUILD_TYPE="$BUILD_TYPE CRASHREP"
1274   AC_MSG_RESULT([yes])
1275else
1276   ENABLE_CRASHDUMP=""
1277   AC_MSG_RESULT([no])
1278fi
1279AC_SUBST(ENABLE_CRASHDUMP)
1280
1281if test "$_os" = "WINNT"; then
1282   BUILD_TYPE="$BUILD_TYPE TWAIN"
1283fi
1284
1285if test "$_os" = "WINNT"; then
1286   dnl ===================================================================
1287   dnl Set the VC_STANDARD variable.
1288   dnl ===================================================================
1289   AC_MSG_CHECKING([whether to use the standard non-optimizing compiler])
1290   if test "$enable_cl_standard" = "" -o "$enable_cl_standard" = "no"; then
1291      VC_STANDARD=""
1292      AC_MSG_RESULT([no])
1293   else
1294      VC_STANDARD="TRUE"
1295      AC_MSG_RESULT([yes])
1296   fi
1297   AC_SUBST(VC_STANDARD)
1298fi
1299
1300if test "$_os" = "WINNT"; then
1301   dnl ===================================================================
1302   dnl Set the BUILD_X64 variable.
1303   dnl ===================================================================
1304   AC_MSG_CHECKING([whether to build/use the Windows 64bit shell extensions])
1305   if test "$enable_win_x64_shellext" = "" -o "$enable_win_x64_shellext" = "no"; then
1306      BUILD_X64=""
1307      AC_MSG_RESULT([no])
1308   else
1309      BUILD_X64="TRUE"
1310      AC_MSG_RESULT([yes])
1311   fi
1312   AC_SUBST(BUILD_X64)
1313
1314   dnl ===================================================================
1315   dnl Set the BUILD_WIN64 variable.
1316   dnl ===================================================================
1317   AC_MSG_CHECKING([whether to build 64 bit OpenOffice on 64 bit Windows])
1318   if test "$build_cpu" = "x86_64" ; then
1319      if test "x$enable_win64" != "xno" ; then
1320         BUILD_WIN64="TRUE"
1321         AC_MSG_RESULT([yes])
1322         OOWINTOOL="./oowintool"
1323      else
1324         BUILD_WIN64=""
1325         AC_MSG_RESULT([no])
1326         OOWINTOOL="./oowintool --aoo32-on-win64"
1327      fi
1328   else
1329      if test "x$enable_win64" != "xno" ; then
1330         AC_MSG_ERROR([the --enable-win64 option can only be used on an AMD64 CPU])
1331      fi
1332      BUILD_WIN64=""
1333      AC_MSG_RESULT([no])
1334      OOWINTOOL="./oowintool"
1335   fi
1336   AC_SUBST(BUILD_WIN64)
1337fi
1338
1339dnl ===================================================================
1340dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
1341dnl ===================================================================
1342AC_MSG_CHECKING([whether to turn warnings to errors])
1343if test -n "$enable_werror" && test "$enable_werror" != "no"; then
1344   ENABLE_WERROR="TRUE"
1345   AC_MSG_RESULT([yes])
1346   AC_MSG_WARN([Turning warnings to errors has no effect in modules or])
1347   AC_MSG_WARN([on platforms where it has been disabled explicitly])
1348   echo "Turning warnings to errors has no effect in modules or on platforms where it has been disabled explicitly" >> warn
1349else
1350   ENABLE_WERROR="FALSE"
1351   AC_MSG_RESULT([no])
1352fi
1353AC_SUBST(ENABLE_WERROR)
1354
1355dnl ===================================================================
1356dnl Set the ENABLE_DEBUG variable. (Activate --enable-symbols)
1357dnl ===================================================================
1358AC_MSG_CHECKING([whether to do a debug build])
1359if test -n "$enable_debug" && test "$enable_debug" != "no"; then
1360   ENABLE_DEBUG="TRUE"
1361   if test -z "$enable_symbols"; then
1362      enable_symbols="yes"
1363   fi
1364   AC_MSG_RESULT([yes])
1365else
1366   ENABLE_DEBUG="FALSE"
1367   AC_MSG_RESULT([no])
1368fi
1369AC_SUBST(ENABLE_DEBUG)
1370
1371dnl ===================================================================
1372dnl Set the ENABLE_DBGUTIL variable
1373dnl ===================================================================
1374AC_MSG_CHECKING([whether to build with additional debug utilities])
1375if test -n "$enable_dbgutil" && test "$enable_dbgutil" != "no"; then
1376   PROEXT=""
1377   PRODUCT=""
1378   PROFULLSWITCH=""
1379   AC_MSG_RESULT([yes])
1380else
1381   PRODUCT="full"
1382   PROFULLSWITCH="product=full"
1383   PROEXT=".pro"
1384   AC_MSG_RESULT([no, full product build])
1385fi
1386AC_SUBST(PRODUCT)
1387AC_SUBST(PROFULLSWITCH)
1388AC_SUBST(PROEXT)
1389
1390dnl ===================================================================
1391dnl First setting is whether to include symbols into final build.
1392dnl ===================================================================
1393AC_MSG_CHECKING([whether to include symbols into final build])
1394if test -n "$enable_symbols" && test "$enable_symbols" != "no"; then
1395    if test "$enable_symbols" = "yes" -o "$enable_symbols" = "TRUE"; then
1396        ENABLE_SYMBOLS="TRUE"
1397        AC_MSG_RESULT([yes])
1398    else
1399        if test "$enable_symbols" = "SMALL" -o "$enable_symbols" = "small"; then
1400            ENABLE_SYMBOLS="SMALL"
1401            AC_MSG_RESULT([yes, small ones])
1402        else if test "$enable_symbols" != "no" ; then
1403                 echo enable symbols is: $enable_symbols
1404                 AC_MSG_ERROR([--enable-symbols only accepts yes, TRUE or SMALL as parameter.])
1405                 else
1406                         ENABLE_SYMBOLS=
1407             fi
1408        fi
1409    fi
1410else
1411   ENABLE_SYMBOLS=
1412   AC_MSG_RESULT([no])
1413fi
1414AC_SUBST(ENABLE_SYMBOLS)
1415
1416dnl ===================================================================
1417dnl Determine if the solver is to be stripped or not.
1418dnl ===================================================================
1419AC_MSG_CHECKING([whether to strip the solver or not.])
1420if test -n "$enable_strip_solver"; then
1421   if test "$enable_strip_solver" = "yes"; then
1422      DISABLE_STRIP=
1423   else if test "$enable_strip_solver" = "no"; then
1424           DISABLE_STRIP="TRUE"
1425        else
1426           AC_MSG_ERROR([--disable-strip-solver only accepts yes or no as parameter.])
1427        fi
1428   fi
1429else
1430   if test -n "$ENABLE_SYMBOLS"; then
1431      DISABLE_STRIP="TRUE"
1432   else
1433      DISABLE_STRIP=
1434   fi
1435fi
1436if test -z "$DISABLE_STRIP"; then
1437   AC_MSG_RESULT([yes])
1438else
1439   AC_MSG_RESULT([no])
1440fi
1441AC_SUBST(DISABLE_STRIP)
1442
1443dnl ===================================================================
1444dnl Build options
1445dnl ===================================================================
1446
1447# Disable or enable category-B libraries: nss, hunspell, hyphen, saxon,
1448# rhino, silgraphite.
1449
1450# Note that further below they may be enabled or disabled again by
1451# more specific options.
1452
1453ENABLE_CATEGORY_B=
1454
1455AC_MSG_CHECKING([whether to enable category B components])
1456# Category B modules (libraries):
1457#   nss (nss)
1458#   hunspell (hunspell)
1459#   hyphen (hyphen)
1460#   saxon (saxon)
1461#   rhino (rhino)
1462#   graphite (silgraphite)
1463if test "$enable_category_b" = "yes"; then
1464   ENABLE_CATEGORY_B=YES
1465   enable_nss_module="yes"
1466   enable_hunspell="yes"
1467   enable_hyphen="yes"
1468   enable_saxon="yes"
1469   enable_javascript="yes"
1470   enable_graphite="yes"
1471   enable_coinmp="yes"
1472   enable_category_b_fonts="yes"
1473
1474   AC_MSG_RESULT([yes: allow modules nss, hunspell, hyphen, saxon, rhino, graphite, coinmp to be built])
1475else
1476   # Disable libraries.
1477   enable_nss_module="no"
1478   enable_hunspell="no"
1479   enable_hyphen="no"
1480   enable_saxon="no"
1481   enable_javascript="no"
1482   enable_graphite="no"
1483   enable_coinmp="no"
1484   enable_category_b_fonts="no"
1485
1486   AC_MSG_RESULT([no: disabled modules nss, hunspell, hyphen, saxon, rhino, graphite, coinmp])
1487fi
1488AC_SUBST(ENABLE_CATEGORY_B)
1489
1490# gstreamer is used only via pre-installed libraries: not a problem
1491
1492dnl ===================================================================
1493dnl Online Update
1494dnl ===================================================================
1495AC_MSG_CHECKING([whether to enable the Online Update support])
1496if test "$enable_online_update" = "yes" -o "$enable_online_update" = "TRUE"; then
1497   ENABLE_ONLINE_UPDATE="YES"
1498   SCPDEFS="$SCPDEFS -DENABLE_ONLINE_UPDATE"
1499   AC_MSG_RESULT([yes])
1500else
1501   ENABLE_ONLINE_UPDATE=""
1502   AC_MSG_RESULT([no])
1503fi
1504AC_SUBST(ENABLE_ONLINE_UPDATE)
1505
1506dnl ===================================================================
1507dnl Unit Tests
1508dnl ===================================================================
1509AC_MSG_CHECKING([whether to enable unit tests])
1510if test "$enable_unit_tests" = "yes" -o "$enable_unit_tests" = "TRUE"; then
1511   ENABLE_UNIT_TESTS="YES"
1512   BUILD_TYPE="$BUILD_TYPE GTEST"
1513   AC_MSG_RESULT([yes])
1514else
1515   ENABLE_UNIT_TESTS=""
1516   AC_MSG_RESULT([no])
1517fi
1518AC_SUBST(ENABLE_UNIT_TESTS)
1519
1520AC_MSG_CHECKING([whether to enable native CUPS support])
1521if test "$test_cups" = "yes" -a \( "$enable_cups" = "yes" -o "$enable_cups" = "TRUE" \) ; then
1522   ENABLE_CUPS="TRUE"
1523   AC_MSG_RESULT([yes])
1524else
1525   ENABLE_CUPS=""
1526   AC_MSG_RESULT([no])
1527fi
1528AC_SUBST(ENABLE_CUPS)
1529
1530AC_MSG_CHECKING([whether to enable fontconfig support])
1531if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a \( "$enable_fontconfig" = "yes" -o "$enable_fontconfig" = "TRUE" \); then
1532   ENABLE_FONTCONFIG="TRUE"
1533   AC_MSG_RESULT([yes])
1534else
1535   ENABLE_FONTCONFIG=""
1536   AC_MSG_RESULT([no])
1537fi
1538AC_SUBST(ENABLE_FONTCONFIG)
1539
1540dnl ===================================================================
1541dnl find external tarballs.
1542dnl ===================================================================
1543if test -z $TARFILE_LOCATION; then
1544   TARFILE_LOCATION="DEFAULT"
1545fi
1546AC_SUBST(TARFILE_LOCATION)
1547
1548if test -z "$enable_fetch_external" || test "$enable_fetch_external" = "yes" \
1549   && test -z "$with_system_libs" -a "$with_system_jars" != "no"; then
1550   DO_FETCH_TARBALLS="yes"
1551fi
1552AC_SUBST(DO_FETCH_TARBALLS)
1553
1554if test "$_os" = "WINNT"; then
1555   AC_MSG_CHECKING([whether to use DirectX])
1556   ENABLE_DIRECT_DRAW=""
1557   if test "$enable_directx" = "yes" -o "$enable_directx" = "TRUE" -o "$enable_directx" = ""; then
1558      ENABLE_DIRECTX="TRUE"
1559      AC_MSG_RESULT([yes])
1560   else
1561      ENABLE_DIRECTX=""
1562      AC_MSG_RESULT([no])
1563   fi
1564   AC_SUBST(ENABLE_DIRECTX)
1565
1566   AC_MSG_CHECKING([whether to use ActiveX])
1567   if test "$enable_activex" = "yes" -o "$enable_activex" = "TRUE" -o "$enable_activex" = ""; then
1568      DISABLE_ACTIVEX=""
1569      AC_MSG_RESULT([yes])
1570   else
1571      DISABLE_ACTIVEX="TRUE"
1572      AC_MSG_RESULT([no])
1573   fi
1574
1575   AC_MSG_CHECKING([whether to use ATL])
1576   if test "$enable_atl" = "yes" -o "$enable_atl" = "TRUE" -o "$enable_atl" = ""; then
1577      DISABLE_ATL=""
1578      AC_MSG_RESULT([yes])
1579   else
1580      DISABLE_ATL="TRUE"
1581      dnl ActiveX depends on ATL, it should be disabled
1582      DISABLE_ACTIVEX="TRUE"
1583      AC_MSG_RESULT([no])
1584   fi
1585
1586   AC_SUBST(DISABLE_ATL)
1587   AC_SUBST(DISABLE_ACTIVEX)
1588
1589fi
1590
1591dnl ===================================================================
1592dnl Disable rpath in shared libraries?
1593dnl ===================================================================
1594AC_MSG_CHECKING([whether to use RPATH in shared libraries])
1595if test "$enable_rpath" = "no"; then
1596   ENABLE_RPATH="no"
1597else
1598   ENABLE_RPATH="yes"
1599fi
1600AC_MSG_RESULT([$ENABLE_RPATH])
1601AC_SUBST(ENABLE_RPATH)
1602
1603dnl ===================================================================
1604dnl Check extensions to be bundled as literal blobs
1605dnl ===================================================================
1606if test -n "$with_bundled_extension_blobs"; then
1607    BUNDLED_EXTENSION_BLOBS="$with_bundled_extension_blobs"
1608else
1609    BUNDLED_EXTENSION_BLOBS=
1610fi
1611AC_SUBST(BUNDLED_EXTENSION_BLOBS)
1612
1613#dnl ===================================================================
1614#dnl Check extensions that are to be bundled as pre-registered
1615#dnl ===================================================================
1616if test -n "$with_bundled_prereg_extensions"; then
1617    BUNDLED_PREREG_EXTENSIONS="$with_bundled_prereg_extensions"
1618else
1619    BUNDLED_PREREG_EXTENSIONS=
1620fi
1621AC_SUBST(BUNDLED_PREREG_EXTENSIONS)
1622
1623dnl ===================================================================
1624dnl Configure system provided dictionary/hyphenation/thesaurus
1625dnl ===================================================================
1626  AC_MSG_CHECKING([whether to use dicts from external paths])
1627  if test -n "$with_system_dicts" -a "$with_system_dicts" = "yes"; then
1628    AC_MSG_RESULT([yes])
1629    SYSTEM_DICTS=YES
1630    AC_MSG_CHECKING([for spelling dictionary directory])
1631    if test -n "$with_external_dict_dir"; then
1632        DICT_SYSTEM_DIR=file://$with_external_dict_dir
1633    else
1634        DICT_SYSTEM_DIR=file:///usr/share/hunspell
1635    fi
1636    AC_MSG_RESULT([$DICT_SYSTEM_DIR])
1637    AC_MSG_CHECKING([for hyphenation patterns directory])
1638    if test -n "$with_external_hyph_dir"; then
1639        HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
1640    else
1641        HYPH_SYSTEM_DIR=file:///usr/share/hyphen
1642    fi
1643    AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
1644    AC_MSG_CHECKING([for thesaurus directory])
1645    if test -n "$with_external_thes_dir"; then
1646        THES_SYSTEM_DIR=file://$with_external_thes_dir
1647    else
1648        THES_SYSTEM_DIR=file:///usr/share/mythes
1649    fi
1650    AC_MSG_RESULT([$THES_SYSTEM_DIR])
1651  else
1652    AC_MSG_RESULT([no])
1653    SYSTEM_DICTS=NO
1654  fi
1655AC_SUBST(SYSTEM_DICTS)
1656AC_SUBST(DICT_SYSTEM_DIR)
1657AC_SUBST(HYPH_SYSTEM_DIR)
1658AC_SUBST(THES_SYSTEM_DIR)
1659
1660if test $_os = "WINNT"; then
1661   AC_MSG_CHECKING([Windows build environment sanity])
1662   dnl ===================================================================
1663   dnl Sanity check! Native Windows programs cannot use cygwin symlinks!
1664   dnl ===================================================================
1665   dnl As long as awk instead of $AWK is used somewhere in the sources,
1666   dnl check for $AWK and awk. $AWK is pointing to gawk in cygwin.
1667      if test -L $AWK -o -L `which awk` ; then
1668         AC_MSG_ERROR([$AWK / awk is a cygwin symlink!
1669Native Windows programs cannot use cygwin symlinks. Remove the symbolic
1670link, and copy the program to the name of the link.])
1671      fi
1672      if test -L `which tar` ; then
1673         AC_MSG_ERROR([tar is a cygwin symlink!
1674Native Windows programs cannot use cygwin symlinks. Remove the symbolic
1675link, and copy the program to the name of the link.])
1676      fi
1677      if test -L `which gunzip` ; then
1678         AC_MSG_ERROR([gunzip is a cygwin symlink!
1679Native Windows programs cannot use cygwin symlinks. Remove the symbolic
1680link, and copy the program to the name of the link.])
1681      fi
1682   dnl ===================================================================
1683   dnl Another sanity check! More a band-aid. winenv.* adds guw.exe to
1684   dnl CC and CXX but the configure checks here assume that guw.exe
1685   dnl (if needed at all) is not yet present.
1686   dnl ===================================================================
1687   CC=`echo $CC | $SED "s/^guw.exe //"`
1688   CXX=`echo $CXX | $SED "s/^guw.exe //"`
1689   dnl ===================================================================
1690   dnl If $CC is set to a MinGW compiler, e.g. "gcc -mno-cygwin" enable
1691   dnl $WITH_MINGWIN
1692   dnl ===================================================================
1693      if test -n "$CC";then
1694         if test "`$CC -dumpmachine 2>/dev/null | $SED -e 's/^.*-//'`" = "mingw32"; then
1695            WITH_MINGWIN="yes"
1696         fi
1697      fi
1698   dnl ===================================================================
1699   if test "$WITH_MINGWIN" = "yes" ; then
1700      if test -z "$CC"; then
1701         CC="gcc -mno-cygwin"
1702         CXX="g++ -mno-cygwin"
1703      fi
1704   fi
1705   AC_MSG_RESULT([ok])
1706fi
1707AC_SUBST(WITH_MINGWIN)
1708
1709dnl ===================================================================
1710dnl Extra check for Windows. cygwin builds need gcc to build dmake
1711dnl and g++ to build guw.exe although MS cl (or MinGW) is used to
1712dnl build AOO.
1713dnl ===================================================================
1714if test "$_os" = "WINNT" ; then
1715   AC_MSG_CHECKING([for cygwin gcc/g++])
1716   if which gcc > /dev/null && which g++ > /dev/null ; then
1717      AC_MSG_RESULT([found])
1718   else
1719      AC_MSG_ERROR([cygwin gcc and g++ are needed, please install them.])
1720   fi
1721fi
1722
1723
1724dnl ===================================================================
1725dnl Check whether the bash shell can be used.
1726dnl ===================================================================
1727AC_PATH_PROG(SHELLPATH, bash)
1728if test -z "$SHELLPATH"; then
1729   AC_MSG_ERROR([bash not found in \$PATH])
1730else
1731   SHELLPATH=`echo $SHELLPATH | $SED -n "s/\/bash$//p"`
1732fi
1733AC_SUBST(SHELLPATH)
1734
1735dnl ===================================================================
1736dnl  Checks for c compiler,
1737dnl  The check for the c++ compiler is later on.
1738dnl ===================================================================
1739AC_MSG_CHECKING([gcc home])
1740if test -z "$with_gcc_home"; then
1741    GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
1742else
1743    GCC_HOME="$with_gcc_home"
1744fi
1745AC_MSG_RESULT($GCC_HOME)
1746AC_SUBST(GCC_HOME)
1747
1748save_CC=$CC
1749save_CXX=$CXX
1750
1751if test -n "$with_gcc_home"; then
1752   if test -z "$CC"; then
1753      CC="$with_gcc_home/bin/gcc"
1754   fi
1755fi
1756
1757dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1758if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
1759   AC_PROG_CC
1760fi
1761
1762COMPATH=`dirname "$CC"`
1763if test "$COMPATH" = "." ; then
1764    AC_PATH_PROGS(COMPATH, $CC)
1765    dnl double square bracket to get single because of M4 quote...
1766    COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`;
1767fi
1768CC_PATH="$COMPATH/"
1769COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`;
1770
1771dnl ===================================================================
1772dnl Test the gcc version, 3 is OK
1773dnl ===================================================================
1774GCCVER=20995
1775if test \( "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes" \) -a "$GCC" = "yes"; then
1776    AC_MSG_CHECKING([the GNU gcc compiler version])
1777   _gcc_version=`$CC -dumpversion`
1778   _gcc_major=`echo $_gcc_version | $AWK -F. '{ print \$1 }'`
1779   GCCVER=`echo $_gcc_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
1780
1781   if test "$_gcc_major" -lt "3"; then
1782      AC_MSG_ERROR([found version "$_gcc_version", use version 3+ of the gcc compiler])
1783   else
1784      if test "$GCCVER" -eq "030203"; then
1785        if test "$ENABLE_SYMBOLS" = "SMALL"; then
1786           AC_MSG_ERROR([version "$_gcc_version" gives internal error with small.])
1787        fi
1788      fi
1789   fi
1790   if test "$_os" = "Darwin" ; then
1791         AC_MSG_RESULT([implicitly using CC=$CC])
1792   else
1793      AC_MSG_RESULT([checked (gcc $_gcc_version)])
1794   fi
1795   if test "$_os" = "SunOS"; then
1796      AC_MSG_CHECKING([gcc linker])
1797      if $CC -Wl,--version 2>&1 |head -n 1| $GREP -v GNU > /dev/null;then
1798          AC_MSG_ERROR([failed (not GNU ld). Use GNU ld instead of Sun ld on Solaris])
1799      fi
1800      AC_MSG_RESULT([ok (GNU ld)])
1801   fi
1802fi
1803AC_SUBST(GCCVER)
1804
1805HAVE_LD_BSYMBOLIC_FUNCTIONS=
1806if test "$GCC" = "yes"; then
1807   AC_MSG_CHECKING( for -Bsymbolic-functions linker support )
1808   bsymbolic_functions_ldflags_save=$LDFLAGS
1809   LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo"
1810   AC_LINK_IFELSE([AC_LANG_PROGRAM([
1811   #include <stdio.h>
1812   ],[
1813    printf ("hello world\n");
1814   ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
1815   if test "z$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "zTRUE"; then
1816     AC_MSG_RESULT( found )
1817   else
1818     AC_MSG_RESULT( not found )
1819   fi
1820   LDFLAGS=$bsymbolic_functions_ldflags_save
1821fi
1822AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
1823
1824dnl ===================================================================
1825dnl Set the ENABLE_PCH variable. (Activate --enable-pch)
1826dnl ===================================================================
1827AC_MSG_CHECKING([whether to enable pch feature])
1828if test -n "$enable_pch" && test "$enable_pch" != "no"; then
1829   if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
1830       ENABLE_PCH="TRUE"
1831       AC_MSG_RESULT([yes])
1832dnl There is no PCH support in GCC versions prior to this
1833   elif test "$GCC" = "yes" -a "$GCCVER" -gt "030400"; then
1834       ENABLE_PCH="TRUE"
1835       AC_MSG_RESULT([yes])
1836   else
1837       ENABLE_PCH=""
1838       AC_MSG_WARN([Precompiled header not yet supported for your platform/compiler])
1839   fi
1840else
1841   ENABLE_PCH=""
1842   AC_MSG_RESULT([no])
1843fi
1844AC_SUBST(ENABLE_PCH)
1845
1846dnl ===================================================================
1847dnl Search all the common names for GNU make
1848dnl ===================================================================
1849AC_MSG_CHECKING([for GNU make])
1850for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
1851      $a --version 2> /dev/null | $GREP GNU 2>&1 > /dev/null
1852      if test $? -eq 0; then
1853           GNUMAKE=$a
1854           break
1855      fi
1856done
1857AC_MSG_RESULT($GNUMAKE)
1858if test -z "$GNUMAKE"; then
1859    AC_MSG_ERROR([not found. install GNU make.])
1860fi
1861
1862AC_MSG_CHECKING([the GNU make version])
1863_make_version=`$GNUMAKE --version | $GREP GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
1864_make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
1865if test "$_make_longver" -ge "038100" ; then
1866   AC_MSG_RESULT([$GNUMAKE $_make_version])
1867else
1868   AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
1869fi
1870AC_SUBST(GNUMAKE)
1871
1872dnl ===================================================================
1873dnl Search for a pre-installed dmake
1874dnl ===================================================================
1875AC_MSG_CHECKING([for dmake])
1876DMAKE="no"
1877# Override system dmake if --with-dmake-path or --with-dmake-url is used.
1878if test -z "$with_dmake_path" && test -z "$with_dmake_url"; then
1879   AC_PATH_PROG(DMAKE, dmake, no)
1880   IS_SYSTEM_DMAKE=NO
1881   if test "$DMAKE" != "no"; then
1882      AC_MSG_RESULT([using system dmake])
1883      DMAKE_PATH="$DMAKE"
1884      IS_SYSTEM_DMAKE=YES
1885   fi
1886elif test -n "$with_dmake_path" ; then
1887   # Did not find pre-installed dmake.
1888   # Is it at a nonstandard location provided by --with-dmake-path ?
1889   AC_MSG_NOTICE([looking for dmake at $DMAKE_PATH])
1890   if test -x "$with_dmake_path" ; then
1891      AC_MSG_RESULT([using user provided dmake])
1892      DMAKE=$with_dmake_path
1893   fi
1894fi
1895
1896DMAKE_URL=
1897if test "$DMAKE" = "no"; then
1898    AC_MSG_NOTICE([no system or user-provided dmake found])
1899    # Check if a URL was supplied from which we can download the source and compile it.
1900    if test -n "$with_dmake_url" ; then
1901       # At this moment we can not verify the URL or the content that we want to download.
1902       # Neither can we apply the test below for ruling out that it is the SunStudio dmake.
1903       DMAKE_URL=$with_dmake_url
1904       AC_MSG_RESULT([dmake will be downloaded and compiled in bootstrap])
1905       DMAKE=
1906    else
1907       AC_MSG_ERROR([no URL for dmake source code specified, either. Use --with-dmake-url to supply an URL; run configure with the --help option for a list of possible URLs.])
1908       BUILD_DMAKE=YES
1909    fi
1910else
1911    AC_MSG_CHECKING([whether the found dmake is the right dmake])
1912    # we need to find out whether that dmake we found is "our" dmake
1913    # or the dmake from Sun's SunStudio Compiler which is something
1914    # different
1915    # This test _should_ work because the one accepts -V (ours) and one
1916    # (the other) not...
1917    $DMAKE -V 2>/dev/null | $GREP -E 'dmake(.exe)? .* Version .*' >/dev/null
1918    if test $? -eq 0; then
1919       BUILD_DMAKE=NO
1920       AC_MSG_RESULT([yes])
1921       AC_MSG_CHECKING([the dmake version])
1922       DMAKE_VERSION=`$DMAKE -V | $AWK '$3 == "Version" {print $4}'`
1923       if test "`echo $DMAKE_VERSION | cut -d'.' -f1`" -gt "4"; then
1924          AC_MSG_RESULT([OK, >= 4.11])
1925       elif test "`echo $DMAKE_VERSION | cut -d'.' -f1`" = "4" && \
1926            test "`echo $DMAKE_VERSION | cut -d'.' -f2`" -ge "11"; then
1927          AC_MSG_RESULT([OK, >= 4.11])
1928       else
1929          AC_MSG_ERROR([too old. >= 4.11 is needed])
1930          DMAKE=no
1931       fi
1932    else
1933       AC_MSG_WARN([no])
1934       DMAKE=no
1935    fi
1936fi
1937if test "$DMAKE" = "no"; then
1938   AC_MSG_ERROR([please use --with-dmake-path or --with-dmake-url to specify dmake executable or source])
1939fi
1940AC_SUBST(DMAKE_URL)
1941AC_SUBST(DMAKE_PATH)
1942AC_SUBST(IS_SYSTEM_DMAKE)
1943
1944
1945dnl ===================================================================
1946dnl Search all the common names for GNU or BSD tar
1947dnl ===================================================================
1948AC_MSG_CHECKING([for GNU or compatible BSD tar])
1949for a in $GNUTAR gtar gnutar bsdtar tar; do
1950      $a --version 2> /dev/null | $EGREP "GNU|libarchive" 2>&1 > /dev/null
1951      if test $? -eq 0; then
1952           GNUTAR=$a
1953           break
1954      fi
1955done
1956AC_MSG_RESULT($GNUTAR)
1957if test -z "$GNUTAR"; then
1958    AC_MSG_ERROR([not found. install GNU tar.])
1959fi
1960
1961AC_SUBST(GNUTAR)
1962
1963dnl ===================================================================
1964dnl  Test the solaris compiler version
1965dnl ===================================================================
1966if test "$_os" = "SunOS"; then
1967   if test "$CC" = "cc"; then
1968      AC_PATH_PROGS(_cc, cc)
1969      COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
1970      AC_MSG_CHECKING([the SunStudio C/C++ compiler version])
1971      dnl cc -V outputs to standard error!!!!
1972      _sunstudio_string=`$CC -V 2>&1 | $GREP '^cc' | sed -e 's/.* C //'`
1973      _sunstudio_version=`echo $_sunstudio_string | $AWK '{ print $1 }'`
1974      _sunstudio_major=`echo $_sunstudio_version | $AWK -F. '{ print $1 }'`
1975      if test "$_sunstudio_major" != "5"; then
1976         AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
1977      else
1978         _sunstudio_minor=`echo $_sunstudio_version | $AWK -F. '{ if ($2 == 5) print "true"; else if ($2 == 7) print "true"; else if ($2 == 8) print "true"; else if ($2 == 9) print "true"; else print "false" }'`
1979         if test "$_sunstudio_minor" = "false"; then
1980            AC_MSG_ERROR([found version "$_sunstudio_version", use version 5.5, 5.7, 5.8 or 5.9 of the SunStudio C/C++ compiler])
1981         else
1982            dnl compiler will do
1983            AC_MSG_RESULT([checked])
1984         fi
1985      fi
1986   fi
1987fi
1988
1989if test "$GCC" = "yes"; then
1990   AC_MSG_CHECKING( for --hash-style=both linker support )
1991   hash_style_ldflags_save=$LDFLAGS
1992   LDFLAGS="$LDFLAGS -Wl,--hash-style=both"
1993   AC_LINK_IFELSE([AC_LANG_PROGRAM([
1994   #include <stdio.h>
1995   ],[
1996    printf ("hello world\n");
1997   ])], HAVE_LD_HASH_STYLE=TRUE, HAVE_LD_HASH_STYLE=FALSE)
1998   if test "z$HAVE_LD_HASH_STYLE" = "zTRUE"; then
1999     AC_MSG_RESULT( found )
2000   else
2001     AC_MSG_RESULT( not found )
2002   fi
2003   LDFLAGS=$hash_style_ldflags_save
2004fi
2005AC_SUBST(HAVE_LD_HASH_STYLE)
2006
2007dnl ===================================================================
2008dnl  Test the Compaq compiler for OSF1
2009dnl ===================================================================
2010if test "$_os" = "OSF1"; then
2011   if test "$CC" = "cc"; then
2012      AC_PATH_PROGS(_cc, cc)
2013      COMPATH=`echo $_cc | $SED -n "s/\/bin\/cc//p"`
2014      AC_MSG_WARN([******* $_cc , $COMPATH])
2015      AC_MSG_CHECKING([the Compaq C compiler version])
2016      dnl cc -V outputs to standard error!!!!
2017      _compaqc_version=`$CC -V 2>&1 | $AWK '{ print $3 }'`
2018      _compaqc_major=`echo $_compaqc_version | $AWK -F. '{ print $1 }'`
2019      if test "$_compaqc_major" != "T6"; then
2020         AC_MSG_ERROR([found version "$_compaqc_version", use version 6 of the Compaq C compiler])
2021      else
2022         dnl compiler will do
2023         AC_MSG_RESULT([checked])
2024      fi
2025   fi
2026fi
2027
2028dnl ===================================================================
2029dnl Check whether there's a Perl version available.
2030dnl ===================================================================
2031if test -z "$with_perl_home"; then
2032   AC_PATH_PROG(PERL, perl)
2033else
2034   if test "$_os" = "WINNT"; then
2035      with_perl_home=`cygpath -u "$with_perl_home"`
2036   fi
2037   _perl_path="$with_perl_home/bin/perl"
2038   if test -x "$_perl_path"; then
2039      PERL=$_perl_path
2040   else
2041      AC_MSG_ERROR([$_perl_path not found])
2042   fi
2043fi
2044
2045dnl ===================================================================
2046dnl Testing for Perl version 5 or greater.
2047dnl $] is the perl version variable, it is returned as an integer
2048dnl ===================================================================
2049if test "$PERL"; then
2050   AC_MSG_CHECKING([the Perl version])
2051   ${PERL} -e "exit($]);"
2052   _perl_version=$?
2053   if test "$_perl_version" -lt 5; then
2054      AC_MSG_ERROR([found Perl version "$_perl_version", use version 5 of Perl])
2055   fi
2056   AC_MSG_RESULT([checked (perl $_perl_version)])
2057else
2058   AC_MSG_ERROR([Perl not found, install version 5 of Perl])
2059fi
2060AC_SUBST(PERL)
2061
2062dnl ===================================================================
2063dnl Testing for required Perl modules
2064dnl The list of required Perl modules is documented here:
2065dnl     https://wiki.openoffice.org/wiki/Documentation/Building_Guide_AOO#General_Build_Requirements
2066dnl ===================================================================
2067AC_MSG_CHECKING([for required Perl modules])
2068if `$PERL -e 'use Archive::Zip;
2069              use LWP::UserAgent;
2070              use XML::Parser;
2071              use Digest::SHA;
2072              use Digest::MD5;
2073              use LWP::Protocol::https;'>/dev/null 2>&1`; then
2074    AC_MSG_RESULT([all modules found])
2075else
2076    # Find out which modules are missing.
2077    missing_perl_modules=
2078    if ! `$PERL -e 'use Archive::Zip;'>/dev/null 2>&1`; then
2079       missing_perl_modules=Archive::Zip
2080    fi
2081    if ! `$PERL -e 'use LWP::UserAgent;'>/dev/null 2>&1`; then
2082       missing_perl_modules="$missing_perl_modules LWP::UserAgent"
2083    fi
2084    if ! `$PERL -e 'use XML::Parser;'>/dev/null 2>&1`; then
2085       missing_perl_modules="$missing_perl_modules XML::Parser"
2086    fi
2087    if ! `$PERL -e 'use Digest::SHA;'>/dev/null 2>&1`; then
2088       missing_perl_modules="$missing_perl_modules Digest::SHA"
2089    fi
2090    if ! `$PERL -e 'use Digest::MD5;'>/dev/null 2>&1`; then
2091       missing_perl_modules="$missing_perl_modules Digest::MD5"
2092    fi
2093    if ! `$PERL -e 'use LWP::Protocol::https;'>/dev/null 2>&1`; then
2094       missing_perl_modules="$missing_perl_modules LWP::Protocol::https"
2095    fi
2096    AC_MSG_ERROR([
2097    The missing Perl modules are: $missing_perl_modules
2098    Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
2099fi
2100
2101dnl ===================================================================
2102dnl  Check which Microsoft C/C++ or MinGW compiler is used for WINNT
2103dnl ===================================================================
2104if test "$_os" = "WINNT"; then
2105    if test "$WITH_MINGWIN" != "yes"; then
2106        AC_MSG_CHECKING([for friendly registry keys])
2107        # VS.Net 2003, VS.Net 2005
2108        if test -z "$with_cl_home"; then
2109            vctest=`$OOWINTOOL --msvc-productdir`;
2110            if test -x "$vctest/bin/cl.exe"; then
2111                with_cl_home=$vctest;
2112            fi
2113        else
2114            with_cl_home=`cygpath -u "$with_cl_home"`
2115        fi
2116        AC_MSG_RESULT([done])
2117
2118        dnl ===========================================================
2119        dnl  Check for mspdb71.dll/mspdb80.dll
2120        dnl ===========================================================
2121        dnl  .NET 2003/5/8 Compiler
2122        if test -n "$with_mspdb_path";then
2123            with_mspdb_path=`cygpath -u "$with_mspdb_path"`
2124        fi
2125        if test -e "$with_mspdb_path/mspdb71.dll" -o -e "$with_mspdb_path/mspdb80.dll"; then
2126            MSPDB_PATH="$with_mspdb_path"
2127        fi
2128        dnl .NET 2003 case
2129        if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb71.dll"; then
2130            MSPDB_PATH="$with_cl_home/../Common7/IDE"
2131        fi
2132        dnl .NET 2005/2008 case
2133        if test -z "$MSPDB_PATH" -a -e "$with_cl_home/../Common7/IDE/mspdb80.dll"; then
2134            MSPDB_PATH="$with_cl_home/../Common7/IDE"
2135        fi
2136        dnl Windows SDK 6.0 case
2137        if test -z "$MSPDB_PATH" -a -e "$with_cl_home/bin/mspdb80.dll"; then
2138            MSPDB_PATH="$with_cl_home/bin"
2139        fi
2140
2141        if test -z "$MSPDB_PATH";then
2142            dnl AC_PATH_PROG only checks if MSPDB_PATH is still empty
2143            AC_PATH_PROG(MSPDB_PATH, mspdb80.dll)
2144            AC_PATH_PROG(MSPDB_PATH, mspdb71.dll)
2145            MSPDB_PATH=`dirname "$MSPDB_PATH"`
2146        fi
2147
2148        if test -z "$MSPDB_PATH"; then
2149            AC_MSG_ERROR([You need a mspdb71.dll/mspdb80.dll, make sure it's in the path or use --with-mspdb-path])
2150        fi
2151        MSPDB_PATH=`cygpath -d "$MSPDB_PATH"`
2152        MSPDB_PATH=`cygpath -u "$MSPDB_PATH"`
2153        dnl The path needs to be added before cl is called
2154        PATH="$MSPDB_PATH:$PATH"
2155
2156        AC_MSG_CHECKING([the Microsoft C/C++ Compiler])
2157        case "$build_cpu" in
2158          i?86)
2159            cl_subdirectory="bin"
2160            ;;
2161          x86_64)
2162            if test "$BUILD_WIN64" = "TRUE" ; then
2163              cl_subdirectory="bin/amd64"
2164            else
2165              cl_subdirectory="bin"
2166            fi
2167            ;;
2168          *)
2169            AC_MSG_ERROR([Unknown/unsupported Windows CPU $build_cpu.])
2170            ;;
2171        esac
2172        if test -x "$with_cl_home/$cl_subdirectory/cl.exe"; then
2173            CC="$with_cl_home/$cl_subdirectory/cl.exe"
2174            COMPATH="$with_cl_home"
2175            # This gives us a posix path with 8.3 filename restrictions
2176            CC=`cygpath -d "$CC"`
2177            CC=`cygpath -u "$CC"`
2178            COMPATH=`cygpath -d "$COMPATH"`
2179            COMPATH=`cygpath -u "$COMPATH"`
2180            # Remove /cl.exe from CC case insensitive
2181            AC_MSG_RESULT([found ($CC)])
2182            export INCLUDE=`cygpath -d "$COMPATH/Include"`
2183            dnl  Check which Microsoft C/C++ compiler is found
2184            AC_MSG_CHECKING([the Version of Microsoft C/C++ Compiler])
2185dnl      The following find microsoft, matches nn.nn.nnnn then pulls numbers out.
2186            CCTXTVER=`$CC 2>&1 | head -n1`
2187            CCNUMVER=`echo $CCTXTVER | $AWK "/Microsoft/ && /..\\...\\...../ {
2188                            x = match( \\\$0, /..\\...\\...../ )
2189                            CCversion = substr( \\\$0, RSTART, RLENGTH)
2190                            tokencount = split (CCversion,vertoken,\".\")
2191                            for ( i = 1 ; i <= tokencount ; i++ ) {
2192                                printf (\"%04d\",vertoken[[i]] )
2193                            }
2194                            }"`
2195            AC_MSG_RESULT([found Compiler version $CCNUMVER in "$CCTXTVER"])
2196            if test "$CCNUMVER" -ge "001500000000"; then
2197                COMEX=12
2198                MSVSVER=2008
2199                AC_MSG_RESULT([found .NET 2008 / VS 9.0.])
2200            else
2201                AC_MSG_ERROR([Compiler too old. Use Microsoft C/C++ .NET 2008.])
2202            fi
2203        else
2204            AC_MSG_ERROR([Microsoft C/C++ Compiler not found. Use --with-cl-home.])
2205        fi
2206    else
2207        AC_MSG_CHECKING([the Mingwin32 C++ Compiler])
2208        if test `$CC -dumpmachine | $SED -e 's/^.*-//'` = "mingw32"; then
2209            AC_MSG_RESULT([found.])
2210            if $CC -dumpspecs | $GREP -q "mno-cygwin"; then
2211                USE_MINGW="cygwin"
2212            else
2213                USE_MINGW="pure-mingw"
2214            fi
2215        else
2216            AC_MSG_ERROR([Mingwin32 C++ Compiler not found.])
2217        fi
2218    fi
2219fi
2220AC_SUBST(COMEX)
2221AC_SUBST(MSPDB_PATH)
2222AC_SUBST(USE_MINGW)
2223
2224dnl Compiler detection, logic from setsoenv.in
2225case "$build_os" in
2226    *cygwin*)
2227        if test "$WITH_MINGWIN" = "yes"; then
2228            COM="GCC";
2229        else
2230            COM="MSC";
2231        fi;;
2232    os2*)
2233        COM="GCC";;
2234    netbsd | kfreebsd* | freebsd* | linux* | darwin* )
2235        if $CC --version 2>&1 | $GREP clang > /dev/null ; then
2236            COM="CLANG";
2237        else
2238            COM="GCC";
2239        fi;;
2240    solaris*)
2241        case "$CC" in
2242            *gcc*)  COM="GCC";;
2243            *)  COM="C52";;
2244        esac;;
2245    osf | aix*)
2246        COM="CXX";;
2247    *) AC_MSG_ERROR([Unable to decipher compiler for $build_os]);;
2248esac
2249AC_SUBST(COM)
2250
2251dnl  Decode the compiler version. Logic from main/solenv/inc/tg_compv.mk.
2252case $COM in
2253    GCC)
2254        CCVER=`${CC} -dumpfullversion -dumpversion 2>&1`;
2255        CCNUMVER=`echo ${CCVER} | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
2256        if test "${CCNUMVER}" -ge 000300000001; then
2257            COMID="gcc3";
2258            COMNAME="gcc3";
2259        elif test "${CCNUMVER}" -ge 000300000001; then
2260            COMID="GCC";
2261            COMNAME="gcc2";
2262        else
2263            AC_MSG_ERROR([gcc too old]);
2264        fi
2265        ;;
2266    CLANG)
2267        CCVER=`${CC} --version 2>&1 | head -n1 | sed -e"s/.*version //" -e"s/ .*//"`;
2268        CCNUMVER=`echo ${CCVER} | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
2269        # The version in tg_compv.mk for darwin does not look correct
2270        # CCNUMVER = `echo ${CCVER} | sed -e"s/\.//";
2271        case "$build_os" in
2272            darwin*) # Mac OS X
2273                COMID="s5abi";
2274                COMNAME="s5abi";
2275                ;;
2276            *)
2277                COMID="gcc3";
2278                COMNAME="gcc3";
2279                ;;
2280        esac
2281        ;;
2282    MSC)
2283        CCVER=`${CC} 2>&1 | $AWK -f ${_solenv}/bin/getcompver.awk`;
2284        CCNUMVER=`${CC} 2>&1 | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
2285        if test "${CCNUMVER}" -ge 001200000000; then
2286            COMID="MSC";
2287            case "$build_cpu" in
2288              i?86)
2289                COMNAME="msci";
2290                ;;
2291              x86_64)
2292                if test "$BUILD_WIN64" = "TRUE" ; then
2293                  COMNAME="mscx";
2294                else
2295                  COMNAME="msci";
2296                fi
2297                ;;
2298              *)
2299                AC_MSG_ERROR([Unknown/unsupported Windows CPU $build_cpu.])
2300                ;;
2301            esac
2302        else
2303            AC_MSG_ERROR([MSC compiler too old]);
2304        fi
2305        ;;
2306    C55 | C54 | C52 | C40 | sunpro)
2307        CCVER=`${CC} -V 2>&1 | $AWK -f ${_solenv}/bin/getcompver.awk`;
2308        CCNUMVER=`${CC} -V 2>&1 | $AWK -v num=true -f ${_solenv}/bin/getcompver.awk`;
2309        if test "${CCNUMVER}" -ge 00050002; then
2310            COMID="C52";
2311            COMNAME="sunpro5";
2312        else
2313            AC_MSG_ERROR([Sun compiler too old]);
2314        fi
2315        ;;
2316    *)
2317        AC_MSG_ERROR([Unable to detect compiler version]);;
2318esac
2319AC_SUBST(CCVER)
2320AC_SUBST(CCNUMVER)
2321AC_SUBST(COMID)
2322AC_SUBST(COMNAME)
2323
2324if test "$_os" = "FreeBSD"; then
2325    FBSD_GCC_RPATH=
2326    if test "$COM" = "GCC"; then
2327        rpath=`$CC --print-file-name libstdc++.so`
2328        rpath=`realpath $rpath`
2329        rpath=`dirname $rpath`
2330    if test "$rpath" != "/usr/lib" ; then
2331            FBSD_GCC_RPATH="-Wl,-rpath=$rpath"
2332    fi
2333    fi
2334    AC_SUBST(FBSD_GCC_RPATH)
2335fi
2336
2337dnl ===================================================================
2338dnl  .NET needs special treatment
2339dnl ===================================================================
2340if test "$_os" = "WINNT"; then
2341if test "$WITH_MINGWIN" = "yes" || test "$COMEX" -ge "10"; then
2342    dnl Check midl.exe
2343    AC_PATH_PROG(MIDL_PATH, midl.exe)
2344    if test -n "$MIDL_PATH";then
2345        MIDL_PATH=`dirname "$MIDL_PATH"`
2346    fi
2347    if test -n "$with_midl_path";then
2348        with_midl_path=`cygpath -u "$with_midl_path"`
2349    fi
2350    if test -x "$with_midl_path/midl.exe"; then
2351        MIDL_PATH="$with_midl_path"
2352    fi
2353    if test -z "$MIDL_PATH" -a -e "$with_cl_home/../Common7/Tools/Bin/midl.exe"; then
2354        MIDL_PATH="$with_cl_home/../Common7/Tools/Bin"
2355    fi
2356    if test -z "$MIDL_PATH" ; then
2357      vstest=`$OOWINTOOL --msvs-productdir`;
2358      if test -x "$vstest/Common7/Tools/Bin/midl.exe" ; then
2359          MIDL_PATH="$vstest/Common7/Tools/Bin"
2360      fi
2361    fi
2362    if test -z "$MIDL_PATH" ; then
2363        psdktest=`$OOWINTOOL --psdk-home`
2364        if test -x "$psdktest/Bin/midl.exe" ; then
2365            MIDL_PATH="$psdktest/Bin"
2366        fi
2367    fi
2368    if test ! -x "$MIDL_PATH/midl.exe"; then
2369        AC_MSG_ERROR([midl.exe not found. Make sure it's in the path or use --with-midl-path])
2370    fi
2371    # Convert to posix path with 8.3 filename restrictions ( No spaces )
2372    MIDL_PATH=`cygpath -d "$MIDL_PATH"`
2373    MIDL_PATH=`cygpath -u "$MIDL_PATH"`
2374
2375    dnl Check csc.exe
2376    AC_PATH_PROG(CSC_PATH, csc.exe)
2377    if test -n "$CSC_PATH";then
2378        CSC_PATH=`dirname "$CSC_PATH"`
2379    fi
2380    if test -n "$with_csc_path";then
2381        with_csc_path=`cygpath -u "$with_csc_path"`
2382    fi
2383    if test -x "$with_csc_path/csc.exe"; then
2384        CSC_PATH="$with_csc_path"
2385    else
2386       csctest=`$OOWINTOOL --csc-compilerdir`;
2387       if test -x "$csctest/csc.exe"; then
2388          CSC_PATH="$csctest"
2389       fi
2390    fi
2391    if test ! -x "$CSC_PATH/csc.exe"; then
2392        AC_MSG_ERROR([csc.exe not found. Make sure it's in the path or use --with-csc-path])
2393    fi
2394    # Convert to posix path with 8.3 filename restrictions ( No spaces )
2395    CSC_PATH=`cygpath -d "$CSC_PATH"`
2396    CSC_PATH=`cygpath -u "$CSC_PATH"`
2397
2398    dnl Check mscoree.lib / .NET Frameworks dir
2399    dnl For VS2003/2005 $with_frame_home has to point to the directory with lib/mscoree.lib.
2400       AC_MSG_CHECKING(.NET Framework)
2401        if test -n "$with_frame_home"; then
2402        with_frame_home=`cygpath -u "$with_frame_home"`
2403        fi
2404        if test -f "$with_frame_home/lib/mscoree.lib"; then
2405            FRAME_HOME="$with_frame_home"
2406        fi
2407        if test -z "$FRAME_HOME" -a -e "$with_cl_home/../SDK/v1.1/lib/mscoree.lib"; then
2408            FRAME_HOME="$with_cl_home/../SDK/v1.1"
2409        fi
2410        if test -z "$FRAME_HOME" ; then
2411          frametest=`$OOWINTOOL --dotnetsdk-dir`
2412          if test -f "$frametest/lib/mscoree.lib"; then
2413             FRAME_HOME="$frametest"
2414          else
2415             frametest=`$OOWINTOOL --psdk-home`
2416             if test -f "$frametest/lib/mscoree.lib"; then
2417                FRAME_HOME="$frametest"
2418             fi
2419          fi
2420        fi
2421        if test ! -f "$FRAME_HOME/lib/mscoree.lib"; then
2422        AC_MSG_ERROR([mscoree.lib (.NET Framework) not found. Make sure you use --with-frame-home])
2423        fi
2424        AC_MSG_RESULT(found)
2425    # Convert to posix path with 8.3 filename restrictions ( No spaces )
2426    FRAME_HOME=`cygpath -d "$FRAME_HOME"`
2427    FRAME_HOME=`cygpath -u "$FRAME_HOME"`
2428fi
2429AC_SUBST(MIDL_PATH)
2430AC_SUBST(CSC_PATH)
2431AC_SUBST(FRAME_HOME)
2432fi
2433
2434dnl ===================================================================
2435dnl Check if stdc headers are available excluding Windows.
2436dnl ===================================================================
2437if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
2438   m4_warn([obsolete],
2439[The preprocessor macro 'STDC_HEADERS' is obsolete.
2440  Except in unusual embedded environments, you can safely include all
2441  C89 headers unconditionally.])dnl
2442# Autoupdate added the next two lines to ensure that your configure
2443# script's behavior did not change.  They are probably safe to remove.
2444AC_CHECK_INCLUDES_DEFAULT
2445AC_PROG_EGREP
2446
2447fi
2448
2449dnl ===================================================================
2450dnl Find pre-processors.
2451dnl ===================================================================
2452if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
2453   AC_PROG_CXXCPP
2454
2455dnl Check whether there's a C pre-processor.
2456dnl ===================================================================
2457dnl When using SunStudio compiler, there is a bug with the cc
2458dnl preprocessor, so use CC preprocessor as the cc preprocessor
2459dnl See Issuezilla #445.
2460dnl ===================================================================
2461   if test "$_os" = "SunOS"; then
2462      CPP=$CXXCPP
2463   else
2464      AC_PROG_CPP
2465   fi
2466fi
2467
2468AC_CHECK_SIZEOF(long)
2469SIZEOF_LONG=$ac_cv_sizeof_long
2470AC_SUBST(SIZEOF_LONG)
2471AC_C_BIGENDIAN
2472WORDS_BIGENDIAN=$ac_cv_c_bigendian
2473AC_SUBST(WORDS_BIGENDIAN)
2474
2475dnl Check for large file support
2476AC_SYS_LARGEFILE
2477if test -n "$ac_cv_sys_file_offset_bits"; then
2478   LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
2479fi
2480if test -n "$ac_cv_sys_large_files" && test "$ac_cv_sys_large_files" != "no"; then
2481   LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
2482fi
2483AC_SUBST(LFS_CFLAGS)
2484
2485dnl ===================================================================
2486dnl Check if valgrind.h is available
2487dnl ===================================================================
2488if test -n "$enable_dbgutil" && test "$enable_dbgutil" != "no"; then
2489   dnl Test $prefix (currently only testing for /usr and /usr/local)
2490   dnl so that VALGRIND_CFLAGS = -I$prefix/include/valgrind
2491   VALGRIND_CFLAGS=""
2492   prev_cppflags=$CPPFLAGS
2493   if test -z "$VALGRIND_CFLAGS"; then
2494      CPPFLAGS="-I/usr/include/valgrind"
2495      AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [unset ac_cv_header_valgrind_h])
2496   fi
2497   if test -z "$VALGRIND_CFLAGS"; then
2498      CPPFLAGS="-I/usr/local/include/valgrind"
2499      AC_CHECK_HEADER([valgrind.h], [VALGRIND_CFLAGS=$CPPFLAGS], [])
2500   fi
2501   if test -n "$VALGRIND_CFLAGS"; then
2502      CPPFLAGS=$VALGRIND_CFLAGS
2503      AC_CHECK_HEADER([memcheck.h], [], [VALGRIND_CFLAGS=""])
2504   fi
2505   CPPFLAGS=$prev_cppflags
2506fi
2507AC_SUBST([VALGRIND_CFLAGS])
2508
2509dnl ===================================================================
2510dnl Check if cups/cups.h is available
2511dnl ===================================================================
2512if test "$test_cups" = "yes" -a "$ENABLE_CUPS" = "TRUE" ; then
2513    AC_CHECK_HEADER(cups/cups.h, [],
2514                    [AC_MSG_ERROR([cups/cups.h could not be found. libcupsys2-dev or cups???-devel missing?])], [])
2515fi
2516
2517dnl ===================================================================
2518dnl Check if PAM/pam_appl.h is available on Linux or FreeBSD
2519dnl ===================================================================
2520if test "$_os" = "Linux" -o "$_os" = "FreeBSD" -o "$_os" = "GNU"; then
2521  AC_MSG_CHECKING([whether to enable pam support])
2522  if test -z "$enable_pam" || test "$enable_pam" != "no"; then
2523    AC_MSG_RESULT([yes])
2524    PAM=YES
2525    AC_CHECK_HEADER(security/pam_appl.h, [],
2526                    [AC_MSG_ERROR([pam_appl.h could not be found. libpam-dev or pam-devel missing?])], [])
2527    AC_MSG_CHECKING([whether to link to libpam])
2528    if test -n "$enable_pam_link" -a "$enable_pam_link" != "no"; then
2529      AC_MSG_RESULT([yes])
2530      PAM_LINK=YES
2531      AC_CHECK_LIB(pam, pam_start, [],
2532          [AC_MSG_ERROR(libpam not found or functional)], [])
2533    else
2534      AC_MSG_RESULT([no, dynamically open it])
2535      PAM_LINK=NO
2536    fi
2537  else
2538    AC_MSG_RESULT([no])
2539    PAM=NO
2540    PAM_LINK=NO
2541    dnl check getspnam_r for needed args (4 or 5)
2542    AX_FUNC_WHICH_GETSPNAM_R
2543  fi
2544fi
2545AC_SUBST(PAM)
2546AC_SUBST(NEW_SHADOW_API)
2547AC_SUBST(PAM_LINK)
2548
2549if test "$_os" = "Linux"; then
2550    AC_MSG_CHECKING([whether to link to libcrypt])
2551    if test -n "$enable_crypt_link" -a "$enable_crypt_link" != "no"; then
2552        AC_MSG_RESULT([yes])
2553        CRYPT_LINK=YES
2554        AC_CHECK_LIB(crypt, crypt, [],
2555            [AC_MSG_ERROR(libcrypt not found or functional)], [])
2556    else
2557        AC_MSG_RESULT([no, dynamically open it])
2558        CRYPT_LINK=NO
2559    fi
2560fi
2561AC_SUBST(CRYPT_LINK)
2562
2563dnl ===================================================================
2564dnl Testing for c++ compiler and version...
2565dnl ===================================================================
2566if test -n "$with_gcc_home"; then
2567   if test -z "$CXX"; then
2568      CXX="$with_gcc_home/bin/g++"
2569   fi
2570fi
2571
2572if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
2573   if test -e "$CC"; then
2574      CXX="$CC"
2575   fi
2576fi
2577
2578dnl Autoconf 2.53 can do this test for cl.exe, 2.13 can't!
2579if test "$_os" != "WINNT" -o "$WITH_MINGWIN" = "yes"; then
2580   AC_PROG_CXX
2581fi
2582
2583dnl check if we are using a buggy version of g++ (currently 3.4.0, 3.4.1 and trunk)
2584if test "$GXX" = "yes"; then
2585   AC_MSG_CHECKING([the GNU C++ compiler version])
2586
2587   _gpp_version=`$CXX -dumpversion`
2588   _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
2589
2590   AC_MSG_RESULT([checked (g++ $_gpp_version)])
2591
2592   if test "$_gpp_majmin" = "304"; then
2593      AC_MSG_CHECKING([whether $CXX has the enum bug])
2594AC_RUN_IFELSE([AC_LANG_SOURCE([[
2595extern "C" void abort (void);
2596extern "C" void exit (int status);
2597
2598enum E { E0, E1, E2, E3, E4, E5 };
2599
2600void
2601test (enum E e)
2602{
2603  if (e == E2 || e == E3 || e == E1)
2604  exit (1);
2605}
2606
2607int
2608main (void)
2609{
2610  test (E4);
2611  test (E5);
2612  test (E0);
2613  return 0;
2614}
2615]])],[AC_MSG_ERROR([your version of the GNU C++ compiler has a bug which prevents Apache OpenOffice from being compiled correctly - please check https://gcc.gnu.org/ml/gcc-patches/2004-07/msg00968.html for details.])],[AC_MSG_RESULT([no])],[])
2616   fi
2617fi
2618
2619dnl ===================================================================
2620dnl Set the mingw runtime library include directories
2621dnl ===================================================================
2622if test "$WITH_MINGWIN" = "yes"; then
2623   AC_MSG_CHECKING([for mingwin runtime include path])
2624   cat >conftest.$ac_ext <<_ACEOF
2625#include <stddef.h>
2626#include <bits/c++config.h>
2627_ACEOF
2628   _mingw_lib_include_path=`$CXX -E -xc++ conftest.$ac_ext | $SED -n -e '/.*1*"\(.*\)\/stddef.h".*/s//\1/p' -e '/.*1*"\(.*\)\/bits\/c++config.h".*/s//\1/p' | sort -u | xargs echo`
2629   rm conftest.$ac_ext
2630   if test -n "$_mingw_lib_include_path"; then
2631      _temp=""
2632      for a in $_mingw_lib_include_path
2633         do
2634            a=`cygpath -d "$a"`
2635            _temp="$_temp "`cygpath -u "$a"`
2636         done
2637      _mingw_lib_include_path=$_temp
2638   fi
2639   if test -z "$_mingw_lib_include_path"; then
2640      _mingw_lib_include_path="NO_LIB_INCLUDE"
2641      AC_MSG_RESULT([no mingwin runtime includes])
2642   else
2643      AC_MSG_RESULT([$_mingw_lib_include_path])
2644   fi
2645  MINGW_LIB_INCLUDE_PATH="$_mingw_lib_include_path"
2646  AC_SUBST(MINGW_LIB_INCLUDE_PATH)
2647dnl mingw gcc 4.4.0 needs backward in include path to use hash_set/hash_map
2648   AC_MSG_CHECKING([for mingwin c++ backward include path])
2649   cat >conftest.$ac_ext <<_ACEOF
2650#include <hash_set>
2651_ACEOF
2652   _mingw_backward_include_path=`$CXX -E -xc++ -Wno-deprecated conftest.$ac_ext 2>&5| $SED -n -e '/.*1*"\(.*\)\/hash_set".*/s//\1/p' | sort -u | xargs echo`
2653   rm conftest.$ac_ext
2654   if test -n "$_mingw_backward_include_path"; then
2655      _mingw_backward_include_path=`cygpath -d $_mingw_backward_include_path`
2656      _mingw_backward_include_path=`cygpath -u $_mingw_backward_include_path`
2657      AC_MSG_RESULT([$_mingw_backward_include_path])
2658   else
2659      _mingw_backward_include_path="NO_BACKWARD_INCLUDE"
2660      AC_MSG_RESULT([no mingwin c++ backward includes])
2661   fi
2662  MINGW_BACKWARD_INCLUDE_PATH="$_mingw_backward_include_path"
2663  AC_SUBST(MINGW_BACKWARD_INCLUDE_PATH)
2664  mingw_crtbegin=`$CC -print-file-name=crtbegin.o`
2665  MINGW_CLIB_DIR=`dirname $mingw_crtbegin`
2666  AC_MSG_CHECKING([whether to use dynamic libgcc])
2667  if test -e "$MINGW_CLIB_DIR/libgcc_s.a"; then
2668    AC_MSG_CHECKING([dynamic libgcc name])
2669    MINGW_GCCDLL_pattern=`nm $MINGW_CLIB_DIR/libgcc_s.a | sed -ne 's@.* _libgcc\(.*\)_dll_iname@libgcc\1.dll@p' | uniq | sed -e 's@_@?@g'`
2670    MINGW_GCCDLL=`cd $COMPATH/bin && ls $MINGW_GCCDLL_pattern 2>/dev/null`
2671    if test -n "$MINGW_GCCDLL"; then
2672        MINGW_SHARED_GCCLIB=YES
2673        AC_MSG_RESULT([use $MINGW_GCCDLL])
2674    else
2675        AC_MSG_RESULT([no])
2676    fi
2677  else
2678    AC_MSG_RESULT([no])
2679  fi
2680  if test -e "$MINGW_CLIB_DIR/libgcc_eh.a"; then
2681      MINGW_GCCLIB_EH=YES
2682  fi
2683  AC_MSG_CHECKING([whether to use dynamic libstdc++])
2684  MINGW_SHARED_LIBSTDCPP=
2685  if test -e "$MINGW_CLIB_DIR/libstdc++_s.a" ; then
2686    MINGW_SHARED_LIBSTDCPP=stdc++_s
2687  fi
2688  if test -e "$MINGW_CLIB_DIR/libstdc++.dll.a" ; then
2689    MINGW_SHARED_LIBSTDCPP=stdc++.dll
2690  fi
2691  if test -n "$MINGW_SHARED_LIBSTDCPP" ; then
2692    AC_MSG_CHECKING([dynamic libstdc++ name])
2693    MINGW_GXXDLL_pattern=`nm $MINGW_CLIB_DIR/lib$MINGW_SHARED_LIBSTDCPP.a | sed -ne 's@.* _libstdc__\(.*\)_dll_iname@libstdc++\1.dll@p' | uniq | sed -e 's@_@?@g'`
2694    MINGW_GXXDLL=`cd $COMPATH/bin && ls $MINGW_GXXDLL_pattern 2>/dev/null`
2695    if test -n "$MINGW_GXXDLL"; then
2696        MINGW_SHARED_LIBSTDCPP=-l$MINGW_SHARED_LIBSTDCPP
2697        MINGW_SHARED_GXXLIB=YES
2698        AC_MSG_RESULT([use $MINGW_GXXDLL])
2699    else
2700        MINGW_SHARED_LIBSTDCPP=
2701        AC_MSG_RESULT([no])
2702    fi
2703  else
2704    AC_MSG_RESULT([no])
2705  fi
2706  MINGW_CLIB_DIR=`cygpath $MINGW_CLIB_DIR`
2707  AC_SUBST(MINGW_CLIB_DIR)
2708  AC_SUBST(MINGW_SHARED_GCCLIB)
2709  AC_SUBST(MINGW_GCCLIB_EH)
2710  AC_SUBST(MINGW_SHARED_GXXLIB)
2711  AC_SUBST(MINGW_SHARED_LIBSTDCPP)
2712  AC_SUBST(MINGW_GCCDLL)
2713  AC_SUBST(MINGW_GXXDLL)
2714fi
2715
2716dnl ===================================================================
2717dnl Extra checking for the SUN OS compiler
2718dnl ===================================================================
2719if test "$_os" = "SunOS"; then
2720   dnl SunStudio C++ compiler packaged with SunStudio C compiler
2721   if test "$CC" = "cc"; then
2722   AC_MSG_CHECKING([SunStudio C++ Compiler])
2723      if test "$CXX" != "CC"; then
2724         AC_MSG_WARN([SunStudio C++ was not found])
2725         echo "SunStudio C++ was not found" >> warn
2726      else
2727         AC_MSG_RESULT([checked])
2728      fi
2729   fi
2730fi
2731dnl ===================================================================
2732dnl Extra checking for the OSF compiler
2733dnl ===================================================================
2734if test "$_os" = "OSF1"; then
2735   AC_MSG_CHECKING([Compaq C++ compiler version])
2736   dnl cxx -V outputs to standard error!!!!
2737   _compaqcxx_version=`$CXX -V 2>&1 | $AWK '{ print $3 }'`
2738   _compaqcxx_major=`echo $_compaqcxx_version | $AWK -F. '{ print $1 }'`
2739   if test "$_compaqcxx_major" != "V6"; then
2740      AC_MSG_WARN([found version "$_compaqc_version", use version 6 of the Compaq C++ compiler])
2741      echo "found version $_compaqc_version, use version 6 of the Compaq C++ compiler" >> warn
2742   else
2743      dnl compiler will do
2744      AC_MSG_RESULT([checked])
2745   fi
2746fi
2747
2748dnl *************************************************************
2749dnl Testing for exception handling - dwarf2 or sjlj exceptions...
2750dnl *************************************************************
2751AC_MSG_CHECKING([exception type])
2752AC_LANG_PUSH([C++])
2753if test "$WITH_MINGWIN" = "yes"; then
2754  AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <iostream>
2755
2756extern "C" void _Unwind_SjLj_RaiseException(void) __attribute__ ((__noreturn__));
2757
2758    ]], [[_Unwind_SjLj_RaiseException() ]])],[exceptions_type="sjlj"],[exceptions_type="dwarf2"
2759  ])
2760fi
2761
2762AC_MSG_RESULT($exceptions_type)
2763AC_LANG_POP([C++])
2764EXCEPTIONS="$exceptions_type"
2765AC_SUBST(EXCEPTIONS)
2766
2767dnl ===================================================================
2768dnl Checks for what the default STL should be
2769dnl ===================================================================
2770   AC_MSG_CHECKING([what the default STL should be])
2771   DEFAULT_TO_STLPORT="no"
2772if test "$WITH_STLPORT" != "no"; then
2773   AC_MSG_ERROR([Option --with-stlport is no longer available.])
2774else
2775   USE_SYSTEM_STL="YES"
2776fi
2777
2778AC_SUBST(USE_SYSTEM_STL)
2779
2780dnl ===================================================================
2781dnl visibility feature
2782dnl ===================================================================
2783if test "$GCC" = "yes"; then
2784   AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])
2785   save_CFLAGS=$CFLAGS
2786   CFLAGS="$CFLAGS -fvisibility=hidden"
2787   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_VISIBILITY_FEATURE=TRUE ],[])
2788   CFLAGS=$save_CFLAGS
2789   if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
2790      AC_MSG_RESULT([yes])
2791   else
2792      AC_MSG_RESULT([no])
2793   fi
2794fi
2795
2796# ===================================================================
2797# use --ccache-skip?
2798# ===================================================================
2799dnl used to escape compiler options for ccache that otherwise prevent
2800dnl caching of the results (like "-x objective-c++" for Mac)
2801AC_MSG_CHECKING([whether we are allowed and able to use --ccache-skip])
2802if test "$_os" != "Darwin" ; then
2803   AC_MSG_RESULT([only used on Mac currently, skipping])
2804elif test "$enable_ccache_skip" = "no" ; then
2805   AC_MSG_RESULT([no - disabled explicitly])
2806elif test "$enable_ccache_skip" = "yes" ; then
2807   AC_MSG_RESULT([yes - enabled explicitly, skipping checks])
2808   AC_SUBST([USE_CCACHE], [YES])
2809elif test "$enable_ccache_skip" = "auto" ; then
2810   # checking for ccache presence/version
2811   AC_MSG_RESULT([probing...])
2812   AC_PATH_PROG([CCACHE],[ccache],[not_found])
2813   if test "$CCACHE" = "not_found" ; then
2814      AC_MSG_NOTICE([not enabling --ccache-skip (ccache not found)])
2815   else
2816      # check ccache version
2817      AC_MSG_CHECKING([whether version of ccache is suitable])
2818      CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2819      if test "$CCACHE_VERSION" = "2.4_OOo"; then
2820         AC_MSG_RESULT([yes])
2821         AC_MSG_CHECKING([whether ccache is actually used for the build])
2822         AC_LANG_PUSH([C++])
2823         save_CXXFLAGS=$CXXFLAGS
2824         CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
2825         dnl an empty program will do, we're checking the compiler flags
2826         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
2827            [use_ccache=yes], [use_ccache=no])
2828         if test $use_ccache = yes ; then
2829            AC_MSG_RESULT([yes, will enable --ccache-skip])
2830            AC_SUBST([USE_CCACHE], [YES])
2831         else
2832            AC_MSG_RESULT([no, will not enable --ccache-skip])
2833         fi
2834         CXXFLAGS=$save_CXXFLAGS
2835         AC_LANG_POP([C++])
2836      else
2837         AC_MSG_RESULT([no])
2838         AC_MSG_NOTICE([ccache version $CCACHE_VERSION not accepted. See description for --enable-ccache-skip])
2839      fi
2840   fi
2841else
2842   AC_MSG_ERROR([invalid option to --enable-ccache-skip. Valid values are "auto", "yes" and "no"])
2843fi
2844
2845dnl ===================================================================
2846dnl system stl sanity tests
2847dnl ===================================================================
2848if false ; then # TODO: update TR1 compliant STLs
2849if test "$USE_SYSTEM_STL" = "YES"; then
2850   AC_MSG_CHECKING([system stl sanity])
2851   AC_LANG_PUSH([C++])
2852
2853   if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
2854      AC_MSG_CHECKING([if STL headers are visibility safe])
2855      AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
2856      AC_MSG_RESULT([$stlvisok])
2857      if test "$stlvisok" = "no"; then
2858         AC_MSG_WARN([Your gcc STL headers are not visibility safe. Disabling visibility])
2859         echo "Your gcc STL headers are not visibility safe. Disabling visibility" >> warn
2860         unset HAVE_GCC_VISIBILITY_FEATURE
2861      fi
2862   fi
2863
2864   if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
2865      sharedlink_ldflags_save=$LDFLAGS
2866      LDFLAGS="$LDFLAGS -fvisibility-inlines-hidden -fpic -shared"
2867
2868      AC_MSG_CHECKING([if gcc is -fvisibility-inlines-hidden safe with STL headers])
2869      AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sstream>
2870using namespace std;
2871]], [[istringstream strm( "test" ); return 0;]])],[$EGREP -q  unresolvable conftest.err;
2872      if test $? -eq 0; then gccvisok=no; else gccvisok=yes; fi],[gccvisok=no])
2873      AC_MSG_RESULT([$gccvisok])
2874      if test "$gccvisok" = "no"; then
2875         AC_MSG_WARN([Your gcc is not -fvisibility-inlines-hidden safe. Disabling visibility])
2876         echo "Your gcc is not -fvisibility-inlines-hidden safe. Disabling visibility" >> warn
2877         unset HAVE_GCC_VISIBILITY_FEATURE
2878      fi
2879
2880      LDFLAGS=$sharedlink_ldflags_save
2881   fi
2882
2883   if test "$HAVE_GCC_VISIBILITY_FEATURE" = "TRUE"; then
2884      AC_MSG_CHECKING([if gcc has a visibility bug with class-level attributes (GCC bug 26905)])
2885      cat >visibility.cxx <<_ACEOF
2886#pragma GCC visibility push(hidden)
2887struct __attribute__ ((visibility ("default"))) TestStruct {
2888  static void Init();
2889};
2890__attribute__ ((visibility ("default"))) void TestFunc() {
2891  TestStruct::Init();
2892}
2893_ACEOF
2894      if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx 2>/dev/null > /dev/null; then
2895         gccvisbroken=yes
2896      else
2897         case "$build_cpu" in
2898            i?86|x86_64)
2899               if $EGREP -q '@PLT' visibility.s; then
2900                  gccvisbroken=no
2901               else
2902                  gccvisbroken=yes
2903               fi
2904               ;;
2905            *)
2906               gccvisbroken=no
2907               ;;
2908         esac
2909      fi
2910      rm -f visibility.s visibility.cxx
2911
2912      AC_MSG_RESULT([$gccvisbroken])
2913      if test "$gccvisbroken" = "yes"; then
2914         AC_MSG_WARN([Your gcc is not -fvisibility=hidden safe. Disabling visibility])
2915         echo "Your gcc is not -fvisibility=hidden safe. Disabling visibility" >> warn
2916         unset HAVE_GCC_VISIBILITY_FEATURE
2917      fi
2918   fi
2919
2920   AC_LANG_POP([C++])
2921fi
2922fi # endof TODO: update TR1 compliant STLs
2923
2924AC_SUBST(HAVE_GCC_VISIBILITY_FEATURE)
2925
2926dnl ===================================================================
2927dnl allocator
2928dnl ===================================================================
2929AC_MSG_CHECKING([which memory allocator to use])
2930if test "$with_alloc" = "system"; then
2931    AC_MSG_RESULT([system])
2932    ALLOC="SYS_ALLOC";
2933    AC_CHECK_FUNCS([malloc realloc calloc free])
2934fi
2935if test "$with_alloc" = "tcmalloc"; then
2936    AC_MSG_RESULT(tcmalloc)
2937    if ! echo $build_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
2938        AC_MSG_ERROR([tcmalloc only available/usable on ix86])
2939    fi
2940    AC_CHECK_LIB(tcmalloc, malloc, [],
2941        [AC_MSG_ERROR(tcmalloc not found or functional. Install the Google Profiling Tools)], [])
2942    ALLOC="TCMALLOC";
2943fi
2944if test "$with_alloc" = "jemalloc"; then
2945  if test "$_os" != "FreeBSD" -o "$_os" != "NetBSD"; then
2946    AC_MSG_RESULT(jemalloc)
2947    save_CFLAGS=$CFLAGS
2948    CFLAGS="$CFLAGS -pthread"
2949    AC_CHECK_LIB(jemalloc, malloc, [],
2950        [AC_MSG_ERROR(jemalloc not found or functional. Install the jemalloc allocator.)], [])
2951    ALLOC="JEMALLOC";
2952    CFLAGS=$save_CFLAGS
2953  else
2954    AC_MSG_RESULT([system])
2955    ALLOC="SYS_ALLOC";
2956    AC_CHECK_FUNCS([malloc realloc calloc free])
2957  fi
2958fi
2959if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
2960   AC_MSG_RESULT([internal])
2961fi
2962AC_SUBST(ALLOC)
2963
2964dnl ===================================================================
2965dnl Custom build version
2966dnl ===================================================================
2967
2968AC_MSG_CHECKING([whether to add custom build version])
2969if test "z$with_build_version" != "z"; then
2970   BUILD_VER_STRING=$with_build_version
2971   AC_MSG_RESULT([yes, $BUILD_VER_STRING])
2972else
2973   BUILD_VER_STRING=
2974   AC_MSG_RESULT([no])
2975fi
2976AC_SUBST(BUILD_VER_STRING)
2977
2978dnl ===================================================================
2979dnl Java support enable
2980dnl ===================================================================
2981AC_MSG_CHECKING([whether to build with Java support])
2982if test "$WITH_JAVA" != "no"; then
2983   AC_MSG_RESULT([yes])
2984   SOLAR_JAVA="TRUE"
2985else
2986   AC_MSG_RESULT([no])
2987   SOLAR_JAVA=""
2988
2989   AC_MSG_WARN([building without java will mean some features will not be available])
2990   echo "building without java will mean some features will not be available" >>warn
2991fi
2992AC_SUBST(SOLAR_JAVA)
2993
2994if test "$_os" = "Linux" && test "$build_cpu" = "powerpc"; then
2995   # IBMs JDK needs this...
2996   JITC_PROCESSOR_TYPE=6
2997   export JITC_PROCESSOR_TYPE
2998fi
2999
3000if test "$_os" = "WINNT"; then
3001   if test -z "$with_jdk_home"; then
3002      AC_MSG_CHECKING([for JDK home])
3003      _jdk_home=`$OOWINTOOL --jdk-home`
3004      AC_MSG_RESULT([$_jdk_home])
3005      if test -d "$_jdk_home"; then
3006          with_jdk_home="$_jdk_home"
3007      else
3008          AC_MSG_WARN([$_jdk_home is not a JDK home directory, ignoring it])
3009      fi
3010   else
3011      with_jdk_home=`cygpath -u "$with_jdk_home"`
3012   fi
3013fi
3014
3015dnl ===================================================================
3016dnl Checks for java
3017dnl ===================================================================
3018if test "$SOLAR_JAVA" != ""; then
3019   JAVA_HOME=; export JAVA_HOME
3020   if test -z "$with_jdk_home"; then
3021      AC_PATH_PROG(JAVAINTERPRETER, $WITH_JAVA)
3022   else
3023      _java_path="$with_jdk_home/bin/$WITH_JAVA"
3024      dnl Check if there is a java interpreter at all.
3025      if test -x "$_java_path"; then
3026         JAVAINTERPRETER=$_java_path
3027      else
3028         AC_MSG_ERROR([$_java_path not found, please use --with-jdk-home])
3029      fi
3030   fi
3031   if test "$_os" = "WINNT"; then
3032      if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
3033          JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
3034      fi
3035      JAVAINTERPRETER=`cygpath -d "$JAVAINTERPRETER"`
3036      JAVAINTERPRETER=`cygpath -u "$JAVAINTERPRETER"`
3037   elif test "$_os" = "Darwin"; then
3038         JAVAIFLAGS=""
3039   fi
3040fi
3041
3042dnl ===================================================================
3043dnl Checks for JDK.
3044dnl ===================================================================
3045if test "$SOLAR_JAVA" != ""; then
3046   _gij_longver=0
3047   AC_MSG_CHECKING([the installed JDK])
3048   if test -n "$JAVAINTERPRETER"; then
3049      dnl java -version sends output to stderr!
3050      if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
3051         AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
3052#        dnl Kaffe specific tests
3053#        KAFFE_VER=`$JAVAINTERPRETER -version 2>&1 | $EGREP "  Version:" | $SED -r "s/.*  Version: ([[0-9\.]]*).*/\1/"`
3054#        if test -z "$KAFFE_VER"; then
3055#          AC_MSG_ERROR([looks like Kaffe but version detection failed])
3056#        fi
3057#        _kaffe_ver=`echo "$KAFFE_VER" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3058#        if test "$_kaffe_ver" -lt 10100; then
3059#           AC_MSG_ERROR([Kaffe is too old ($KAFFE_VER - $_kaffe_ver), you need at least 1.1.0])
3060#        fi
3061#        JDK=kaffe
3062#
3063#        dnl TODO: define some project exclusion variables
3064#
3065#        AC_MSG_RESULT([checked (Kaffe $KAFFE_VER)])
3066#        AC_MSG_WARN([EXPERIMENTAL: Kaffe is not a full JDK replacement - some projects will fail to compile])
3067#        echo "EXPERIMENTAL: Kaffe is not a full JDK replacement - some projects will fail to compile" >>warn
3068#        JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
3069      elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
3070        JDK=gcj
3071        AC_MSG_RESULT([checked (gcj)])
3072        _gij_version=`$JAVAINTERPRETER --version | $GREP GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
3073        _gij_longver=`echo $_gij_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3074
3075      elif test `$JAVAINTERPRETER -version 2>&1 | awk '{ print }' | $GREP -c "BEA"` -gt 0; then
3076         AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.in])
3077#        JDK=bea
3078#
3079#        dnl BEA JDK specific tests
3080#        _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
3081#        _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3082#
3083#        if test "$_jdk_ver" -lt 10500; then
3084#          AC_MSG_ERROR([JDK is too old, you need at least BEA JDK 1.5.0])
3085#        fi
3086#
3087#        AC_MSG_RESULT([checked (BEA JDK $_jdk)])
3088#
3089#        if test "$with_jdk_home" = ""; then
3090#             AC_MSG_ERROR([In order to successfully build Apache OpenOffice using the BEA JDK,
3091#you must use the "--with-jdk-home" configure option explicitly])
3092#        fi
3093#
3094#        AC_MSG_WARN([A bug in certain BEA JREs can prevent you from successfully compiling some modules])
3095#        echo "A bug in certain BEA JREs can prevent you from successfully compiling some modules" >>warn
3096#
3097#        JAVA_HOME=$with_jdk_home
3098#
3099      elif test `$JAVAINTERPRETER -version 2>&1 | awk '{ print }' | $GREP -c "IBM"` -gt 0; then
3100        JDK=ibm
3101
3102        dnl IBM JDK specific tests
3103        _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
3104        _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3105
3106        if test "$_jdk_ver" -lt 10500; then
3107             AC_MSG_ERROR([IBM JDK is too old, you need at least 1.5])
3108        fi
3109
3110        AC_MSG_RESULT([checked (IBM JDK $_jdk)])
3111
3112        if test "$with_jdk_home" = ""; then
3113             AC_MSG_ERROR([In order to successfully build Apache OpenOffice using the IBM JDK,
3114you must use the "--with-jdk-home" configure option explicitly])
3115        fi
3116
3117        JAVA_HOME=$with_jdk_home
3118
3119      else
3120        JDK=sun
3121
3122        dnl SUN JDK specific tests
3123        _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
3124        _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
3125
3126        if test "$_jdk_ver" -lt 10500; then
3127             AC_MSG_ERROR([JDK is too old, you need at least 1.5])
3128        fi
3129        AC_MSG_RESULT([checked (JDK $_jdk)])
3130        JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
3131        if test "$_os" = "WINNT"; then
3132          JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
3133        fi
3134        if test "$_os" = "OS2"; then
3135          JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
3136        fi
3137      fi
3138   else
3139      AC_MSG_ERROR([JAVA not found. You need at least jdk-1.5, or gcj-4])
3140   fi
3141else
3142   dnl Java disabled
3143   JAVA_HOME=NO_JAVA_HOME ; export JAVA_HOME
3144fi
3145
3146dnl ===================================================================
3147dnl Checks for javac
3148dnl ===================================================================
3149if test "$SOLAR_JAVA" != ""; then
3150    if test "$JDK" = "gcj"; then
3151        javacompiler=`echo $WITH_JAVA | $SED -e "s/gij/gcj/g" | $SED -e "s/java/javac/g"`
3152    else
3153        javacompiler="javac"
3154    fi
3155    if test "$_os" = "WNT" -o "$_os" = "OS2"; then
3156      if test x`echo "$javacompiler" | $GREP -i '\.exe$'` = x; then
3157          javacompiler="${javacompiler}.exe"
3158      fi
3159    fi
3160    if test -z "$with_jdk_home"; then
3161        AC_PATH_PROG(JAVACOMPILER, $javacompiler)
3162    else
3163        _javac_path="$with_jdk_home/bin/$javacompiler"
3164        dnl Check if there is a java compiler at all.
3165        if test -x "$_javac_path"; then
3166            JAVACOMPILER=$_javac_path
3167        fi
3168    fi
3169    if test -z "$JAVACOMPILER"; then
3170      AC_MSG_ERROR([$javacompiler not found, please use --with-jdk-home])
3171    fi
3172    if test "$_os" = "WINNT"; then
3173       if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
3174          JAVACOMPILER="${JAVACOMPILER}.exe"
3175       fi
3176       JAVACOMPILER=`cygpath -d "$JAVACOMPILER"`
3177       JAVACOMPILER=`cygpath -u "$JAVACOMPILER"`
3178    fi
3179    if test "$_os" = "OS2"; then
3180       if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
3181          JAVACOMPILER="${JAVACOMPILER}.exe"
3182       fi
3183    fi
3184
3185    if test `$JAVACOMPILER -version 2>&1 | $GREP -c "Eclipse Java Compiler"` -gt 0; then
3186        AC_MSG_CHECKING([re-checking JDK])
3187        JDK=gcj
3188        AC_MSG_RESULT([checked (ecj)])
3189        #TODO: what's to do here? some switch to do 1.5 compiling?
3190        JAVAFLAGS="-source 1.5 -target 1.5"
3191        _gij_longver="40200"
3192    fi
3193fi
3194
3195JAVACISGCJ=""
3196dnl ===================================================================
3197dnl Checks that javac is gcj
3198dnl ===================================================================
3199if test "$SOLAR_JAVA" != ""; then
3200    if test `$JAVACOMPILER --version 2>&1 | $GREP -c "GCC"` -gt 0; then
3201        JAVACISGCJ="yes"
3202    fi
3203fi
3204AC_SUBST(JAVACISGCJ)
3205
3206dnl ===================================================================
3207dnl Checks for javadoc
3208dnl ===================================================================
3209if test "$SOLAR_JAVA" != ""; then
3210    if test -z "$with_jdk_home"; then
3211        AC_PATH_PROG(JAVADOC, javadoc)
3212    else
3213        _javadoc_path="$with_jdk_home/bin/javadoc"
3214        if test "$_os" = "WNT" -o "$_os" = "OS2"; then
3215          if test x`echo "$_javadoc_path" | $GREP -i '\.exe$'` = x; then
3216              _javadoc_path="${_javadoc_path}.exe"
3217          fi
3218        fi
3219        dnl Check if there is a javadoc at all.
3220        if test -x "$_javadoc_path"; then
3221            JAVADOC=$_javadoc_path
3222        else
3223            AC_PATH_PROG(JAVADOC, javadoc)
3224        fi
3225    fi
3226    if test -z "$JAVADOC"; then
3227      AC_MSG_ERROR([$_javadoc_path not found, please use --with-jdk-home])
3228    fi
3229    if test "$_os" = "WINNT"; then
3230        if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
3231            JAVADOC="${JAVADOC}.exe"
3232        fi
3233        JAVADOC=`cygpath -d "$JAVADOC"`
3234        JAVADOC=`cygpath -u "$JAVADOC"`
3235    fi
3236    if test "$_os" = "OS2"; then
3237        if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
3238            JAVADOC="${JAVADOC}.exe"
3239        fi
3240    fi
3241fi
3242
3243if test "$SOLAR_JAVA" != ""; then
3244    dnl first check if we have been asked to autodetect JAVA_HOME with a recent gij
3245    if test "$JDK" = "gcj" -a -z "$JAVA_HOME"; then
3246      if test "x$with_jdk_home" = "x" -a "$_gij_longver" -ge "40200"; then
3247        cat > findhome.java <<_ACEOF
3248[import java.io.File;
3249
3250class findhome
3251{
3252    public static void main(String args[])
3253    {
3254        String jrelocation = System.getProperty("java.home");
3255        File jre = new File(jrelocation);
3256        System.out.println(jre.getParent());
3257    }
3258}]
3259_ACEOF
3260        AC_MSG_CHECKING([if javac works])
3261        javac_cmd="$JAVACOMPILER findhome.java 1>&2"
3262        AC_TRY_EVAL(javac_cmd)
3263        if test $? = 0 && test -f ./findhome.class ; then
3264          AC_MSG_RESULT([javac works])
3265        else
3266          echo "configure: javac test failed" >&5
3267          cat findhome.java >&5
3268          AC_MSG_ERROR([javac does not work - java projects will not build!])
3269        fi
3270
3271        AC_MSG_CHECKING([if gij knows its java.home])
3272        JAVA_HOME=`$JAVAINTERPRETER findhome`
3273        if test $? = 0 && test "$JAVA_HOME" != "" ; then
3274          AC_MSG_RESULT([$JAVA_HOME])
3275        else
3276          echo "configure: java test failed" >&5
3277          cat findhome.java >&5
3278          AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
3279        fi
3280      else
3281        JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$WITH_JAVA,,p"`
3282      fi
3283    fi
3284
3285    dnl second sanity check JAVA_HOME if possible
3286    if test "$JDK" != "gcj" -o "$_gij_longver" -ge "40200"; then
3287      # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
3288      if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
3289         javac_link_f=`readlink -f "$JAVACOMPILER" 2>/dev/null`
3290         if test $? == 0 && test "$JAVACOMPILER" != "$javac_link_f"; then
3291          # try to recover first by looking whether we have a alternatives
3292          # system as in Debian or newer SuSEs where following /usr/bin/javac
3293          # over /etc/alternatives/javac leads to the right bindir where we
3294          # just need to strip a bit away to get a valid JAVA_HOME
3295          # Solaris 11 is even worse, because target is relative, so use -f
3296            JAVA_HOME="$javac_link_f"
3297         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
3298          # Darwin readlink(1) is so primitive it doesn't even support -f
3299          # maybe only one level of symlink (e.g. on Mac)
3300            JAVA_HOME=`readlink $JAVACOMPILER`
3301         else
3302          # else warn
3303          AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
3304          AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
3305          echo "JAVA_HOME is set to /usr - this is very likely to be incorrect" >> warn
3306          echo "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home" >> warn
3307          fi
3308         dnl now that we have the path to the real javac, make a JAVA_HOME out of it..
3309         if test "$JAVA_HOME" != "/usr"; then
3310            if test "$_os" = "Darwin"; then
3311               dnl Leopard returns a non-suitable path with readlink - points to "Current" only
3312               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
3313               dnl Tiger already returns a JDK path..
3314               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
3315            else
3316               JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
3317            fi
3318         fi
3319      fi
3320      # now check if $JAVA_HOME is really valid
3321      if test "$_os" = "Darwin"; then
3322         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
3323            JAVA_HOME_OK="NO"
3324         fi
3325      elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
3326         JAVA_HOME_OK="NO"
3327      fi
3328      if test "$JAVA_HOME_OK" = "NO"; then
3329         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
3330         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
3331         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects with not be built correctly])
3332         echo "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script" >> warn
3333         echo "attempted to find JAVA_HOME automatically, but apparently it failed" >> warn
3334         echo "in case JAVA_HOME is incorrectly set, some projects with not be built correctly" >> warn
3335#         if test "$JDK" = "gcj"; then
3336#             echo "e.g. install java-1.4.2-gcj-compat-devel and use --with-jdk-home=/usr/lib/jvm/java-1.4.2-gcj" >> warn
3337#         fi
3338      fi
3339    fi
3340fi
3341
3342AWTLIB=
3343if test "$SOLAR_JAVA" != ""; then
3344   AC_MSG_CHECKING([for jawt lib name])
3345   if test "$JDK" = "gcj"; then
3346      save_CFLAGS=$CFLAGS
3347      save_LDFLAGS=$LDFLAGS
3348      CFLAGS="$CFLAGS -I$JAVA_HOME/include"
3349      LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib -lgcj"
3350      exec 6>/dev/null # no output
3351      AC_CHECK_HEADER(jni.h, [],
3352                    [AC_MSG_ERROR([jni.h could not be found. Mismatch between gcc and libgcj or libgcj-devel missing?])], [])
3353      AC_CHECK_LIB(gcjawt, JAWT_GetAWT, [ AWTLIB="-lgcjawt -lgcj"] )
3354      exec 6>&1 # output on again
3355      CFLAGS=$save_CFLAGS
3356      LDFLAGS=$save_LDFLAGS
3357   fi
3358   # IBM SDK 1.5.0-sr5 includes libjawt.so with unresolved symbols.
3359   # A workaround is to link also against libpmawt.so
3360   if test "$JDK" = "ibm" ; then
3361      save_CFLAGS=$CFLAGS
3362      save_LDFLAGS=$LDFLAGS
3363      save_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
3364      CFLAGS="$CFLAGS -I$JAVA_HOME/include"
3365      LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin"
3366      LD_LIBRARY_PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/jre/bin/classic:$JAVA_HOME/jre/bin/xawt:$LD_LIBRARY_PATH
3367      export LD_LIBRARY_PATH
3368      exec 6>/dev/null # no output
3369      AC_CHECK_HEADER(jni.h, [],
3370                    [AC_MSG_ERROR([jni.h could not be found.])], [])
3371      AC_CHECK_LIB(jawt, JAWT_GetAWT, [ AWTLIB="-ljawt"] )
3372      if test -z "$AWTLIB"; then
3373         LDFLAGS="$LDFLAGS -L$JAVA_HOME/jre/bin/xawt -ljawt"
3374         AC_CHECK_LIB(mawt, JAWT_GetAWT, [ AWTLIB="-L$JAVA_HOME/jre/bin/xawt -ljawt -lmawt"])
3375      fi
3376      exec 6>&1 # output on again
3377      CFLAGS=$save_CFLAGS
3378      LDFLAGS=$save_LDFLAGS
3379      LD_LIBRARY_PATH=$save_LD_LIBRARY_PATH
3380   fi
3381   if test -z "$AWTLIB"; then
3382      AWTLIB=-ljawt
3383   fi
3384   AC_MSG_RESULT([$AWTLIB])
3385   AC_SUBST(AWTLIB)
3386fi
3387
3388dnl ===================================================================
3389dnl Check for optional gcj for AOT
3390dnl ===================================================================
3391if test "$SOLAR_JAVA" != ""; then
3392  AC_MSG_CHECKING([whether to enable gcj aot compilation])
3393  if test -n "$enable_gcjaot" && test "$enable_gcjaot" != "no"; then
3394     AC_MSG_RESULT([yes])
3395     if test `echo $WITH_JAVA | $GREP -c "gij"` -eq 0; then
3396        gcjaot="gcj"
3397     else
3398        gcjaot=`echo $WITH_JAVA | $SED -e "s/gij/gcj/g"`
3399     fi
3400     AC_MSG_RESULT([$gcjaot])
3401     if test -n "$with_jdk_home"; then
3402        _javac_path="$with_jdk_home/bin/$gcjaot"
3403        dnl Check if there is a gcj at all.
3404        if test -x "$_javac_path"; then
3405           JAVAAOTCOMPILER=$_javac_path
3406        fi
3407     fi
3408     if test -z "$JAVAAOTCOMPILER"; then
3409        AC_PATH_PROG(JAVAAOTCOMPILER, $gcjaot)
3410     fi
3411     if test -z "$JAVAAOTCOMPILER"; then
3412        AC_MSG_WARN([$gcjaot not found, please use --with-jdk-home])
3413     fi
3414  else
3415     AC_MSG_RESULT([no])
3416  fi
3417fi
3418
3419AC_SUBST(JAVA_HOME)
3420AC_SUBST(JDK)
3421AC_SUBST(JAVAFLAGS)
3422AC_SUBST(JAVAINTERPRETER)
3423AC_SUBST(JAVAIFLAGS)
3424AC_SUBST(JAVACOMPILER)
3425AC_SUBST(JAVAAOTCOMPILER)
3426AC_SUBST(JAVADOC)
3427
3428dnl ===================================================================
3429dnl Checks for specific files.
3430dnl ===================================================================
3431
3432dnl ===================================================================
3433dnl Checks for programs.
3434dnl ===================================================================
3435
3436AC_MSG_CHECKING([whether to enable EPM for packing])
3437if test "$enable_epm" = "yes"; then
3438   AC_MSG_RESULT([yes])
3439   dnl ================================================================================
3440   dnl Check for epm - not needed for Windows or building archive or installed formats
3441   dnl ================================================================================
3442   if test "$_os" != "WINNT" -a "$with_package_format" != "archive" -a "$with_package_format" != "installed"; then
3443      if test -n "$with_epm"; then
3444          EPM=$with_epm
3445      else
3446         AC_PATH_PROG(EPM, epm, no)
3447      fi
3448
3449      # Override system epm and --with-epm if --with-epm-url is used.
3450      if test -n "$with_epm_url" ; then
3451         # At this moment we can not verify the URL or the content that we want to download.
3452         EPM_URL=$with_epm_url
3453         AC_MSG_RESULT([epm will be downloaded and compiled in bootstrap])
3454         EPM=
3455         echo "EPM will be built."
3456         BUILD_EPM=YES
3457         BUILD_TYPE="$BUILD_TYPE EPM"
3458      else
3459         if test "$EPM" = "no" ; then
3460             AC_MSG_ERROR([no. Install ESP Package Manager (EPM) (https://jimjag.github.io/epm/) and/or specify the path to the right epm (--with-epm). Or specify an URL to an epm-5.0.0 (or later) source package (--with-epm-url); run configure with the --help option for a list of possible URLs.])
3461          else
3462             # Gentoo has some epm which is something different...
3463            AC_MSG_CHECKING([whether the found EPM is the right EPM])
3464            if $EPM --version | $GREP "ESP Package Manager" >/dev/null 2>/dev/null; then
3465               AC_MSG_RESULT([yes])
3466            else
3467                AC_MSG_ERROR([no. Install ESP Package Manager (https://jimjag.github.io/epm/) and/or specify the path to the right epm (--with-epm). Or specify an URL to an epm-5.0.0 (or later) source package (--with-epm-url); run configure with the --help option for a list of possible URLs.])
3468            fi
3469            AC_MSG_CHECKING([EPM version])
3470            EPM_VERSION=`$EPM --version | $GREP 'ESP Package Manager' | cut -d' ' -f5 | $SED -e s/v//`
3471             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -ge "5"; then
3472               AC_MSG_RESULT([OK, >= 5.0])
3473               BUILD_EPM=NO
3474             else
3475               AC_MSG_ERROR([too old. EPM >= 5.0.0 is required.])
3476             fi
3477        fi
3478      fi
3479   fi
3480
3481   # test which package format to use
3482   AC_MSG_CHECKING([which package format to use])
3483
3484   # defaults
3485   case "$_os" in
3486    OS2)
3487        PKGFORMAT=native
3488        ;;
3489    Darwin)
3490        PKGFORMAT=dmg
3491        ;;
3492    SunOS)
3493        PKGFORMAT=pkg
3494        ;;
3495    Linux)
3496      # if building on Debian, default should be deb...
3497      if test -e /etc/debian_version; then
3498         PKGFORMAT=deb
3499      else
3500         PKGFORMAT=rpm
3501      fi
3502        ;;
3503    AIX)
3504        PKGFORMAT=aix
3505        ;;
3506    *BSD)
3507        PKGFORMAT=bsd
3508        ;;
3509    OSF1)
3510        PKGFORMAT=setld
3511        ;;
3512    WINNT)
3513        PKGFORMAT=msi
3514        ;;
3515    # we never should get here since we check the architecture/os at the beginning,
3516    # but go sure...
3517    *)
3518        AC_MSG_ERROR([unknown system])
3519   esac
3520   if test -n "$with_package_format"; then
3521    for i in $with_package_format; do
3522        case "$i" in
3523            aix | bsd | deb | inst | tardist | osx | pkg | rpm | setld | native | portable | archive | dmg | installed | msi)
3524            ;;
3525        *)
3526            AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
3527aix - AIX software distribution
3528bsd - FreeBSD, NetBSD, or OpenBSD software distribution
3529depot or swinstall - HP-UX software distribution
3530deb - Debian software distribution
3531inst or tardist - IRIX software distribution
3532osx - MacOS X software distribution
3533pkg - Solaris software distribution
3534rpm - RedHat software distribution
3535setld - Tru64 (setld) software distribution
3536native - "Native" software distribution for the platform
3537portable - Portable software distribution
3538AOO additionally supports:
3539archive - .tar.gz or .zip
3540dmg - Mac OS X .dmg
3541installed - installation tree
3542msi - Windows .msi
3543            ])
3544            ;;
3545        esac
3546    done
3547    PKGFORMAT="$with_package_format"
3548   fi
3549   AC_MSG_RESULT([$PKGFORMAT])
3550   if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
3551      AC_MSG_CHECKING([for rpm])
3552      for a in "$RPM" rpmbuild rpm; do
3553         $a --usage >/dev/null 2> /dev/null
3554         if test $? -eq 0; then
3555            RPM=$a
3556            break
3557         else
3558            $a --version >/dev/null 2> /dev/null
3559            if test $? -eq 0; then
3560               RPM=$a
3561               break
3562            fi
3563         fi
3564       done
3565       if test -z "$RPM" ; then
3566          AC_MSG_ERROR([not found])
3567       elif "$RPM" --usage 2>&1 | $EGREP -- -bb >/dev/null; then
3568          RPM_PATH=`which $RPM`
3569          AC_MSG_RESULT([$RPM_PATH])
3570       else
3571          AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
3572       fi
3573   fi
3574   if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
3575      AC_PATH_PROG(DPKG, dpkg, no)
3576      if test "$DPKG" = "no"; then
3577         AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
3578      fi
3579      AC_PATH_PROG(FAKEROOT, fakeroot, no)
3580      if test "$FAKEROOT" = "no"; then
3581         AC_MSG_ERROR([fakeroot needed for deb creation. Install fakeroot.])
3582      fi
3583   fi
3584   if echo "$PKGFORMAT" | $EGREP osx 2>&1 >/dev/null; then
3585      if test "$_os" = "Darwin"; then
3586         if test "$_osxpkgbuild" = "no"; then
3587            AC_MSG_CHECKING([for PackageMaker availability])
3588            if ! test -x /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker; then
3589               AC_MSG_ERROR([not installed. Please install Apples Dev Tools])
3590            else
3591               AC_MSG_RESULT([ok])
3592            fi
3593         fi
3594      else
3595         AC_MSG_ERROR([PackageMaker needed to build OSX packages and you are not on OSX...])
3596       fi
3597   fi
3598   if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
3599      AC_PATH_PROG(PKGMK, pkgmk, no)
3600      if test "$PKGMK" = "no"; then
3601         AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
3602      fi
3603   fi
3604   AC_SUBST(RPM)
3605   AC_SUBST(DPKG)
3606   AC_SUBST(FAKEROOT)
3607   AC_SUBST(PKGMK)
3608else
3609   AC_MSG_RESULT([no])
3610   BUILD_EPM=NO
3611   EPM=NO
3612   PKGFORMAT=native
3613fi
3614AC_SUBST(BUILD_EPM)
3615AC_SUBST(EPM_URL)
3616AC_SUBST(EPM)
3617AC_SUBST(PKGFORMAT)
3618
3619dnl ===================================================================
3620dnl Check for gperf
3621dnl ===================================================================
3622AC_PATH_PROG(GPERF, gperf)
3623if test -z "$with_gperf"; then
3624    AC_PATH_PROG(GPERF, gperf)
3625    if test -z "$GPERF"; then
3626       AC_MSG_ERROR([gperf not found but needed. Install it and/or specify --with-gperf=/path/to/it.])
3627    fi
3628else
3629  if test -x "$with_gperf"; then
3630    GPERF=$with_gperf
3631  else
3632    AC_MSG_ERROR([--with-gperf did not point to an executable])
3633  fi
3634fi
3635AC_MSG_CHECKING([gperf version])
3636if test "`$GPERF --version | $EGREP ^GNU\ gperf | $AWK '{ print $3 }' | cut -d. -f1`" -ge "3"; then
3637    AC_MSG_RESULT([OK])
3638   GPERF=$GPERF
3639else
3640    AC_MSG_ERROR([too old, you need at least 3.0.0])
3641fi
3642AC_SUBST(GPERF)
3643
3644dnl ===================================================================
3645dnl Check for building stax
3646dnl ===================================================================
3647AC_MSG_CHECKING([whether to build the stax])
3648if test -f "./stax/download/stax-1.2.0.jar"; then
3649   BUILD_STAX=NO
3650   AC_MSG_RESULT([no, will use the prebuilt stax/download/stax-1.2.0.jar])
3651else
3652   BUILD_STAX=YES
3653   AC_MSG_RESULT([yes])
3654fi
3655AC_SUBST(BUILD_STAX)
3656
3657dnl ===================================================================
3658dnl Check for building ODK
3659dnl ===================================================================
3660AC_MSG_CHECKING([whether to build the ODK])
3661if test "z$enable_odk" = "z" -o "$enable_odk" != "no"; then
3662   AC_MSG_RESULT([yes])
3663   if test "$WITH_JAVA" != "no"; then
3664   AC_MSG_CHECKING([for external/unowinreg/unowinreg.dll])
3665   if ! test -f "./external/unowinreg/unowinreg.dll"; then
3666      HAVE_UNOWINREG_DLL=no
3667   else
3668      HAVE_UNOWINREG_DLL=yes
3669   fi
3670   if test "$HAVE_UNOWINREG_DLL" = "yes"; then
3671      AC_MSG_RESULT([found])
3672      BUILD_UNOWINREG=NO
3673   else
3674      if test "$_os" = "WINNT"; then
3675         AC_MSG_RESULT([not found, will be built])
3676      else
3677         AC_MSG_WARN([not found, will be cross-built using mingw32])
3678      fi
3679      BUILD_UNOWINREG=YES
3680   fi
3681   if test "$_os" != "WINNT" && test "$BUILD_UNOWINREG" = "YES"; then
3682      if test -z "$WITH_MINGWIN" || test "$WITH_MINGWIN" = "0"; then
3683         AC_MSG_ERROR([for rebuilding unowinreg.dll you need the mingw32 C++ compiler.
3684         Specify mingw32 g++ executable name with --with-mingwin.
3685         Or use prebuilt one from https://tools.openoffice.org/unowinreg_prebuild/680/ and
3686         put it into external/unowinreg using your browser or a command equivalent to:
3687         wget -O external/unowinreg/unowinreg.dll https://www.openoffice.org/tools/unowinreg_prebuild/680/unowinreg.dll])
3688      fi
3689      if echo "$WITH_MINGWIN" | $EGREP -q "/"; then
3690         if ! test -x "$WITH_MINGWIN"; then MINGWCXX=false; else MINGWCXX=`basename $WITH_MINGWIN`; fi
3691      else
3692         AC_CHECK_TOOL(MINGWCXX, $WITH_MINGWIN, false)
3693      fi
3694      if test "$MINGWCXX" = "false"; then
3695         AC_MSG_ERROR(specified MinGW32 C++ cross-compiler not found. Install it or correct name.)
3696      fi
3697      AC_MSG_CHECKING(whether we are using the MinGW32 cross C++ compiler)
3698      if ! echo "`$MINGWCXX -dumpmachine`" | $GREP -q mingw32; then
3699         AC_MSG_ERROR(no)
3700      else
3701         AC_MSG_RESULT(yes)
3702      fi
3703      if echo "$WITH_MINGWIN" | $EGREP -q "/"; then
3704         if ! test -x "`echo $WITH_MINGWIN | $SED -e s/g++/strip/ | $SED -e s/c++/strip/`"; then MINGWSTRIP=false; else MINGWSTRIP=$(basename $(echo $WITH_MINGWIN | $SED -e s/g++/strip/ | $SED -e s/c++/strip/)); fi
3705      else
3706         AC_CHECK_TOOL(MINGWSTRIP, `echo $WITH_MINGWIN | $SED -e s/g++/strip/ | $SED -e s/c++/strip/`, false)
3707      fi
3708      if test "$MINGWSTRIP" = "false"; then
3709         AC_MSG_ERROR(MinGW32 binutils needed. Install them.)
3710      fi
3711      AC_LANG_PUSH([C++])
3712      save_CXX=$CXX
3713      save_CXXCPP=$CXXCPP
3714      CXX=$MINGWCXX
3715      CXXCPP="$MINGWCXX -E"
3716      save_CXXFLAGS=$CXXFLAGS
3717      save_CPPFLAGS=$CPPFLAGS
3718      CXXFLAGS="$CXXFLAGS -I$JAVA_HOME/include"
3719      CPPFLAGS="$CPPFLAGS -I$JAVA_HOME/include"
3720      # LIBS contains -lcrypt etc due to the AC_CHECK_LIBS which obviously
3721      # do not make sense here (and 'd make the check fail)
3722      save_LIBS=$LIBS
3723      LIBS=""
3724      AC_CHECK_LIB([kernel32],[main],[],[],[])ac_cv_lib_kernel32=ac_cv_lib_kernel32_main
3725
3726      AC_CHECK_LIB([advapi32],[main],[],[],[])ac_cv_lib_advapi32=ac_cv_lib_advapi32_main
3727
3728      AC_CHECK_HEADER(windows.h, [], [AC_MSG_ERROR([windows.h missing])])
3729      CXXFLAGS=$save_CXXFLAGS
3730      CPPFLAGS=$save_CPPFLAGS
3731      CXX=$save_CXX
3732      CXXCPP=$save_CXXCPP
3733      LIBS=$save_LIBS
3734      AC_LANG_POP([C++])
3735      fi
3736   fi
3737   BUILD_TYPE="$BUILD_TYPE ODK"
3738else
3739   AC_MSG_RESULT([no])
3740   BUILD_UNOWINREG=NO
3741fi
3742AC_SUBST(BUILD_UNOWINREG)
3743AC_SUBST(MINGWCXX)
3744AC_SUBST(MINGWSTRIP)
3745
3746dnl ===================================================================
3747dnl Check for system stdlibs
3748dnl ===================================================================
3749AC_MSG_CHECKING([whether to provide libstdc++/libgcc_s in the installset])
3750if test -n "$with_system_stdlibs" -o -n "$with_system_libs" && \
3751   test "$with_system_stdlibs" != "no"; then
3752   AC_MSG_RESULT([no])
3753   SYSTEM_STDLIBS=YES
3754else
3755   AC_MSG_RESULT([yes])
3756   SYSTEM_STDLIBS=NO
3757fi
3758AC_SUBST(SYSTEM_STDLIBS)
3759
3760dnl ===================================================================
3761dnl Check for system zlib
3762dnl ===================================================================
3763if test "$_os" = "Darwin" && test "$with_system_zlib" != "no"; then
3764   with_system_zlib=yes
3765fi
3766AC_MSG_CHECKING([which zlib to use])
3767if test -n "$with_system_zlib" -o -n "$with_system_libs" && \
3768    test "$with_system_zlib" != "no"; then
3769    AC_MSG_RESULT([external])
3770    SYSTEM_ZLIB=YES
3771    AC_CHECK_HEADER(zlib.h, [],
3772        [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
3773    AC_CHECK_LIB(z, deflate, [ ZLIB=-lz ],
3774        [AC_MSG_ERROR(zlib not found or functional)], [])
3775else
3776    AC_MSG_RESULT([internal])
3777    SYSTEM_ZLIB=NO
3778    BUILD_TYPE="$BUILD_TYPE ZLIB"
3779fi
3780AC_SUBST(SYSTEM_ZLIB)
3781
3782dnl ===================================================================
3783dnl Check for system jpeg
3784dnl ===================================================================
3785AC_MSG_CHECKING([which jpeg to use])
3786if test -n "$with_system_jpeg" -o -n "$with_system_libs" && \
3787    test "$with_system_jpeg" != "no"; then
3788    AC_MSG_RESULT([external])
3789    SYSTEM_JPEG=YES
3790    AC_CHECK_HEADER(jpeglib.h, [],
3791        [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
3792    AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ JPEG3RDLIB=-ljpeg ],
3793    [AC_MSG_CHECKING(jpeg library not found or functional)], [])
3794else
3795    AC_MSG_RESULT([internal])
3796    SYSTEM_JPEG=NO
3797    BUILD_TYPE="$BUILD_TYPE JPEG"
3798fi
3799AC_SUBST(SYSTEM_JPEG)
3800
3801dnl ===================================================================
3802dnl Check for system expat
3803dnl ===================================================================
3804AC_MSG_CHECKING([which expat to use])
3805if test -n "$with_system_expat" -o -n "$with_system_libs" && \
3806    test "$with_system_expat" != "no"; then
3807    AC_MSG_RESULT([external])
3808    SYSTEM_EXPAT=YES
3809    AC_CHECK_HEADER(expat.h, [],
3810        [AC_MSG_ERROR(expat.h not found. install expat)], [])
3811    AC_CHECK_LIB(expat, XML_ParserCreate, [],
3812    [AC_MSG_RESULT(expat library not found or functional.)], [])
3813else
3814    AC_MSG_RESULT([internal])
3815    SYSTEM_EXPAT=NO
3816    BUILD_TYPE="$BUILD_TYPE EXPAT"
3817fi
3818AC_SUBST(SYSTEM_EXPAT)
3819
3820dnl ===================================================================
3821dnl Check whether freetype is available
3822dnl ===================================================================
3823if test  "$test_freetype" = "yes"; then
3824   AC_MSG_CHECKING([whether freetype is available])
3825    PKG_CHECK_MODULES( FREETYPE, freetype2 >= 2.0 )
3826fi
3827AC_SUBST(FREETYPE_CFLAGS)
3828AC_SUBST(FREETYPE_LIBS)
3829
3830dnl ===================================================================
3831dnl Check whether freetype2 supports emboldening
3832dnl ===================================================================
3833if test  "$test_freetype" = "yes"; then
3834    save_CPPFLAGS="$CPPFLAGS"
3835    save_LDFLAGS="$LDFLAGS"
3836    save_LIBS="$LIBS"
3837    CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
3838    LDFLAGS="$LDFLAGS $FREETYPE_LIBS"
3839    AC_CHECK_LIB(freetype, FT_GlyphSlot_Embolden,
3840                 [USE_FT_EMBOLDEN="YES"], [USE_FT_EMBOLDEN="NO"], [])
3841    LDFLAGS="$save_LDFLAGS"
3842    CPPFLAGS="$save_CPPFLAGS"
3843    LIBS="$save_LIBS"
3844fi
3845AC_SUBST(USE_FT_EMBOLDEN)
3846
3847if test -n "$with_system_libxslt" -o -n "$with_system_libs" && \
3848   test "$with_system_libxslt" != "no"; then
3849    if test -z "$with_system_libxml" -a -z "$with_system_libs" || \
3850      test "$with_system_libxml" = "no"; then
3851      # somehow AC_MSG_WARN won't work...
3852       echo "to prevent incompatibilities between internal libxml2 and libxslt, the office will be build with system-libxml"
3853       echo "to prevent incompatibilities between internal libxml2 and libxslt, the office will be build with system-libxml" >> warn
3854       with_system_libxml=yes
3855    fi
3856fi
3857if test -n "$with_system_libxml" -o -n "$with_system_libs" && \
3858   test "$with_system_libxml" != "no"; then
3859    if test -z "$with_system_libxslt" -a -z "$with_system_libs" || \
3860      test "$with_system_libxslt" = "no"; then
3861      # somehow AC_MSG_WARN won't work...
3862       echo "to prevent incompatibilities between internal libxslt and libxml2, the office will be build with system-libxslt"
3863       echo "to prevent incompatibilities between internal libxslt and libxml2, the office will be build with system-libxslt" >> warn
3864       with_system_libxslt=yes
3865    fi
3866fi
3867
3868dnl ===================================================================
3869dnl Check for system libxslt
3870dnl ===================================================================
3871AC_MSG_CHECKING([which libxslt to use])
3872if test -n "$with_system_libxslt" -o -n "$with_system_libs" -o \
3873       "$_os" = "Darwin" && \
3874   test "$with_system_libxslt" != "no"; then
3875   AC_MSG_RESULT([external])
3876   SYSTEM_LIBXSLT=YES
3877
3878    if test "$_os" != "Darwin"; then
3879        PKG_CHECK_MODULES(LIBXSLT, libxslt)
3880    else
3881        LIBXSLT_CFLAGS=`xslt-config --cflags`
3882        LIBXSLT_LIBS=`xslt-config --libs`
3883    fi
3884
3885   dnl Check for xsltproc
3886   AC_PATH_PROG(XSLTPROC, xsltproc, no)
3887   if test "$XSLTPROC" = "no"; then
3888      AC_MSG_ERROR([xsltproc is required])
3889   fi
3890else
3891   AC_MSG_RESULT([internal])
3892   SYSTEM_LIBXSLT=NO
3893   BUILD_TYPE="$BUILD_TYPE LIBXSLT"
3894fi
3895AC_SUBST(SYSTEM_LIBXSLT)
3896AC_SUBST(LIBXSLT_CFLAGS)
3897AC_SUBST(LIBXSLT_LIBS)
3898
3899
3900dnl ===================================================================
3901dnl Check for system libxml
3902dnl ===================================================================
3903AC_MSG_CHECKING([which libxml to use])
3904if test -n "$with_system_libxml" -o -n "$with_system_libs" -o \
3905            "$_os" = "Darwin" && \
3906    test "$with_system_libxml" != "no"; then
3907    AC_MSG_RESULT([external])
3908    SYSTEM_LIBXML=YES
3909    BUILD_TYPE="$BUILD_TYPE LIBXMLSEC"
3910
3911    if test "$_os" != "Darwin"; then
3912        PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
3913    else
3914        LIBXML_CFLAGS=`xml2-config --cflags`
3915        LIBXML_LIBS=`xml2-config --libs`
3916    fi
3917else
3918    AC_MSG_RESULT([internal])
3919    SYSTEM_LIBXML=NO
3920    BUILD_TYPE="$BUILD_TYPE LIBXML2 LIBXMLSEC"
3921fi
3922AC_SUBST(SYSTEM_LIBXML)
3923AC_SUBST(LIBXML_CFLAGS)
3924AC_SUBST(LIBXML_LIBS)
3925
3926
3927dnl ===================================================================
3928dnl Checks for a MacOS platform SDK compatible with deployment target
3929dnl ===================================================================
3930if test  "$_os" = "Darwin"; then
3931   sdk_target=$with_macosx_target
3932   AC_MSG_CHECKING([checking SDK compatibility with OSX $sdk_target])
3933
3934   sdk_major=`echo $sdk_target | cut -d"." -f1`
3935   sdk_minor=`echo $sdk_target | cut -d"." -f2`
3936   test -z "$sdk_minor" && sdk_minor=0
3937
3938   dnl Minimum supported macOS deployment target is 11.0 (Big Sur). This is
3939   dnl also the hard floor for Apple Silicon (arm64), so enforce it for every
3940   dnl architecture.
3941   if test "$sdk_major" -lt "11" ; then
3942      AC_MSG_ERROR([macOS deployment target < 11.0 is no longer supported; use --with-macosx-target=11.0 or later])
3943   else
3944      MACOSX_DEPLOYMENT_TARGET=$sdk_target
3945      sdk_path=$with_macosx_sdk
3946      if test -z "$sdk_path"; then
3947          dnl --macosx-sdk not used (or blank): We look for the SDK.
3948          dnl Prefer xcodebuild when full Xcode is installed, but fall back
3949          dnl to xcrun so that Command Line Tools-only setups also work
3950          dnl (xcodebuild is unavailable without the full Xcode app).
3951          sdk_found=`xcodebuild -showsdks 2>/dev/null | $EGREP "sdk macosx(1[1-9]|[2-9][0-9])" | sed -e "s/.*sdk //" | tail -n1`
3952          if test -n "$sdk_found"; then
3953             AC_MSG_RESULT([yes, by using SDK $sdk_found])
3954             sdk_path=`xcodebuild -version -sdk ${sdk_found} Path`
3955          else
3956             sdk_path=`xcrun --sdk macosx --show-sdk-path 2>/dev/null`
3957             if test -z "$sdk_path"; then
3958                AC_MSG_ERROR([No SDK with OSX $sdk_target compatibility found])
3959             fi
3960             AC_MSG_RESULT([yes, by using SDK at $sdk_path])
3961          fi
3962      elif test ! -d "$sdk_path"; then
3963          dnl --macosx-sdk=<version> given (not a path): resolve it. Prefer
3964          dnl xcodebuild, but fall back to xcrun so Command Line Tools-only
3965          dnl setups (no full Xcode) also work.
3966          sdk_found=`xcodebuild -showsdks 2>/dev/null | $EGREP "sdk macosx${sdk_path}" | sed -e "s/.*sdk //" | tail -n1`
3967          if test -n "$sdk_found"; then
3968             AC_MSG_RESULT([SDK $sdk_found])
3969             sdk_path=`xcodebuild -version -sdk ${sdk_found} Path`
3970          else
3971             sdk_xcrun=`xcrun --sdk macosx${sdk_path} --show-sdk-path 2>/dev/null`
3972             if test -z "$sdk_xcrun"; then
3973                AC_MSG_ERROR([SDK macosx${sdk_path} not found])
3974             fi
3975             AC_MSG_RESULT([SDK at $sdk_xcrun])
3976             sdk_path=$sdk_xcrun
3977          fi
3978      fi
3979      AC_MSG_CHECKING([for $sdk_path])
3980      if test -d "$sdk_path"; then
3981         AC_MSG_RESULT([yes])
3982      else
3983         AC_MSG_ERROR([not found!])
3984      fi
3985
3986      MACOSX_SDK_PATH=$sdk_path
3987      SDKROOT=$sdk_path
3988   fi
3989
3990fi
3991AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3992AC_SUBST(MACOSX_SDK_PATH)
3993AC_SUBST(SDKROOT)
3994
3995
3996dnl ===================================================================
3997dnl Check for system python
3998dnl ===================================================================
3999AC_MSG_CHECKING([which python to use])
4000if test "$_os" = "Darwin" && test "$with_system_python" != "no"; then
4001   with_system_python=yes
4002
4003   dnl Recent macOS releases no longer ship a usable Python under /usr/bin,
4004   dnl so probe the locations where a system/user Python is typically found:
4005   dnl the python.org framework build, Homebrew (Apple Silicon and Intel),
4006   dnl and the Command Line Tools python3. Fall back to whatever python3 or
4007   dnl python is on PATH.
4008   _python=""
4009   for _python_candidate in \
4010       "/Library/Frameworks/Python.framework/Versions/Current/bin/python3" \
4011       "/Library/Frameworks/Python.framework/Versions/Current/bin/python" \
4012       "/opt/homebrew/bin/python3" \
4013       "/usr/local/bin/python3" \
4014       "/usr/bin/python3" \
4015       "/usr/bin/python" ; do
4016       if test -x "$_python_candidate"; then
4017           _python="$_python_candidate"
4018           break
4019       fi
4020   done
4021   if test -z "$_python"; then
4022       AC_PATH_PROGS([_python], [python3 python])
4023   fi
4024   if test -z "$_python"; then
4025       AC_MSG_ERROR([no system python found; install Python (e.g. from python.org or Homebrew), or configure with --without-system-python])
4026   fi
4027   AC_MSG_RESULT([compiling against system python ($_python)])
4028
4029   _python_hexversion=`$_python -c "import sys; print(sys.hexversion);"`
4030
4031   dnl hex version of Python 2.7.1 = 34013680
4032   if test $_python_hexversion -ge 34013680 ; then
4033      _python_version=`$_python -c "import sys; print(sys.version);" | head -c 3`
4034      AC_MSG_RESULT([compiling against system python (version $_python_version)])
4035
4036      if ! $_python -c "import distutils.sysconfig;"; then
4037          AC_MSG_ERROR([python setuptools module is required to provide distutils for python >= 3.12])
4038      fi
4039      _python_ver=`$_python -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
4040
4041      dnl Locate the headers. Prefer the framework/SDK locations, but fall
4042      dnl back to whatever include dir the interpreter itself reports (this
4043      dnl is what makes Homebrew and other non-framework installs work).
4044      if test -d "/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"; then
4045         PYTHON_CFLAGS="-I/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"
4046         elif test -d "$MACOSX_SDK_PATH/usr/include/python$_python_ver"; then
4047             PYTHON_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/python$_python_ver"
4048         elif test -d "$MACOSX_SDK_PATH/System/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"; then
4049             PYTHON_CFLAGS="-I$MACOSX_SDK_PATH/System/Library/Frameworks/Python.framework/Versions/$_python_ver/include/python$_python_ver"
4050      else
4051             _python_inc=`$_python -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_inc());"`
4052             PYTHON_CFLAGS="-I$_python_inc"
4053      fi
4054   else
4055        AC_MSG_ERROR([Python 2.7.1 or higher is required])
4056   fi
4057
4058   dnl A framework build links against the Python framework; any other
4059   dnl install (Homebrew, etc.) links against libpython in its LIBDIR.
4060   case "$_python" in
4061       /Library/Frameworks/Python.framework/*|*/System/Library/Frameworks/Python.framework/*)
4062           PYTHON_LIBS="-framework Python"
4063           ;;
4064       *)
4065           _python_libdir=`$_python -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
4066           PYTHON_LIBS="-L$_python_libdir -lpython$_python_ver"
4067           ;;
4068   esac
4069elif test -n "$with_system_python" -o -n "$with_system_libs" && \
4070    test "$with_system_python" != "no"; then
4071   with_system_python=yes
4072   AC_MSG_RESULT([external])
4073   AM_PATH_PYTHON([2.7])
4074
4075   if ! $PYTHON -c "import distutils.sysconfig;"; then
4076       AC_MSG_ERROR([python setuptools module is required to provide distutils for python >= 3.12])
4077   fi
4078   python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
4079   python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
4080   # Python 3.8 and later distinguish building Python modules from linking to the libpython:
4081   # (https://bugs.python.org/issue36721)
4082   if test "$python_version" -lt "3.8"; then
4083       PKG_CHECK_MODULES(PYTHON, python-$python_version, PYTHON_PC="TRUE", PYTHON_PC="" )
4084   else
4085       PKG_CHECK_MODULES(PYTHON, python-$python_version-embed, PYTHON_PC="TRUE", PYTHON_PC="" )
4086   fi
4087   if test "$PYTHON_PC" != "TRUE"; then
4088       PYTHON_CFLAGS="-I$python_include"
4089       PYTHON_LIBS="-lpython$python_version"
4090   fi
4091fi
4092if test "$with_system_python" = "yes" ; then
4093   SYSTEM_PYTHON=YES
4094   dnl check if the headers really work:
4095   save_CPPFLAGS="$CPPFLAGS"
4096   CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
4097   AC_CHECK_HEADER(Python.h, [],
4098       [AC_MSG_ERROR(Python headers not found)], [])
4099   CPPFLAGS="$save_CPPFLAGS"
4100else
4101   SYSTEM_PYTHON=NO
4102   BUILD_TYPE="$BUILD_TYPE PYTHON"
4103   AC_MSG_RESULT([internal])
4104   # Embedded python dies without Home set
4105   if test "z$HOME" = "z"; then
4106      export HOME="";
4107   fi
4108   # bz2 tarball and bzip2 is not standard
4109   if test -z "$BZIP2"; then
4110    AC_PATH_PROG( BZIP2, bzip2)
4111    if test -z "$BZIP2"; then
4112        AC_MSG_ERROR([the internal Python module has a .tar.bz2. You need bzip2])
4113    fi
4114   fi
4115fi
4116AC_SUBST(SYSTEM_PYTHON)
4117AC_SUBST(PYTHON_CFLAGS)
4118AC_SUBST(PYTHON_LIBS)
4119HOME=`echo $HOME | sed 's:\\\\:/:g'`
4120AC_SUBST(HOME)
4121
4122dnl ===================================================================
4123dnl Check for system lucene
4124dnl ===================================================================
4125AC_MSG_CHECKING([which lucene to use])
4126if test -n "$with_system_lucene" -o -n "$with_system_libs" && \
4127       test "$with_system_lucene" != "no" && test "$with_system_jars" != "no"; then
4128        AC_MSG_RESULT([external])
4129        SYSTEM_LUCENE=YES
4130        if test -z $LUCENE_CORE_JAR; then
4131          AC_CHECK_FILE(/usr/share/java/lucene-core-2.9.4.jar,
4132            [ LUCENE_CORE_JAR=/usr/share/java/lucene-core-2.9.4.jar ],
4133            [
4134              AC_CHECK_FILE(/usr/share/java/lucene-core.jar,
4135                [ LUCENE_CORE_JAR=/usr/share/java/lucene-core.jar ],
4136                [ AC_CHECK_FILE(/usr/share/java/lucene.jar,
4137                   [ LUCENE_CORE_JAR=/usr/share/java/lucene.jar ],
4138                   [ AC_MSG_ERROR(lucene-core.jar replacement not found)]
4139                  )
4140                ]
4141              )
4142            ]
4143          )
4144        else
4145          AC_CHECK_FILE($LUCENE_CORE_JAR, [],
4146               [AC_MSG_ERROR(lucene-core.jar not found.)], [])
4147        fi
4148
4149        if test -z $LUCENE_ANALYZERS_JAR; then
4150          AC_CHECK_FILE(/usr/share/java/lucene-analyzers-2.3.jar,
4151            [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-analyzers-2.3.jar ],
4152            [
4153              AC_CHECK_FILE(/usr/share/java/lucene-contrib/lucene-analyzers.jar,
4154                [ LUCENE_ANALYZERS_JAR=/usr/share/java/lucene-contrib/lucene-analyzers.jar ],
4155                [ AC_MSG_ERROR(lucene-analyzers.jar replacement not found.)]
4156              )
4157            ]
4158          )
4159        else
4160          AC_CHECK_FILE($LUCENE_CORE_JAR, [],
4161               [ AC_MSG_ERROR(lucene-analyzers.jar not found.)], [])
4162        fi
4163        AC_MSG_CHECKING([whether lucene is version 2.x])
4164        export LUCENE_CORE_JAR
4165        if $PERL -e 'use Archive::Zip;
4166            my $file = "$ENV{'LUCENE_CORE_JAR'}";
4167            my $zip = Archive::Zip->new( $file );
4168            my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4169            if ( $mf =~ m/Specification-Version: 2.*/ ) {
4170                exit 0;
4171            } else {
4172                exit 1;
4173            }'; then
4174            AC_MSG_RESULT([yes])
4175         else
4176            AC_MSG_RESULT([no])
4177            AC_MSG_CHECKING([whether lucene is version 3.x])
4178
4179            if $PERL -e 'use Archive::Zip;
4180                my $file = "$ENV{'LUCENE_CORE_JAR'}";
4181                my $zip = Archive::Zip->new( $file );
4182                my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4183                if ( $mf =~ m/Specification-Version: 3.*/ ) {
4184                    exit 0;
4185                } else {
4186                    exit 1;
4187                }'; then
4188                AC_MSG_RESULT([yes])
4189             else
4190                AC_MSG_ERROR([no, you need lucene 2 or 3])
4191             fi
4192         fi
4193
4194else
4195    AC_MSG_RESULT([internal])
4196    SYSTEM_LUCENE=NO
4197    BUILD_TYPE="$BUILD_TYPE LUCENE"
4198fi
4199AC_SUBST(SYSTEM_LUCENE)
4200AC_SUBST(LUCENE_CORE_JAR)
4201AC_SUBST(LUCENE_ANALYZERS_JAR)
4202
4203AC_MSG_CHECKING([whether to build the MySQL Connector extension])
4204if test -n "$enable_mysql_connector" -a "$enable_mysql_connector" != "no"; then
4205  AC_MSG_RESULT([yes])
4206  ENABLE_MYSQLC=YES
4207  AC_MSG_CHECKING([for mysqlc module])
4208  if test -d mysqlc; then
4209   AC_MSG_RESULT([OK])
4210  else
4211   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
4212  fi
4213  BUILD_TYPE="$BUILD_TYPE MYSQLC"
4214else
4215  AC_MSG_RESULT([no])
4216  ENABLE_MYSQLC=NO
4217fi
4218AC_SUBST(ENABLE_MYSQLC)
4219
4220if test "$ENABLE_MYSQLC" = "YES"; then
4221dnl ===================================================================
4222dnl Check for system MySQL
4223dnl ===================================================================
4224AC_MSG_CHECKING([for mysql pre-requisites])
4225if test -n "$with_system_mysql" -o -n "$with_system_libs" && \
4226       test "$with_system_mysql" != "no" && test "$with_system_libs" != "no"; then
4227    AC_MSG_RESULT([external MySQL])
4228    SYSTEM_MYSQL=YES
4229    AC_PATH_PROG( MYSQLCONFIG, mysql_config)
4230    AC_MSG_CHECKING([MySQL version])
4231    if test -z "$MYSQLCONFIG" -o ! -x "$MYSQLCONFIG" ; then
4232        AC_MSG_ERROR([can not find/execute mysql_config]);
4233    fi
4234    MYSQL_VERSION=`$MYSQLCONFIG --version`
4235    MYSQL_MAJOR=`$MYSQLCONFIG --version | cut -d"." -f1`
4236    if test "$MYSQL_MAJOR" -ge "5"; then
4237        AC_MSG_RESULT([OK])
4238    else
4239        AC_MSG_ERROR([too old, use 5.0.x or 5.1.x])
4240    fi
4241    AC_MSG_CHECKING([for MySQL Client library])
4242    MYSQL_INC=`$MYSQLCONFIG --include`
4243    MYSQL_LIB=`$MYSQLCONFIG --libs`
4244    MYSQL_DEFINES=`$MYSQLCONFIG --cflags | sed -e s,$MYSQL_INC,,`
4245    AC_MSG_RESULT([includes $MYSQL_INC, libraries $MYSQL_LIB])
4246else
4247    SYSTEM_MYSQL=NO
4248    if test -n "$with_libmysql_path"; then
4249        AC_MSG_RESULT([external Connector/C (libmysql)])
4250        LIBMYSQL=libmysql.so
4251        if test "$_os" = "Darwin"; then
4252            LIBMYSQL=libmysql.dylib
4253        elif test "$_os" = "WINNT"; then
4254            LIBMYSQL=libmysql.dll
4255        fi
4256        AC_MSG_CHECKING([for $LIBMYSQL])
4257        if test -e "$with_libmysql_path/lib/$LIBMYSQL"; then
4258            AC_MSG_RESULT([found.])
4259            LIBMYSQL_PATH=$with_libmysql_path
4260        else
4261            AC_MSG_ERROR([not found. Please specify proper path in --with-libmysql-path.])
4262        fi
4263    else
4264        AC_MSG_ERROR([not given. Please specify either --with-system-mysql or --with-libmysql-path])
4265    fi
4266fi
4267AC_SUBST(SYSTEM_MYSQL)
4268AC_SUBST(MYSQL_INC)
4269AC_SUBST(MYSQL_LIB)
4270AC_SUBST(MYSQL_DEFINES)
4271AC_SUBST(LIBMYSQL_PATH)
4272
4273AC_LANG_PUSH([C++])
4274dnl ===================================================================
4275dnl Check for system MySQL C++ Connector
4276dnl ===================================================================
4277# FIXME!
4278# who thought this too-generic cppconn dir was a good idea?
4279AC_MSG_CHECKING([MySQL Connector/C++])
4280if test -n "$with_system_mysql_cppconn" -o -n "$with_system_libs" && \
4281        test "$with_system_mysql_cppconn" != "no" && test "$with_system_libs" != "no"; then
4282    AC_MSG_RESULT([external])
4283    SYSTEM_MYSQL_CPPCONN=YES
4284        AC_LANG_PUSH([C++])
4285    AC_CHECK_HEADER(mysql_driver.h, [],
4286                    [AC_MSG_ERROR(mysql_driver.h not found. install MySQL C++ Connectivity)], [])
4287    AC_CHECK_LIB(mysqlcppconn, main, [],
4288                    [AC_MSG_ERROR(MySQL C++ Connectivity lib not found or functional)], [])
4289   AC_MSG_CHECKING([version])
4290      AC_RUN_IFELSE([AC_LANG_SOURCE([[
4291#include <mysql_driver.h>
4292
4293int main(int argc, char **argv) {
4294    sql::Driver *driver;
4295    driver = get_driver_instance();
4296    if (driver->getMajorVersion() > 1 || \
4297       (driver->getMajorVersion() == 1 && driver->getMinorVersion() > 0) || \
4298       (driver->getMajorVersion() == 1 && driver->getMinorVersion() == 0 && driver->getPatchVersion() >= 6))
4299        return 0;
4300      else
4301        return 1;
4302}
4303      ]])],[AC_MSG_RESULT(OK)],[AC_MSG_ERROR([not suitable, we need >= 1.0.6])],[])
4304        AC_LANG_POP([C++])
4305
4306else
4307    AC_MSG_RESULT([no])
4308    SYSTEM_MYSQL_CPPCONN=
4309fi
4310AC_LANG_POP([C++])
4311AC_SUBST(SYSTEM_MYSQL_CPPCONN)
4312fi
4313
4314dnl ===================================================================
4315dnl Check for system hsqldb
4316dnl ===================================================================
4317AC_MSG_CHECKING([which hsqldb to use])
4318if test -n "$with_system_hsqldb" -o -n "$with_system_libs" && \
4319       test "$with_system_hsqldb" != "no" && test "$with_system_jars" != "no"; then
4320        AC_MSG_RESULT([external])
4321        SYSTEM_HSQLDB=YES
4322        if test -z $HSQLDB_JAR; then
4323               HSQLDB_JAR=/usr/share/java/hsqldb.jar
4324        fi
4325        AC_CHECK_FILE($HSQLDB_JAR, [],
4326               [AC_MSG_ERROR(hsqldb.jar not found.)], [])
4327        AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
4328        export HSQLDB_JAR
4329        if $PERL -e 'use Archive::Zip;
4330            my $file = "$ENV{'HSQLDB_JAR'}";
4331            my $zip = Archive::Zip->new( $file );
4332            my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
4333            if ( $mf =~ m/Specification-Version: 1.8.*/ ) {
4334               push @l, split(/\n/, $mf);
4335               foreach my $line (@l) {
4336                  if ($line =~ m/Specification-Version:/) {
4337                      ($t, $version) = split (/:/,$line);
4338                      $version =~ s/^\s//;
4339                      ($a, $b, $c, $d) = split (/\./,$version);
4340                      if ($c == "0" && $d > "8")  {
4341                          exit 0;
4342                      } else {
4343                          exit 1;
4344                      }
4345                  }
4346               }
4347            } else {
4348                exit 1;
4349            }'; then
4350            AC_MSG_RESULT([yes])
4351         else
4352            AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
4353         fi
4354else
4355    AC_MSG_RESULT([internal])
4356    SYSTEM_HSQLDB=NO
4357    BUILD_TYPE="$BUILD_TYPE HSQLDB"
4358fi
4359AC_SUBST(SYSTEM_HSQLDB)
4360AC_SUBST(HSQLDB_JAR)
4361
4362dnl ===================================================================
4363dnl Check for system beanshell
4364dnl ===================================================================
4365ENABLE_BEANSHELL=YES
4366AC_MSG_CHECKING([which beanshell to use])
4367if test -n "$with_system_beanshell" -o -n "$with_system_libs" && \
4368       test "$with_system_beanshell" != "no" && test "$with_system_jars" != "no"; then
4369        AC_MSG_RESULT([external])
4370        SYSTEM_BSH=YES
4371        if test -z $BSH_JAR; then
4372               BSH_JAR=/usr/share/java/bsh.jar
4373        fi
4374        AC_CHECK_FILE($BSH_JAR, [],
4375               [AC_MSG_ERROR(bsh.jar not found.)], [])
4376elif test "x$enable_beanshell" = "xyes"; then
4377    AC_MSG_RESULT([internal])
4378    SYSTEM_BSH=NO
4379    BUILD_TYPE="$BUILD_TYPE BSH"
4380else
4381    AC_MSG_RESULT([none (disabled)])
4382    SYSTEM_BSH=NO
4383    ENABLE_BEANSHELL=NO
4384fi
4385AC_SUBST(SYSTEM_BSH)
4386AC_SUBST(BSH_JAR)
4387AC_SUBST(ENABLE_BEANSHELL)
4388
4389
4390dnl ===================================================================
4391dnl Check for saxon. It can come from two different places:
4392dnl - pre-installed on the system. This is checked when the --with-system-saxon
4393dnl   option is given to configure.
4394dnl   The exact place can be specified with the --with-saxon-jar=<path> option.
4395dnl - From the saxon tar ball in ext_sources/. This is used when --enable-saxon
4396dnl   is given to configure but not any of --with-system-saxon or --with-saxon-jar.
4397dnl ===================================================================
4398DISABLE_SAXON=
4399AC_MSG_CHECKING([which saxon to use])
4400if test -n "$with_system_saxon" -o -n "$with_system_libs" && \
4401       test "$with_system_saxon" != "no" && test "$with_system_jars" != "no"; then
4402        AC_MSG_RESULT([external])
4403        SYSTEM_SAXON=YES
4404        if test -z $SAXON_JAR; then
4405          AC_CHECK_FILE(/usr/share/java/saxon9.jar,
4406            [ SAXON_JAR=/usr/share/java/saxon9.jar ],
4407            [
4408              AC_CHECK_FILE(/usr/share/java/saxon.jar,
4409                [ SAXON_JAR=/usr/share/java/saxon.jar ],
4410                [ AC_CHECK_FILE(/usr/share/java/saxon9.jar,
4411                    [ SAXON_JAR=/usr/share/java/saxon9.jar ],
4412                    [ AC_MSG_ERROR(saxon.jar replacement not found)]
4413                  )
4414                ]
4415              )
4416            ]
4417          )
4418        else
4419          AC_CHECK_FILE($SAXON_JAR, [],
4420               [AC_MSG_ERROR(saxon.jar replacement not found.)], [])
4421        fi
4422        if test -n "$SERIALIZER_JAR"; then
4423          AC_CHECK_FILE($SERIALIZER_JAR, [],
4424               [AC_MSG_ERROR(serializer.jar not found.)], [])
4425          AC_SUBST(SERIALIZER_JAR)
4426        fi
4427
4428dnl Saxon comes in two practically available versions, the out-of-date saxonb which
4429dnl supports the java extensions that AOO uses, and the up-to-date saxon he
4430dnl "home edition" version, which is crippled to not support those java extensions.
4431dnl And as an aside the he one also needs to be tweaked to include
4432dnl a META-INF/services to broadcast that it supports the jaxp transform factory
4433
4434        AC_MSG_CHECKING([if saxon works])
4435        cat > saxontest.java <<_ACEOF
4436[import javax.xml.transform.TransformerFactory;
4437import javax.xml.transform.Transformer;
4438import javax.xml.transform.stream.StreamSource;
4439import java.io.*;
4440
4441import net.sf.saxon.FeatureKeys;
4442
4443class saxontest {
4444    public static void main(String[] args) {
4445      System.setProperty("javax.xml.transform.TransformerFactory",
4446        "net.sf.saxon.TransformerFactoryImpl");
4447      try {
4448        TransformerFactory tfactory = TransformerFactory.newInstance();
4449    // some external saxons (Debian, Ubuntu, ...) have this disabled
4450    // per default
4451    tfactory.setAttribute(FeatureKeys.ALLOW_EXTERNAL_FUNCTIONS, new Boolean(true));
4452        System.out.println("TransformerFactory is" +
4453          tfactory.getClass().getName());
4454        Transformer transformer = tfactory.newTransformer(
4455          new StreamSource(new File(args[0])));
4456      } catch(Exception e){
4457        e.printStackTrace(System.err);
4458        System.exit(-1);
4459      }
4460      System.exit(0);
4461    }
4462}
4463]
4464_ACEOF
4465        cat > saxontest.xsl<<_ACEOF
4466[<?xml version="1.0" encoding="UTF-8"?>
4467<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4468 <xsl:template match="/">
4469  <xsl:value-of select="math:sqrt(1)" xmlns:math="java:java.lang.Math"/>
4470 </xsl:template>
4471</xsl:stylesheet>
4472]
4473_ACEOF
4474        javac_cmd="$JAVACOMPILER -cp $SAXON_JAR saxontest.java 1>&2"
4475        AC_TRY_EVAL(javac_cmd)
4476        if test $? = 0 && test -f ./saxontest.class ; then
4477            java_cmd="$JAVAINTERPRETER -cp $SAXON_JAR:. saxontest saxontest.xsl 1>&2"
4478            AC_TRY_EVAL(java_cmd)
4479            if test $? = 0; then
4480              AC_MSG_RESULT([yes])
4481            else
4482              cat saxontest.java >&5
4483              AC_MSG_RESULT([no])
4484              AC_MSG_ERROR([Non-functional saxon jar, e.g. crippled saxon-he instead of saxonb])
4485            fi
4486        else
4487          AC_MSG_RESULT([no])
4488          cat saxontest.java >&5
4489          AC_MSG_ERROR([saxontest could not be compiled, non-functional saxon jar])
4490        fi
4491elif test "x$enable_saxon" = "xyes"; then
4492    AC_MSG_RESULT([internal])
4493    SYSTEM_SAXON=NO
4494    BUILD_TYPE="$BUILD_TYPE SAXON"
4495else
4496    AC_MSG_RESULT([none (disabled)])
4497    SYSTEM_SAXON=NO
4498    DISABLE_SAXON=YES
4499fi
4500AC_SUBST(SYSTEM_SAXON)
4501AC_SUBST(SAXON_JAR)
4502AC_SUBST(DISABLE_SAXON)
4503
4504
4505dnl ===================================================================
4506dnl Check for rhino
4507dnl ===================================================================
4508ENABLE_JAVASCRIPT=
4509AC_MSG_CHECKING([whether to enable support for JavaScript])
4510if test "x$enable_javascript" = "xyes"; then
4511   BUILD_TYPE="$BUILD_TYPE RHINO"
4512   AC_MSG_RESULT([yes])
4513   ENABLE_JAVASCRIPT=YES
4514else
4515   AC_MSG_RESULT([no])
4516   ENABLE_JAVASCRIPT=NO
4517fi
4518AC_SUBST(ENABLE_JAVASCRIPT)
4519
4520
4521dnl ===================================================================
4522dnl Check for CoinMP
4523dnl ===================================================================
4524ENABLE_COINMP=
4525SYSTEM_COINMP=NO
4526COINMP_CFLAGS=
4527COINMP_LIBS=
4528AC_MSG_CHECKING([whether to enable support for CoinMP])
4529if test "x$enable_coinmp" = "xyes"; then
4530    BUILD_TYPE="$BUILD_TYPE COINMP"
4531    AC_MSG_RESULT([yes])
4532    ENABLE_COINMP=YES
4533
4534    dnl Check whether to use system or internal CoinMP
4535    AC_MSG_CHECKING([which coinmp to use])
4536    if test "x$with_system_coinmp" = "xyes" -o -n "$with_system_libs"; then
4537        AC_MSG_RESULT([system])
4538    PKG_CHECK_MODULES([COINMP], [coinmp])
4539        SYSTEM_COINMP=YES
4540        # some systems need this. Like Ubuntu....
4541        AC_CHECK_LIB(m, floor)
4542        AC_CHECK_LIB(dl, dlopen)
4543    else
4544        AC_MSG_RESULT([internal])
4545        SYSTEM_COINMP=NO
4546        BUILD_TYPE="$BUILD_TYPE COINMP"
4547    fi
4548else
4549    AC_MSG_RESULT([no])
4550    ENABLE_COINMP=NO
4551fi
4552AC_SUBST(ENABLE_COINMP)
4553AC_SUBST(SYSTEM_COINMP)
4554AC_SUBST(COINMP_CFLAGS)
4555AC_SUBST(COINMP_LIBS)
4556
4557
4558dnl ===================================================================
4559dnl Check for system curl
4560dnl ===================================================================
4561if test "$_os" = "Darwin" && test "$with_system_curl" != "no"; then
4562   with_system_curl=yes
4563fi
4564AC_MSG_CHECKING([which curl to use])
4565if test -n "$with_system_curl" -o -n "$with_system_libs" && \
4566    test "$with_system_curl" != "no"; then
4567   AC_MSG_RESULT([external])
4568   SYSTEM_CURL=YES
4569
4570   AC_PATH_PROG( CURLCONFIG, curl-config)
4571   if test -z "$CURLCONFIG"; then
4572      AC_MSG_ERROR([install curl to run this script])
4573   fi
4574
4575   # check curl version
4576   AC_MSG_CHECKING([whether curl is >= 7.13.1])
4577   if test "`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $1 }'`" -gt "7" -a \
4578    "`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $2 }'`" -gt "13" -a \
4579    "`$CURLCONFIG --version | $AWK -F' ' '{print $2}' | $AWK -F. '{ print $3 }'`" -gt "1"; then
4580      AC_MSG_ERROR([no, you need at least curl 7.13,1])
4581   else
4582      AC_MSG_RESULT([yes])
4583   fi
4584
4585   # Does curl use OpenSSL as its SSL implementation? Needed for ucb/source/ucp/webdav.
4586   AC_MSG_CHECKING([whether curl uses OpenSSL as its SSL backend])
4587   if $CURLCONFIG --ssl-backends | $GREP -q 'OpenSSL'; then
4588      AC_MSG_RESULT([yes])
4589   else
4590      AC_MSG_ERROR([no, cannot use system curl whose SSL backend isn't OpenSSL])
4591   fi
4592
4593   CURL_LIBS=`$CURLCONFIG --libs`
4594   CURL_CFLAGS=`$CURLCONFIG --cflags`
4595else
4596   AC_MSG_RESULT([internal])
4597   SYSTEM_CURL=NO
4598   BUILD_TYPE="$BUILD_TYPE CURL"
4599fi
4600AC_SUBST(SYSTEM_CURL)
4601AC_SUBST(CURL_CFLAGS)
4602AC_SUBST(CURL_LIBS)
4603
4604dnl ===================================================================
4605dnl Check for system mdds
4606dnl ===================================================================
4607AC_MSG_CHECKING([which mdds to use])
4608if test -n "$with_system_mdds" -o -n "$with_system_headers" && \
4609    test "$with_system_mdds" != "no"; then
4610    AC_MSG_RESULT([external])
4611    SYSTEM_MDDS=YES
4612    AC_LANG_PUSH([C++])
4613    AC_CHECK_HEADER(mdds/flat_segment_tree.hpp, [],
4614        [AC_MSG_ERROR(mdds/flat_segment_tree.hpp not found. install mdds)], [])
4615    AC_LANG_POP([C++])
4616else
4617   AC_MSG_RESULT([internal])
4618   BUILD_TYPE="$BUILD_TYPE MDDS"
4619   SYSTEM_MDDS=NO
4620fi
4621AC_SUBST(SYSTEM_MDDS)
4622
4623dnl ===================================================================
4624dnl Check for system boost
4625dnl ===================================================================
4626AC_MSG_CHECKING([which boost to use])
4627if test -n "$with_system_boost" -o -n "$with_system_headers" && \
4628    test "$with_system_boost" != "no"; then
4629   AC_MSG_RESULT([external])
4630   SYSTEM_BOOST=YES
4631   AC_LANG_PUSH([C++])
4632   AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
4633       [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
4634   AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
4635       [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
4636   AC_CHECK_HEADER(boost/function.hpp, [],
4637       [AC_MSG_ERROR(boost/function.hpp not found. install boost)], [])
4638
4639   save_CXXFLAGS=$CXXFLAGS
4640   CXXFLAGS="$CXXFLAGS -fno-exceptions"
4641   AC_MSG_CHECKING([whether boost/function.hpp compiles with -fno-exceptions])
4642   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <boost/function.hpp>
4643]], [[]])],[ac_cv_cxx_boost_no_exceptons_broken=no],[ac_cv_cxx_boost_no_exceptons_broken=yes])
4644
4645   if test "$ac_cv_cxx_boost_no_exceptons_broken" = "yes"; then
4646    AC_MSG_ERROR([no, see https://bugzilla.redhat.com/show_bug.cgi?id=477131])
4647   else
4648    AC_MSG_RESULT([yes])
4649   fi
4650   CXXFLAGS=$save_CXXFLAGS
4651   AC_LANG_POP([C++])
4652else
4653   AC_MSG_RESULT([internal])
4654   BUILD_TYPE="$BUILD_TYPE BOOST"
4655   SYSTEM_BOOST=NO
4656fi
4657AC_SUBST(SYSTEM_BOOST)
4658
4659dnl ===================================================================
4660dnl Check for system vigra
4661dnl ===================================================================
4662AC_MSG_CHECKING([which vigra to use])
4663if test -n "$with_system_vigra" -o -n "$with_system_headers" && \
4664    test "$with_system_vigra" != "no"; then
4665   AC_MSG_RESULT([external])
4666   SYSTEM_VIGRA=YES
4667   AC_LANG_PUSH([C++])
4668   AC_CHECK_HEADER(vigra/copyimage.hxx, [],
4669       [AC_MSG_ERROR(vigra/copyimage.hxx not found. install vigra)], [])
4670   AC_LANG_POP([C++])
4671else
4672   AC_MSG_RESULT([internal])
4673   BUILD_TYPE="$BUILD_TYPE VIGRA"
4674   SYSTEM_VIGRA=NO
4675fi
4676AC_SUBST(SYSTEM_VIGRA)
4677
4678dnl ===================================================================
4679dnl Check for system odbc
4680dnl ===================================================================
4681AC_MSG_CHECKING([which odbc headers to use])
4682if test -n "$with_system_odbc_headers" -o -n "$with_system_headers" && \
4683    test "$with_system_odbc_headers" != "no"; then
4684   AC_MSG_RESULT([external])
4685   SYSTEM_ODBC_HEADERS=YES
4686
4687   AC_CHECK_HEADER(sqlext.h, [],
4688      [AC_MSG_ERROR(odbc not found. install odbc)], [])
4689else
4690   AC_MSG_RESULT([internal])
4691   SYSTEM_ODBC_HEADERS=NO
4692   BUILD_TYPE="$BUILD_TYPE UNIXODBC"
4693fi
4694AC_SUBST(SYSTEM_ODBC_HEADERS)
4695
4696AC_MSG_CHECKING([whether to build XML Security support])
4697if test "$enable_nss_module" = "no"; then
4698   AC_MSG_RESULT([no, since NSS disabled but needed])
4699else
4700   AC_MSG_RESULT([yes])
4701fi
4702
4703AC_MSG_CHECKING([whether to build LDAP configuration backend])
4704if test -z "$enable_ldap" || test "$enable_ldap" = "yes"; then
4705   if test "$with_openldap" = "yes"; then
4706      AC_MSG_RESULT([yes])
4707      WITH_LDAP=YES
4708   else
4709      WITH_LDAP=NO
4710   fi
4711else
4712   AC_MSG_RESULT([no])
4713   WITH_LDAP=NO
4714fi
4715
4716if test "$WITH_LDAP" = "YES"; then
4717   dnl ===================================================================
4718   dnl Test whether we want to use the OpenLDAP LDAP SDK
4719   dnl ===================================================================
4720   AC_MSG_CHECKING([which LDAP SDK to use])
4721   if test -n "$with_openldap" && test "$with_openldap" != "no"; then
4722       AC_MSG_RESULT([OpenLDAP])
4723       WITH_OPENLDAP=YES
4724       AC_CHECK_HEADERS(ldap.h, [],
4725           [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
4726       AC_CHECK_LIB(ldap, ldap_simple_bind_s, [],
4727           [AC_MSG_ERROR(openldap lib not found or functional)], [])
4728       # rumours say that OpenLDAP doesn't have that function. I looked and
4729       # it has it. Test for it to be sure
4730         AC_CHECK_LIB(ldap, ldap_set_option, [],
4731                [AC_MSG_ERROR(openldap lib not found or functional)], [])
4732   fi
4733fi
4734AC_SUBST(WITH_LDAP)
4735AC_SUBST(WITH_OPENLDAP)
4736
4737AC_MSG_CHECKING([whether to build the internal NSS module])
4738if test "$enable_nss_module" != "no"; then
4739   ENABLE_NSS_MODULE="YES"
4740   BUILD_TYPE="$BUILD_TYPE NSS"
4741   AC_MSG_RESULT([yes])
4742   if test "$_os" = "WINNT"; then
4743      AC_MSG_CHECKING([for Mozilla build tooling])
4744      if test -z "$MOZILLABUILD" ; then
4745AC_MSG_ERROR([
4746Mozilla build tooling not found!
4747  It is required for NSS that is needed for AOO's security facilities.
4748  Either disable NSS using the option --disable-nss-module
4749  or use the --with-mozilla-build option after installing the tool obtained
4750  from https://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/])
4751      else
4752         if test \( "$WITH_MINGWIN" = "yes" \) ; then
4753            if test ! -d "$MOZILLABUILD" ; then
4754AC_MSG_ERROR([Mozilla build tooling incomplete!])
4755            else
4756               AC_MSG_RESULT([ok])
4757            fi
4758         else
4759            if test ! -d "$MOZILLABUILD/msys" ; then
4760AC_MSG_ERROR([Mozilla build tooling incomplete!])
4761            else
4762               AC_MSG_RESULT([ok])
4763            fi
4764         fi
4765      fi
4766   fi
4767else
4768   ENABLE_NSS_MODULE="NO"
4769   AC_MSG_RESULT([no])
4770fi
4771
4772AC_SUBST(ENABLE_NSS_MODULE)
4773AC_SUBST(MOZILLABUILD)
4774AC_SUBST(MOZ_INC)
4775
4776dnl ===================================================================
4777dnl Check for system sane
4778dnl ===================================================================
4779AC_MSG_CHECKING([which sane header to use])
4780if test -n "$with_system_sane_header" -o -n "$with_system_headers" && \
4781    test "$with_system_sane_header" != "no"; then
4782   AC_MSG_RESULT([external])
4783   SYSTEM_SANE_HEADER=YES
4784   AC_CHECK_HEADER(sane/sane.h, [],
4785      [AC_MSG_ERROR(sane not found. install sane)], [])
4786else
4787   AC_MSG_RESULT([internal])
4788   SYSTEM_SANE_HEADER=NO
4789   BUILD_TYPE="$BUILD_TYPE SANE"
4790fi
4791AC_SUBST(SYSTEM_SANE_HEADER)
4792
4793dnl ===================================================================
4794dnl Check for system icu
4795dnl ===================================================================
4796AC_MSG_CHECKING([which icu to use])
4797if test -n "$with_system_icu" -o -n "$with_system_libs" && \
4798    test "$with_system_icu" != "no"; then
4799   AC_MSG_RESULT([external])
4800   SYSTEM_ICU=YES
4801   AC_LANG_PUSH([C++])
4802   AC_MSG_CHECKING([for unicode/rbbi.h])
4803   AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT(checked.)],[AC_MSG_ERROR(icu headers not found.)])
4804   AC_LANG_POP([C++])
4805   AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
4806   if test -z "$SYSTEM_GENBRK"; then
4807      AC_MSG_ERROR([\"genbrk\" not found in \$PATH, install the icu development tool \"genbrk"\])
4808   fi
4809   AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin])
4810   if test -z "$SYSTEM_GENCCODE"; then
4811      AC_MSG_ERROR([\"genccode\" not found in \$PATH, install the icu development tool \"genccode"\])
4812   fi
4813   AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin])
4814   if test -z "$SYSTEM_GENCMN"; then
4815      AC_MSG_ERROR([\"gencmn\" not found in \$PATH, install the icu development tool \"gencmn"\])
4816   fi
4817
4818   AC_PATH_PROG( ICUCONFIG, icu-config)
4819   AC_MSG_CHECKING([ICU version])
4820   if test "$_os" = "OS2"; then
4821      ICU_MAJOR=4
4822   else
4823      ICU_VERSION=`$ICUCONFIG --version`
4824      ICU_MAJOR=`$ICUCONFIG --version | cut -d"." -f1`
4825      ICU_MINOR=`$ICUCONFIG --version | cut -d"." -f2`
4826      ICU_MICRO=`$ICUCONFIG --version | cut -d"." -f3`
4827   fi
4828
4829   if test "$ICU_MAJOR" -ge "4"; then
4830      AC_MSG_RESULT([OK])
4831   else
4832      AC_MSG_ERROR([not suitable, only >= 4.0 supported currently])
4833   fi
4834
4835else
4836    AC_MSG_RESULT([internal])
4837    SYSTEM_ICU=NO
4838    BUILD_TYPE="$BUILD_TYPE ICU"
4839fi
4840AC_SUBST(SYSTEM_ICU)
4841AC_SUBST(SYSTEM_GENBRK)
4842AC_SUBST(SYSTEM_GENCCODE)
4843AC_SUBST(SYSTEM_GENCMN)
4844AC_SUBST(ICU_MAJOR)
4845AC_SUBST(ICU_MINOR)
4846AC_SUBST(ICU_MICRO)
4847
4848dnl ===================================================================
4849dnl Graphite
4850dnl ===================================================================
4851
4852ENABLE_GRAPHITE="FALSE"
4853AC_MSG_CHECKING([whether to enable graphite support])
4854if test "x$enable_graphite" = "xyes" -a \( "$_os" = "WINNT" -o "$_os" = "Linux" -o "$_os" = "FreeBSD" \) ; then
4855    AC_MSG_RESULT([yes])
4856    ENABLE_GRAPHITE="TRUE"
4857    AC_MSG_CHECKING([which graphite to use])
4858    if test -n "$with_system_graphite" -o -n "$with_system_libs" && \
4859        test "$with_system_graphite" != "no"; then
4860        AC_MSG_RESULT([external])
4861        SYSTEM_GRAPHITE=YES
4862        PKG_CHECK_MODULES( GRAPHITE, silgraphite )
4863    else
4864        AC_MSG_RESULT([internal])
4865        SYSTEM_GRAPHITE=NO
4866        BUILD_TYPE="$BUILD_TYPE GRAPHITE"
4867    fi
4868else
4869   AC_MSG_RESULT([no])
4870   ENABLE_GRAPHITE="FALSE"
4871fi
4872AC_SUBST(ENABLE_GRAPHITE)
4873AC_SUBST(SYSTEM_GRAPHITE)
4874AC_SUBST(GRAPHITE_LIBS)
4875AC_SUBST(GRAPHITE_CFLAGS)
4876
4877
4878dnl ===================================================================
4879dnl Checks for libraries.
4880dnl ===================================================================
4881dnl Check for Mac OS X native GUI, which may is now required; the X11 build is no longer supported
4882dnl See if we have the AppKit framework for building with Quartz graphics.
4883
4884if test  "$_os" = "Darwin"; then
4885   if test "x$with_x" = "xyes"; then
4886      AC_MSG_ERROR([X11 build is no longer supported on MacOSX, please use the native aqua build])
4887   else
4888      AC_MSG_CHECKING([for /System/Library/Frameworks/AppKit.framework])
4889      if test -d "/System/Library/Frameworks/AppKit.framework/"; then
4890         AC_MSG_RESULT([yes])
4891         x_includes="no_x_includes"
4892         x_libraries="no_x_libraries"
4893         dnl disable some things used on other Unix versions but not on the aqua build
4894         enable_gtk=no
4895         enable_cups=no
4896         ENABLE_CUPS=""
4897         AC_SUBST(ENABLE_CUPS)
4898      else
4899         AC_MSG_ERROR([No AppKit.framewrok found])
4900      fi
4901   fi
4902fi
4903
4904dnl ***************************************
4905dnl testing for X libraries and includes...
4906dnl ***************************************
4907if test "$_os" = "Darwin" -a "x$x_includes" = "xno_x_includes"; then
4908   echo "Do Nothing for _os = Darwin"
4909   dnl Mac OS X using Aqua graphics. Don't check for X11.
4910   :
4911elif test "$_os" = "OS2" ; then
4912   echo "Do Nothing for _os = OS2. Don't check for X11."
4913   dnl OS/2 uses native graphics. Don't check for X11.
4914   :
4915elif test "$_os" != "WINNT" ; then
4916   AC_PATH_X
4917   AC_PATH_XTRA
4918   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
4919
4920   if test "x$x_includes" = "x"; then
4921     x_includes="default_x_includes"
4922   fi
4923   if test "x$x_libraries" = "x"; then
4924     x_libraries="default_x_libraries"
4925   fi
4926   dnl The variables $x_libraries and $x_includes are set.
4927   if test -z "$x_libraries"; then
4928      AC_MSG_ERROR([No X libraries found]) # Exit
4929   fi
4930   if test -z "$x_includes"; then
4931      AC_MSG_ERROR([No X includes found]) # Exit
4932   fi
4933   CFLAGS=$X_CFLAGS
4934   LDFLAGS="$X_LDFLAGS $X_LIBS"
4935   AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
4936   dnl Check if the XauDisposeAuth symbol is provided by libXau.
4937   AC_CHECK_LIB(Xau, XauDisposeAuth, XAU_LIBS="-lXau", [])
4938else
4939   x_includes="no_x_includes"
4940   x_libraries="no_x_libraries"
4941fi
4942if test -z "$x_includes"; then
4943   x_includes="no_x_includes"
4944fi
4945if test -z "$x_libraries"; then
4946   x_libraries="no_x_libraries"
4947fi
4948if test "$x_includes" = "default_x_includes"; then
4949   XINC="/usr/include"
4950else
4951   XINC="$x_includes"
4952fi
4953AC_SUBST(XINC)
4954if test "$x_libraries" = "default_x_libraries"; then
4955   XLIB=`$PKG_CONFIG --variable=libdir x11`
4956   if test "x$XLIB" = x; then
4957         XLIB="/usr/lib"
4958   fi
4959else
4960   XLIB="$x_libraries"
4961fi
4962AC_SUBST(XLIB)
4963AC_SUBST(XAU_LIBS)
4964
4965dnl ===================================================================
4966dnl Check if fontconfig/fontconfig.h is available
4967dnl ===================================================================
4968if test "$ENABLE_FONTCONFIG" = "TRUE" ; then
4969    AC_CHECK_HEADER(fontconfig/fontconfig.h, [],
4970                    [AC_MSG_ERROR([fontconfig/fontconfig.h could not be found. libfontconfig1-dev or fontconfig???-devel missing?])], [])
4971    AC_MSG_CHECKING([whether fontconfig is >= 2.2.0])
4972    AC_RUN_IFELSE([AC_LANG_SOURCE([[
4973#include <fontconfig/fontconfig.h>
4974
4975int main(int argc, char **argv) {
4976    if(FC_MAJOR > 2 || (FC_MAJOR == 2 && FC_MINOR >= 2)) return 0;
4977    else return 1;
4978}
4979]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, fontconfig >= 2.2.0 needed])],[])
4980fi
4981
4982dnl ===================================================================
4983dnl Check for system Xrender
4984dnl ===================================================================
4985AC_MSG_CHECKING([whether to link to Xrender])
4986if test -n "$enable_xrender_link" -a "$enable_xrender_link" != "no"; then
4987   AC_MSG_RESULT([yes])
4988   XRENDER_LINK=YES
4989   with_system_xrender_headers=yes
4990else
4991   AC_MSG_RESULT([no, dynamically open it])
4992   XRENDER_LINK=NO
4993fi
4994AC_MSG_CHECKING([which Xrender headers to use])
4995if test -n "$with_system_xrender_headers" -o -n "$with_system_headers" && \
4996    test "$with_system_xrender_headers" != "no"; then
4997   AC_MSG_RESULT([external])
4998   SYSTEM_XRENDER_HEADERS=YES
4999   AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
5000      [AC_MSG_ERROR(Xrender not found. install X)], [])
5001else
5002   AC_MSG_RESULT([internal])
5003   SYSTEM_XRENDER_HEADERS=NO
5004   BUILD_TYPE="$BUILD_TYPE X11_EXTENSIONS"
5005fi
5006if test "$XRENDER_LINK" = "YES"; then
5007   AC_CHECK_LIB(Xrender, XRenderQueryVersion, [],
5008      [AC_MSG_ERROR(libXrender not found or functional)], [])
5009fi
5010AC_SUBST(SYSTEM_XRENDER_HEADERS)
5011AC_SUBST(XRENDER_LINK)
5012
5013dnl ===================================================================
5014dnl Check for XRandr
5015dnl ===================================================================
5016AC_MSG_CHECKING([whether to enable RandR support])
5017if test "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \) ; then
5018   if test -z "$enable_randr_link" -o "$enable_randr_link" = "no"; then
5019      XRANDR_DLOPEN="TRUE"
5020      AC_MSG_RESULT([resorting to dlopen libXrandr at runtime])
5021   else
5022      XRANDR_DLOPEN="FALSE"
5023      PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
5024      if test "$ENABLE_RANDR" != "TRUE"; then
5025         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
5026                        [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
5027         XRANDR_CFLAGS=" "
5028         AC_CHECK_LIB(Xrandr, XRRQueryExtension, [],
5029              [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
5030         XRANDR_LIBS="-lXrandr "
5031         ENABLE_RANDR="TRUE"
5032         AC_MSG_RESULT([enabling RandR support])
5033      fi
5034   fi
5035else
5036   ENABLE_RANDR=""
5037   AC_MSG_RESULT([no])
5038fi
5039AC_SUBST(XRANDR_DLOPEN)
5040AC_SUBST(XRANDR_CFLAGS)
5041AC_SUBST(XRANDR_LIBS)
5042AC_SUBST(ENABLE_RANDR)
5043
5044dnl ===================================================================
5045dnl Check for system nss
5046dnl ===================================================================
5047AC_MSG_CHECKING([which libnss to use])
5048if test -n "$with_system_nss" -o -n "$with_system_libs" && test "$with_system_nss" != "no"; then
5049    AC_MSG_RESULT([external])
5050    PKG_CHECK_MODULES( NSS, nss )
5051    SYSTEM_NSS=YES
5052else
5053    AC_MSG_RESULT([internal])
5054    SYSTEM_NSS=NO
5055    BUILD_TYPE="$BUILD_TYPE NSS"
5056fi
5057AC_SUBST(SYSTEM_NSS)
5058AC_SUBST(NSS_CFLAGS)
5059AC_SUBST(NSS_LIBS)
5060
5061dnl ===================================================================
5062dnl Check for system openssl
5063dnl ===================================================================
5064AC_MSG_CHECKING([which libssl to use])
5065if test -n "$with_system_openssl" -o -n "$with_system_libs" && \
5066        test "$with_system_openssl" != "no"; then
5067    AC_MSG_RESULT([external])
5068    if test "$_os" = "FreeBSD"; then
5069        OPENSSL_CFLAGS=
5070        OPENSSL_LIBS="-lssl -lcrypto"
5071    else
5072        PKG_CHECK_MODULES( OPENSSL, openssl )
5073    fi
5074    SYSTEM_OPENSSL=YES
5075else
5076    AC_MSG_RESULT([internal])
5077    SYSTEM_OPENSSL=NO
5078    BUILD_TYPE="$BUILD_TYPE OPENSSL"
5079fi
5080AC_SUBST(SYSTEM_OPENSSL)
5081AC_SUBST(OPENSSL_CFLAGS)
5082AC_SUBST(OPENSSL_LIBS)
5083
5084dnl ===================================================================
5085dnl Check for system redland
5086dnl ===================================================================
5087AC_MSG_CHECKING([which redland library to use])
5088if test -n "$with_system_redland" -o -n "$with_system_libs" && \
5089    test "$with_system_redland" != "no"; then
5090    AC_MSG_RESULT([external])
5091    SYSTEM_REDLAND=YES
5092   dnl versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
5093   PKG_CHECK_MODULES(REDLAND, redland >= 1.0.8)
5094else
5095    AC_MSG_RESULT([internal])
5096    BUILD_TYPE="$BUILD_TYPE REDLAND"
5097    SYSTEM_REDLAND=NO
5098fi
5099AC_SUBST(SYSTEM_REDLAND)
5100AC_SUBST(REDLAND_CFLAGS)
5101AC_SUBST(REDLAND_LIBS)
5102
5103dnl ===================================================================
5104dnl Check for hunspell
5105dnl ===================================================================
5106AC_MSG_CHECKING([whether to build the Spell Checking component])
5107ENABLE_HUNSPELL=
5108
5109if test "x$enable_hunspell" != "xno" ; then
5110    AC_MSG_CHECKING([which libhunspell to use])
5111    if test -n "$with_system_hunspell" -o -n "$with_system_libs" && \
5112        test "$with_system_hunspell" != "no"; then
5113        AC_MSG_RESULT([external])
5114        SYSTEM_HUNSPELL=YES
5115        AC_LANG_PUSH([C++])
5116        PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
5117        if test "$HUNSPELL_PC" != "TRUE"; then
5118            AC_CHECK_HEADER(hunspell.hxx, [],
5119            [AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
5120                [AC_MSG_ERROR(hunspell headers not found.)], [])
5121             ], [])
5122            AC_CHECK_LIB(hunspell, main, [],
5123            [ AC_MSG_ERROR(hunspell library not found.) ], [])
5124            HUNSPELL_LIBS=-lhunspell
5125        fi
5126        AC_LANG_POP([C++])
5127    else
5128        AC_MSG_RESULT([internal])
5129        SYSTEM_HUNSPELL=NO
5130        BUILD_TYPE="$BUILD_TYPE HUNSPELL"
5131    fi
5132    ENABLE_HUNSPELL=YES
5133    AC_SUBST(SYSTEM_HUNSPELL)
5134    AC_SUBST(HUNSPELL_CFLAGS)
5135    AC_SUBST(HUNSPELL_LIBS)
5136else
5137    AC_MSG_RESULT([no])
5138fi
5139AC_SUBST(ENABLE_HUNSPELL)
5140
5141dnl ===================================================================
5142dnl Checking for libhyphen
5143dnl ===================================================================
5144AC_MSG_CHECKING([whether to build the Hyphenator component])
5145ENABLE_HYPHEN=
5146
5147if test "x$enable_hyphen" != "xno" ; then
5148    AC_MSG_CHECKING([which libhyphen to use])
5149    if test -n "$with_system_hyphen" -o -n "$with_system_libs" && \
5150        test "$with_system_hyphen" != "no"; then
5151        AC_MSG_RESULT([external])
5152        SYSTEM_HYPH=YES
5153        AC_CHECK_HEADER(hyphen.h, [],
5154        [ AC_MSG_ERROR(libhyphen headers not found.)], [])
5155        AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
5156        [ AC_MSG_ERROR(no. You are sure you have libhyphen headers?)],
5157        [#include <hyphen.h>])
5158        AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
5159            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5160        if test -z "$HYPHEN_LIB"; then
5161        AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
5162            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5163        fi
5164        if test -z "$HYPHEN_LIB"; then
5165        AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
5166            [ AC_MSG_ERROR(libhyphen not found or too old.)], [])
5167        fi
5168    else
5169        AC_MSG_RESULT([internal])
5170        SYSTEM_HYPH=NO
5171        BUILD_TYPE="$BUILD_TYPE HYPHEN"
5172    fi
5173    ENABLE_HYPHEN=YES
5174    AC_SUBST(SYSTEM_HYPH)
5175    AC_SUBST(HYPHEN_LIB)
5176else
5177    AC_MSG_RESULT([no])
5178fi
5179AC_SUBST(ENABLE_HYPHEN)
5180
5181
5182#dnl ===================================================================
5183#dnl Check whether we are allowed to bundle dictionaries and whether
5184#dnl hunspell is available.
5185#dnl ===================================================================
5186ENABLE_BUNDLED_DICTIONARIES=
5187if test "x$enable_bundled_dictionaries" != "xno" -a "x$ENABLE_HUNSPELL" = "xYES"; then
5188   ENABLE_BUNDLED_DICTIONARIES=YES
5189fi
5190AC_SUBST(ENABLE_BUNDLED_DICTIONARIES)
5191
5192
5193
5194dnl ===================================================================
5195dnl Checking for mythes
5196dnl ===================================================================
5197AC_MSG_CHECKING([which mythes to use])
5198if test -n "$with_system_mythes" -o -n "$with_system_libs" && \
5199   test "$with_system_mythes" != "no"; then
5200    AC_MSG_RESULT([external])
5201    SYSTEM_MYTHES=YES
5202    AC_LANG_PUSH([C++])
5203    PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
5204    if test "$MYTHES_PKGCONFIG" = "no"; then
5205        AC_CHECK_HEADER(mythes.hxx, [],
5206            [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
5207        AC_CHECK_LIB(mythes-1.2, main, [],
5208            [ MYTHES_FOUND=no], [])
5209    if test "$MYTHES_FOUND" = "no"; then
5210            AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
5211                [ MYTHES_FOUND=no], [])
5212    fi
5213    if test "$MYTHES_FOUND" = "no"; then
5214        AC_MSG_ERROR([mythes library not found!.])
5215    fi
5216    fi
5217    AC_LANG_POP([C++])
5218else
5219    AC_MSG_RESULT([internal])
5220    SYSTEM_MYTHES=NO
5221    BUILD_TYPE="$BUILD_TYPE MYTHES"
5222fi
5223AC_SUBST(SYSTEM_MYTHES)
5224AC_SUBST(MYTHES_CFLAGS)
5225AC_SUBST(MYTHES_LIBS)
5226
5227
5228dnl ===================================================================
5229dnl Checking for libtextcat
5230dnl ===================================================================
5231AC_MSG_CHECKING([which libtextcat to use])
5232if test -n "$with_system_libtextcat" && test "$with_system_libtextcat" != "no"; then
5233    AC_MSG_RESULT([external])
5234    SYSTEM_LIBTEXTCAT=YES
5235    AC_CHECK_HEADER(libtextcat/textcat.h, [],
5236       [ AC_MSG_ERROR(libtextcat headers not found.)], [])
5237    AC_CHECK_LIB(textcat, special_textcat_Init, ,
5238        [ AC_MSG_ERROR(libtextcat library not found or not suitable. libtextcat typically needs to be patched)], [])
5239else
5240    AC_MSG_RESULT([internal])
5241    SYSTEM_LIBTEXTCAT=NO
5242    BUILD_TYPE="$BUILD_TYPE LIBTEXTCAT"
5243fi
5244AC_SUBST(SYSTEM_LIBTEXTCAT)
5245
5246AC_MSG_CHECKING([which libtextcat data directory to use])
5247if test -n "$with_system_libtextcat_data" && test "$with_system_libtextcat_data" != "no"; then
5248    if test "$with_system_libtextcat_data" = "yes"; then
5249        SYSTEM_LIBTEXTCAT_DATA=file:///usr/share/libtextcat
5250    else
5251        SYSTEM_LIBTEXTCAT_DATA=file://$with_system_libtextcat_data
5252    fi
5253    AC_MSG_RESULT([$SYSTEM_LIBTEXTCAT_DATA])
5254else
5255    AC_MSG_RESULT([internal])
5256    BUILD_TYPE="$BUILD_TYPE LIBTEXTCATDATA"
5257fi
5258AC_SUBST(SYSTEM_LIBTEXTCAT_DATA)
5259
5260dnl ***************************************
5261dnl testing libc version for Linux...
5262dnl ***************************************
5263if test "$_os" = "Linux"; then
5264   AC_MSG_CHECKING([whether libc is >= 2.1.1])
5265   exec 6>/dev/null # no output
5266   AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
5267   exec 6>&1 # output on again
5268   if test "$HAVE_LIBC"; then
5269      AC_MSG_RESULT([yes])
5270   else
5271      AC_MSG_ERROR([no, upgrade libc])
5272   fi
5273fi
5274
5275if test "$_os" != "WNT"; then
5276  AC_CHECK_FUNCS(getopt, HAVE_GETOPT=YES, [HAVE_GETOPT=NO])
5277  AC_CHECK_FUNCS(readdir_r, HAVE_READDIR_R=YES, [HAVE_READDIR_R=NO])
5278  if test "$HAVE_GETOPT" = "YES" -a "$HAVE_READDIR_R" = "YES"; then
5279    SYSTEM_LIBC=YES
5280  fi
5281else
5282  HAVE_GETOPT=NO
5283  HAVE_READDIR_R=NO
5284  SYSTEM_LIBC=YES
5285fi
5286AC_SUBST(HAVE_GETOPT)
5287AC_SUBST(HAVE_READDIR_R)
5288AC_SUBST(SYSTEM_LIBC)
5289
5290dnl =========================================
5291dnl Check for the Microsoft Platform SDK.
5292dnl =========================================
5293dnl FIXME: I don't know yet if PSDK works with MinGW, keep it until I know better,
5294dnl and add "-a \( "$WITH_MINGWIN" != "yes" \)" then
5295if test \( "$_os" = "WINNT" \) ; then
5296    AC_MSG_CHECKING([for PSDK files])
5297    if test -z "$with_psdk_home"; then
5298        # This first line will detect a February 2003 Microsoft Platform SDK
5299        PSDK_HOME=`$OOWINTOOL --psdk-home`
5300        # But there might be also an April 2005 PSDK, unfortunately MS changed
5301        # the registry entry. (we prefer the old version!?)
5302        if test -z "$PSDK_HOME"; then
5303          PSDK_HOME=`cat /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install\ Dir 2> /dev/null | tr '\000' '\n' | head -n 1`
5304        fi
5305            # normalize if found
5306            if test -n "$PSDK_HOME"; then
5307              PSDK_HOME=`cygpath -d "$PSDK_HOME"`
5308              PSDK_HOME=`cygpath -u "$PSDK_HOME"`
5309           fi
5310    else
5311           PSDK_HOME=`cygpath -u "$with_psdk_home"`
5312    fi
5313        # Remove a possible trailing backslash
5314        PSDK_HOME=`echo $PSDK_HOME | $SED 's/\/$//'`
5315    # Problem with current PSDK (iz 49865)
5316    if test -f "$PSDK_HOME/Lib/libcp.lib"; then
5317        AC_MSG_ERROR([
5318
5319Some modules do not build correctly with MS Platform SDK - April 2005
5320Edition if the library ($PSDK_HOME/Lib/libcp.lib) is found.
5321Remove/rename/backup that file and restart configure. Details about this
5322problem can be found in issue 49856.])
5323    fi
5324# Windows SDK has different headers
5325    if test \( -f "$PSDK_HOME/Include/adoint.h" \) \
5326         -a \( -f "$PSDK_HOME/Include/SqlUcode.h" \) \
5327         -a \( -f "$PSDK_HOME/Include/usp10.h" \); then
5328        HAVE_PSDK_H="yes"
5329    else
5330        HAVE_PSDK_H="no"
5331    fi
5332    if test -f "$PSDK_HOME/lib/unicows.lib"; then
5333        HAVE_PSDK_LIB="yes"
5334    else
5335        HAVE_PSDK_LIB="no"
5336    fi
5337    if test "$HAVE_PSDK_H" = "no" -o "$HAVE_PSDK_LIB" = "no"; then
5338        AC_MSG_ERROR([Some (all?) PSDK files not found, please check if all needed Platform SDKs
5339are installed or use --with-psdk-home .])
5340    fi
5341    if test ! -x "$PSDK_HOME/bin/msiinfo.exe" \
5342         -o ! -x "$PSDK_HOME/bin/msidb.exe" \
5343         -o ! -x "$PSDK_HOME/bin/uuidgen.exe" \
5344         -o ! -x "$PSDK_HOME/bin/msitran.exe" ; then
5345        AC_MSG_ERROR([Some (all) files of the Windows Installer SDK are missing, please install.])
5346    fi
5347    AC_MSG_RESULT([SDK files found ...)])
5348dnl Check if this is the right SDK.
5349    if echo $PSDK_HOME | $GREP "v6.1" >/dev/null 2>/dev/null; then
5350        AC_MSG_RESULT([Found Windows SDK 6.1 ($PSDK_HOME)])
5351        WINDOWS_VISTA_PSDK=TRUE
5352    elif echo $PSDK_HOME | $GREP "v6.0" >/dev/null 2>/dev/null; then
5353        AC_MSG_RESULT([Found Windows SDK 6.0 ($PSDK_HOME)])
5354        WINDOWS_VISTA_PSDK=TRUE
5355    elif echo $PSDK_HOME | $GREP "v7.0" >/dev/null 2>/dev/null; then
5356        AC_MSG_RESULT([Found Windows SDK 7.0 ($PSDK_HOME)])
5357        WINDOWS_VISTA_PSDK=TRUE
5358    else
5359        AC_MSG_RESULT([Found Legacy Windows Platform SDK ($PSDK_HOME)])
5360    fi
5361fi
5362AC_SUBST(PSDK_HOME)
5363AC_SUBST(WINDOWS_VISTA_PSDK)
5364
5365dnl =========================================
5366dnl Check for the Microsoft DirectX SDK.
5367dnl =========================================
5368if test \( "$_os" = "WINNT" \) ; then
5369    AC_MSG_CHECKING([for DirectX SDK files])
5370    if test -z "$with_directx_home"; then
5371        dnl A standard installation of the DirectX SDK sets $DXSDK_DIR
5372        if test -n "$DXSDK_DIR"; then
5373            DIRECTXSDK_HOME=`cygpath -d "$DXSDK_DIR"`
5374            DIRECTXSDK_HOME=`cygpath -u "$DIRECTXSDK_HOME"`
5375        fi
5376        # At this point $DIRECTXSDK_HOME might still be undefined. This will lead to
5377        # the "DirectX SDK files not found" error later
5378    else
5379    DIRECTXSDK_HOME=`cygpath -u "$with_directx_home"`
5380    fi
5381    # Remove a possible trailing backslash
5382    DIRECTXSDK_HOME=`echo $DIRECTXSDK_HOME | $SED 's/\/$//'`
5383
5384    if test -f "$DIRECTXSDK_HOME/Include/ddraw.h" ; then
5385        HAVE_DIRECTDRAW_H="yes"
5386    else
5387        HAVE_DIRECTDRAW_H="no"
5388    fi
5389    if test -f "$DIRECTXSDK_HOME/Include/d3d9.h" ; then
5390        HAVE_DIRECTXSDK_H="yes"
5391    else
5392        HAVE_DIRECTXSDK_H="no"
5393    fi
5394
5395    # MS changed the location of the libraries with dec 2004 directx sdk
5396    if test -d "$DIRECTXSDK_HOME/lib/x86" ; then
5397        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib/x86"
5398    else
5399        DIRECTXSDK_LIB="$DIRECTXSDK_HOME/lib"
5400    fi
5401    if test -f "$DIRECTXSDK_LIB/ddraw.lib" ; then
5402        HAVE_DIRECTDRAW_LIB="yes"
5403    else
5404        HAVE_DIRECTDRAW_LIB="no"
5405    fi
5406    if test -f "$DIRECTXSDK_LIB/d3d9.lib" ; then
5407        HAVE_DIRECTXSDK_LIB="yes"
5408    else
5409        HAVE_DIRECTXSDK_LIB="no"
5410    fi
5411
5412    if test "$HAVE_DIRECTDRAW_H" = "yes" -a "$HAVE_DIRECTDRAW_LIB" = "yes" ; then
5413       ENABLE_DIRECT_DRAW="TRUE"
5414    fi
5415    if test "$HAVE_DIRECTXSDK_H" = "yes" -a "$HAVE_DIRECTXSDK_LIB" = "yes" ; then
5416       HAVE_DIRECTXSDK="yes"
5417    else
5418       HAVE_DIRECTXSDK="no"
5419    fi
5420
5421    if test -n "$ENABLE_DIRECTX"; then
5422        if test "$HAVE_DIRECTDRAW" = "yes" -o "$HAVE_DIRECTXSDK" = "yes" ; then
5423            AC_MSG_RESULT([found])
5424        else
5425            AC_MSG_ERROR([DirectX SDK files not found, please use --with-directx-home or --disable-directx.])
5426        fi
5427    else
5428        DIRECTXSDK_HOME=""
5429        AC_MSG_RESULT([disabled])
5430    fi
5431fi
5432AC_SUBST(ENABLE_DIRECT_DRAW)
5433AC_SUBST(DIRECTXSDK_HOME)
5434AC_SUBST(DIRECTXSDK_LIB)
5435
5436
5437dnl ============================================
5438dnl Check for ATL and MFC
5439dnl ============================================
5440if test \( "$_os" = "WINNT" \) ; then
5441    AC_MSG_CHECKING([for ATL and MFC])
5442    if test "$DISABLE_ATL" = "TRUE"; then
5443        AC_MSG_RESULT([ATL is disabled, nothing to check])
5444    else
5445        AC_MSG_NOTICE([testing ATL/MFC libs and includes])
5446        if test -z "$with_atl_include_dir"; then
5447            ATL_INCLUDE=$COMPATH/atlmfc/include
5448        else
5449            ATL_INCLUDE=`cygpath -u "$with_atl_include_dir"`
5450        fi
5451        if test -z "$with_atl_lib_dir"; then
5452            ATL_LIB=$COMPATH/atlmfc/lib
5453        ATL_LIB_X64=$COMPATH/atlmfc/lib/amd64
5454        else
5455            ATL_LIB=`cygpath -u "$with_atl_lib_dir"`
5456            ATL_LIB_X64=$ATL_LIB/../amd64
5457        fi
5458        if test -z "$with_mfc_include_dir"; then
5459            MFC_INCLUDE=$COMPATH/atlmfc/include
5460        else
5461            MFC_INCLUDE=`cygpath -u "$with_mfc_include_dir"`
5462        fi
5463        if test -z "$with_mfc_lib_dir"; then
5464            MFC_LIB=$COMPATH/atlmfc/lib
5465        else
5466            MFC_LIB=`cygpath -u "$with_mfc_lib_dir"`
5467        fi
5468
5469        ATL_INCLUDE=`echo $ATL_INCLUDE | $SED 's/\/$//'`
5470        ATL_LIB=`echo $ATL_LIB | $SED 's/\/$//'`
5471        ATL_LIB_X64=`echo $ATL_LIB_X64 | $SED 's/\/$//'`
5472        MFC_INCLUDE=`echo $MFC_INCLUDE | $SED 's/\/$//'`
5473        MFC_LIB=`echo $MFC_LIB | $SED 's/\/$//'`
5474
5475        AC_MSG_NOTICE([looking for atlbase.h in "$ATL_INCLUDE"])
5476        if test -f "$ATL_INCLUDE/atlbase.h"; then
5477            HAVE_ATL_H="yes"
5478        else
5479            HAVE_ATL_H="no"
5480        fi
5481        AC_MSG_NOTICE([found atlbase.h in "$ATL_INCLUDE"? "$HAVE_ATL_H"])
5482
5483        AC_MSG_NOTICE([looking for afx.h in "$MFC_INCLUDE"])
5484        if test -f "$MFC_INCLUDE/afx.h"; then
5485            HAVE_MFC_H="yes"
5486        else
5487            HAVE_MFC_H="no"
5488        fi
5489        AC_MSG_NOTICE([found afx.h in "$MFC_INCLUDE"? "$HAVE_MFC_H"])
5490
5491        AC_MSG_NOTICE([looking for atls.lib in "$ATL_LIB"])
5492        if test -f "$ATL_LIB/atls.lib"; then
5493            HAVE_ATL_LIB="yes"
5494            AC_MSG_NOTICE([looking for atlthunk.lib in "$ATL_LIB"])
5495            if test -f "$ATL_LIB/atlthunk.lib"; then
5496                HAVE_ATLTHUNK="YES"
5497            else
5498                HAVE_ATLTHUNK="NO"
5499            fi
5500            AC_MSG_NOTICE([found atlthunk.lib in "$ATL_LIB"? "$HAVE_ATLTHUNK"])
5501        else
5502            HAVE_ATL_LIB="no"
5503        fi
5504        AC_MSG_NOTICE([found atls.lib in "$ATL_LIB"? "$HAVE_ATL_LIB"])
5505
5506        dnl TODO check also MFC libraries, they seem to have different names
5507        dnl mfc42.lib mfc90.lib
5508        if test -d "$MFC_LIB"; then
5509            HAVE_MFC_LIB="yes"
5510        else
5511            HAVE_MFC_LIB="no"
5512        fi
5513
5514        if test "$HAVE_ATL_H" = "no" -o "$HAVE_MFC_H" = "no" -o "$HAVE_ATL_LIB" = "no" -o "$HAVE_MFC_LIB" = "no"; then
5515            ATL_INCLUDE=
5516            ATL_LIB=
5517            ATL_LIB_X64=
5518            MFC_INCLUDE=
5519            MFC_LIB=
5520            HAVE_ATL_LIB=
5521            dnl TODO shouldn't this be an error?
5522            DISABLE_ACTIVEX="TRUE"
5523            DISABLE_ATL="TRUE"
5524            AC_MSG_RESULT([ATL/MFC disabled])
5525        else
5526            ATL_INCLUDE=`cygpath -dm "$ATL_INCLUDE"`
5527            ATL_LIB=`cygpath -dm "$ATL_LIB"`
5528            ATL_LIB_X64=`cygpath -dm "$ATL_LIB_X64"`
5529            MFC_INCLUDE=`cygpath -dm "$MFC_INCLUDE"`
5530            MFC_LIB=`cygpath -dm "$MFC_LIB"`
5531            AC_MSG_RESULT([ATL/MFC enabled])
5532        fi
5533    fi
5534fi
5535AC_SUBST(ATL_INCLUDE)
5536AC_SUBST(ATL_LIB)
5537AC_SUBST(ATL_LIB_X64)
5538AC_SUBST(HAVE_ATLTHUNK)
5539AC_SUBST(MFC_INCLUDE)
5540AC_SUBST(MFC_LIB)
5541
5542
5543dnl ============================================
5544dnl Check for Nullsoft Scriptable Install System
5545dnl ============================================
5546NSIS_PATH=""
5547if test "$_os" = "WINNT" ; then
5548    AC_MSG_CHECKING([for NSIS])
5549    AC_PATH_PROG(NSIS_PATH, nsis.exe)
5550    if test -n "$NSIS_PATH"; then
5551        NSIS_PATH=`dirname "$NSIS_PATH"`
5552    fi
5553    if test -n "$with_nsis_path"; then
5554        with_nsis_path=`cygpath -u "$with_nsis_path"`
5555    fi
5556    if test -e "$with_nsis_path/nsis.exe"; then
5557        NSIS_PATH="$with_nsis_path"
5558    fi
5559    nsistest=`$OOWINTOOL --nsis-dir`;
5560    if test -x "$nsistest/nsis.exe"; then
5561        NSIS_PATH="$nsistest"
5562    fi
5563    if test -z "$NSIS_PATH"; then
5564        AC_MSG_WARN([NSIS not found, no self contained installer will be build.])
5565        echo "NSIS not found, no self contained installer will be build." >> warn
5566    else
5567        NSIS_PATH=`cygpath -d "$NSIS_PATH"`
5568        NSIS_PATH=`cygpath -u "$NSIS_PATH"`
5569        AC_MSG_RESULT([found ($NSIS_PATH)])
5570        AC_MSG_CHECKING([whether NSIS version is >= 3.*])
5571        nsis_version_string=`"$NSIS_PATH/makensis.exe" /VERSION | $SED -e s/^v//i`
5572        nsis_version_major=`echo $nsis_version_string | cut -d. -f1`
5573        nsis_version_minor=`echo $nsis_version_string | cut -d. -f2`
5574        if test "$nsis_version_major" -ge "3"; then
5575            AC_MSG_RESULT([found NSIS $nsis_version_major.$nsis_version_minor >= 3.*])
5576            AC_MSG_CHECKING([whether NSIS was compiled with Unicode support])
5577            if echo `"$NSIS_PATH/makensis.exe" /HDRINFO` | $EGREP  "\bNSIS_UNICODE_MAKENSIS\b" 2>&1 >/dev/null; then
5578                AC_MSG_RESULT([NSIS version compiled with Unicode support.])
5579            else
5580                NSIS_PATH=""
5581                AC_MSG_WARN([NSIS version compiled without Unicode support, no self contained installer will be build.])
5582            fi
5583        else
5584            NSIS_PATH=""
5585            AC_MSG_WARN([NSIS version found is < 3.*, no self contained installer will be build.])
5586        fi
5587    fi
5588fi
5589AC_SUBST(NSIS_PATH)
5590
5591dnl ***************************************
5592dnl testing bison and flex exist
5593dnl ***************************************
5594AC_PATH_PROG(BISON, bison)
5595if test -z "$BISON"; then
5596   AC_MSG_ERROR([no bison found in \$PATH, install bison])
5597else
5598   AC_MSG_CHECKING([the bison version])
5599   _bison_version=`$BISON --version | $GREP GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`;
5600    _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
5601    # Accept newer than 1.875 or older(equal) than 1.75
5602    if test "$_bison_longver" -ge 1875 -o "$_bison_longver" -le 1075; then
5603       if test "$_bison_version" = "1.875" ; then
5604          AC_MSG_WARN([suspect ($BISON $_bison_version)])
5605          echo "Suspect ($BISON $_bison_version) suggest upgrade" >> warn
5606       else
5607          AC_MSG_RESULT([checked ($BISON $_bison_version)])
5608       fi
5609    else
5610       AC_MSG_ERROR([failed ($BISON $_bison_version need 1.875+ (or 1.75 and older))])
5611    fi
5612fi
5613AC_PATH_PROG(FLEX, flex)
5614if test -z "$FLEX"; then
5615   AC_MSG_ERROR([no flex found in \$PATH, install flex])
5616fi
5617dnl ***************************************
5618dnl testing that patch exists
5619dnl ***************************************
5620AC_PATH_PROG(PATCH, patch)
5621if test -z "$PATCH"; then
5622   AC_MSG_ERROR([\"patch\" not found in \$PATH, install the development tool named\"patch"\])
5623fi
5624
5625dnl On Solaris, FreeBSD or MacOS X, check if --with-gnu-patch was used
5626if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
5627   if test -z "$with_gnu_patch"; then
5628      GNUPATCH=$PATCH
5629   else
5630      if test -x "$with_gnu_patch"; then
5631          GNUPATCH=$with_gnu_patch
5632      else
5633         AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
5634      fi
5635   fi
5636
5637   AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
5638   if $GNUPATCH --version | $GREP "Free Software Foundation" >/dev/null 2>/dev/null; then
5639       AC_MSG_RESULT([yes])
5640   else
5641      AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
5642   fi
5643fi
5644
5645dnl We also need to check for --with-gnu-cp
5646
5647if test -z "$with_gnu_cp"; then
5648   # check the place where the GNU stuff is hidden on Solaris...
5649   if test -x /usr/gnu/bin/cp; then
5650      GNUCP=/usr/gnu/bin/cp
5651   else
5652      AC_PATH_PROGS(GNUCP, gnucp cp)
5653   fi
5654   if test -z $GNUCP; then
5655      AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
5656   fi
5657else
5658   if test -x "$with_gnu_cp"; then
5659      GNUCP=$with_gnu_cp
5660   else
5661      AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
5662   fi
5663fi
5664
5665AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
5666if $GNUCP --version 2>/dev/null | $GREP "coreutils" >/dev/null 2>/dev/null; then
5667   AC_MSG_RESULT([yes])
5668else
5669   AC_MSG_RESULT([no])
5670   GNUCP=''
5671fi
5672
5673if test -z "$GNUCP"; then
5674   if test "$_os" = "SunOS"; then
5675      AC_MSG_ERROR([no, GNU cp from coreutils is needed. install or specify with --with-gnu-cp=/path/to/it])
5676   else
5677      AC_MSG_RESULT([no GNU cp from coreutils found - using the system's cp command])
5678   fi
5679fi
5680
5681AC_SUBST(GNUPATCH)
5682AC_SUBST(GNUCP)
5683
5684dnl ***************************************
5685dnl testing bash tools path on Windows
5686dnl ***************************************
5687if test "$_os" = "WINNT"; then
5688    CYGWIN_PATH=""
5689    AC_PATH_PROG(CYGWIN_PATH, bash)
5690    CYGWIN_PATH=`dirname "$CYGWIN_PATH"`
5691fi
5692if test -z "$CYGWIN_PATH"; then
5693   CYGWIN_PATH="NO_CYGWIN"
5694fi
5695AC_SUBST(CYGWIN_PATH)
5696
5697dnl ***************************************
5698dnl testing ml.exe assembler path
5699dnl ***************************************
5700if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5701  AC_MSG_CHECKING([ml.exe assembler path])
5702  if test -n "$with_asm_home"; then
5703    with_asm_home=`cygpath -u "$with_asm_home"`
5704  fi
5705  if test ! -x "$with_asm_home/ml.exe"; then
5706    AC_PATH_PROG(ML_EXE, ml.exe)
5707    if test -z "$ML_EXE"; then
5708      if test -x "$with_cl_home/bin/ml.exe"; then
5709        with_asm_home=$with_cl_home/bin
5710        AC_MSG_RESULT([found ($with_asm_home)])
5711      else
5712        AC_MSG_ERROR([Configure did not find ml.exe assembler.])
5713      fi
5714    else
5715       with_asm_home="ASM_IN_PATH"
5716    fi
5717  fi
5718  AC_MSG_RESULT([$ASM_HOME])
5719else
5720  with_asm_home="NO_ASM_HOME"
5721fi
5722ASM_HOME="$with_asm_home"
5723AC_SUBST(ASM_HOME)
5724
5725dnl ***************************************
5726dnl testing nasm.exe assembler path
5727dnl ***************************************
5728if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes" -a "$SYSTEM_OPENSSL" = "NO"; then
5729  AC_MSG_CHECKING([nasm.exe assembler path])
5730  if test -n "$with_nasm_home"; then
5731    with_nasm_home=`cygpath -u "$with_nasm_home"`
5732  fi
5733  if test ! -x "$with_nasm_home/nasm.exe"; then
5734    AC_PATH_PROG(NASM_EXE, nasm.exe)
5735    if test -z "$NASM_EXE"; then
5736      with_nasm_home="NO_NASM_HOME"
5737      AC_MSG_ERROR([NASM is required to build on Windows, please install or use --with-nasm-home],,)
5738    else
5739      with_nasm_home="NASM_IN_PATH"
5740    fi
5741  fi
5742  AC_MSG_RESULT([$NASM_HOME])
5743else
5744  with_nasm_home="NO_NASM_HOME"
5745fi
5746NASM_HOME="$with_nasm_home"
5747AC_SUBST(NASM_HOME)
5748
5749dnl ===================================================================
5750dnl testing handle deprecated unzip switch
5751dnl ===================================================================
5752if test -z "$with_zip_home"; then
5753    with_zip_home="$with_unzip_home"
5754fi
5755dnl ===================================================================
5756dnl Zip will be found where you tell me to find it
5757dnl ===================================================================
5758if test -n "$with_zip_home" ; then
5759    if test "$_os" = "WINNT"; then
5760        with_zip_home=`cygpath -u "$with_zip_home"`
5761    fi
5762    ZIP="$with_zip_home/zip"
5763    UNZIP="$with_zip_home/unzip"
5764    ZIP_HOME="$with_zip_home"
5765else
5766    AC_PATH_PROG(ZIP, zip)
5767    AC_PATH_PROG(UNZIP, unzip)
5768    ZIP_HOME=`dirname "$ZIP"`
5769fi
5770dnl ===================================================================
5771dnl Zip must be available or else it is an error, all platforms
5772dnl ===================================================================
5773if test -z "$ZIP" -o -z "$UNZIP"; then
5774    AC_MSG_ERROR([Zip/Unzip are required to build, please install or use --with-zip-home],,)
5775fi
5776if "$ZIP" -FS < /dev/null 2>&1 | $EGREP "no such option: S" > /dev/null; then
5777    AC_MSG_ERROR([Zip version 3.0 or newer is required to build, please install or use --with-zip-home],,)
5778fi
5779
5780dnl ===================================================================
5781dnl Zip must be a specific type for different build types.
5782dnl ===================================================================
5783if test "$_os" = "WINNT"; then
5784    if test -n "`$ZIP -h | $GREP -i WinNT`" ; then
5785AC_MSG_ERROR([$ZIP found in the path is not the required cygwin version of Info-ZIPs zip.exe.])
5786    fi
5787fi
5788AC_SUBST(ZIP_HOME)
5789
5790dnl ===================================================================
5791dnl Windows builds need dbghelp.dll in external/dbghelp/
5792dnl ===================================================================
5793if test "$_os" = "WINNT"; then
5794   AC_MSG_CHECKING([for dbghelp.dll])
5795   if test -x ./external/dbghelp/dbghelp.dll; then
5796      AC_MSG_RESULT([found and executable])
5797   else
5798      AC_MSG_ERROR([dbghelp.dll is missing in external/dbghelp/.
5799Get it from the Microsoft site and put it into external/dbghelp.
5800(Note: Microsoft seems to enjoy changing the exact location of this file. You
5801may have to search Microsoft's website.) Last time it was seen at:
5802<https://www.microsoft.com/downloads/release.asp?releaseid=30682>.])
5803   fi
5804fi
5805
5806dnl ===================================================================
5807dnl Windows builds need vcredist_x*.exe in external/vcredist/
5808dnl ===================================================================
5809WITH_VC_REDIST=""
5810
5811if test "$_os" = "WINNT"; then
5812   AC_MSG_CHECKING([for vcredist_x86.exe])
5813   if test -x ./external/vcredist/vcredist_x86.exe; then
5814      AC_MSG_RESULT([found and executable])
5815   else
5816      AC_MSG_ERROR([ vcredist_x86.exe is missing in external/vcredist/.
5817Get it from the Microsoft site and put it into external/vcredist. You can try
5818to download it from https://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
5819   fi
5820   AC_MSG_CHECKING([for vcredist_x64.exe])
5821   if test -x ./external/vcredist/vcredist_x64.exe; then
5822      AC_MSG_RESULT([found and executable])
5823   else
5824      AC_MSG_ERROR([ vcredist_x64.exe is missing in external/vcredist/.
5825Get it from the Microsoft site and put it into external/vcredist. You can try
5826to download it from https://www.microsoft.com/download/en/search.aspx?q=redistributable%20package.])
5827   fi
5828   WITH_VC_REDIST=YES
5829   AC_SUBST(WITH_VC_REDIST)
5830fi
5831
5832dnl ===================================================================
5833dnl Windows builds - use oowintool to copy CRT dlls and manifest
5834dnl ===================================================================
5835if test "$_os" = "WINNT" -a "$WITH_MINGWIN" != "yes"; then
5836       if $OOWINTOOL --msvc-copy-dlls ./external/msvcp ; then
5837          :
5838       else
5839          AC_MSG_ERROR([oowintool failed to copy CRT])
5840       fi
5841fi
5842
5843dnl ===================================================================
5844dnl Windows builds need gdiplus.dll in external/gdiplus/
5845dnl ===================================================================
5846if test "$_os" = "WINNT"; then
5847   AC_MSG_CHECKING([for gdiplus.dll])
5848   if test -x ./external/gdiplus/gdiplus.dll; then
5849      AC_MSG_RESULT([found and executable])
5850   else
5851      AC_MSG_ERROR([gdiplus.dll is missing in external/gdiplus/.
5852Get it from the Microsoft site and put it into external/gdiplus.
5853You may have to search Microsoft's website. Last time it was seen at:
5854<https://www.microsoft.com/downloads/details.aspx?familyid=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en>.])
5855   fi
5856fi
5857
5858dnl ===================================================================
5859dnl Windows builds need msvcr100.dll in external/msvcp100/
5860dnl ===================================================================
5861if test "$_os" = "WINNT"; then
5862   AC_MSG_CHECKING([for msvcr100.dll])
5863   if test -x ./external/msvcp100/msvcr100.dll; then
5864      AC_MSG_RESULT([found and executable])
5865   else
5866      AC_MSG_ERROR([msvcr100.dll is missing in external/msvcp100/.
5867Get it from the Microsoft Visual C++ 2010 Redistributable Package (x86),
5868from the Microsoft site and put it into external/msvcp100.
5869You may have to search Microsoft's website. Last time it was seen at:
5870<https://www.microsoft.com/en-us/download/search.aspx?q=Microsoft+Visual+C%2b%2b+2010+Redistributable>.])
5871   fi
5872fi
5873
5874dnl ===================================================================
5875dnl Test which vclplugs have to be built.
5876dnl ===================================================================
5877AC_MSG_CHECKING([which VCLplugs shall be built])
5878ENABLE_GTK=""
5879if test "x$enable_gtk" = "xyes"; then
5880    ENABLE_GTK="TRUE"
5881    R="gtk"
5882fi
5883AC_SUBST(ENABLE_GTK)
5884
5885ENABLE_KDE=""
5886if test "x$enable_kde" = "xyes"; then
5887    ENABLE_KDE="TRUE"
5888    R="$R kde"
5889fi
5890AC_SUBST(ENABLE_KDE)
5891
5892ENABLE_KDE4=""
5893if test "x$enable_kde4" = "xyes"; then
5894    ENABLE_KDE4="TRUE"
5895    R="$R kde4"
5896fi
5897AC_SUBST(ENABLE_KDE4)
5898
5899if test -z "$R"; then
5900    AC_MSG_RESULT([none])
5901else
5902    AC_MSG_RESULT([$R])
5903fi
5904
5905dnl ===================================================================
5906dnl GCONF check
5907dnl ===================================================================
5908
5909ENABLE_GCONF=""
5910AC_MSG_CHECKING([whether to enable GConf support])
5911if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$_os" != "OS2" -a "$enable_gconf" = "yes"; then
5912    ENABLE_GCONF="TRUE"
5913    AC_MSG_RESULT([yes])
5914    PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5915else
5916    AC_MSG_RESULT([no])
5917fi
5918AC_SUBST(ENABLE_GCONF)
5919
5920dnl ===================================================================
5921dnl Gnome VFS check
5922dnl ===================================================================
5923
5924ENABLE_GNOMEVFS=""
5925AC_MSG_CHECKING([whether to enable GNOME VFS support])
5926if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gnome_vfs" = "yes"; then
5927    ENABLE_GNOMEVFS="TRUE"
5928    AC_MSG_RESULT([yes])
5929    PKG_CHECK_MODULES( GNOMEVFS, gnome-vfs-2.0 >= 2.6.0 )
5930    if test "$ENABLE_GCONF" != "TRUE"; then
5931        PKG_CHECK_MODULES( GCONF, gconf-2.0 )
5932    fi
5933else
5934    AC_MSG_RESULT([no])
5935fi
5936AC_SUBST(ENABLE_GNOMEVFS)
5937
5938dnl ===================================================================
5939dnl Check whether the gtk 2.0 libraries are available.
5940dnl ===================================================================
5941
5942GTK_CFLAGS=""
5943GTK_LIBS=""
5944ENABLE_SYSTRAY_GTK=""
5945ENABLE_DBUS=""
5946if test  "$test_gtk" = "yes"; then
5947
5948   if test "$ENABLE_GTK" = "TRUE" ; then
5949      PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gdk-pixbuf-xlib-2.0 >= 2.2 ,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages]))
5950      PKG_CHECK_MODULES(GTHREAD, gthread-2.0,,AC_MSG_ERROR([requirements to build the gtk-plugin not met. Use --disable-gtk or install the missing packages]))
5951      BUILD_TYPE="$BUILD_TYPE GTK"
5952
5953      if test "x$enable_systray" = "xyes"; then
5954         PKG_CHECK_MODULES(GTK_2_10,gtk+-2.0 >= 2.10.0,
5955                           [ENABLE_SYSTRAY_GTK="TRUE"
5956                            BUILD_TYPE="$BUILD_TYPE SYSTRAY_GTK"],
5957                           [ENABLE_SYSTRAY_GTK=""])
5958      fi
5959
5960      AC_MSG_CHECKING([whether to enable DBUS support])
5961      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_dbus" = "yes"; then
5962          ENABLE_DBUS="TRUE"
5963          AC_MSG_RESULT([yes])
5964          PKG_CHECK_MODULES( DBUS, dbus-glib-1 >= 0.70 )
5965      else
5966          AC_MSG_RESULT([no])
5967      fi
5968
5969      AC_MSG_CHECKING([whether to enable GIO support])
5970      if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
5971          if test "$ENABLE_GNOMEVFS" = "TRUE" ; then
5972             AC_MSG_ERROR([please use --enable-gio only together with --disable-gnome-vfs.])
5973          fi
5974          ENABLE_GIO="TRUE"
5975          AC_MSG_RESULT([yes])
5976          PKG_CHECK_MODULES( GIO, gio-2.0 )
5977      else
5978          AC_MSG_RESULT([no])
5979      fi
5980
5981   fi
5982
5983fi
5984AC_SUBST(ENABLE_GIO)
5985AC_SUBST(ENABLE_DBUS)
5986AC_SUBST(ENABLE_SYSTRAY_GTK)
5987AC_SUBST(GTK_CFLAGS)
5988AC_SUBST(GTK_LIBS)
5989AC_SUBST(GTHREAD_CFLAGS)
5990AC_SUBST(GTHREAD_LIBS)
5991
5992dnl ===================================================================
5993dnl Check whether the GStreamer libraries are available.
5994dnl ===================================================================
5995
5996GSTREAMER_CFLAGS=""
5997GSTREAMER_LIBS=""
5998ENABLE_GSTREAMER=""
5999
6000if test "$test_gstreamer" = "yes"; then
6001    AC_MSG_CHECKING([whether to build the GStreamer media backend])
6002    if test "x$enable_gstreamer" != "xno" ; then
6003        PKG_CHECK_MODULES( GSTREAMER, gtk+-2.0 >= 2.4 gthread-2.0 gstreamer-1.0 gstreamer-video-1.0,,AC_MSG_ERROR([requirements to build the GStreamer media backend not met. Do not use --enable-gstreamer or install the missing packages]))
6004        ENABLE_GSTREAMER="TRUE"
6005        AC_MSG_RESULT([yes])
6006    else
6007        AC_MSG_RESULT([no])
6008    fi
6009fi
6010AC_SUBST(ENABLE_GSTREAMER)
6011AC_SUBST(GSTREAMER_CFLAGS)
6012AC_SUBST(GSTREAMER_LIBS)
6013
6014dnl ===================================================================
6015dnl Check the ARM target
6016dnl ===================================================================
6017
6018if echo "$build_cpu" | $GREP -q arm; then
6019    # default value
6020    ARM_TARGET=ARMV4T
6021    AC_MSG_CHECKING([which ARM processor optimization to use])
6022    if test "$with_arm_target" -lt "6"; then
6023    ARM_TARGET=ARMV4T
6024    elif test "$with_arm_target" = "6"; then
6025    ARM_TARGET=ARMV6
6026    elif test "$with_arm_target" -gt "6"; then
6027    ARM_TARGET=ARMV7
6028    fi
6029    AC_MSG_RESULT([$ARM_TARGET])
6030    AC_SUBST(ARM_TARGET)
6031fi
6032
6033dnl ===================================================================
6034dnl Check whether the Cairo libraries are available.
6035dnl ===================================================================
6036
6037ENABLE_CAIRO=""
6038BUILD_PIXMAN=""
6039SYSTEM_CAIRO=""
6040
6041if test  "$test_cairo" = "yes"; then
6042
6043    AC_MSG_CHECKING([whether to use cairo])
6044    if test "x$enable_cairo" != "xno" ; then
6045        ENABLE_CAIRO="TRUE"
6046    AC_MSG_RESULT([yes])
6047        AC_MSG_CHECKING([which cairo to use])
6048        if test -n "$with_system_cairo" -o -n "$with_system_libs" && \
6049           test "$with_system_cairo" != "no"; then
6050           AC_MSG_RESULT([external])
6051           SYSTEM_CAIRO=YES
6052
6053           PKG_CHECK_MODULES( CAIRO, cairo >= 1.0.2 )
6054       if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$ENABLE_FONTCONFIG" != "TRUE" ; then
6055          AC_MSG_ERROR([Cairo library requires fontconfig.])
6056       fi
6057           if test "$with_system_xrender_headers" = "yes"; then
6058              AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
6059              AC_RUN_IFELSE([AC_LANG_SOURCE([[
6060#include <X11/extensions/Xrender.h>
6061
6062int main(int argc, char **argv) {
6063#ifdef PictStandardA8
6064      return 0;
6065#else
6066      return 1;
6067#endif
6068}
6069               ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])],[])
6070           fi
6071        else
6072           BUILD_TYPE="$BUILD_TYPE CAIRO"
6073       dnl === compiler fails on pixman with 64bit architectures...===
6074       if test "$build_cpu" != "x86_64"; then
6075          BUILD_PIXMAN=YES
6076       fi
6077           AC_MSG_RESULT([internal])
6078        fi
6079    else
6080       AC_MSG_RESULT([no])
6081    fi
6082fi
6083
6084AC_SUBST(ENABLE_CAIRO)
6085AC_SUBST(BUILD_PIXMAN)
6086AC_SUBST(SYSTEM_CAIRO)
6087AC_SUBST(CAIRO_CFLAGS)
6088AC_SUBST(CAIRO_LIBS)
6089
6090ENABLE_CAIRO_CANVAS="FALSE"
6091if test "$enable_cairo_canvas" = "yes" -a "$ENABLE_CAIRO" = "TRUE" ; then
6092   ENABLE_CAIRO_CANVAS="TRUE"
6093fi
6094AC_SUBST(ENABLE_CAIRO_CANVAS)
6095
6096dnl ===================================================================
6097dnl Check whether the OpenGL libraries are available
6098dnl ===================================================================
6099
6100AC_MSG_CHECKING([whether to build the OpenGL Transitions component])
6101ENABLE_OPENGL=
6102
6103if test "x$enable_opengl" != "xno" ; then
6104   AC_MSG_RESULT([yes])
6105   AC_CHECK_HEADER(GL/gl.h, [],
6106                   [AC_MSG_ERROR([OpenGL headers not found])], [])
6107   AC_CHECK_LIB(GL, main, [],
6108     [AC_MSG_ERROR(libGL not installed or functional)], [])
6109   AC_CHECK_LIB(GLU, main, [],
6110     [AC_MSG_ERROR(libGLU not installed or functional)], [])
6111   ENABLE_OPENGL=TRUE
6112else
6113   AC_MSG_RESULT([no])
6114fi
6115
6116AC_SUBST(ENABLE_OPENGL)
6117
6118
6119AC_MSG_CHECKING([whether to build the PDF Import extension])
6120if test -n "$enable_pdfimport" -a "$enable_pdfimport" != "no"; then
6121  AC_MSG_RESULT([yes])
6122  ENABLE_PDFIMPORT=YES
6123
6124  dnl ===================================================================
6125  dnl Check for system poppler
6126  dnl ===================================================================
6127  AC_MSG_CHECKING([whether to use system pdf backend])
6128  if test -n "$with_system_poppler" -o -n "$with_system_libs" && \
6129       test "$with_system_poppler" != "no"; then
6130      AC_MSG_RESULT([external])
6131      SYSTEM_POPPLER=YES
6132      PKG_CHECK_MODULES( POPPLER, poppler >= 0.8.0 )
6133  else
6134      AC_MSG_RESULT([no])
6135      SYSTEM_POPPLER=NO
6136      ENABLE_PDFIMPORT=NO
6137  fi
6138else
6139   AC_MSG_RESULT([no])
6140   ENABLE_PDFIMPORT=NO
6141fi
6142AC_SUBST(ENABLE_PDFIMPORT)
6143AC_SUBST(SYSTEM_POPPLER)
6144AC_SUBST(POPPLER_CFLAGS)
6145AC_SUBST(POPPLER_LIBS)
6146
6147AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
6148if test -n "$enable_wiki_publisher" -a "$enable_wiki_publisher" != "no" && test "$WITH_JAVA" != "no"; then
6149  AC_MSG_RESULT([yes])
6150  AC_MSG_CHECKING([for swext module])
6151  if test -d ./swext; then
6152   AC_MSG_RESULT([OK])
6153  else
6154   AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6155  fi
6156  ENABLE_MEDIAWIKI=YES
6157  BUILD_TYPE="$BUILD_TYPE SWEXT"
6158else
6159  AC_MSG_RESULT([no])
6160  ENABLE_MEDIAWIKI=NO
6161fi
6162AC_SUBST(ENABLE_MEDIAWIKI)
6163
6164if test "$ENABLE_MEDIAWIKI" = "YES"; then
6165  AC_MSG_CHECKING([which Servlet API Jar to use])
6166  if test -n "$with_system_servlet_api"; then
6167    AC_MSG_RESULT([external])
6168    SYSTEM_SERVLETAPI=YES
6169      if test -z "$SERVLETAPI_JAR"; then
6170    SERVLETAPI_JAR=/usr/share/java/servlet-api.jar
6171      fi
6172      AC_CHECK_FILE($SERVLETAPI_JAR, [],
6173             [AC_MSG_ERROR(servlet-api.jar not found.)], [])
6174  else
6175    AC_MSG_RESULT([internal])
6176    SYSTEM_SERVLETAPI=NO
6177    BUILD_TYPE="$BUILD_TYPE TOMCAT"
6178  fi
6179fi
6180AC_SUBST(SYSTEM_SERVLETAPI)
6181AC_SUBST(SERVLETAPI_JAR)
6182
6183AC_MSG_CHECKING([whether to build the Report Builder extension])
6184if test -n "$enable_report_builder" -a "$enable_report_builder" != "no" && test "$WITH_JAVA" != "no"; then
6185  AC_MSG_RESULT([yes])
6186  ENABLE_REPORTBUILDER=YES
6187  SYSTEM_JFREEREPORT=YES
6188  AC_MSG_CHECKING([for reportbuilder module])
6189  if test -d ./reportbuilder; then
6190    AC_MSG_RESULT([OK])
6191  else
6192    AC_MSG_ERROR([not existing. get it (did you get the -extensions tarball?)])
6193  fi
6194  AC_MSG_CHECKING([which jfreereport libs to use (for Report Builder extension)])
6195  AC_MSG_RESULT([external])
6196  if test -z $SAC_JAR; then
6197         SAC_JAR=/usr/share/java/sac.jar
6198  fi
6199  AC_CHECK_FILE($SAC_JAR, [],
6200         [AC_MSG_ERROR(sac.jar not found.)], [])
6201
6202  if test -z $LIBXML_JAR; then
6203    AC_CHECK_FILE(/usr/share/java/libxml-1.0.0.jar,
6204      [ LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar ],
6205      [
6206        AC_CHECK_FILE(/usr/share/java/libxml.jar,
6207          [ LIBXML_JAR=/usr/share/java/libxml.jar ],
6208          [AC_MSG_ERROR(libxml.jar replacement not found.)]
6209        )
6210      ]
6211    )
6212  else
6213    AC_CHECK_FILE($LIBXML_JAR, [],
6214         [AC_MSG_ERROR(libxml.jar not found.)], [])
6215  fi
6216
6217  if test -z $FLUTE_JAR; then
6218    AC_CHECK_FILE(/usr/share/java/flute-1.3.0.jar,
6219      [ FLUTE_JAR=/usr/share/java/flute-1.3.0.jar ],
6220      [
6221        AC_CHECK_FILE(/usr/share/java/flute.jar,
6222          [ FLUTE_JAR=/usr/share/java/flute.jar ],
6223          [ AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)]
6224        )
6225      ]
6226    )
6227  else
6228    AC_CHECK_FILE($FLUTE_JAR, [],
6229         [AC_MSG_ERROR(flute-1.3.0.jar not found.)], [])
6230  fi
6231
6232  if test -z $JFREEREPORT_JAR; then
6233    AC_CHECK_FILE(/usr/share/java/flow-engine-0.9.2.jar,
6234      [ JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar ],
6235      [
6236        AC_CHECK_FILE(/usr/share/java/flow-engine.jar,
6237          [ JFREEREPORT_JAR=/usr/share/java/flow-engine.jar ],
6238          [AC_MSG_ERROR(jfreereport.jar replacement not found.)]
6239        )
6240      ]
6241    )
6242  else
6243    AC_CHECK_FILE($JFREEREPORT_JAR, [],
6244         [AC_MSG_ERROR(jfreereport.jar not found.)], [])
6245  fi
6246
6247  if test -z $LIBLAYOUT_JAR; then
6248    AC_CHECK_FILE(/usr/share/java/liblayout-0.2.9.jar,
6249      [ LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar ],
6250      [
6251        AC_CHECK_FILE(/usr/share/java/liblayout.jar,
6252          [ LIBLAYOUT_JAR=/usr/share/java/liblayout.jar ],
6253          [AC_MSG_ERROR(liblayout.jar replacement not found.)]
6254        )
6255      ]
6256    )
6257  else
6258    AC_CHECK_FILE($LIBLAYOUT_JAR, [],
6259         [AC_MSG_ERROR(liblayout.jar not found.)], [])
6260  fi
6261
6262  if test -z $LIBLOADER_JAR; then
6263    AC_CHECK_FILE(/usr/share/java/libloader-1.0.0.jar,
6264      [ LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar ],
6265      [
6266        AC_CHECK_FILE(/usr/share/java/libloader.jar,
6267          [ LIBLOADER_JAR=/usr/share/java/libloader.jar ],
6268          [AC_MSG_ERROR(libloader.jar replacement not found.)]
6269        )
6270      ]
6271    )
6272  else
6273    AC_CHECK_FILE($LIBLOADER_JAR, [],
6274         [AC_MSG_ERROR(libloader.jar not found.)], [])
6275  fi
6276
6277  if test -z $LIBFORMULA_JAR; then
6278    AC_CHECK_FILE(/usr/share/java/libformula-0.2.0.jar,
6279      [ LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar ],
6280      [
6281        AC_CHECK_FILE(/usr/share/java/libformula.jar,
6282          [ LIBFORMULA_JAR=/usr/share/java/libformula.jar ],
6283          [AC_MSG_ERROR(libformula.jar replacement not found.)]
6284        )
6285      ]
6286    )
6287  else
6288    AC_CHECK_FILE($LIBFORMULA_JAR, [],
6289         [AC_MSG_ERROR(libformula.jar not found.)], [])
6290  fi
6291
6292  if test -z $LIBREPOSITORY_JAR; then
6293    AC_CHECK_FILE(/usr/share/java/librepository-1.0.0.jar,
6294      [ LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar ],
6295      [
6296        AC_CHECK_FILE(/usr/share/java/librepository.jar,
6297          [ LIBREPOSITORY_JAR=/usr/share/java/librepository.jar ],
6298          [AC_MSG_ERROR(librepository.jar replacement not found.)]
6299        )
6300      ]
6301    )
6302  else
6303    AC_CHECK_FILE($LIBREPOSITORY_JAR, [],
6304         [AC_MSG_ERROR(librepository.jar not found.)], [])
6305  fi
6306
6307  if test -z $LIBFONTS_JAR; then
6308    AC_CHECK_FILE(/usr/share/java/libfonts-1.0.0.jar,
6309      [ LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar ],
6310      [
6311        AC_CHECK_FILE(/usr/share/java/libfonts.jar,
6312          [ LIBFONTS_JAR=/usr/share/java/libfonts.jar ],
6313          [AC_MSG_ERROR(libfonts.jar replacement not found.)]
6314        )
6315      ]
6316    )
6317  else
6318    AC_CHECK_FILE($LIBFONTS_JAR, [],
6319         [AC_MSG_ERROR(libfonts.jar not found.)], [])
6320  fi
6321
6322  if test -z $LIBSERIALIZER_JAR; then
6323    AC_CHECK_FILE(/usr/share/java/libserializer-1.0.0.jar,
6324      [ LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar ],
6325      [
6326        AC_CHECK_FILE(/usr/share/java/libserializer.jar,
6327          [ LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar ],
6328          [AC_MSG_ERROR(libserializer.jar replacement not found.)]
6329        )
6330      ]
6331    )
6332  else
6333    AC_CHECK_FILE($LIBSERIALIZER_JAR, [],
6334         [AC_MSG_ERROR(libserializer.jar not found.)], [])
6335  fi
6336
6337
6338  if test -z $LIBBASE_JAR; then
6339    AC_CHECK_FILE(/usr/share/java/libbase-1.0.0.jar,
6340      [ LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar ],
6341      [
6342        AC_CHECK_FILE(/usr/share/java/libbase.jar,
6343          [ LIBBASE_JAR=/usr/share/java/libbase.jar ],
6344          [AC_MSG_ERROR(libbase.jar replacement not found.)]
6345        )
6346      ]
6347    )
6348  else
6349    AC_CHECK_FILE($LIBBASE_JAR, [],
6350         [AC_MSG_ERROR(libbase.jar not found.)], [])
6351  fi
6352  BUILD_TYPE="$BUILD_TYPE REPORTBUILDER"
6353else
6354  AC_MSG_RESULT([no])
6355  ENABLE_REPORTBUILDER=NO
6356fi
6357AC_SUBST(ENABLE_REPORTBUILDER)
6358AC_SUBST(SYSTEM_JFREEREPORT)
6359AC_SUBST(SAC_JAR)
6360AC_SUBST(LIBXML_JAR)
6361AC_SUBST(FLUTE_JAR)
6362AC_SUBST(JFREEREPORT_JAR)
6363AC_SUBST(LIBBASE_JAR)
6364AC_SUBST(LIBLAYOUT_JAR)
6365AC_SUBST(LIBLOADER_JAR)
6366AC_SUBST(LIBFORMULA_JAR)
6367AC_SUBST(LIBREPOSITORY_JAR)
6368AC_SUBST(LIBFONTS_JAR)
6369AC_SUBST(LIBSERIALIZER_JAR)
6370
6371# this has to be here because both the Wiki Publisher and the Report
6372# Builder use commons-logging, while the non-optional PostgreSQL
6373# connector uses commons-lang.
6374AC_MSG_CHECKING([which Apache commons-* libs to use])
6375if test "$with_system_apache_commons" = "yes"; then
6376  SYSTEM_APACHE_COMMONS=YES
6377  AC_MSG_RESULT([external])
6378
6379  if test -z $COMMONS_LANG_JAR; then
6380    AC_CHECK_FILE(/usr/share/java/commons-lang3-3.3.jar,
6381      [ COMMONS_LANG_JAR=/usr/share/java/commons-lang3-3.3.jar ],
6382      [
6383        AC_CHECK_FILE(/usr/share/java/commons-lang.jar,
6384          [ COMMONS_LANG_JAR=/usr/share/java/commons-lang.jar ],
6385          [AC_MSG_ERROR(commons-lang.jar replacement not found.)]
6386        )
6387      ]
6388    )
6389  else
6390    AC_CHECK_FILE($COMMONS_LANG_JAR, [],
6391         [AC_MSG_ERROR(commons-lang.jar not found.)], [])
6392  fi
6393  AC_MSG_CHECKING([whether commons-lang is version 3.x])
6394  export COMMONS_LANG_JAR
6395  if $PERL -e 'use Archive::Zip;
6396      my $file = "$ENV{'COMMONS_LANG_JAR'}";
6397      my $zip = Archive::Zip->new( $file );
6398      my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
6399      if ( $mf =~ m/Specification-Version: 3.*/ ) {
6400          exit 0;
6401      } else {
6402          exit 1;
6403      }'; then
6404      AC_MSG_RESULT([yes])
6405  else
6406      AC_MSG_ERROR([no, you need Apache Commons Lang 3.x])
6407  fi
6408
6409  if test "$ENABLE_MEDIAWIKI" = "YES"; then
6410    if test -z $COMMONS_CODEC_JAR; then
6411      AC_CHECK_FILE(/usr/share/java/commons-codec-1.9.jar,
6412        [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec-1.9.jar ],
6413        [
6414          AC_CHECK_FILE(/usr/share/java/commons-codec.jar,
6415            [ COMMONS_CODEC_JAR=/usr/share/java/commons-codec.jar ],
6416            [AC_MSG_ERROR(commons-codec.jar replacement not found.)]
6417          )
6418        ]
6419      )
6420    else
6421      AC_CHECK_FILE($COMMONS_CODEC_JAR, [],
6422           [AC_MSG_ERROR(commons-codec.jar not found.)], [])
6423    fi
6424
6425    if test -z $COMMONS_HTTPCLIENT_JAR; then
6426      AC_CHECK_FILE(/usr/share/java/commons-httpclient-3.1.jar,
6427        [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient-3.1.jar ],
6428        [
6429          AC_CHECK_FILE(/usr/share/java/commons-httpclient.jar,
6430            [ COMMONS_HTTPCLIENT_JAR=/usr/share/java/commons-httpclient.jar ],
6431            [AC_MSG_ERROR(commons-httpclient.jar replacement not found.)]
6432          )
6433        ]
6434      )
6435    else
6436      AC_CHECK_FILE($COMMONS_HTTPCLIENT_JAR, [],
6437           [AC_MSG_ERROR(commons-httpclient.jar not found.)], [])
6438    fi
6439  fi
6440  if test "$ENABLE_MEDIAWIKI" = "YES" -o "$ENABLE_REPORTBUILDER" = "YES"; then
6441    if test -z $COMMONS_LOGGING_JAR; then
6442      AC_CHECK_FILE(/usr/share/java/commons-logging-1.1.3.jar,
6443        [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-1.1.3.jar ],
6444        [
6445          AC_CHECK_FILE(/usr/share/java/commons-logging.jar,
6446            [ COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar ],
6447            [AC_MSG_ERROR(commons-logging.jar replacement not found.)]
6448          )
6449        ]
6450      )
6451    else
6452      AC_CHECK_FILE($COMMONS_LOGGING_JAR, [],
6453           [AC_MSG_ERROR(commons-logging.jar not found.)], [])
6454    fi
6455  fi
6456else
6457  AC_MSG_RESULT([internal])
6458  SYSTEM_APACHE_COMMONS=NO
6459  BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS TOMCAT"
6460fi
6461AC_SUBST(SYSTEM_APACHE_COMMONS)
6462AC_SUBST(COMMONS_CODEC_JAR)
6463AC_SUBST(COMMONS_LANG_JAR)
6464AC_SUBST(COMMONS_HTTPCLIENT_JAR)
6465AC_SUBST(COMMONS_LOGGING_JAR)
6466
6467dnl ===================================================================
6468dnl Check whether the Qt and KDE libraries are available.
6469dnl ===================================================================
6470
6471KDE_CFLAGS=""
6472KDE_LIBS=""
6473MOC="moc"
6474if test "$test_kde" = "yes" -a "$ENABLE_KDE" = "TRUE" ; then
6475    dnl Search paths for Qt and KDE
6476    if test "$build_cpu" != "x86_64" ; then
6477        qt_incdirs="$QTINC /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/lib/qt3/include /usr/lib/qt/include /usr/share/qt3/include $x_includes"
6478        qt_libdirs="$QTLIB /usr/local/qt/lib /usr/lib/qt /usr/lib /usr/X11R6/lib/X11/qt /usr/X11R6/lib/qt /usr/lib/qt3/lib /usr/lib/qt/lib /usr/share/qt3/lib $x_libraries"
6479    else
6480        qt_incdirs="$QTINC /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/lib64/qt3/include /usr/lib64/qt/include /usr/share/qt3/include /usr/lib/qt3/include /usr/lib/qt/include $x_includes"
6481        qt_libdirs="$QTLIB /usr/local/qt/lib64 /usr/lib64/qt /usr/lib64 /usr/X11R6/lib64/X11/qt /usr/X11R6/lib64/qt /usr/lib64/qt3/lib64 /usr/lib64/qt/lib64 /usr/share/qt3/lib64 /usr/local/qt/lib /usr/lib/qt /usr/lib /usr/X11R6/lib/X11/qt /usr/X11R6/lib/qt /usr/lib/qt3/lib /usr/lib/qt/lib /usr/share/qt3/lib $x_libraries"
6482    fi
6483    if test -n "$QTDIR" ; then
6484        qt_incdirs="$QTDIR/include $qt_incdirs"
6485        if test "$build_cpu" != "x86_64" ; then
6486            qt_libdirs="$QTDIR/lib $qt_libdirs"
6487        else
6488            qt_libdirs="$QTDIR/lib64 $QTDIR/lib $qt_libdirs"
6489        fi
6490    fi
6491    if test "$build_cpu" != "x86_64" ; then
6492        kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /opt/kde3/include /opt/kde/include $x_includes"
6493        kde_libdirs="/usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib/kde3 /usr/X11R6/lib /usr/local/lib /opt/kde3/lib /opt/kde/lib /usr/X11R6/kde/lib /usr/lib $x_libraries"
6494    else
6495        kde_incdirs="/usr/lib64/kde/include /usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /opt/kde3/include /opt/kde/include $x_includes"
6496        kde_libdirs="/usr/lib64/kde/lib64 /usr/local/kde/lib64 /usr/kde/lib64 /usr/lib64/kde /usr/lib64/kde3 /usr/X11R6/lib64 /usr/local/lib64 /opt/kde3/lib64 /opt/kde/lib64 /usr/X11R6/kde/lib64 /usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib/kde3 /usr/lib /usr/X11R6/lib /usr/local/lib /opt/kde3/lib /opt/kde/lib /usr/X11R6/kde/lib /usr/lib64 $x_libraries"
6497    fi
6498    if test -n "$KDEDIR" ; then
6499        kde_incdirs="$KDEDIR/include $kde_incdirs"
6500        if test "$build_cpu" != "x86_64" ; then
6501            kde_libdirs="$KDEDIR/lib $kde_libdirs"
6502        else
6503            kde_libdirs="$KDEDIR/lib64 $KDEDIR/lib $kde_libdirs"
6504        fi
6505    fi
6506
6507    dnl What to test
6508    qt_test_include="qstyle.h"
6509    qt_test_library="libqt-mt.so"
6510    kde_test_include="ksharedptr.h"
6511    kde_test_library="libkdeui.so"
6512
6513    dnl Check for Qt headers
6514    AC_MSG_CHECKING([for Qt headers])
6515    qt_incdir="no"
6516    for kde_check in $qt_incdirs ; do
6517        if test -r "$kde_check/$qt_test_include" ; then
6518            qt_incdir="$kde_check"
6519            break
6520        fi
6521    done
6522    AC_MSG_RESULT([$qt_incdir])
6523    if test "x$qt_incdir" = "xno" ; then
6524        AC_MSG_ERROR([Qt headers not found. Please specify the root of
6525your Qt installation by exporting QTDIR before running "configure".])
6526    fi
6527
6528    dnl Check for Qt libraries
6529    AC_MSG_CHECKING([for Qt libraries])
6530    qt_libdir="no"
6531    for qt_check in $qt_libdirs ; do
6532        if test -r "$qt_check/$qt_test_library" ; then
6533            qt_libdir="$qt_check"
6534            break
6535        fi
6536    done
6537    AC_MSG_RESULT([$qt_libdir])
6538    if test "x$qt_libdir" = "xno" ; then
6539        AC_MSG_ERROR([Qt libraries not found. Please specify the root of
6540your Qt installation by exporting QTDIR before running "configure".])
6541    fi
6542
6543    dnl Check for Meta Object Compiler
6544    AC_PATH_PROG( MOC, moc, no, [$QTDIR/bin:$PATH] )
6545    if test "$MOC" = "no" ; then
6546        AC_MSG_ERROR([Qt Meta Object Compiler not found. Please specify
6547the root of your Qt installation by exporting QTDIR before running "configure".])
6548    fi
6549
6550    dnl Check for KDE headers
6551    AC_MSG_CHECKING([for KDE headers])
6552    kde_incdir="no"
6553    for kde_check in $kde_incdirs ; do
6554        if test -r "$kde_check/$kde_test_include" ; then
6555            kde_incdir="$kde_check"
6556            break
6557        fi
6558    done
6559    AC_MSG_RESULT([$kde_incdir])
6560    if test "x$kde_incdir" = "xno" ; then
6561        AC_MSG_ERROR([KDE headers not found. Please specify the root of
6562your KDE installation by exporting KDEDIR before running "configure".])
6563    fi
6564
6565    dnl Check for KDE libraries
6566    AC_MSG_CHECKING([for KDE libraries])
6567    kde_libdir="no"
6568    for kde_check in $kde_libdirs ; do
6569        if test -r "$kde_check/$kde_test_library" ; then
6570            kde_libdir="$kde_check"
6571            break
6572        fi
6573    done
6574    AC_MSG_RESULT([$kde_libdir])
6575    if test "x$kde_libdir" = "xno" ; then
6576        AC_MSG_ERROR([KDE libraries not found. Please specify the root of
6577your KDE installation by exporting KDEDIR before running "configure".])
6578    fi
6579
6580    dnl Set the variables
6581    KDE_CFLAGS="-I$qt_incdir -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6582    KDE_LIBS="-L$kde_libdir -L$qt_libdir -lkdeui -lkdecore -lqt-mt"
6583fi
6584AC_SUBST(KDE_CFLAGS)
6585AC_SUBST(KDE_LIBS)
6586AC_SUBST(MOC)
6587
6588dnl ===================================================================
6589dnl KDE4 Integration
6590dnl ===================================================================
6591
6592KDE4_CFLAGS=""
6593KDE4_LIBS=""
6594MOC4="moc"
6595if test "$test_kde4" = "yes" -a "$ENABLE_KDE4" = "TRUE" ; then
6596   qt_incdirs="$QT4INC $QT4DIR /usr/include/qt4 /usr/include $x_includes"
6597   qt_libdirs="$QT4LIB /usr/lib $x_libraries"
6598
6599   kde_incdirs="/usr/include /usr/include/kde4 $x_includes"
6600   kde_libdirs="/usr/lib /usr/lib/kde4 /usr/lib/kde4/devel $x_libraries"
6601
6602   if test "$build_cpu" = "x86_64" ; then
6603      qt_libdirs="$qt_libdirs /usr/lib64/qt4 /usr/lib64/qt /usr/lib64"
6604      kde_libdirs="$kde_libdirs /usr/lib64 /usr/lib64/kde4 /usr/lib64/kde4/devel"
6605   fi
6606
6607   if test -n "$KDE4DIR" ; then
6608      kde_incdirs="$KDE4DIR/include $kde_incdirs"
6609      if test "$build_cpu" != "x86_64" ; then
6610         kde_libdirs="$KDE4DIR/lib $kde_libdirs"
6611      else
6612         kde_libdirs="$KDE4DIR/lib64 $KDE4DIR/lib $kde_libdirs"
6613      fi
6614   fi
6615
6616   qt_test_include="Qt/qobject.h"
6617   qt_test_library="libQtCore.so"
6618   kde_test_include="ksharedptr.h"
6619   kde_test_library="libkdeui.so"
6620
6621   AC_MSG_CHECKING([for Qt4 headers])
6622   qt_header_dir="no"
6623   for inc_dir in $qt_incdirs ; do
6624      if test -r "$inc_dir/$qt_test_include" ; then
6625         qt_header_dir="$inc_dir"
6626         break
6627      fi
6628   done
6629
6630   AC_MSG_RESULT([$qt_header_dir])
6631   if test "x$qt_header_dir" = "xno" ; then
6632      AC_MSG_ERROR([Qt4 headers not found. Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6633   fi
6634
6635   AC_MSG_CHECKING([for Qt4 libraries])
6636   qt_lib_dir="no"
6637   for lib_dir in $qt_libdirs ; do
6638      if test -r "$lib_dir/$qt_test_library" ; then
6639         qt_lib_dir="$lib_dir"
6640         break
6641      fi
6642   done
6643
6644   AC_MSG_RESULT([$qt_lib_dir])
6645
6646   if test "x$qt_lib_dir" = "xno" ; then
6647      AC_MSG_ERROR([Qt4 libraries not found. Please specify the root of your Qt4 installation by exporting QT4DIR before running "configure".])
6648   fi
6649
6650   dnl Check for Meta Object Compiler
6651   AC_PATH_PROG( MOCQT4, moc-qt4, no, [$QT4DIR/bin:$PATH] )
6652   MOC4="$MOCQT4"
6653   if test "$MOC4" = "no" ; then
6654      AC_PATH_PROG( MOC4, moc, no, [$PATH:$QT4DIR/bin] )
6655      if test "$MOC4" = "no" ; then
6656         AC_MSG_ERROR([Qt Meta Object Compiler not found. Please specify the root of your Qt installation by exporting QT4DIR before running "configure".])
6657      fi
6658   fi
6659
6660   dnl Check for KDE4 headers
6661   AC_MSG_CHECKING([for KDE4 headers])
6662   kde_incdir="no"
6663   for kde_check in $kde_incdirs ; do
6664      if test -r "$kde_check/$kde_test_include" ; then
6665         kde_incdir="$kde_check"
6666         break
6667      fi
6668   done
6669   AC_MSG_RESULT([$kde_incdir])
6670   if test "x$kde_incdir" = "xno" ; then
6671      AC_MSG_ERROR([KDE4 headers not found. Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6672   fi
6673
6674   dnl Check for KDE4 libraries
6675   AC_MSG_CHECKING([for KDE4 libraries])
6676   kde_libdir="no"
6677   for kde_check in $kde_libdirs ; do
6678      if test -r "$kde_check/$kde_test_library" ; then
6679         kde_libdir="$kde_check"
6680         break
6681      fi
6682   done
6683
6684   AC_MSG_RESULT([$kde_libdir])
6685   if test "x$kde_libdir" = "xno" ; then
6686      AC_MSG_ERROR([KDE4 libraries not found. Please specify the root of your KDE4 installation by exporting KDE4DIR before running "configure".])
6687   fi
6688
6689   KDE4_CFLAGS="`pkg-config --cflags QtCore` `pkg-config --cflags QtGui` -I$kde_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT"
6690   KDE4_LIBS="-L$kde_libdir -L$qt_lib_dir -lkdeui -lkdecore -lQtCore -lQtGui"
6691fi
6692AC_SUBST(KDE4_CFLAGS)
6693AC_SUBST(KDE4_LIBS)
6694AC_SUBST(MOC4)
6695
6696dnl ===================================================================
6697dnl Test for the enabling the lockdown pieces
6698dnl ===================================================================
6699AC_MSG_CHECKING([whether to enable the lockdown pieces])
6700ENABLE_LOCKDOWN=""
6701if test -n "$enable_lockdown" && test "$enable_lockdown" != "no"; then
6702  ENABLE_LOCKDOWN=YES
6703  AC_MSG_RESULT([yes])
6704else
6705  AC_MSG_RESULT([no])
6706fi
6707AC_SUBST(ENABLE_LOCKDOWN)
6708
6709dnl ===================================================================
6710dnl Test whether to include Evolution 2 support
6711dnl ===================================================================
6712AC_MSG_CHECKING([whether to enable evolution 2 support])
6713if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
6714   AC_MSG_RESULT([yes])
6715   PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
6716   ENABLE_EVOAB2="TRUE"
6717else
6718   ENABLE_EVOAB2=""
6719   AC_MSG_RESULT([no])
6720fi
6721AC_SUBST(ENABLE_EVOAB2)
6722AC_SUBST(GOBJECT_CFLAGS)
6723AC_SUBST(GOBJECT_LIBS)
6724
6725dnl ===================================================================
6726dnl Test whether to include MathMLDTD
6727dnl ===================================================================
6728AC_MSG_CHECKING([whether to include MathMLDTD])
6729if test -n "$enable_mathmldtd"; then
6730  if test "$enable_mathmldtd" = "no"; then
6731    AC_MSG_RESULT([no])
6732    SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6733  else
6734    AC_MSG_RESULT([yes])
6735    BUILD_TYPE="$BUILD_TYPE MATHMLDTD"
6736  fi
6737else
6738  AC_MSG_RESULT([no])
6739  SCPDEFS="$SCPDEFS -DWITHOUT_MATHMLDTD"
6740fi
6741
6742dnl ===================================================================
6743dnl Test whether to include category-B fonts
6744dnl ===================================================================
6745WITH_CATB_FONTS=
6746AC_MSG_CHECKING([whether to include category B fonts])
6747if test "x$enable_category_b_fonts" = "xyes" && test "x$with_fonts" != "xno"; then
6748   AC_MSG_RESULT([yes])
6749   BUILD_TYPE="$BUILD_TYPE CATB_FONTS"
6750   WITH_CATB_FONTS=YES
6751   SCPDEFS="$SCPDEFS -DWITH_CATB_FONTS"
6752else
6753   AC_MSG_RESULT([no])
6754   WITH_CATB_FONTS=NO
6755fi
6756
6757dnl ===================================================================
6758dnl Test whether to include category-A fonts
6759dnl ===================================================================
6760WITH_CATA_FONTS=
6761AC_MSG_CHECKING([whether to include category A fonts])
6762if test "x$with_fonts" != "xno" ; then
6763  AC_MSG_RESULT([yes])
6764  WITH_CATA_FONTS=YES
6765  SCPDEFS="$SCPDEFS -DWITH_CATA_FONTS"
6766else
6767  AC_MSG_RESULT([no])
6768  WITH_CATA_FONTS=NO
6769  WITH_CATB_FONTS=NO
6770fi
6771
6772WITH_FONTS=NO
6773AC_MSG_CHECKING([whether any fonts are included])
6774if test "x$WITH_CATA_FONTS" = "xYES" -o "x$WITH_CATB_FONTS" = "xYES"; then
6775  BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
6776  WITH_FONTS=YES
6777  AC_MSG_RESULT([yes])
6778else
6779  AC_MSG_RESULT([no])
6780fi
6781
6782AC_SUBST(WITH_CATA_FONTS)
6783AC_SUBST(WITH_CATB_FONTS)
6784AC_SUBST(WITH_FONTS)
6785
6786dnl ===================================================================
6787dnl Test whether to include ppds
6788dnl ===================================================================
6789AC_MSG_CHECKING([whether to include PPDs])
6790if test "$with_ppds" != "no"; then
6791  AC_MSG_RESULT([yes])
6792else
6793  AC_MSG_RESULT([no])
6794  WITHOUT_PPDS=YES
6795  SCPDEFS="$SCPDEFS -DWITHOUT_PPDS"
6796fi
6797AC_SUBST(WITHOUT_PPDS)
6798
6799dnl ===================================================================
6800dnl Test whether to include afms
6801dnl ===================================================================
6802AC_MSG_CHECKING([whether to include AFMs])
6803if test "$with_afms" != "no"; then
6804  AC_MSG_RESULT([yes])
6805  BUILD_TYPE="$BUILD_TYPE AFMS"
6806else
6807  AC_MSG_RESULT([no])
6808  WITHOUT_AFMS=YES
6809  SCPDEFS="$SCPDEFS -DWITHOUT_AFMS"
6810fi
6811AC_SUBST(WITHOUT_AFMS)
6812
6813AC_SUBST(SCPDEFS)
6814
6815AC_MSG_CHECKING([whether and how to use Xinerama])
6816if test "$_os" = "Darwin"; then
6817   USE_XINERAMA=YES
6818   XINERAMA_LINK=dynamic
6819   AC_MSG_RESULT([yes])
6820elif test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
6821   if test -e "$XLIB/libXinerama.so" -a -e "$XLIB/libXinerama.a"; then
6822      # we have both versions, let the user decide but use the dynamic one
6823      # per default
6824      USE_XINERAMA=YES
6825      if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
6826         XINERAMA_LINK=dynamic
6827      else
6828         XINERAMA_LINK=static
6829      fi
6830   elif test -e "$XLIB/libXinerama.so" -a ! -e "$XLIB/libXinerama.a"; then
6831      # we have only the dynamic version
6832      USE_XINERAMA=YES
6833      XINERAMA_LINK=dynamic
6834   elif test -e "$XLIB/libXinerama.a"; then
6835      # static version
6836      if echo $build_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
6837         USE_XINERAMA=YES
6838         XINERAMA_LINK=static
6839      else
6840         USE_XINERAMA=NO
6841         XINERAMA_LINK=none
6842      fi
6843   else
6844      # no Xinerama
6845      USE_XINERAMA=NO
6846      XINERAMA_LINK=none
6847   fi
6848   if test "$USE_XINERAMA" = "YES"; then
6849      AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
6850      AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
6851          [AC_MSG_ERROR(Xinerama header not found.)], [])
6852      XINERAMA_EXTRA_LIBS="-L$XLIB -lXext"
6853      if test "$_os" = "FreeBSD"; then
6854          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
6855      fi
6856      if test "$_os" = "Linux"; then
6857          XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
6858      fi
6859      AC_CHECK_LIB(Xinerama, XineramaIsActive, [],
6860          [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
6861   else
6862      AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
6863   fi
6864else
6865   AC_MSG_RESULT([no])
6866fi
6867AC_SUBST(USE_XINERAMA)
6868AC_SUBST(XINERAMA_LINK)
6869
6870dnl ===================================================================
6871dnl always rely on the system version of gdk-pixbuf
6872dnl ===================================================================
6873
6874SYSTEM_GDKPIXBUF=YES
6875AC_SUBST(SYSTEM_GDKPIXBUF)
6876
6877dnl ===================================================================
6878dnl always rely on the system version of glib
6879dnl ===================================================================
6880
6881SYSTEM_GLIB=YES
6882AC_SUBST(SYSTEM_GLIB)
6883
6884dnl ===================================================================
6885dnl always rely on the system version of gettext
6886dnl ===================================================================
6887
6888SYSTEM_GETTEXT=YES
6889AC_SUBST(SYSTEM_GETTEXT)
6890
6891if test "$_os" = "FreeBSD"; then
6892    LIBINTL_PREFIX=
6893    for dir in $CPPFLAGS; do
6894      if dir=`expr -- $dir : '-I\(.*\)'`; then
6895        if test -f "$dir/libintl.h" ; then
6896          LIBINTL_PREFIX=`dirname $dir`
6897        fi
6898      fi
6899    done
6900    AC_SUBST(LIBINTL_PREFIX)
6901fi
6902
6903dnl ===================================================================
6904dnl always rely on the system version of pango
6905dnl ===================================================================
6906
6907SYSTEM_PANGO=YES
6908AC_SUBST(SYSTEM_PANGO)
6909
6910dnl ===================================================================
6911dnl Test whether to build libpng or rely on the system version
6912dnl ===================================================================
6913AC_MSG_CHECKING([whether to build own version of libpng])
6914
6915case "$_os" in
6916    WINNT*) # Windows
6917        SYSTEM_LIBPNG=NO
6918        AC_MSG_RESULT([yes])
6919        ;;
6920    Darwin*)
6921        SYSTEM_LIBPNG=NO
6922        AC_MSG_RESULT([yes])
6923        ;;
6924   *)
6925   SYSTEM_LIBPNG=YES
6926   AC_MSG_RESULT([no])
6927   ;;
6928esac
6929AC_SUBST(SYSTEM_LIBPNG)
6930
6931dnl ===================================================================
6932dnl Test whether to build libjpeg or rely on the system version
6933dnl ===================================================================
6934dnl FIXME: this is currently because we have jpeg-6b for our filters
6935dnl        and jpeg-8 as dependency for librsvg
6936dnl        this should be unified into using only one version for both
6937
6938AC_MSG_CHECKING([whether to build own version of libjpeg])
6939
6940if test "$SYSTEM_JPEG" = "YES"; then
6941SYSTEM_LIBJPEG=YES
6942else
6943case "$_os" in
6944    WINNT*) # Windows
6945        SYSTEM_LIBJPEG=NO
6946        ;;
6947    Darwin*)
6948        SYSTEM_LIBJPEG=NO
6949        ;;
6950   *)
6951        SYSTEM_LIBJPEG=YES
6952        ;;
6953esac
6954fi
6955
6956if test "$SYSTEM_LIBJPEG" = "YES"; then
6957   AC_MSG_RESULT([no])
6958else
6959   AC_MSG_RESULT([yes])
6960fi
6961AC_SUBST(SYSTEM_LIBJPEG)
6962
6963dnl ===================================================================
6964dnl Test whether rat scan was requested and whether apache-rat is available
6965dnl ===================================================================
6966RAT_JAR=
6967AC_MSG_CHECKING([whether to trigger rat scan])
6968if test -z "$with_rat_scan" -o "$with_rat_scan" = "no"; then
6969    AC_MSG_RESULT([no])
6970else
6971    if test "$WITH_JAVA" = "no"; then
6972        AC_MSG_ERROR([no, java disabled, enable with --with-java])
6973    elif test "$enable_saxon" = "no"; then
6974        AC_MSG_ERROR([no, saxon disabled, enable with --enable-category-b])
6975    elif test "$with_rat_scan" = "yes"; then
6976        AC_MSG_RESULT([yes, use pre-built library])
6977        RAT_JAR_HOME="BUILD"
6978        BUILD_TYPE="$BUILD_TYPE RAT"
6979    else
6980        AC_MSG_RESULT([yes, use pre-installed library])
6981        AC_MSG_CHECKING([whether apache-rat is available])
6982        if test -d "$with_rat_scan"; then
6983            RAT_JAR_HOME=$with_rat_scan
6984        else
6985            AC_MSG_ERROR([$with_rat_scan is not a directory])
6986        fi
6987    fi
6988fi
6989AC_SUBST(RAT_JAR_HOME)
6990
6991
6992dnl ===================================================================
6993dnl Test for the presence of Ant and that it works
6994dnl ===================================================================
6995
6996if test "$SOLAR_JAVA" != ""; then
6997ANT_HOME=; export ANT_HOME
6998WITH_ANT_HOME=; export WITH_ANT_HOME
6999if test -z "$with_ant_home"; then
7000   if test "$_os" = "OS2"; then
7001     AC_PATH_PROGS(ANT, ant.cmd)
7002   else
7003     AC_PATH_PROGS(ANT, [apache-ant ant ant.sh ant.bat ant.cmd])
7004   fi
7005else
7006   if test "$_os" = "WINNT"; then
7007      with_ant_home=`cygpath -u "$with_ant_home"`
7008   fi
7009   if test "$_os" = "OS2"; then
7010     AC_PATH_PROGS(ANT, ant.cmd,,$with_ant_home/bin:$PATH)
7011   else
7012     AC_PATH_PROGS(ANT, [apache-ant ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
7013   fi
7014   WITH_ANT_HOME=$with_ant_home
7015   ANT_HOME=$with_ant_home
7016fi
7017
7018if test -z "$ANT"; then
7019  AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
7020else
7021  # resolve relative or absolute symlink
7022  while test -h "$ANT"; do
7023     a_cwd=`pwd`
7024     a_basename=`basename "$ANT"`
7025     a_script=`ls -l "$ANT" | sed "s/.*${a_basename} -> //g"`
7026     cd "`dirname "$ANT"`"
7027     cd "`dirname "$a_script"`"
7028     ANT="`pwd`"/"`basename "$a_script"`"
7029     cd "$a_cwd"
7030  done
7031
7032  if test "$_os" = "OS2"; then
7033    ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7034    export ANT_HOME
7035  fi
7036
7037  AC_MSG_CHECKING([if $ANT works])
7038cat > conftest.java << EOF
7039    public class conftest {
7040    int testmethod(int a, int b) {
7041            return a + b;
7042    }
7043    }
7044EOF
7045
7046cat > conftest.xml << EOF
7047    <project name="conftest" default="conftest">
7048    <target name="conftest">
7049            <javac srcdir="." includes="conftest.java">
7050        </javac>
7051    </target>
7052    </project>
7053EOF
7054  oldJAVA_HOME=$JAVA_HOME
7055  if test "$JAVACISGCJ" = "yes"; then
7056    JAVA_HOME=; export JAVA_HOME
7057    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7058  else
7059    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7060  fi
7061  AC_TRY_EVAL(ant_cmd)
7062  if test $? = 0 && test -f ./conftest.class ; then
7063    AC_MSG_RESULT([Ant works])
7064    if test -z "$WITH_ANT_HOME"; then
7065        ANT_HOME=`$ANT -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
7066        if test -z "$ANT_HOME"; then
7067            ANT_HOME=`echo $ANT | $SED -n "s/\/bin\/ant.*\$//p"`
7068        fi
7069    else
7070        ANT_HOME="$WITH_ANT_HOME"
7071    fi
7072  else
7073    echo "configure: Ant test failed" >&5
7074    cat conftest.java >&5
7075    cat conftest.xml >&5
7076    AC_MSG_WARN([Ant does not work - Some Java projects will not build!])
7077    ANT_HOME=""
7078    echo "Ant does not work - Some Java projects will not build!" >>warn
7079  fi
7080  JAVA_HOME=$oldJAVA_HOME
7081  rm -f conftest* core core.* *.core
7082fi
7083if test -z "$ANT_HOME"; then
7084   ANT_HOME="NO_ANT_HOME"
7085fi
7086AC_SUBST(ANT_HOME)
7087
7088dnl Checking for ant.jar
7089if test "$ANT_HOME" != "NO_ANT_HOME"; then
7090   AC_MSG_CHECKING([Ant lib directory])
7091   if test -f $ANT_HOME/lib/ant.jar; then
7092    ANT_LIB="$ANT_HOME/lib"
7093   else
7094      if test -f $ANT_HOME/ant.jar; then
7095         ANT_LIB="$ANT_HOME"
7096      else
7097          if test -f /usr/share/java/ant.jar; then
7098              ANT_LIB=/usr/share/java
7099          else
7100             if test -f /usr/share/ant-core/lib/ant.jar; then
7101                 ANT_LIB=/usr/share/ant-core/lib
7102             else
7103                if test -f $ANT_HOME/lib/ant/ant.jar; then
7104                    ANT_LIB="$ANT_HOME/lib/ant"
7105                else
7106                   if test -f /usr/share/lib/ant/ant.jar; then
7107                       ANT_LIB=/usr/share/lib/ant
7108                   else
7109                       AC_MSG_ERROR([Ant libraries not found!])
7110                   fi
7111                fi
7112             fi
7113          fi
7114      fi
7115   fi
7116   AC_MSG_RESULT([Ant lib directory found.])
7117fi
7118AC_SUBST(ANT_LIB)
7119fi
7120
7121ant_minver=1.9.1
7122# update for more extensions...
7123if test "$ENABLE_MEDIAWIKI" = "YES"; then
7124  ant_minver=1.9.1
7125fi
7126ant_minminor1=`echo $ant_minver | cut -d"." -f2`
7127
7128AC_MSG_CHECKING([whether ant is >= $ant_minver])
7129ant_version=`$ANT -version | $AWK '{ print $4; }'`
7130ant_version_major=`echo $ant_version | cut -d. -f1`
7131ant_version_minor=`echo $ant_version | cut -d. -f2`
7132echo "configure: ant_version $ant_version " >&5
7133echo "configure: ant_version_major $ant_version_major " >&5
7134echo "configure: ant_version_minor $ant_version_minor " >&5
7135if test "$ant_version_major" -ge "2"; then
7136   AC_MSG_RESULT([yes, $ant_version])
7137elif test "$ant_version_major" = "1" && test "$ant_version_minor" -ge "$ant_minminor1"; then
7138   AC_MSG_RESULT([yes, $ant_version])
7139else
7140   AC_MSG_ERROR([no, you need at least ant >= $ant_minver])
7141fi
7142
7143if test "$ENABLE_MEDIAWIKI" = "YES"; then
7144AC_MSG_CHECKING([whether ant supports mapper type="regexp"])
7145rm -rf confdir
7146mkdir confdir
7147cat > conftest.java << EOF
7148    public class conftest {
7149        int testmethod(int a, int b) {
7150            return a + b;
7151        }
7152    }
7153EOF
7154
7155cat > conftest.xml << EOF
7156    <project name="conftest" default="conftest">
7157        <target name="conftest" depends="copytest">
7158            <javac srcdir="." includes="conftest.java">
7159            </javac>
7160        </target>
7161        <target name="copytest">
7162             <copy todir="confdir">
7163                 <fileset dir="confdir" includes="**/*.abc" casesensitive="yes"/>
7164                 <filterset/>
7165                 <mapper type="regexp" from="^(.*[/\\])foo([/\\].*)" to="\1baa\2"/>
7166             </copy>
7167        </target>
7168    </project>
7169EOF
7170  if test "$JAVACISGCJ" = "yes"; then
7171    JAVA_HOME=; export JAVA_HOME
7172    ant_cmd="$ANT -Dbuild.compiler=gcj -buildfile conftest.xml 1>&2"
7173  else
7174    ant_cmd="$ANT -buildfile conftest.xml 1>&2"
7175  fi
7176  AC_TRY_EVAL(ant_cmd)
7177  if test $? = 0 && test -f ./conftest.class ; then
7178    AC_MSG_RESULT([yes])
7179    rm -rf confdir
7180  else
7181    echo "configure: Ant test failed" >&5
7182    cat conftest.java >&5
7183    cat conftest.xml >&5
7184    rm -rf confdir
7185    AC_MSG_ERROR([no. Did you install ant-apache-regexp?])
7186  fi
7187fi
7188rm -f conftest* core core.* *.core
7189
7190OOO_JUNIT_JAR=
7191JUNIT_NEEDS_HAMCREST=
7192if test "$SOLAR_JAVA" != "" && test "$with_junit" != "no"; then
7193    AC_MSG_CHECKING([for JUnit])
7194    if test "$with_junit" = "yes"; then
7195        if test -e /usr/share/java/junit4.jar; then
7196           OOO_JUNIT_JAR=/usr/share/java/junit4.jar
7197        else
7198           if test -e /usr/local/share/java/classes/junit4.jar; then
7199              OOO_JUNIT_JAR=/usr/local/share/java/classes/junit4.jar
7200           else
7201              if test -e /usr/share/lib/java/junit.jar; then
7202                 OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
7203              else
7204                 if test -e /usr/share/local/lib/java/junit.jar; then
7205                    OOO_JUNIT_JAR=/usr/share/local/lib/java/junit.jar
7206                 else
7207                    if test -e /usr/share/java/junit.jar; then
7208                       OOO_JUNIT_JAR=/usr/share/java/junit.jar
7209                    else
7210                       if test -e /usr/local/share/java/classes/junit.jar; then
7211                          OOO_JUNIT_JAR=/usr/local/share/java/classes/junit.jar
7212                       fi
7213                    fi
7214                 fi
7215              fi
7216           fi
7217        fi
7218    else
7219        OOO_JUNIT_JAR=$with_junit
7220    fi
7221    if test -e "$OOO_JUNIT_JAR"; then
7222        AC_MSG_RESULT([yes])
7223    else
7224        AC_MSG_ERROR([cannot find JUnit 4 jar; please install one in the default
7225locations (/usr/share/java or /usr/local/share/java/classes), specify its pathname via
7226--with-junit=..., or disable it via --without-junit.])
7227    fi
7228    if test "$_os" = "WINNT"; then
7229        OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
7230    fi
7231    AC_MSG_CHECKING([whether JUnit is version 4.x])
7232    export OOO_JUNIT_JAR
7233    if $PERL -e 'use Archive::Zip;
7234        my $file = "$ENV{'OOO_JUNIT_JAR'}";
7235        my $zip = Archive::Zip->new( $file );
7236        my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
7237        if ( $mf =~ m/Implementation-Version: 4.12*/ ) {
7238            exit 0;
7239        } elsif ( $mf =~ m/Implementation-Version: 4.11*/ ) {
7240            exit 0;
7241        } elsif ( $mf =~ m/Bundle-Version: 4.12*/ ) {
7242            exit 0;
7243        } elsif ( $mf =~ m/Bundle-Version: 4.11*/ ) {
7244            exit 0;
7245        } else {
7246            exit 1;
7247        }'; then
7248        AC_MSG_RESULT([yes, but Hamcrest Core is mandatory with this JUnit version (>= 4.11)])
7249        JUNIT_NEEDS_HAMCREST=yes
7250    elif $PERL -e 'use Archive::Zip;
7251        my $file = "$ENV{'OOO_JUNIT_JAR'}";
7252        my $zip = Archive::Zip->new( $file );
7253        my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
7254        if ( $mf =~ m/Implementation-Version: 4.*/ ) {
7255            exit 0;
7256        } elsif ( $mf =~ m/Bundle-Version: 4.*/ ) {
7257        } else {
7258            exit 1;
7259        }'; then
7260        AC_MSG_RESULT([yes])
7261    else
7262        AC_MSG_ERROR([no, your JUnit version is too old, you need JUnit 4.x])
7263    fi
7264fi
7265AC_SUBST(OOO_JUNIT_JAR)
7266
7267HAMCREST_CORE_JAR=
7268if test "$SOLAR_JAVA" != "" && test "$with_hamcrest_core" != "no"; then
7269    AC_MSG_CHECKING([for hamcrest-core])
7270    if test "$with_hamcrest_core" = "yes"; then
7271        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/java/hamcrest-core-1.3.jar; then
7272            HAMCREST_CORE_JAR=/usr/share/java/hamcrest-core-1.3.jar
7273        fi
7274        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/java/classes/hamcrest-core-1.3.jar; then
7275            HAMCREST_CORE_JAR=/usr/local/share/java/classes/hamcrest-core-1.3.jar
7276        fi
7277        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/lib/java/hamcrest-core.jar; then
7278            HAMCREST_CORE_JAR=/usr/share/lib/java/hamcrest-core.jar
7279        fi
7280        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/lib/java/hamcrest-core.jar; then
7281            HAMCREST_CORE_JAR=/usr/local/share/lib/java/hamcrest-core.jar
7282        fi
7283        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/java/hamcrest-core.jar; then
7284            HAMCREST_CORE_JAR=/usr/share/java/hamcrest-core.jar
7285        fi
7286        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/java/classes/hamcrest-core.jar; then
7287            HAMCREST_CORE_JAR=/usr/local/share/java/classes/hamcrest-core.jar
7288        fi
7289        # Sometimes the "-core-" part is missing...
7290        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/java/hamcrest1.3.jar; then
7291            HAMCREST_CORE_JAR=/usr/share/java/hamcrest1.3.jar
7292        fi
7293        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/java/classes/hamcrest1.3.jar; then
7294            HAMCREST_CORE_JAR=/usr/local/share/java/classes/hamcrest1.3.jar
7295        fi
7296        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/lib/java/hamcrest.jar; then
7297            HAMCREST_CORE_JAR=/usr/share/lib/java/hamcrest.jar
7298        fi
7299        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/lib/java/hamcrest.jar; then
7300            HAMCREST_CORE_JAR=/usr/local/share/lib/java/hamcrest.jar
7301        fi
7302        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/share/java/hamcrest.jar; then
7303            HAMCREST_CORE_JAR=/usr/share/java/hamcrest.jar
7304        fi
7305        if test "$HAMCREST_CORE_JAR" = "" && test -e /usr/local/share/java/classes/hamcrest.jar; then
7306            HAMCREST_CORE_JAR=/usr/local/share/java/classes/hamcrest.jar
7307        fi
7308    else
7309        HAMCREST_CORE_JAR=$with_hamcrest_core
7310    fi
7311    if test -e "$HAMCREST_CORE_JAR"; then
7312        AC_MSG_RESULT([yes])
7313        if test "$_os" = "WINNT"; then
7314            HAMCREST_CORE_JAR=`cygpath -m "$HAMCREST_CORE_JAR"`
7315        fi
7316    else
7317        if test "$JUNIT_NEEDS_HAMCREST" = "yes"; then
7318            AC_MSG_ERROR([cannot find hamcrest-core jar; please install one in the
7319default locations (/usr/share/java or /usr/local/share/java/classes), specify its
7320pathname via --with-hamcrest-core=..., or disable
7321it via --without-hamcrest-core or --without-junit])
7322        else
7323            AC_MSG_RESULT([no, skipping])
7324        fi
7325    fi
7326else
7327    if test "$JUNIT_NEEDS_HAMCREST" = "yes"; then
7328        AC_MSG_ERROR([JUnit needs Hamcrest but Hamcrest disabled.])
7329    fi
7330fi
7331AC_SUBST(HAMCREST_CORE_JAR)
7332
7333AC_MSG_CHECKING([which languages to be built])
7334WITH_LANG="$with_lang"
7335if test -z "$WITH_LANG"; then
7336   AC_MSG_RESULT([en-US])
7337else
7338   AC_MSG_RESULT([$WITH_LANG])
7339   ADDITIONAL_REPOSITORIES="$ADDITIONAL_REPOSITORIES ../extras"
7340   BUILD_TYPE="$BUILD_TYPE L10N"
7341fi
7342AC_SUBST(WITH_LANG)
7343
7344AC_MSG_CHECKING([which languages have poor help localizations])
7345WITH_POOR_HELP_LOCALIZATIONS="$with_poor_help_localizations"
7346if test -z "$WITH_POOR_HELP_LOCALIZATIONS"; then
7347   AC_MSG_RESULT([none])
7348else
7349   AC_MSG_RESULT([$WITH_POOR_HELP_LOCALIZATIONS])
7350fi
7351AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
7352
7353AC_MSG_CHECKING([which dictionaries to include])
7354if test -z "$with_dict"; then
7355   WITH_DICT=,ALL,
7356   AC_MSG_RESULT([ALL])
7357else
7358   WITH_DICT=","$with_dict","
7359   AC_MSG_RESULT([$with_dict])
7360fi
7361AC_SUBST(WITH_DICT)
7362
7363AC_MSG_CHECKING([for additional 'intro' bitmaps])
7364INTRO_BITMAPS=
7365if test -z "$with_intro_bitmaps" -o "$with_intro_bitmaps" = "no" ; then
7366   INTRO_BITMAPS=
7367   AC_MSG_RESULT([none])
7368else
7369   for bitmap in `echo $with_intro_bitmaps | tr ',' ' '` ; do
7370      case "$bitmap" in
7371         *.png) ;;
7372         *)     bitmap= ; AC_MSG_WARN([Intro bitmaps should be .png files!]) ;;
7373      esac
7374      if test -n "$bitmap" ; then
7375         INTRO_BITMAPS="$INTRO_BITMAPS $bitmap"
7376      fi
7377   done
7378   AC_MSG_RESULT([$INTRO_BITMAPS])
7379fi
7380AC_SUBST(INTRO_BITMAPS)
7381
7382AC_MSG_CHECKING([for additional 'about' bitmaps])
7383ABOUT_BITMAPS=
7384if test -z "$with_about_bitmaps" -o "$with_about_bitmaps" = "no" ; then
7385   ABOUT_BITMAPS=
7386   AC_MSG_RESULT([none])
7387else
7388   for bitmap in `echo $with_about_bitmaps | tr ',' ' '` ; do
7389      case "$bitmap" in
7390         *.png) ;;
7391         *)     bitmap= ; AC_MSG_WARN([About bitmaps should be .png files!]) ;;
7392      esac
7393      if test -n "$bitmap" ; then
7394         ABOUT_BITMAPS="$ABOUT_BITMAPS $bitmap"
7395      fi
7396   done
7397   AC_MSG_RESULT([$ABOUT_BITMAPS])
7398fi
7399AC_SUBST(ABOUT_BITMAPS)
7400
7401OOO_VENDOR=
7402AC_MSG_CHECKING([for vendor])
7403if test -z "$with_vendor" -o "$with_vendor" = "no" ; then
7404   AC_MSG_RESULT([not set])
7405else
7406   OOO_VENDOR="$with_vendor"
7407   AC_MSG_RESULT([$OOO_VENDOR])
7408fi
7409AC_SUBST(OOO_VENDOR)
7410
7411UNIXWRAPPERNAME=
7412AC_MSG_CHECKING([for UNIX wrapper name])
7413if test -z "$with_unix_wrapper" -o "$with_unix_wrapper" = "no" -o "$with_unix_wrapper" = "yes" ; then
7414   AC_MSG_RESULT([not set])
7415else
7416   UNIXWRAPPERNAME="$with_unix_wrapper"
7417   AC_MSG_RESULT([$UNIXWRAPPERNAME])
7418fi
7419AC_SUBST(UNIXWRAPPERNAME)
7420
7421AC_MSG_CHECKING([whether to statically link to Gtk])
7422if test -n "$enable_static_gtk" && test "$enable_static_gtk" != "no"; then
7423   ENABLE_STATIC_GTK="TRUE"
7424   AC_MSG_RESULT([yes])
7425else
7426   ENABLE_STATIC_GTK="FALSE"
7427   AC_MSG_RESULT([no])
7428fi
7429AC_SUBST(ENABLE_STATIC_GTK)
7430
7431AC_MSG_CHECKING([whether to use layout dialogs])
7432if test -n "$enable_layout" && test "$enable_layout" != "no"; then
7433   ENABLE_LAYOUT="TRUE"
7434   AC_MSG_RESULT([yes])
7435else
7436   ENABLE_LAYOUT="FALSE"
7437   AC_MSG_RESULT([no])
7438fi
7439AC_SUBST(ENABLE_LAYOUT)
7440
7441# ===================================================================
7442# De- or increase default verbosity of build process
7443# ===================================================================
7444AC_MSG_CHECKING([build verbosity])
7445if test -n "$enable_verbose"; then
7446   if test "$enable_verbose" = "yes"; then
7447      VERBOSE="TRUE"
7448      AC_MSG_RESULT([high])
7449   fi
7450   if test "$enable_verbose" = "no"; then
7451      VERBOSE="FALSE"
7452      AC_MSG_RESULT([low])
7453   fi
7454else
7455   AC_MSG_RESULT([not set])
7456fi
7457AC_SUBST(VERBOSE)
7458
7459dnl ===================================================================
7460dnl Hook up AOOs nodep environmental variable to automake's equivalent
7461dnl --enable-dependency-tracking configure option
7462dnl ===================================================================
7463AC_MSG_CHECKING([whether to enable dependency tracking])
7464if test "$enable_dependency_tracking" = "no"; then
7465    nodep=TRUE
7466    AC_MSG_RESULT([no])
7467else
7468    AC_MSG_RESULT([yes])
7469fi
7470AC_SUBST(nodep)
7471
7472dnl ===================================================================
7473dnl Setting up the environment.
7474dnl ===================================================================
7475echo "********************************************************************"
7476echo "*                                                                  *"
7477echo "*   Setting up the build environment variables.                    *"
7478echo "*                                                                  *"
7479echo "********************************************************************"
7480
7481if test -z "$COMPATH"; then
7482   AC_MSG_ERROR([No compiler found.])
7483fi
7484AC_SUBST(COMPATH)
7485AC_SUBST(CC_PATH)
7486
7487AC_MSG_CHECKING([solver path])
7488if test -z "$with_local_solver"; then
7489   LOCAL_SOLVER="DEFAULT"
7490   AC_MSG_RESULT([default])
7491else
7492   LOCAL_SOLVER=$with_local_solver
7493   AC_MSG_RESULT([$with_local_solver])
7494fi
7495AC_SUBST(LOCAL_SOLVER)
7496
7497AC_SUBST(BUILD_TYPE)
7498AC_SUBST(ADDITIONAL_REPOSITORIES)
7499
7500# make sure config.guess is +x; we execute config.guess, so it has to be so;
7501chmod +x ./config.guess
7502
7503# Create files from their *.in templates.
7504AC_CONFIG_FILES([set_soenv Makefile])
7505
7506AC_MSG_NOTICE([writing config.status])
7507AC_OUTPUT
7508
7509dnl Executing the set_soenv script to setup the environment variables.
7510chmod a+x set_soenv
7511if test -z "$enable_check_only"; then
7512   './set_soenv'
7513else
7514   echo
7515   echo Test Complete
7516   echo No environment file will be generated
7517   echo
7518   num_warnings=`wc -l warn`
7519   _num=`echo $num_warnings | $AWK '{ print $1 }'`
7520   if test $_num -gt 0; then
7521      echo The following warning\(s\) were generated by configure
7522      echo ----------------------------------------------------
7523      echo
7524      cat warn
7525      echo
7526   else
7527      echo There were no warnings
7528   fi
7529   echo
7530fi
7531
7532
7533