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