]> git.lyx.org Git - lyx.git/blob - configure.ac
remove unneeded "default language" option
[lyx.git] / configure.ac
1 dnl Process with autoconf to generate configure script   -*- sh -*-
2
3 AC_INIT(LyX,2.0.0svn,[lyx-devel@lists.lyx.org],[lyx])
4 AC_SUBST(LYX_DATE, ["Sat, Nov 15, 2008"])
5 AC_PREREQ(2.52)
6 AC_CONFIG_SRCDIR(src/main.cpp)
7 AC_CONFIG_HEADERS([config.h])
8
9 AC_CONFIG_AUX_DIR(config)
10
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])
20
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
24 fi
25 AM_MAINTAINER_MODE
26
27 save_PACKAGE=$PACKAGE
28 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.5])
29 PACKAGE=$save_PACKAGE
30
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
35
36 ### Check for programs
37 dnl AC_PROG_MAKE_SET
38 dnl AC_PROG_INSTALL
39
40 # Check for installed python
41 AM_PATH_PYTHON(2.3.4,, :)
42
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}'
48
49 ### we will also need a C compiler to compile GNU gettext
50 AC_PROG_CC
51 AC_USE_SYSTEM_EXTENSIONS
52
53 ### we need to know the byte order for unicode conversions
54 AC_C_BIGENDIAN
55
56 ### check which frontend we want to use
57 LYX_USE_FRONTENDS
58
59 ### Check for a C++ compiler
60 LYX_PROG_CXX
61 ### Some checks on what the C++ compiler can(not) do
62 AC_LANG(C++)
63 dnl we do not need that currently (and probably all our supported
64 dnl compiler allow that)
65 dnl LYX_CXX_PARTIAL
66 dnl LYX_CXX_EXPLICIT
67 dnl LYX_CXX_GLOBAL_CSTD
68 dnl LYX_STD_COUNT
69 dnl we disable rtti for now
70 dnl LYX_CXX_RTTI
71 dnl AC_CHECK_HEADERS(ostream istream sstream locale limits ios)
72 dnl LYX_CXX_STL_MODERN_STREAMS
73
74 ### Objective-C compiler
75 AC_PROG_OBJC
76 _AM_DEPENDENCIES([OBJC])
77
78 ### and now some special lyx flags.
79 AC_ARG_ENABLE(assertions,
80   AC_HELP_STRING([--enable-assertions],[add runtime sanity checks in the program]),,
81   [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
82         enable_assertions=yes;
83     else
84         enable_assertions=no;
85     fi;])
86 if test "x$enable_assertions" = xyes ; then
87    lyx_flags="assertions $lyx_flags"
88    AC_DEFINE(ENABLE_ASSERTIONS,1,
89     [Define if you want assertions to be enabled in the code])
90 fi
91
92 ### Library Files
93 dnl AC_CHECK_LIB(m, sin)
94
95 ### Add extra directories to check for libraries.
96 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
97 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
98 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
99
100 ### Add extra directories to check for include files.
101 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
102 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
103 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
104
105 ### Add both includes and libraries
106 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
107 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
108 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
109   LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
110
111 ### These are needed in windows
112 AC_CHECK_LIB(shlwapi, main, [LIBSHLWAPI=-lshlwapi])
113 AC_SUBST(LIBSHLWAPI)
114 AC_CHECK_LIB(gdi32, main)
115
116 AC_ARG_WITH(mythes,
117   [  --without-mythes        do not use the MyThes library],
118   [lyx_use_mythes=$withval])
119 if test x$lyx_use_mythes != xno; then
120 AC_CHECK_LIB(mythes, main,
121         [AC_DEFINE(HAVE_LIBMYTHES,1,[Define this if you have the MyThes library])
122          MYTHES_LIBS="-lmythes"
123          lyx_flags="mythes $lyx_flags"
124         ])
125 AC_CHECK_HEADER(mythes.hxx,[
126   ac_cv_header_mythes_h=yes
127   lyx_cv_mythes_h_location="<mythes.hxx>"])
128 AC_CHECK_HEADER(mythes/mythes.hxx,[
129   ac_cv_header_mythes_h=yes
130   lyx_cv_mythes_h_location="<mythes/mythes.hxx>"])
131 AC_DEFINE_UNQUOTED(MYTHES_H_LOCATION,$lyx_cv_mythes_h_location,[Location of mythes.hxx])
132 fi
133 AC_SUBST(MYTHES_LIBS)
134
135 AC_ARG_WITH(aiksaurus,
136   [  --without-aiksaurus     do not use the Aiksaurus library],
137   [lyx_use_aiksaurus=$withval])
138 if test x$lyx_use_aiksaurus != xno; then
139 AC_CHECK_LIB(Aiksaurus, main,
140         [AC_DEFINE(HAVE_LIBAIKSAURUS,1,[Define this if you have the AikSaurus library])
141          AIKSAURUS_LIBS="-lAiksaurus"
142          lyx_flags="aiksaurus $lyx_flags"
143         ])
144 AC_CHECK_HEADER(Aiksaurus.h,[
145   ac_cv_header_aiksaurus_h=yes
146   lyx_cv_aiksaurus_h_location="<Aiksaurus.h>"])
147 AC_CHECK_HEADER(Aiksaurus/Aiksaurus.h,[
148   ac_cv_header_aiksaurus_h=yes
149   lyx_cv_aiksaurus_h_location="<Aiksaurus/Aiksaurus.h>"])
150 AC_DEFINE_UNQUOTED(AIKSAURUS_H_LOCATION,$lyx_cv_aiksaurus_h_location,[Location of Aiksaurus.h])
151 fi
152 AC_SUBST(AIKSAURUS_LIBS)
153
154 AC_DEFINE(HAVE_THESAURUS, (HAVE_LIBMYTHES || HAVE_LIBAIKSAURUS),[Define this if you have a supported thesaurus library])
155
156 LYX_USE_INCLUDED_BOOST
157
158 # Needed for our char_type
159 AC_CHECK_SIZEOF(wchar_t)
160
161 ### We need iconv for unicode support (Qt4 frontend requires it too)
162 AM_ICONV
163 if test "$am_cv_func_iconv" = no; then
164   LYX_ERROR([Cannot find required library iconv])
165 else
166   LIBS="$LIBS $LIBICONV"
167 fi
168
169 ### check for compression support
170 AC_CHECK_HEADERS(zlib.h,
171  [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
172  [LYX_LIB_ERROR(zlib.h,zlib)])
173
174
175 ### check which frontend we want to use
176
177 dnl The code below is not in a macro, because this would cause big
178 dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
179 for frontend in $FRONTENDS ; do
180   case "$frontend" in
181     qt4)
182           QT4_DO_IT_ALL
183           FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
184           FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt4"
185           RPM_FRONTEND="qt4"
186           FRONTEND_INFO="${FRONTEND_INFO}\
187   Qt 4 Frontend:\n\
188       Qt 4 version:\t\t${QT4_VERSION}\n"
189 dnl qt 4 build will fail without moc or uic
190           if test -z "$MOC4"; then
191             LYX_ERROR([moc 4 binary not found !])
192           fi
193           if test -z "$UIC4"; then
194             LYX_ERROR([uic 4 binary not found !])
195           fi
196           if test -z "$QT4_LIB"; then
197             LYX_ERROR([qt 4 library not found !])
198           fi
199       ;;
200     *)
201           LYX_ERROR(Unknown frontend '$frontend');;
202   esac
203 done
204
205 # fix the value of the prefixes.
206 test "x$prefix" = xNONE && prefix=$default_prefix
207 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
208 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
209   LYX_WARNING([The installation prefix \"${prefix}\" contains a space, which
210    causes problems with the Makefiles. The installation will be done in
211    directory \"`pwd`/installprefix\" instead. Please move its contents to
212    the right place after installation.])
213   prefix=`pwd`/installprefix
214 fi
215
216 ### Setup GNU gettext
217 dnl GNU gettext is written in C
218 AC_LANG_PUSH(C)
219 dnl Dirty trick ahead: disable macro AC_GNU_SOURCE because it triggers a bug with autoconf 2.62.
220 dnl this can be removed if gettext is been updated to avoid that.
221 m4_undefine([AC_GNU_SOURCE])
222 m4_defun([AC_GNU_SOURCE],[])
223 AM_GNU_GETTEXT
224 AM_GNU_GETTEXT_VERSION([0.16.1])
225 AC_LANG_POP(C)
226
227 # some standard header files
228 AC_HEADER_DIRENT
229 AC_HEADER_MAJOR
230 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)
231
232 # some standard structures
233 AC_HEADER_STAT
234 AC_HEADER_TIME
235
236 # some standard types
237 AC_CHECK_TYPE(mode_t,[AC_DEFINE(HAVE_MODE_T, 1, [Define this to 1 if your compiler supports the mode_t type.])])
238 AC_TYPE_OFF_T
239 AC_TYPE_PID_T
240 AC_TYPE_SIGNAL
241 AC_TYPE_SIZE_T
242 AC_TYPE_UID_T
243
244 AC_CHECK_FUNCS(strerror)
245 LYX_CHECK_DECL(istreambuf_iterator, iterator)
246 LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
247
248 # Check the form of mkdir()
249 AC_FUNC_MKDIR
250
251 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
252 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
253 dnl We aim to remove this eventually, since we should test as much as
254 dnl possible with the compiler which will use the functions (JMarc)
255 AC_LANG_PUSH(C)
256 AC_CHECK_FUNCS(chmod close _close getpid _getpid lstat mkfifo mkstemp mktemp open _open pclose _pclose popen _popen readlink)
257 AC_LANG_POP(C)
258
259 LYX_CHECK_SPELL_ENGINES
260
261 lyx_client_subdir=true
262 AC_LANG_PUSH(C)
263 dnl LIBS already contains some X extra libs that may interfere.
264 save_LIBS="$LIBS"
265 LIBS=
266 AC_CHECK_FUNCS(fcntl,
267   [AC_SEARCH_LIBS([gethostbyname], [nsl])
268    AC_SEARCH_LIBS([socket], [socket], [],
269      [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
270                 [], [-lnsl])])],
271   [lyx_client_subdir=false])
272 AC_SUBST(SOCKET_LIBS,$LIBS)
273 LIBS="$save_LIBS"
274 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
275 AC_LANG_POP(C)
276
277 lyx_win_res=false;
278 case ${host} in
279     *mingw*|*cygwin*) lyx_win_res=true;;
280 esac
281 AM_CONDITIONAL(LYX_WIN_RESOURCE, $lyx_win_res)
282 LYX_SET_VERSION_INFO
283
284 AC_FUNC_SELECT_ARGTYPES
285
286 ### Some information on what just happened
287 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
288 real_pkgdatadir=`eval "echo \`eval \"echo \\\`eval \\\"echo ${pkgdatadir}\\\"\\\`\"\`"`
289 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
290 VERSION_INFO="Configuration\n\
291   Host type:                    ${host}\n\
292   Special build flags:          ${lyx_flags}\n\
293   C   Compiler:                 ${CC} ${CC_VERSION}\n\
294   C   Compiler LyX flags:       ${AM_CPPFLAGS} ${AM_CFLAGS}\n\
295   C   Compiler flags:           ${CPPFLAGS} ${CFLAGS}\n\
296   C++ Compiler:                 ${CXX} ${CXX_VERSION}\n\
297   C++ Compiler LyX flags:       ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
298   C++ Compiler flags:           ${CPPFLAGS} ${CXXFLAGS}\n\
299   Linker flags:                 ${AM_LDFLAGS}\n\
300   Linker user flags:            ${LDFLAGS}\n\
301 ${FRONTEND_INFO}\
302   Packaging:                    ${lyx_use_packaging}\n\
303   LyX binary dir:               ${real_bindir}\n\
304   LyX files dir:                ${real_pkgdatadir}\n"
305
306 AC_SUBST(VERSION_INFO)
307 AC_SUBST(RPM_FRONTEND)
308 AC_SUBST(AM_CPPFLAGS)
309 AC_SUBST(AM_CXXFLAGS)
310 AC_SUBST(AM_CFLAGS)
311 AC_SUBST(AM_LDFLAGS)
312 AC_SUBST(real_pkgdatadir)
313
314 ## Some config.h stuff
315
316 AH_TOP([
317 /* -*- C++ -*- */
318 /*
319  * \file config.h
320  * This file is part of LyX, the document processor.
321  * Licence details can be found in the file COPYING.
322  *
323  * This is the compilation configuration file for LyX.
324  * It was generated by autoconfs configure.
325  * You might want to change some of the defaults if something goes wrong
326  * during the compilation.
327  */
328
329 #ifndef _CONFIG_H
330 #define _CONFIG_H
331 ])
332
333 AH_BOTTOM([
334 /************************************************************
335  ** You should not need to change anything beyond this point */
336
337 #ifndef HAVE_STRERROR
338 #if defined(__cplusplus)
339 extern "C"
340 #endif
341 char * strerror(int n);
342 #endif
343
344 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
345 #  define USE_BOOST_FORMAT 1
346 #else
347 #  define USE_BOOST_FORMAT 0
348 #endif
349
350 #define BOOST_USER_CONFIG <config.h>
351
352 #if !defined(ENABLE_ASSERTIONS)
353 #  define BOOST_DISABLE_ASSERTS 1
354 #endif
355 #define BOOST_ENABLE_ASSERT_HANDLER 1
356
357 #define BOOST_DISABLE_THREADS 1
358 #define BOOST_NO_WREGEX 1
359 #define BOOST_NO_WSTRING 1
360
361 #ifdef __CYGWIN__
362 #  define BOOST_POSIX 1
363 #  define BOOST_POSIX_API 1
364 #  define BOOST_POSIX_PATH 1
365 #endif
366
367 #if defined(HAVE_NEWAPIS_H)
368 #  define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
369 #endif
370
371 /*
372  * the FreeBSD libc uses UCS4, but libstdc++ has no proper wchar_t
373  * support compiled in:
374  * http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#3_9
375  * And we are not interested at all what libc
376  * does: What we need is a 32bit wide wchar_t, and a libstdc++ that
377  * has the needed wchar_t support and uses UCS4. Whether it
378  * implements this with the help of libc, or whether it has own code
379  * does not matter for us, because we do not use libc directly (Georg)
380 */
381 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
382 #  define USE_WCHAR_T
383 #endif
384
385 #endif
386 ])
387
388
389 AC_ARG_ENABLE(monolithic-boost,
390   AC_HELP_STRING([--enable-monolithic-boost],
391                 [Use monolithic boost compilations]),,
392   [enable_monolithic_boost=no])
393 AM_CONDITIONAL(MONOLITHIC_BOOST, test "$enable_monolithic_boost" = "yes")
394
395 AC_ARG_ENABLE(monolithic-client,
396   AC_HELP_STRING([--enable-monolithic-client],
397                 [Use monolithic client compilations]),,
398   [enable_monolithic_client=no])
399 AM_CONDITIONAL(MONOLITHIC_CLIENT, test "$enable_monolithic_client" = "yes")
400
401 AC_ARG_ENABLE(monolithic-insets,
402   AC_HELP_STRING([--enable-monolithic-insets],
403                 [Use monolithic insets compilations]),,
404   [enable_monolithic_insets=no])
405 AM_CONDITIONAL(MONOLITHIC_INSETS, test "$enable_monolithic_insets" = "yes")
406
407 AC_ARG_ENABLE(monolithic-mathed,
408   AC_HELP_STRING([--enable-monolithic-mathed],
409                 [Use monolithic mathed compilations]),,
410   [enable_monolithic_mathed=no])
411 AM_CONDITIONAL(MONOLITHIC_MATHED, test "$enable_monolithic_mathed" = "yes")
412
413 AC_ARG_ENABLE(monolithic-core,
414   AC_HELP_STRING([--enable-monolithic-core],
415                 [Use monolithic core files compilations]),,
416   [enable_monolithic_core=no])
417 AM_CONDITIONAL(MONOLITHIC_CORE, test "$enable_monolithic_core" = "yes")
418
419 AC_ARG_ENABLE(monolithic-tex2lyx,
420   AC_HELP_STRING([--enable-monolithic-tex2lyx],
421                 [Use monolithic tex2lyx compilations]),,
422   [enable_monolithic_tex2lyx=no])
423 AM_CONDITIONAL(MONOLITHIC_TEX2LYX, test "$enable_monolithic_tex2lyx" = "yes")
424
425 AC_ARG_ENABLE(monolithic-frontend-qt4,
426   AC_HELP_STRING([--enable-monolithic-frontend-qt4],
427                 [Use monolithic compilation of the Qt 4 frontend. Only recommended with > 512 MB of RAM]),,
428   [enable_monolithic_frontend_qt4=no])
429 AM_CONDITIONAL(MONOLITHIC_FRONTEND_QT4, test "$enable_monolithic_frontend_qt4" = "yes")
430
431 MSYS_AC_CANONICAL_PATH(lyx_abs_top_srcdir, ${srcdir})
432 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_localedir, ${real_localedir})
433 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_datadir, ${real_pkgdatadir})
434
435 AC_DEFINE_UNQUOTED([LYX_ABS_TOP_SRCDIR],
436         "${lyx_abs_top_srcdir}", [Top source directory])
437 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_LOCALEDIR],
438         "${lyx_abs_installed_localedir}",[Hard coded locale directory])
439 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_DATADIR],
440         "${lyx_abs_installed_datadir}",[Hard system support directory])
441 AC_DEFINE_UNQUOTED([PROGRAM_SUFFIX],
442         "${version_suffix}",[Program version suffix])
443
444 AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
445 AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
446 AC_DEFINE_UNQUOTED([LYX_DIR_VER],"$lyx_dir_ver",[Versioned env var for system dir])
447 AC_DEFINE_UNQUOTED([LYX_USERDIR_VER],"$lyx_userdir_ver",[Versioned env var for user dir])
448 AC_DEFINE_UNQUOTED([LYX_MAJOR_VERSION],$lyx_major,[Major version number])
449 AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
450 AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
451 AC_DEFINE_UNQUOTED([LYX_RELEASE_PATCH],$lyx_patch,[Patch version number])
452
453 AC_CONFIG_FILES([Makefile \
454       lyx.1:lyx.1in \
455       boost/Makefile \
456       config/Makefile \
457       development/Makefile \
458       development/MacOSX/Makefile \
459       development/MacOSX/Info.plist \
460       development/MacOSX/lyxrc.dist \
461       development/MacOSX/spotlight/Makefile \
462       development/lyx.spec \
463       intl/Makefile \
464       lib/Makefile \
465       lib/doc/Makefile \
466       lib/lyx2lyx/lyx2lyx_version.py \
467       lib/lyx2lyx/Makefile \
468       m4/Makefile \
469       po/Makefile.in \
470       sourcedoc/Doxyfile \
471       sourcedoc/Makefile \
472       src/client/Makefile \
473       src/Makefile \
474       src/tex2lyx/Makefile \
475       src/support/Makefile \
476       src/frontends/Makefile \
477       src/frontends/qt4/Makefile
478 ])
479
480
481 AC_OUTPUT
482
483 # show version information
484 echo
485 printf "$VERSION_INFO"
486 echo
487
488 # Display a final warning if there has been a LYX_ERROR
489 LYX_CHECK_ERRORS