1 dnl 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, ["Wed, Jun 27, 2007"])
6 AC_CONFIG_SRCDIR(src/main.cpp)
7 AC_CONFIG_HEADERS([src/config.h])
9 AC_CONFIG_AUX_DIR(config)
11 # First check the version
14 # Check how the files should be packaged
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
28 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.5])
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}
36 ### Provide a dummy POTFILES.in in po in order to mark it as a PO directory
37 test -f ${srcdir}/po/POTFILES.in || touch ${srcdir}/po/POTFILES.in
39 ### Check for programs
44 test "$AWK" = gawk && AWK="gawk --posix"
47 AC_CHECK_PROG(KPSEWHICH, kpsewhich, kpsewhich, :)
48 if test "x$KPSEWHICH" = xkpsewhich ; then
49 AC_DEFINE(HAVE_KPSEWHICH, 1,
50 [Define this if you have the kpsewhich program working on your system.])
52 AC_CHECK_PROGS(M4, gm4 gnum4 m4, m4)
54 # Check for installed python
55 AM_PATH_PYTHON(2.3,, :)
57 # Work around a problem in automake 1.4: when invoking install-strip,
58 # INSTALL_PROGRAM is changed to 'install -s', and since
59 # INSTALL_SCRIPT==INSTALL_PROGRAM, we get errors with fileutils-4.0
60 # which returns an error condition when stripping fails.
61 INSTALL_SCRIPT='${INSTALL}'
63 ### we will also need a C compiler to compile GNU gettext
66 ### check for special systems
70 ### we need to know the byte order for unicode conversions
73 ### check which frontend we want to use
76 ### Check for a C++ compiler
78 ### Some checks on what the C++ compiler can(not) do
80 dnl we do not need that currently (and probably all our supported
81 dnl compiler allow that)
86 dnl we disable rtti for now
88 dnl AC_CHECK_HEADERS(ostream istream sstream locale limits ios)
89 dnl LYX_CXX_STL_MODERN_STREAMS
91 ### and now some special lyx flags.
92 AC_ARG_ENABLE(assertions,
93 AC_HELP_STRING([--enable-assertions],[add runtime sanity checks in the program]),,
94 [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
95 enable_assertions=yes;
99 if test "x$enable_assertions" = xyes ; then
100 lyx_flags="assertions $lyx_flags"
101 AC_DEFINE(ENABLE_ASSERTIONS,1,
102 [Define if you want assertions to be enabled in the code])
106 dnl AC_CHECK_LIB(m, sin)
108 ### Add extra directories to check for libraries.
109 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
110 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
111 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
113 ### Add extra directories to check for include files.
114 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
115 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
116 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
118 ### Add both includes and libraries
119 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
120 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
121 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
122 LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
124 ### These are needed in windows
125 AC_CHECK_LIB(shlwapi, main, [LIBSHLWAPI=-lshlwapi])
127 AC_CHECK_LIB(gdi32, main)
129 AC_ARG_WITH(aiksaurus,
130 [ --without-aiksaurus do not use the Aiksaurus library],
131 [lyx_use_aiksaurus=$withval])
132 if test x$lyx_use_aiksaurus != xno; then
133 AC_CHECK_LIB(Aiksaurus, main,
134 [AC_DEFINE(HAVE_LIBAIKSAURUS,1,[Define this if you have the AikSaurus library])
135 AIKSAURUS_LIBS="-lAiksaurus"
136 lyx_flags="aiksaurus $lyx_flags"
138 AC_CHECK_HEADER(Aiksaurus.h,[
139 ac_cv_header_aiksaurus_h=yes
140 lyx_cv_aiksaurus_h_location="<Aiksaurus.h>"])
141 AC_CHECK_HEADER(Aiksaurus/Aiksaurus.h,[
142 ac_cv_header_aiksaurus_h=yes
143 lyx_cv_aiksaurus_h_location="<Aiksaurus/Aiksaurus.h>"])
144 AC_DEFINE_UNQUOTED(AIKSAURUS_H_LOCATION,$lyx_cv_aiksaurus_h_location,[Location of Aiksaurus.h])
146 AC_SUBST(AIKSAURUS_LIBS)
148 LYX_USE_INCLUDED_BOOST
150 # Needed for our char_type
151 AC_CHECK_SIZEOF(wchar_t)
154 dnl Dirty trick ahead: disable libtool checking for a fortran compiler
155 dnl see http://permalink.gmane.org/gmane.comp.gnu.libtool.general/6699
156 dnl Note that this will reportedly not be needed with libtool 2.0
157 m4_undefine([AC_PROG_F77])
158 m4_defun([AC_PROG_F77],[])
166 ### We need iconv for unicode support (Qt4 frontend requires it too)
168 if test "$am_cv_func_iconv" = no; then
169 LYX_ERROR([Cannot find required library iconv])
171 LIBS="$LIBS $LIBICONV"
174 ### check for compression support
175 AC_CHECK_HEADERS(zlib.h,
176 [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
177 [LYX_LIB_ERROR(zlib.h,zlib)])
180 ### Check for X libraries
183 yes) LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
184 CPPFLAGS="$CPPFLAGS $X_CFLAGS";;
186 [Cannot find X window libraries and/or headers. Check your installation.
187 If you use a Linux system, check that you have installed
188 the development tools.]);;
192 ### check which frontend we want to use
194 dnl The code below is not in a macro, because this would cause big
195 dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
196 for frontend in $FRONTENDS ; do
200 FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
201 FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt4"
203 FRONTEND_INFO="${FRONTEND_INFO}\
205 Qt 4 version:\t\t${QT4_VERSION}\n"
206 dnl qt 4 build will fail without moc or uic
207 if test -z "$MOC4"; then
208 LYX_ERROR([moc 4 binary not found !])
210 if test -z "$UIC4"; then
211 LYX_ERROR([uic 4 binary not found !])
213 if test -z "$QT4_LIB"; then
214 LYX_ERROR([qt 4 library not found !])
218 LYX_ERROR(Unknown frontend '$frontend');;
222 # fix the value of the prefixes.
223 test "x$prefix" = xNONE && prefix=$default_prefix
224 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
225 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
226 LYX_WARNING([The installation prefix \"${prefix}\" contains a space, which
227 causes problems with the Makefiles. The installation will be done in
228 directory \"`pwd`/installprefix\" instead. Please move its contents to
229 the right place after installation.])
230 prefix=`pwd`/installprefix
233 ### Setup GNU gettext
234 dnl GNU gettext is written in C
239 # some standard header files
242 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)
244 # some standard structures
248 # some standard types
249 AC_CHECK_TYPE(mode_t,[AC_DEFINE(HAVE_MODE_T, 1, [Define this to 1 if your compiler supports the mode_t type.])])
256 AC_CHECK_FUNCS(strerror)
257 LYX_CHECK_DECL(istreambuf_iterator, iterator)
258 LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
260 # Check the form of mkdir()
263 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
264 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
265 dnl We aim to remove this eventually, since we should test as much as
266 dnl possible with the compiler which will use the functions (JMarc)
268 AC_CHECK_FUNCS(chmod close _close getpid _getpid lstat mkfifo mkstemp mktemp open _open pclose _pclose popen _popen readlink)
271 LYX_CHECK_SPELL_ENGINES
273 lyx_client_subdir=true
275 dnl LIBS already contains some X extra libs that may interfere.
278 AC_CHECK_FUNCS(fcntl,
279 [AC_SEARCH_LIBS([gethostbyname], [nsl])
280 AC_SEARCH_LIBS([socket], [socket], [],
281 [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
283 [lyx_client_subdir=false])
284 AC_SUBST(SOCKET_LIBS,$LIBS)
286 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
291 *mingw*|*cygwin*) lyx_win_res=true;;
293 AM_CONDITIONAL(LYX_WIN_RESOURCE, $lyx_win_res)
296 AC_FUNC_SELECT_ARGTYPES
298 ### Some information on what just happened
299 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
300 real_pkgdatadir=`eval "echo \`eval \"echo \\\`eval \\\"echo ${pkgdatadir}\\\"\\\`\"\`"`
301 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
302 VERSION_INFO="Configuration\n\
303 Host type: ${host}\n\
304 Special build flags: ${lyx_flags}\n\
305 C Compiler: ${CC} ${CC_VERSION}\n\
306 C Compiler LyX flags: ${AM_CPPFLAGS} ${AM_CFLAGS}\n\
307 C Compiler flags: ${CPPFLAGS} ${CFLAGS}\n\
308 C++ Compiler: ${CXX} ${CXX_VERSION}\n\
309 C++ Compiler LyX flags: ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
310 C++ Compiler flags: ${CPPFLAGS} ${CXXFLAGS}\n\
311 Linker flags: ${AM_LDFLAGS}\n\
312 Linker user flags: ${LDFLAGS}\n\
314 Packaging: ${lyx_use_packaging}\n\
315 LyX binary dir: ${real_bindir}\n\
316 LyX files dir: ${real_pkgdatadir}\n"
318 AC_SUBST(VERSION_INFO)
319 AC_SUBST(RPM_FRONTEND)
320 AC_SUBST(AM_CPPFLAGS)
321 AC_SUBST(AM_CXXFLAGS)
325 ## Some config.h stuff
331 * This file is part of LyX, the document processor.
332 * Licence details can be found in the file COPYING.
334 * This is the compilation configuration file for LyX.
335 * It was generated by autoconfs configure.
336 * You might want to change some of the defaults if something goes wrong
337 * during the compilation.
345 /************************************************************
346 ** You should not need to change anything beyond this point */
348 #ifndef HAVE_STRERROR
349 #if defined(__cplusplus)
352 char * strerror(int n);
355 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
356 # define USE_BOOST_FORMAT 1
358 # define USE_BOOST_FORMAT 0
361 #define BOOST_USER_CONFIG <config.h>
363 #if !defined(ENABLE_ASSERTIONS)
364 # define BOOST_DISABLE_ASSERTS 1
366 #define BOOST_ENABLE_ASSERT_HANDLER 1
368 #define BOOST_DISABLE_THREADS 1
369 #define BOOST_NO_WREGEX 1
370 #define BOOST_NO_WSTRING 1
373 # define BOOST_POSIX 1
374 # define BOOST_POSIX_API 1
375 # define BOOST_POSIX_PATH 1
378 #if defined(HAVE_NEWAPIS_H)
379 # define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
383 * the FreeBSD libc uses UCS4, but libstdc++ has no proper wchar_t
384 * support compiled in:
385 * http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#3_9
386 * And we are not interested at all what libc
387 * does: What we need is a 32bit wide wchar_t, and a libstdc++ that
388 * has the needed wchar_t support and uses UCS4. Whether it
389 * implements this with the help of libc, or whether it has own code
390 * does not matter for us, because we do not use libc directly (Georg)
392 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
401 AC_HELP_STRING([--with-qmake],
402 [Use qmake instead of automake to generate Makefiles]),,
405 AC_ARG_ENABLE(monolithic-boost,
406 AC_HELP_STRING([--enable-monolithic-boost],
407 [Use monolithic boost compilations]),,
408 [enable_monolithic_boost=no])
409 AM_CONDITIONAL(MONOLITHIC_BOOST, test "$enable_monolithic_boost" = "yes")
411 AC_ARG_ENABLE(monolithic-client,
412 AC_HELP_STRING([--enable-monolithic-client],
413 [Use monolithic client compilations]),,
414 [enable_monolithic_client=no])
415 AM_CONDITIONAL(MONOLITHIC_CLIENT, test "$enable_monolithic_client" = "yes")
417 AC_ARG_ENABLE(monolithic-controllers,
418 AC_HELP_STRING([--enable-monolithic-controllers],
419 [Use monolithic controllers compilations]),,
420 [enable_monolithic_controllers=no])
421 AM_CONDITIONAL(MONOLITHIC_CONTROLLERS, test "$enable_monolithic_controllers" = "yes")
423 AC_ARG_ENABLE(monolithic-insets,
424 AC_HELP_STRING([--enable-monolithic-insets],
425 [Use monolithic insets compilations]),,
426 [enable_monolithic_insets=no])
427 AM_CONDITIONAL(MONOLITHIC_INSETS, test "$enable_monolithic_insets" = "yes")
429 AC_ARG_ENABLE(monolithic-mathed,
430 AC_HELP_STRING([--enable-monolithic-mathed],
431 [Use monolithic mathed compilations]),,
432 [enable_monolithic_mathed=no])
433 AM_CONDITIONAL(MONOLITHIC_MATHED, test "$enable_monolithic_mathed" = "yes")
435 AC_ARG_ENABLE(monolithic-core,
436 AC_HELP_STRING([--enable-monolithic-core],
437 [Use monolithic core files compilations]),,
438 [enable_monolithic_core=no])
439 AM_CONDITIONAL(MONOLITHIC_CORE, test "$enable_monolithic_core" = "yes")
441 AC_ARG_ENABLE(monolithic-tex2lyx,
442 AC_HELP_STRING([--enable-monolithic-tex2lyx],
443 [Use monolithic tex2lyx compilations]),,
444 [enable_monolithic_tex2lyx=no])
445 AM_CONDITIONAL(MONOLITHIC_TEX2LYX, test "$enable_monolithic_tex2lyx" = "yes")
447 AC_ARG_ENABLE(monolithic-frontend-qt4,
448 AC_HELP_STRING([--enable-monolithic-frontend-qt4],
449 [Use monolithic compilation of the Qt 4 frontend. Only recommended with > 512 MB of RAM]),,
450 [enable_monolithic_frontend_qt4=no])
451 AM_CONDITIONAL(MONOLITHIC_FRONTEND_QT4, test "$enable_monolithic_frontend_qt4" = "yes")
453 MSYS_AC_CANONICAL_PATH(lyx_abs_top_srcdir, ${srcdir})
454 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_localedir, ${real_localedir})
455 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_datadir, ${real_pkgdatadir})
457 AC_DEFINE_UNQUOTED([LYX_ABS_TOP_SRCDIR],
458 "${lyx_abs_top_srcdir}", [Top source directory])
459 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_LOCALEDIR],
460 "${lyx_abs_installed_localedir}",[Hard coded locale directory])
461 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_DATADIR],
462 "${lyx_abs_installed_datadir}",[Hard system support directory])
463 AC_DEFINE_UNQUOTED([PROGRAM_SUFFIX],
464 "${version_suffix}",[Program version suffix])
466 AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
467 AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
468 AC_DEFINE_UNQUOTED([LYX_MAJOR_VERSION],$lyx_major,[Major version number])
469 AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
470 AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
471 AC_DEFINE_UNQUOTED([LYX_RELEASE_PATCH],$lyx_patch,[Patch version number])
473 AC_CONFIG_FILES([Makefile
476 development/Makefile \
477 development/MacOSX/Makefile \
478 development/MacOSX/Info.plist \
479 development/MacOSX/lyxrc.dist \
480 development/MacOSX/spotlight/Makefile \
481 development/lyx.spec \
485 lib/lyx2lyx/lyx2lyx_version.py \
486 lib/lyx2lyx/Makefile \
491 src/client/Makefile \
493 src/tex2lyx/Makefile \
494 src/support/Makefile \
495 src/frontends/Makefile \
496 src/frontends/controllers/Makefile \
497 src/frontends/qt4/Makefile
503 if test x$with_qmake = xyes ; then
504 echo "CONFIGURE WITH QMAKE ONLY"
505 if test x$srcdir = x ; then
506 echo "ONLY FOR OUT-OF-TREE-BUILDS POSSIBLE"
509 rm src/client/Makefile
511 rm src/tex2lyx/Makefile
512 rm src/support/Makefile
513 rm src/frontends/Makefile
514 rm src/frontends/controllers/Makefile
515 rm src/frontends/qt4/Makefile
517 rm -rf src/client/.deps
519 rm -rf src/tex2lyx/.deps
520 rm -rf src/support/.deps
521 rm -rf src/frontends/.deps
522 rm -rf src/frontends/controllers/.deps
523 rm -rf src/frontends/qt4/.deps
524 ${srcdir}/development/qmake/doit
529 # show version information
531 printf "$VERSION_INFO"
534 # Display a final warning if there has been a LYX_ERROR