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, ["Mon, Feb 19, 2007"])
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 ### we need to know the byte order for unicode conversions
70 ### check which frontend we want to use
73 ### Check for a C++ compiler
75 ### Some checks on what the C++ compiler can(not) do
77 dnl we do not need that currently (and probably all our supported
78 dnl compiler allow that)
83 dnl we disable rtti for now
85 AC_CHECK_HEADERS(ostream istream sstream locale limits ios)
86 LYX_CXX_STL_MODERN_STREAMS
88 ### and now some special lyx flags.
89 AC_ARG_ENABLE(assertions,
90 AC_HELP_STRING([--enable-assertions],[add runtime sanity checks in the program]),,
91 [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
92 enable_assertions=yes;
96 if test "x$enable_assertions" = xyes ; then
97 lyx_flags="assertions $lyx_flags"
98 AC_DEFINE(ENABLE_ASSERTIONS,1,
99 [Define if you want assertions to be enabled in the code])
103 dnl by testing these we check if it is ok to have
104 dnl -lc and -lm as args to the compiler
106 AC_CHECK_LIB(c, fopen)
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],[])
164 ### Check for X libraries
167 yes) LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
168 CPPFLAGS="$CPPFLAGS $X_CFLAGS";;
170 [Cannot find X window libraries and/or headers. Check your installation.
171 If you use a Linux system, check that you have installed
172 the development tools.]);;
176 ### check which frontend we want to use
178 dnl The code below is not in a macro, because this would cause big
179 dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
180 for frontend in $FRONTENDS ; do
184 FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
185 FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt4"
187 FRONTEND_INFO="${FRONTEND_INFO}\
189 Qt 4 version:\t\t${QT4_VERSION}\n"
190 dnl qt 4 build will fail without moc or uic
191 if test -z "$MOC4"; then
192 LYX_ERROR([moc 4 binary not found !])
194 if test -z "$UIC4"; then
195 LYX_ERROR([uic 4 binary not found !])
197 if test -z "$QT4_LIB"; then
198 LYX_ERROR([qt 4 library not found !])
202 LYX_ERROR(Unknown frontend '$frontend');;
206 # fix the value of the prefixes.
207 test "x$prefix" = xNONE && prefix=$default_prefix
208 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
209 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
210 LYX_WARNING([The installation prefix \"${prefix}\" contains a space, which
211 causes problems with the Makefiles. The installation will be done in
212 directory \"`pwd`/installprefix\" instead. Please move its contents to
213 the right place after installation.])
214 prefix=`pwd`/installprefix
217 ### We need iconv for unicode support
219 if test "$am_cv_func_iconv" = no; then
220 LYX_ERROR([Cannot find required library iconv])
223 ### Setup GNU gettext
224 dnl GNUÂ gettext is written in C
229 # some standard header files
232 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)
234 # some standard structures
238 # some standard types
239 AC_CHECK_TYPE(mode_t,[AC_DEFINE(HAVE_MODE_T, 1, [Define this to 1 if your compiler supports the mode_t type.])])
246 AC_CHECK_FUNCS(strerror)
247 LYX_CHECK_DECL(istreambuf_iterator, iterator)
248 LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
250 # Check the form of mkdir()
253 # check for compression support
254 AC_CHECK_HEADERS(zlib.h,
255 [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
256 [LYX_LIB_ERROR(zlib.h,zlib)])
258 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
259 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
260 dnl We aim to remove this eventually, since we should test as much as
261 dnl possible with the compiler which will use the functions (JMarc)
263 AC_CHECK_FUNCS(chmod close _close getpid _getpid lstat mkfifo mkstemp mktemp open _open pclose _pclose popen _popen readlink)
266 LYX_CHECK_SPELL_ENGINES
268 lyx_client_subdir=true
270 dnl LIBS already contains some X extra libs that may interfere.
273 AC_CHECK_FUNCS(fcntl,
274 [AC_SEARCH_LIBS([gethostbyname], [nsl])
275 AC_SEARCH_LIBS([socket], [socket], [],
276 [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
278 [lyx_client_subdir=false])
279 AC_SUBST(SOCKET_LIBS,$LIBS)
281 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
284 AC_FUNC_SELECT_ARGTYPES
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\
302 Packaging: ${lyx_use_packaging}\n\
303 LyX binary dir: ${real_bindir}\n\
304 LyX files dir: ${real_pkgdatadir}\n"
306 MSYS_AC_CANONICAL_PATH(LYX_ABS_TOP_SRCDIR, ${srcdir})
307 MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_LOCALEDIR, ${real_localedir})
308 MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_DATADIR, ${real_pkgdatadir})
310 AC_SUBST(VERSION_INFO)
311 AC_SUBST(RPM_FRONTEND)
312 AC_SUBST(AM_CPPFLAGS)
313 AC_SUBST(AM_CXXFLAGS)
316 AC_SUBST(LYX_ABS_TOP_SRCDIR)
317 AC_SUBST(LYX_ABS_INSTALLED_LOCALEDIR)
318 AC_SUBST(LYX_ABS_INSTALLED_DATADIR)
320 ## Some config.h stuff
326 * This file is part of LyX, the document processor.
327 * Licence details can be found in the file COPYING.
329 * This is the compilation configuration file for LyX.
330 * It was generated by autoconfs configure.
331 * You might want to change some of the defaults if something goes wrong
332 * during the compilation.
340 /************************************************************
341 ** You should not need to change anything beyond this point */
343 #ifndef HAVE_STRERROR
344 #if defined(__cplusplus)
347 char * strerror(int n);
351 #ifndef HAVE_DECL_MKSTEMP
352 #if defined(__cplusplus)
359 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
360 # define USE_BOOST_FORMAT 1
362 # define USE_BOOST_FORMAT 0
365 #define BOOST_USER_CONFIG <config.h>
367 #if !defined(ENABLE_ASSERTIONS)
368 # define BOOST_DISABLE_ASSERTS 1
370 #define BOOST_ENABLE_ASSERT_HANDLER 1
372 #define BOOST_DISABLE_THREADS 1
373 #define BOOST_NO_WREGEX 1
374 #define BOOST_NO_WSTRING 1
377 # define BOOST_POSIX 1
378 # define BOOST_POSIX_API 1
379 # define BOOST_POSIX_PATH 1
382 #if defined(HAVE_NEWAPIS_H)
383 # define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
386 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4
387 # define LIBC_WCTYPE_USES_UCS4
394 AC_CONFIG_FILES([Makefile m4/Makefile \
396 boost/libs/Makefile \
397 boost/libs/filesystem/Makefile \
398 boost/libs/filesystem/src/Makefile \
399 boost/libs/iostreams/Makefile \
400 boost/libs/iostreams/src/Makefile \
401 boost/libs/regex/Makefile \
402 boost/libs/regex/src/Makefile \
403 boost/libs/signals/Makefile \
404 boost/libs/signals/src/Makefile \
406 development/Makefile \
407 development/lyx.spec \
410 lib/lyx2lyx/lyx2lyx_version.py \
411 lib/lyx2lyx/Makefile \
416 src/client/Makefile \
418 src/version.C-tmp:src/version.C.in \
419 src/tex2lyx/Makefile \
420 src/mathed/Makefile \
421 src/graphics/Makefile \
422 src/insets/Makefile \
423 src/support/Makefile \
424 src/support/tests/Makefile \
425 src/frontends/Makefile \
426 src/frontends/controllers/Makefile \
427 src/frontends/controllers/tests/Makefile \
428 src/frontends/qt4/Makefile \
429 src/frontends/qt4/ui/Makefile \
433 # show version information
435 printf "$VERSION_INFO"
438 # Display a final warning if there has been a LYX_ERROR