1 dnl Process with autoconf to generate configure script -*- sh -*-
3 AC_INIT(LyX,1.5.0svn,[lyx-devel@lists.lyx.org],[lyx])
4 AC_SUBST(LYX_DATE, ["Fri, Jul 13, 2006"])
6 AC_CONFIG_SRCDIR(src/main.C)
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 tar-ustar no-define 1.9])
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 ### Check for programs
41 test "$AWK" = gawk && AWK="gawk --posix"
44 AC_CHECK_PROG(KPSEWHICH, kpsewhich, kpsewhich, :)
45 if test "x$KPSEWHICH" = xkpsewhich ; then
46 AC_DEFINE(HAVE_KPSEWHICH, 1,
47 [Define this if you have the kpsewhich program working on your system.])
49 AC_CHECK_PROGS(M4, gm4 gnum4 m4, m4)
51 # Check for installed python
52 AM_PATH_PYTHON(2.3,, :)
54 # Work around a problem in automake 1.4: when invoking install-strip,
55 # INSTALL_PROGRAM is changed to 'install -s', and since
56 # INSTALL_SCRIPT==INSTALL_PROGRAM, we get errors with fileutils-4.0
57 # which returns an error condition when stripping fails.
58 INSTALL_SCRIPT='${INSTALL}'
60 ### we will also need a C compiler to compile GNU gettext
63 ### check for special systems
67 ### check which frontend we want to use
70 ### Check for a C++ compiler
72 ### Some checks on what the C++ compiler can(not) do
74 dnl we do not need that currently (and probably all our supported
75 dnl compiler allow that)
80 dnl we disable rtti for now
82 AC_CHECK_HEADERS(ostream istream sstream locale limits ios)
83 LYX_CXX_STL_MODERN_STREAMS
85 ### and now some special lyx flags.
86 AC_ARG_ENABLE(assertions,
87 AC_HELP_STRING([--enable-assertions],[add runtime sanity checks in the program]),,
88 [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
89 enable_assertions=yes;
93 if test "x$enable_assertions" = xyes ; then
94 lyx_flags="assertions $lyx_flags"
95 AC_DEFINE(ENABLE_ASSERTIONS,1,
96 [Define if you want assertions to be enabled in the code])
100 dnl by testing these we check if it is ok to have
101 dnl -lc and -lm as args to the compiler
103 AC_CHECK_LIB(c, fopen)
105 ### Add extra directories to check for libraries.
106 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
107 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
108 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
110 ### Add extra directories to check for include files.
111 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
112 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
113 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
115 ### Add both includes and libraries
116 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
117 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
118 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
119 LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
121 ### These are needed in windows
122 AC_CHECK_LIB(shlwapi, main, [LIBSHLWAPI=-lshlwapi])
124 AC_CHECK_LIB(gdi32, main)
126 AC_ARG_WITH(aiksaurus,
127 [ --without-aiksaurus do not use the Aiksaurus library],
128 [lyx_use_aiksaurus=$withval])
129 if test x$lyx_use_aiksaurus != xno; then
130 AC_CHECK_LIB(Aiksaurus, main,
131 [AC_DEFINE(HAVE_LIBAIKSAURUS,1,[Define this if you have the AikSaurus library])
132 AIKSAURUS_LIBS="-lAiksaurus"
133 lyx_flags="aiksaurus $lyx_flags"
135 AC_CHECK_HEADER(Aiksaurus.h,[
136 ac_cv_header_aiksaurus_h=yes
137 lyx_cv_aiksaurus_h_location="<Aiksaurus.h>"])
138 AC_CHECK_HEADER(Aiksaurus/Aiksaurus.h,[
139 ac_cv_header_aiksaurus_h=yes
140 lyx_cv_aiksaurus_h_location="<Aiksaurus/Aiksaurus.h>"])
141 AC_DEFINE_UNQUOTED(AIKSAURUS_H_LOCATION,$lyx_cv_aiksaurus_h_location,[Location of Aiksaurus.h])
143 AC_SUBST(AIKSAURUS_LIBS)
145 LYX_USE_INCLUDED_BOOST
148 dnl Dirty trick ahead: disable libtool checking for a fortran compiler
149 dnl see http://permalink.gmane.org/gmane.comp.gnu.libtool.general/6699
150 dnl Note that this will reportedly not be needed with libtool 2.0
151 m4_undefine([AC_PROG_F77])
152 m4_defun([AC_PROG_F77],[])
158 ### Check for X libraries
161 yes) LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
162 CPPFLAGS="$CPPFLAGS $X_CFLAGS";;
164 [Cannot find X window libraries and/or headers. Check your installation.
165 If you use a Linux system, check that you have installed
166 the development tools.]);;
170 ### check which frontend we want to use
172 dnl The code below is not in a macro, because this would cause big
173 dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
174 for frontend in $FRONTENDS ; do
177 PKG_CHECK_MODULES(GTK_FRONTEND, gtkmm-2.4 libglademm-2.4 xft)
178 FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-gtk\$(EXEEXT)"
179 FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS gtk"
181 GTKMM_VERSION=`pkg-config --modversion gtkmm-2.4`
182 LIBGLADEMM_VERSION=`pkg-config --modversion libglademm-2.4`
183 FRONTEND_INFO="${FRONTEND_INFO}\
185 libgtkmm version:\t\t${GTKMM_VERSION}\n\
186 libglademm version:\t\t${LIBGLADEMM_VERSION}\n"
191 FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt3\$(EXEEXT)"
192 FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt3"
194 FRONTEND_INFO="${FRONTEND_INFO}\
196 Qt version:\t\t${QT_VERSION}\n"
197 dnl qt build will fail without moc or uic
198 if test -z "$MOC"; then
199 LYX_ERROR([moc binary not found !])
201 if test -z "$UIC"; then
202 LYX_ERROR([uic binary not found !])
204 if test -z "$QT_LIB"; then
205 LYX_ERROR([qt library not found !])
210 FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
211 FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt4"
213 FRONTEND_INFO="${FRONTEND_INFO}\
215 Qt 4 version:\t\t${QT4_VERSION}\n"
216 dnl qt 4 build will fail without moc or uic
217 if test -z "$MOC4"; then
218 LYX_ERROR([moc 4 binary not found !])
220 if test -z "$UIC4"; then
221 LYX_ERROR([uic 4 binary not found !])
223 if test -z "$QT4_LIB"; then
224 LYX_ERROR([qt 4 library not found !])
228 LYX_ERROR(Unknown frontend '$frontend');;
232 # fix the value of the prefixes.
233 test "x$prefix" = xNONE && prefix=$default_prefix
234 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
235 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
236 LYX_WARNING([The installation prefix \"${prefix}\" contains a space, which
237 causes problems with the Makefiles. The installation will be done in
238 directory \"`pwd`/installprefix\" instead. Please move its contents to
239 the right place after installation.])
240 prefix=`pwd`/installprefix
243 ### We need iconv for unicode support
245 if test "$am_cv_func_iconv" = no; then
246 LYX_ERROR([Cannot find required library iconv])
249 ### Setup GNU gettext
250 dnl GNUÂ gettext is written in C
255 # some standard header files
258 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h strings.h locale.h utime.h sys/utime.h io.h process.h NewAPIs.h)
260 # some standard structures
264 # some standard types
272 AC_CHECK_FUNCS(strerror)
273 LYX_CHECK_DECL(istreambuf_iterator, iterator)
274 LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
276 # Check the form of mkdir()
279 # check for compression support
280 AC_CHECK_HEADERS(zlib.h,
281 [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
282 [LYX_LIB_ERROR(zlib.h,zlib)])
284 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
285 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
286 dnl We aim to remove this eventually, since we should test as much as
287 dnl possible with the compiler which will use the functions (JMarc)
289 AC_CHECK_FUNCS(close _close getpid _getpid lstat mkfifo mkstemp mktemp open _open pclose _pclose popen _popen readlink)
292 LYX_CHECK_SPELL_ENGINES
294 lyx_client_subdir=true
296 dnl LIBS already contains some X extra libs that may interfere.
299 AC_CHECK_FUNCS(fcntl,
300 [AC_SEARCH_LIBS([gethostbyname], [nsl])
301 AC_SEARCH_LIBS([socket], [socket], [],
302 [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
304 [lyx_client_subdir=false])
305 AC_SUBST(SOCKET_LIBS,$LIBS)
307 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
310 AC_FUNC_SELECT_ARGTYPES
312 ### Some information on what just happened
313 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
314 real_pkgdatadir=`eval "echo \`eval \"echo ${pkgdatadir}\"\`"`
315 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
316 VERSION_INFO="Configuration\n\
317 Host type: ${host}\n\
318 Special build flags: ${lyx_flags}\n\
319 C Compiler: ${CC} ${CC_VERSION}\n\
320 C Compiler LyX flags: ${AM_CPPFLAGS} ${AM_CFLAGS}\n\
321 C Compiler flags: ${CPPFLAGS} ${CFLAGS}\n\
322 C++ Compiler: ${CXX} ${CXX_VERSION}\n\
323 C++ Compiler LyX flags: ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
324 C++ Compiler flags: ${CPPFLAGS} ${CXXFLAGS}\n\
325 Linker flags: ${AM_LDFLAGS}\n\
326 Linker user flags: ${LDFLAGS}\n\
328 Packaging: ${lyx_use_packaging}\n\
329 LyX binary dir: ${real_bindir}\n\
330 LyX files dir: ${real_pkgdatadir}\n"
332 MSYS_AC_CANONICAL_PATH(LYX_ABS_TOP_SRCDIR, ${srcdir})
333 MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_LOCALEDIR, ${real_localedir})
334 MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_DATADIR, ${real_pkgdatadir})
336 AC_SUBST(VERSION_INFO)
337 AC_SUBST(RPM_FRONTEND)
338 AC_SUBST(AM_CPPFLAGS)
339 AC_SUBST(AM_CXXFLAGS)
342 AC_SUBST(LYX_ABS_TOP_SRCDIR)
343 AC_SUBST(LYX_ABS_INSTALLED_LOCALEDIR)
344 AC_SUBST(LYX_ABS_INSTALLED_DATADIR)
346 ## Some config.h stuff
352 * This file is part of LyX, the document processor.
353 * Licence details can be found in the file COPYING.
355 * This is the compilation configuration file for LyX.
356 * It was generated by autoconfs configure.
357 * You might want to change some of the defaults if something goes wrong
358 * during the compilation.
366 /************************************************************
367 ** You should not need to change anything beyond this point */
369 #ifndef HAVE_STRERROR
370 #if defined(__cplusplus)
373 char * strerror(int n);
377 #ifndef HAVE_DECL_MKSTEMP
378 #if defined(__cplusplus)
385 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
386 # define USE_BOOST_FORMAT 1
388 # define USE_BOOST_FORMAT 0
391 #define BOOST_USER_CONFIG <config.h>
393 #if !defined(ENABLE_ASSERTIONS)
394 # define BOOST_DISABLE_ASSERTS 1
396 #define BOOST_ENABLE_ASSERT_HANDLER 1
398 #define BOOST_DISABLE_THREADS 1
399 #define BOOST_NO_WREGEX 1
400 #define BOOST_NO_WSTRING 1
403 # define BOOST_POSIX 1
406 #if defined(HAVE_NEWAPIS_H)
407 # define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
414 AC_CONFIG_FILES([Makefile m4/Makefile \
416 boost/libs/Makefile \
417 boost/libs/filesystem/Makefile \
418 boost/libs/filesystem/src/Makefile \
419 boost/libs/iostreams/Makefile \
420 boost/libs/iostreams/src/Makefile \
421 boost/libs/regex/Makefile \
422 boost/libs/regex/src/Makefile \
423 boost/libs/signals/Makefile \
424 boost/libs/signals/src/Makefile \
426 development/Makefile \
427 development/lyx.spec \
430 lib/lyx2lyx/lyx2lyx_version.py \
431 lib/lyx2lyx/Makefile \
436 src/client/Makefile \
438 src/version.C-tmp:src/version.C.in \
439 src/tex2lyx/Makefile \
440 src/mathed/Makefile \
441 src/graphics/Makefile \
442 src/insets/Makefile \
443 src/support/Makefile \
444 src/support/tests/Makefile \
445 src/frontends/Makefile \
446 src/frontends/controllers/Makefile \
447 src/frontends/controllers/tests/Makefile \
448 src/frontends/gtk/Makefile \
449 src/frontends/gtk/gimages/Makefile \
450 src/frontends/gtk/glade/Makefile \
451 src/frontends/qt3/Makefile \
452 src/frontends/qt3/ui/Makefile \
453 src/frontends/qt3/ui/moc/Makefile \
454 src/frontends/qt4/Makefile \
455 src/frontends/qt4/ui/Makefile \
459 # show version information
461 printf "$VERSION_INFO"
464 # Display a final warning if there has been a LYX_ERROR