1 dnl Process with autoconf to generate configure script -*- sh -*-
3 AC_INIT(LyX,1.4.0svn,[lyx-devel@lists.lyx.org],[lyx])
5 AC_CONFIG_SRCDIR(src/main.C)
6 AC_CONFIG_HEADERS([src/config.h])
8 AC_CONFIG_AUX_DIR(config)
10 # First check the version
13 # Check how the files should be packaged
16 # We need to define these variables here and the no-define option of
17 # AM_INIT_AUTOMAKE above because we alter $PACKAGE in LYX_USE_PACKAGING.
18 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
20 dnl default maintainer mode to true for development versions
21 if test "${enable_maintainer_mode+set}" != set; then
22 enable_maintainer_mode=$lyx_devel_version
27 AM_INIT_AUTOMAKE([foreign dist-bzip2 tar-ustar no-define 1.9])
30 ### Set the execute permissions of the various scripts correctly
31 for file in config/install-sh config/mkinstalldirs lib/configure ; do
32 chmod 755 ${srcdir}/${file}
35 ### Check for programs
40 test "$AWK" = gawk && AWK="gawk --posix"
43 AC_CHECK_PROG(KPSEWHICH, kpsewhich, kpsewhich, :)
44 if test "x$KPSEWHICH" = xkpsewhich ; then
45 AC_DEFINE(HAVE_KPSEWHICH, 1,
46 [Define this if you have the kpsewhich program working on your system.])
48 AC_CHECK_PROGS(M4, gm4 gnum4 m4, m4)
50 # Check for installed python
51 AM_PATH_PYTHON(1.5.2,, :)
53 # Work around a problem in automake 1.4: when invoking install-strip,
54 # INSTALL_PROGRAM is changed to 'install -s', and since
55 # INSTALL_SCRIPT==INSTALL_PROGRAM, we get errors with fileutils-4.0
56 # which returns an error condition when stripping fails.
57 INSTALL_SCRIPT='${INSTALL}'
59 ### we will also need a C compiler to compile GNU gettext
62 ### check for special systems
66 ### check which frontend we want to use
69 ### Check for a C++ compiler
71 ### Some checks on what the C++ compiler can(not) do
73 dnl we do not need that currently (and probably all our supported
74 dnl compiler allow that)
79 dnl we disable rtti for now
81 AC_CHECK_HEADERS(ostream istream sstream locale limits ios)
82 LYX_CXX_STL_MODERN_STREAMS
84 ### and now some special lyx flags.
85 AC_ARG_ENABLE(assertions,
86 AC_HELP_STRING([--enable-assertions],[add runtime sanity checks in the program]),,
87 [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
88 enable_assertions=yes;
92 if test "x$enable_assertions" = xyes ; then
93 lyx_flags="assertions $lyx_flags"
94 AC_DEFINE(ENABLE_ASSERTIONS,1,
95 [Define if you want assertions to be enabled in the code])
99 dnl by testing these we check if it is ok to have
100 dnl -lc and -lm as args to the compiler
102 AC_CHECK_LIB(c, fopen)
104 ### Add extra directories to check for libraries.
105 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
106 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
107 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
109 ### Add extra directories to check for include files.
110 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
111 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
112 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
114 ### Add both includes and libraries
115 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
116 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
117 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
118 LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
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"
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
147 ### Check for some Cygwin-specific details.
150 ### Check for X libraries
153 yes) LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
154 CPPFLAGS="$CPPFLAGS $X_CFLAGS";;
156 [Cannot find X window libraries and/or headers. Check your installation.
157 If you use a Linux system, check that you have installed
158 the development tools.]);;
162 ### check which frontend we want to use
164 dnl The code below is not in a macro, because this would cause big
165 dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
166 for frontend in $FRONTENDS ; do
170 FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-xforms\$(EXEEXT)"
171 FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS xforms"
172 RPM_FRONTEND="xforms"
173 FRONTEND_INFO="${FRONTEND_INFO}\
175 libXpm version:\t\t${XPM_VERSION}\n\
176 libforms version:\t\t${XFORMS_VERSION}\n"
179 PKG_CHECK_MODULES(GTK_FRONTEND, gtkmm-2.4 libglademm-2.4 xft)
180 FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-gtk\$(EXEEXT)"
181 FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS gtk"
183 GTKMM_VERSION=`pkg-config --modversion gtkmm-2.4`
184 LIBGLADEMM_VERSION=`pkg-config --modversion libglademm-2.4`
185 FRONTEND_INFO="${FRONTEND_INFO}\
187 libgtkmm version:\t\t${GTKMM_VERSION}\n\
188 libglademm version:\t\t${LIBGLADEMM_VERSION}\n"
193 FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt\$(EXEEXT)"
194 FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt2"
196 FRONTEND_INFO="${FRONTEND_INFO}\
198 Qt version:\t\t${QT_VERSION}\n"
199 dnl qt build will fail without moc or uic
200 if test -z "$MOC"; then
201 LYX_ERROR([moc binary not found !])
203 if test -z "$UIC"; then
204 LYX_ERROR([uic binary not found !])
206 if test -z "$QT_LIB"; then
207 LYX_ERROR([qt library not found !])
211 LYX_ERROR(Unknown frontend '$frontend');;
215 # fix the value of the prefixes.
216 test "x$prefix" = xNONE && prefix=$default_prefix
217 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
218 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
219 LYX_WARNING([The installation prefix \"${prefix}\" contains a space, which
220 causes problems with the Makefiles. The installation will be done in
221 directory \"`pwd`/installprefix\" instead. Please move its contents to
222 the right place after installation.])
223 prefix=`pwd`/installprefix
226 ### Setup GNU gettext
227 dnl GNUÂ gettext is written in C
232 # some standard header files
235 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)
237 # some standard structures
241 # some standard types
249 AC_CHECK_FUNCS(strerror)
250 LYX_CHECK_DECL(istreambuf_iterator, iterator)
251 LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
253 # Check the form of mkdir()
256 AC_ARG_ENABLE(compression-support, AC_HELP_STRING([--enable-compression-support],[Support for compressed files.]),[
257 case "${enableval}" in
258 yes) use_compression=true ;;
259 no) use_compression=false ;;
260 *) AC_MSG_ERROR(bad value ${enableval} for --enable-compression-support) ;;
262 ],[use_compression=true])
263 if test $use_compression=true ; then
264 AC_CHECK_HEADERS(zlib.h, use_compression=true, use_compression=false)
265 AC_CHECK_LIB(z, gzopen,[use_compression=true;LIBS="$LIBS -lz"], use_compression=false)
266 if test $use_compression = true ; then
267 AC_DEFINE(USE_COMPRESSION, 1, [Define as 1 if you want to support compressed files.])
268 lyx_flags="compression $lyx_flags"
271 AM_CONDITIONAL(USE_COMPRESSION, test x$use_compression = xtrue)
272 AC_MSG_CHECKING([whether to support compressed files])
273 AC_MSG_RESULT($use_compression)
276 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
277 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
278 dnl We aim to remove this eventually, since we should test as much as
279 dnl possible with the compiler which will use the functions (JMarc)
281 AC_CHECK_FUNCS(close _close getpid _getpid lstat mkfifo mkstemp mktemp open _open pclose _pclose popen _popen readlink)
284 LYX_CHECK_SPELL_ENGINES
286 lyx_client_subdir=true
288 dnl LIBS already contains some X extra libs that may interfere.
291 AC_CHECK_FUNCS(fcntl,
292 [AC_SEARCH_LIBS([gethostbyname], [nsl])
293 AC_SEARCH_LIBS([socket], [socket], [],
294 [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
296 [lyx_client_subdir=false])
297 AC_SUBST(SOCKET_LIBS,$LIBS)
299 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
302 AC_FUNC_SELECT_ARGTYPES
304 ### Some information on what just happened
305 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
306 real_pkgdatadir=`eval "echo \`eval \"echo ${pkgdatadir}\"\`"`
307 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
308 VERSION_INFO="Configuration\n\
309 Host type: ${host}\n\
310 Special build flags: ${lyx_flags}\n\
311 C Compiler: ${CC} ${CC_VERSION}\n\
312 C Compiler LyX flags: ${AM_CPPFLAGS} ${AM_CFLAGS}\n\
313 C Compiler flags: ${CPPFLAGS} ${CFLAGS}\n\
314 C++ Compiler: ${CXX} ${CXX_VERSION}\n\
315 C++ Compiler LyX flags: ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
316 C++ Compiler flags: ${CPPFLAGS} ${CXXFLAGS}\n\
317 Linker flags: ${AM_LDFLAGS}\n\
318 Linker user flags: ${LDFLAGS}\n\
320 Packaging: ${lyx_use_packaging}\n\
321 LyX binary dir: ${real_bindir}\n\
322 LyX files dir: ${real_pkgdatadir}\n"
324 MSYS_AC_CANONICAL_PATH(LYX_ABS_TOP_SRCDIR, ${srcdir})
325 MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_LOCALEDIR, ${real_localedir})
326 MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_DATADIR, ${real_pkgdatadir})
328 AC_SUBST(VERSION_INFO)
329 AC_SUBST(RPM_FRONTEND)
330 AC_SUBST(AM_CPPFLAGS)
331 AC_SUBST(AM_CXXFLAGS)
334 AC_SUBST(LYX_ABS_TOP_SRCDIR)
335 AC_SUBST(LYX_ABS_INSTALLED_LOCALEDIR)
336 AC_SUBST(LYX_ABS_INSTALLED_DATADIR)
338 ## Some config.h stuff
344 * This file is part of LyX, the document processor.
345 * Licence details can be found in the file COPYING.
347 * This is the compilation configuration file for LyX.
348 * It was generated by autoconfs configure.
349 * You might want to change some of the defaults if something goes wrong
350 * during the compilation.
358 /************************************************************
359 ** You should not need to change anything beyond this point */
361 #ifndef HAVE_STRERROR
362 #if defined(__cplusplus)
365 char * strerror(int n);
369 #ifndef HAVE_DECL_MKSTEMP
370 #if defined(__cplusplus)
378 #include "support/os2_defines.h"
381 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
382 #define USE_BOOST_FORMAT 1
384 #define USE_BOOST_FORMAT 0
387 #define BOOST_USER_CONFIG <config.h>
389 #if defined(ENABLE_ASSERTIONS)
390 #define BOOST_ENABLE_ASSERT_HANDLER 1
392 #define BOOST_DISABLE_ASSERTS 1
395 #define BOOST_DISABLE_THREADS 1
396 #define BOOST_NO_WREGEX 1
397 #define BOOST_NO_WSTRING 1
400 #define BOOST_POSIX 1
403 #if defined(HAVE_NEWAPIS_H)
404 #define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
411 AC_CONFIG_SUBDIRS(lib)
412 AC_CONFIG_FILES([Makefile m4/Makefile \
414 boost/libs/Makefile \
415 boost/libs/filesystem/Makefile \
416 boost/libs/filesystem/src/Makefile \
417 boost/libs/regex/Makefile \
418 boost/libs/regex/src/Makefile \
419 boost/libs/signals/Makefile \
420 boost/libs/signals/src/Makefile \
422 development/Makefile \
423 development/lyx.spec \
426 lib/lyx2lyx/Makefile \
431 src/client/Makefile \
433 src/version.C-tmp:src/version.C.in \
434 src/tex2lyx/Makefile \
435 src/mathed/Makefile \
436 src/graphics/Makefile \
437 src/insets/Makefile \
438 src/support/Makefile \
439 src/support/tests/Makefile \
440 src/frontends/Makefile \
441 src/frontends/controllers/Makefile \
442 src/frontends/xforms/Makefile \
443 src/frontends/xforms/lyx_forms.h-tmp:src/frontends/xforms/lyx_forms.h.in \
444 src/frontends/xforms/lyx_xpm.h-tmp:src/frontends/xforms/lyx_xpm.h.in \
445 src/frontends/xforms/forms/Makefile \
446 src/frontends/gtk/Makefile \
447 src/frontends/gtk/gimages/Makefile \
448 src/frontends/gtk/glade/Makefile \
449 src/frontends/qt2/Makefile \
450 src/frontends/qt2/moc/Makefile \
451 src/frontends/qt2/ui/Makefile \
452 src/frontends/qt2/ui/moc/Makefile \
456 # show version information
458 printf "$VERSION_INFO"
461 # Display a final warning if there has been a LYX_ERROR