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