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