Fix missing include (QMessageBox) and clean extra whitespaces.
[lyx.git] / configure.ac
blobb60f085aea4e38acd65ec39c36c4263505d9fb7f
1 vdnl Process with autoconf to generate configure script   -*- sh -*-
3 AC_INIT(LyX,1.6.0svn,[lyx-devel@lists.lyx.org],[lyx])
4 AC_SUBST(LYX_DATE, ["Tue, Jun 3, 2008"])
5 AC_PREREQ(2.52)
6 AC_CONFIG_SRCDIR(src/main.cpp)
7 AC_CONFIG_HEADERS([config.h])
9 AC_CONFIG_AUX_DIR(config)
11 # First check the version
12 LYX_CHECK_VERSION
13 LYX_VERSION_SUFFIX
14 # Check how the files should be packaged
15 AC_CANONICAL_TARGET
16 LYX_USE_PACKAGING
17 # We need to define these variables here and the no-define option of
18 # AM_INIT_AUTOMAKE above because we alter $PACKAGE in LYX_USE_PACKAGING.
19 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
21 dnl default maintainer mode to true for development versions
22 if test "${enable_maintainer_mode+set}" != set; then
23   enable_maintainer_mode=$lyx_devel_version
25 AM_MAINTAINER_MODE
27 save_PACKAGE=$PACKAGE
28 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.5])
29 PACKAGE=$save_PACKAGE
31 ### Set the execute permissions of the various scripts correctly
32 for file in config/install-sh config/mkinstalldirs ; do
33   chmod 755 ${srcdir}/${file}
34 done
36 ### Check for programs
37 AC_PROG_MAKE_SET
38 AC_PROG_INSTALL
40 # Check for installed python
41 AM_PATH_PYTHON(2.3,, :)
43 # Work around a problem in automake 1.4: when invoking install-strip,
44 # INSTALL_PROGRAM is changed to 'install -s', and since
45 # INSTALL_SCRIPT==INSTALL_PROGRAM, we get errors with fileutils-4.0
46 # which returns an error condition when stripping fails.
47 INSTALL_SCRIPT='${INSTALL}'
49 ### we will also need a C compiler to compile GNU gettext
50 AC_PROG_CC
51 AC_GNU_SOURCE
53 ### check for special systems
54 AC_ISC_POSIX
55 AC_AIX
57 ### we need to know the byte order for unicode conversions
58 AC_C_BIGENDIAN
60 ### check which frontend we want to use
61 LYX_USE_FRONTENDS
63 ### Check for a C++ compiler
64 LYX_PROG_CXX
65 ### Some checks on what the C++ compiler can(not) do
66 AC_LANG(C++)
67 dnl we do not need that currently (and probably all our supported
68 dnl compiler allow that)
69 dnl LYX_CXX_PARTIAL
70 dnl LYX_CXX_EXPLICIT
71 dnl LYX_CXX_GLOBAL_CSTD
72 dnl LYX_STD_COUNT
73 dnl we disable rtti for now
74 dnl LYX_CXX_RTTI
75 dnl AC_CHECK_HEADERS(ostream istream sstream locale limits ios)
76 dnl LYX_CXX_STL_MODERN_STREAMS
78 ### Objective-C compiler
79 AC_PROG_OBJC
80 _AM_DEPENDENCIES([OBJC])
82 ### and now some special lyx flags.
83 AC_ARG_ENABLE(assertions,
84   AC_HELP_STRING([--enable-assertions],[add runtime sanity checks in the program]),,
85   [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
86         enable_assertions=yes;
87     else
88         enable_assertions=no;
89     fi;])
90 if test "x$enable_assertions" = xyes ; then
91    lyx_flags="assertions $lyx_flags"
92    AC_DEFINE(ENABLE_ASSERTIONS,1,
93     [Define if you want assertions to be enabled in the code])
96 ### Library Files
97 dnl AC_CHECK_LIB(m, sin)
99 ### Add extra directories to check for libraries.
100 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
101 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
102 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
104 ### Add extra directories to check for include files.
105 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
106 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
107 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
109 ### Add both includes and libraries
110 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
111 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
112 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
113   LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
115 ### These are needed in windows
116 AC_CHECK_LIB(shlwapi, main, [LIBSHLWAPI=-lshlwapi])
117 AC_SUBST(LIBSHLWAPI)
118 AC_CHECK_LIB(gdi32, main)
120 AC_ARG_WITH(aiksaurus,
121   [  --without-aiksaurus     do not use the Aiksaurus library],
122   [lyx_use_aiksaurus=$withval])
123 if test x$lyx_use_aiksaurus != xno; then
124 AC_CHECK_LIB(Aiksaurus, main,
125         [AC_DEFINE(HAVE_LIBAIKSAURUS,1,[Define this if you have the AikSaurus library])
126          AIKSAURUS_LIBS="-lAiksaurus"
127          lyx_flags="aiksaurus $lyx_flags"
128         ])
129 AC_CHECK_HEADER(Aiksaurus.h,[
130   ac_cv_header_aiksaurus_h=yes
131   lyx_cv_aiksaurus_h_location="<Aiksaurus.h>"])
132 AC_CHECK_HEADER(Aiksaurus/Aiksaurus.h,[
133   ac_cv_header_aiksaurus_h=yes
134   lyx_cv_aiksaurus_h_location="<Aiksaurus/Aiksaurus.h>"])
135 AC_DEFINE_UNQUOTED(AIKSAURUS_H_LOCATION,$lyx_cv_aiksaurus_h_location,[Location of Aiksaurus.h])
137 AC_SUBST(AIKSAURUS_LIBS)
139 LYX_USE_INCLUDED_BOOST
141 # Needed for our char_type
142 AC_CHECK_SIZEOF(wchar_t)
144 ### Setup libtool
145 dnl Dirty trick ahead: disable libtool checking for a fortran compiler
146 dnl see http://permalink.gmane.org/gmane.comp.gnu.libtool.general/6699
147 dnl Note that this will reportedly not be needed with libtool 2.0
148 m4_undefine([AC_PROG_F77])
149 m4_defun([AC_PROG_F77],[])
151 AC_DISABLE_SHARED
152 #AC_DISABLE_STATIC
153 AC_LIBTOOL_WIN32_DLL
154 #AM_PROG_LIBTOOL
155 LYX_PROG_LIBTOOL
157 ### We need iconv for unicode support (Qt4 frontend requires it too)
158 AM_ICONV
159 if test "$am_cv_func_iconv" = no; then
160   LYX_ERROR([Cannot find required library iconv])
161 else
162   LIBS="$LIBS $LIBICONV"
165 ### check for compression support
166 AC_CHECK_HEADERS(zlib.h,
167  [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
168  [LYX_LIB_ERROR(zlib.h,zlib)])
171 ### Check for X libraries
172 AC_PATH_XTRA
173 case $have_x in
174   yes) LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
175        CPPFLAGS="$CPPFLAGS $X_CFLAGS";;
176   no) LYX_ERROR(dnl
177 [Cannot find X window libraries and/or headers. Check your installation.
178   If you use a Linux system, check that you have installed
179   the development tools.]);;
180   disable) ;;
181 esac
183 ### check which frontend we want to use
185 dnl The code below is not in a macro, because this would cause big
186 dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
187 for frontend in $FRONTENDS ; do
188   case "$frontend" in
189     qt4)
190           QT4_DO_IT_ALL
191           FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
192           FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt4"
193           RPM_FRONTEND="qt4"
194           FRONTEND_INFO="${FRONTEND_INFO}\
195   Qt 4 Frontend:\n\
196       Qt 4 version:\t\t${QT4_VERSION}\n"
197 dnl qt 4 build will fail without moc or uic
198           if test -z "$MOC4"; then
199             LYX_ERROR([moc 4 binary not found !])
200           fi
201           if test -z "$UIC4"; then
202             LYX_ERROR([uic 4 binary not found !])
203           fi
204           if test -z "$QT4_LIB"; then
205             LYX_ERROR([qt 4 library not found !])
206           fi
207       ;;
208     *)
209           LYX_ERROR(Unknown frontend '$frontend');;
210   esac
211 done
213 # fix the value of the prefixes.
214 test "x$prefix" = xNONE && prefix=$default_prefix
215 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
216 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
217   LYX_WARNING([The installation prefix \"${prefix}\" contains a space, which
218    causes problems with the Makefiles. The installation will be done in
219    directory \"`pwd`/installprefix\" instead. Please move its contents to
220    the right place after installation.])
221   prefix=`pwd`/installprefix
224 ### Setup GNU gettext
225 dnl GNU gettext is written in C
226 AC_LANG_PUSH(C)
227 AM_GNU_GETTEXT
228 AM_GNU_GETTEXT_VERSION([0.16.1])
229 AC_LANG_POP(C)
231 # some standard header files
232 AC_HEADER_DIRENT
233 AC_HEADER_MAJOR
234 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h strings.h locale.h io.h process.h NewAPIs.h utime.h sys/utime.h)
236 # some standard structures
237 AC_HEADER_STAT
238 AC_HEADER_TIME
240 # some standard types
241 AC_CHECK_TYPE(mode_t,[AC_DEFINE(HAVE_MODE_T, 1, [Define this to 1 if your compiler supports the mode_t type.])])
242 AC_TYPE_OFF_T
243 AC_TYPE_PID_T
244 AC_TYPE_SIGNAL
245 AC_TYPE_SIZE_T
246 AC_TYPE_UID_T
248 AC_CHECK_FUNCS(strerror)
249 LYX_CHECK_DECL(istreambuf_iterator, iterator)
250 LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
252 # Check the form of mkdir()
253 AC_FUNC_MKDIR
255 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
256 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
257 dnl We aim to remove this eventually, since we should test as much as
258 dnl possible with the compiler which will use the functions (JMarc)
259 AC_LANG_PUSH(C)
260 AC_CHECK_FUNCS(chmod close _close getpid _getpid lstat mkfifo mkstemp mktemp open _open pclose _pclose popen _popen readlink)
261 AC_LANG_POP(C)
263 LYX_CHECK_SPELL_ENGINES
265 lyx_client_subdir=true
266 AC_LANG_PUSH(C)
267 dnl LIBS already contains some X extra libs that may interfere.
268 save_LIBS="$LIBS"
269 LIBS=
270 AC_CHECK_FUNCS(fcntl,
271   [AC_SEARCH_LIBS([gethostbyname], [nsl])
272    AC_SEARCH_LIBS([socket], [socket], [],
273      [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
274                 [], [-lnsl])])],
275   [lyx_client_subdir=false])
276 AC_SUBST(SOCKET_LIBS,$LIBS)
277 LIBS="$save_LIBS"
278 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
279 AC_LANG_POP(C)
281 lyx_win_res=false;
282 case ${host} in
283     *mingw*|*cygwin*) lyx_win_res=true;;
284 esac
285 AM_CONDITIONAL(LYX_WIN_RESOURCE, $lyx_win_res)
286 LYX_SET_VERSION_INFO
288 AC_FUNC_SELECT_ARGTYPES
290 ### Some information on what just happened
291 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
292 real_pkgdatadir=`eval "echo \`eval \"echo \\\`eval \\\"echo ${pkgdatadir}\\\"\\\`\"\`"`
293 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
294 VERSION_INFO="Configuration\n\
295   Host type:                    ${host}\n\
296   Special build flags:          ${lyx_flags}\n\
297   C   Compiler:                 ${CC} ${CC_VERSION}\n\
298   C   Compiler LyX flags:       ${AM_CPPFLAGS} ${AM_CFLAGS}\n\
299   C   Compiler flags:           ${CPPFLAGS} ${CFLAGS}\n\
300   C++ Compiler:                 ${CXX} ${CXX_VERSION}\n\
301   C++ Compiler LyX flags:       ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
302   C++ Compiler flags:           ${CPPFLAGS} ${CXXFLAGS}\n\
303   Linker flags:                 ${AM_LDFLAGS}\n\
304   Linker user flags:            ${LDFLAGS}\n\
305 ${FRONTEND_INFO}\
306   Packaging:                    ${lyx_use_packaging}\n\
307   LyX binary dir:               ${real_bindir}\n\
308   LyX files dir:                ${real_pkgdatadir}\n"
310 AC_SUBST(VERSION_INFO)
311 AC_SUBST(RPM_FRONTEND)
312 AC_SUBST(AM_CPPFLAGS)
313 AC_SUBST(AM_CXXFLAGS)
314 AC_SUBST(AM_CFLAGS)
315 AC_SUBST(AM_LDFLAGS)
317 ## Some config.h stuff
319 AH_TOP([
320 /* -*- C++ -*- */
322  * \file config.h
323  * This file is part of LyX, the document processor.
324  * Licence details can be found in the file COPYING.
326  * This is the compilation configuration file for LyX.
327  * It was generated by autoconfs configure.
328  * You might want to change some of the defaults if something goes wrong
329  * during the compilation.
330  */
332 #ifndef _CONFIG_H
333 #define _CONFIG_H
336 AH_BOTTOM([
337 /************************************************************
338  ** You should not need to change anything beyond this point */
340 #ifndef HAVE_STRERROR
341 #if defined(__cplusplus)
342 extern "C"
343 #endif
344 char * strerror(int n);
345 #endif
347 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
348 #  define USE_BOOST_FORMAT 1
349 #else
350 #  define USE_BOOST_FORMAT 0
351 #endif
353 #define BOOST_USER_CONFIG <config.h>
355 #if !defined(ENABLE_ASSERTIONS)
356 #  define BOOST_DISABLE_ASSERTS 1
357 #endif
358 #define BOOST_ENABLE_ASSERT_HANDLER 1
360 #define BOOST_DISABLE_THREADS 1
361 #define BOOST_NO_WREGEX 1
362 #define BOOST_NO_WSTRING 1
364 #ifdef __CYGWIN__
365 #  define BOOST_POSIX 1
366 #  define BOOST_POSIX_API 1
367 #  define BOOST_POSIX_PATH 1
368 #endif
370 #if defined(HAVE_NEWAPIS_H)
371 #  define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
372 #endif
375  * the FreeBSD libc uses UCS4, but libstdc++ has no proper wchar_t
376  * support compiled in:
377  * http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#3_9
378  * And we are not interested at all what libc
379  * does: What we need is a 32bit wide wchar_t, and a libstdc++ that
380  * has the needed wchar_t support and uses UCS4. Whether it
381  * implements this with the help of libc, or whether it has own code
382  * does not matter for us, because we do not use libc directly (Georg)
384 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
385 #  define USE_WCHAR_T
386 #endif
388 #endif
392 AC_ARG_WITH(qmake,
393         AC_HELP_STRING([--with-qmake],
394                 [Use qmake instead of automake to generate Makefiles]),,
395         [with_qmake=no])
397 AC_ARG_ENABLE(monolithic-boost,
398   AC_HELP_STRING([--enable-monolithic-boost],
399                 [Use monolithic boost compilations]),,
400   [enable_monolithic_boost=no])
401 AM_CONDITIONAL(MONOLITHIC_BOOST, test "$enable_monolithic_boost" = "yes")
403 AC_ARG_ENABLE(monolithic-client,
404   AC_HELP_STRING([--enable-monolithic-client],
405                 [Use monolithic client compilations]),,
406   [enable_monolithic_client=no])
407 AM_CONDITIONAL(MONOLITHIC_CLIENT, test "$enable_monolithic_client" = "yes")
409 AC_ARG_ENABLE(monolithic-insets,
410   AC_HELP_STRING([--enable-monolithic-insets],
411                 [Use monolithic insets compilations]),,
412   [enable_monolithic_insets=no])
413 AM_CONDITIONAL(MONOLITHIC_INSETS, test "$enable_monolithic_insets" = "yes")
415 AC_ARG_ENABLE(monolithic-mathed,
416   AC_HELP_STRING([--enable-monolithic-mathed],
417                 [Use monolithic mathed compilations]),,
418   [enable_monolithic_mathed=no])
419 AM_CONDITIONAL(MONOLITHIC_MATHED, test "$enable_monolithic_mathed" = "yes")
421 AC_ARG_ENABLE(monolithic-core,
422   AC_HELP_STRING([--enable-monolithic-core],
423                 [Use monolithic core files compilations]),,
424   [enable_monolithic_core=no])
425 AM_CONDITIONAL(MONOLITHIC_CORE, test "$enable_monolithic_core" = "yes")
427 AC_ARG_ENABLE(monolithic-tex2lyx,
428   AC_HELP_STRING([--enable-monolithic-tex2lyx],
429                 [Use monolithic tex2lyx compilations]),,
430   [enable_monolithic_tex2lyx=no])
431 AM_CONDITIONAL(MONOLITHIC_TEX2LYX, test "$enable_monolithic_tex2lyx" = "yes")
433 AC_ARG_ENABLE(monolithic-frontend-qt4,
434   AC_HELP_STRING([--enable-monolithic-frontend-qt4],
435                 [Use monolithic compilation of the Qt 4 frontend. Only recommended with > 512 MB of RAM]),,
436   [enable_monolithic_frontend_qt4=no])
437 AM_CONDITIONAL(MONOLITHIC_FRONTEND_QT4, test "$enable_monolithic_frontend_qt4" = "yes")
439 MSYS_AC_CANONICAL_PATH(lyx_abs_top_srcdir, ${srcdir})
440 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_localedir, ${real_localedir})
441 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_datadir, ${real_pkgdatadir})
443 AC_DEFINE_UNQUOTED([LYX_ABS_TOP_SRCDIR],
444         "${lyx_abs_top_srcdir}", [Top source directory])
445 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_LOCALEDIR],
446         "${lyx_abs_installed_localedir}",[Hard coded locale directory])
447 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_DATADIR],
448         "${lyx_abs_installed_datadir}",[Hard system support directory])
449 AC_DEFINE_UNQUOTED([PROGRAM_SUFFIX],
450         "${version_suffix}",[Program version suffix])
452 AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
453 AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
454 AC_DEFINE_UNQUOTED([LYX_MAJOR_VERSION],$lyx_major,[Major version number])
455 AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
456 AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
457 AC_DEFINE_UNQUOTED([LYX_RELEASE_PATCH],$lyx_patch,[Patch version number])
459 AC_CONFIG_FILES([Makefile
460       boost/Makefile \
461       config/Makefile \
462       development/Makefile \
463       development/MacOSX/Makefile \
464       development/MacOSX/Info.plist \
465       development/MacOSX/lyxrc.dist \
466       development/MacOSX/spotlight/Makefile \
467       development/lyx.spec \
468       intl/Makefile \
469       lib/Makefile \
470       lib/doc/Makefile \
471       lib/lyx2lyx/lyx2lyx_version.py \
472       lib/lyx2lyx/Makefile \
473       m4/Makefile \
474       po/Makefile.in \
475       sourcedoc/Doxyfile \
476       sourcedoc/Makefile \
477       src/client/Makefile \
478       src/Makefile \
479       src/tex2lyx/Makefile \
480       src/support/Makefile \
481       src/frontends/Makefile \
482       src/frontends/qt4/Makefile
486 AC_OUTPUT
488 if test x$with_qmake = xyes ; then
489         echo "CONFIGURE WITH QMAKE ONLY"
490         if test x$srcdir = x ; then
491                 echo "ONLY FOR OUT-OF-TREE-BUILDS POSSIBLE"
492         else
493                 rm boost/Makefile
494                 rm src/client/Makefile
495                 rm src/Makefile
496                 rm src/tex2lyx/Makefile
497                 rm src/support/Makefile
498                 rm src/frontends/Makefile
499                 rm src/frontends/qt4/Makefile
500                 rm -rf boost/.deps
501                 rm -rf src/client/.deps
502                 rm -rf src/.deps
503                 rm -rf src/tex2lyx/.deps
504                 rm -rf src/support/.deps
505                 rm -rf src/frontends/.deps
506                 rm -rf src/frontends/qt4/.deps
507                 ${srcdir}/development/qmake/doit
508         fi
512 # show version information
513 echo
514 printf "$VERSION_INFO"
515 echo
517 # Display a final warning if there has been a LYX_ERROR
518 LYX_CHECK_ERRORS