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