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