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, ["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 ### 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])
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
147 # Needed for our char_type
148 AC_CHECK_SIZEOF(wchar_t)
151 dnl Dirty trick ahead: disable libtool checking for a fortran compiler
152 dnl see http://permalink.gmane.org/gmane.comp.gnu.libtool.general/6699
153 dnl Note that this will reportedly not be needed with libtool 2.0
154 m4_undefine([AC_PROG_F77])
155 m4_defun([AC_PROG_F77],[])
161 ### Check for X libraries
164 yes) LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
165 CPPFLAGS="$CPPFLAGS $X_CFLAGS";;
167 [Cannot find X window libraries and/or headers. Check your installation.
168 If you use a Linux system, check that you have installed
169 the development tools.]);;
173 ### check which frontend we want to use
175 dnl The code below is not in a macro, because this would cause big
176 dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
177 for frontend in $FRONTENDS ; do
181 FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
182 FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt4"
184 FRONTEND_INFO="${FRONTEND_INFO}\
186 Qt 4 version:\t\t${QT4_VERSION}\n"
187 dnl qt 4 build will fail without moc or uic
188 if test -z "$MOC4"; then
189 LYX_ERROR([moc 4 binary not found !])
191 if test -z "$UIC4"; then
192 LYX_ERROR([uic 4 binary not found !])
194 if test -z "$QT4_LIB"; then
195 LYX_ERROR([qt 4 library not found !])
199 LYX_ERROR(Unknown frontend '$frontend');;
203 # fix the value of the prefixes.
204 test "x$prefix" = xNONE && prefix=$default_prefix
205 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
206 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
207 LYX_WARNING([The installation prefix \"${prefix}\" contains a space, which
208 causes problems with the Makefiles. The installation will be done in
209 directory \"`pwd`/installprefix\" instead. Please move its contents to
210 the right place after installation.])
211 prefix=`pwd`/installprefix
214 ### We need iconv for unicode support
216 if test "$am_cv_func_iconv" = no; then
217 LYX_ERROR([Cannot find required library iconv])
220 ### Setup GNU gettext
221 dnl GNUÂ gettext is written in C
226 # some standard header files
229 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)
231 # some standard structures
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.])])
243 AC_CHECK_FUNCS(strerror)
244 LYX_CHECK_DECL(istreambuf_iterator, iterator)
245 LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
247 # Check the form of mkdir()
250 # check for compression support
251 AC_CHECK_HEADERS(zlib.h,
252 [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
253 [LYX_LIB_ERROR(zlib.h,zlib)])
255 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
256 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
257 dnl We aim to remove this eventually, since we should test as much as
258 dnl possible with the compiler which will use the functions (JMarc)
260 AC_CHECK_FUNCS(chmod close _close getpid _getpid lstat mkfifo mkstemp mktemp open _open pclose _pclose popen _popen readlink)
263 LYX_CHECK_SPELL_ENGINES
265 lyx_client_subdir=true
267 dnl LIBS already contains some X extra libs that may interfere.
270 AC_CHECK_FUNCS(fcntl,
271 [AC_SEARCH_LIBS([gethostbyname], [nsl])
272 AC_SEARCH_LIBS([socket], [socket], [],
273 [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
275 [lyx_client_subdir=false])
276 AC_SUBST(SOCKET_LIBS,$LIBS)
278 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
281 AC_FUNC_SELECT_ARGTYPES
283 ### Some information on what just happened
284 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
285 real_pkgdatadir=`eval "echo \`eval \"echo \\\`eval \\\"echo ${pkgdatadir}\\\"\\\`\"\`"`
286 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
287 VERSION_INFO="Configuration\n\
288 Host type: ${host}\n\
289 Special build flags: ${lyx_flags}\n\
290 C Compiler: ${CC} ${CC_VERSION}\n\
291 C Compiler LyX flags: ${AM_CPPFLAGS} ${AM_CFLAGS}\n\
292 C Compiler flags: ${CPPFLAGS} ${CFLAGS}\n\
293 C++ Compiler: ${CXX} ${CXX_VERSION}\n\
294 C++ Compiler LyX flags: ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
295 C++ Compiler flags: ${CPPFLAGS} ${CXXFLAGS}\n\
296 Linker flags: ${AM_LDFLAGS}\n\
297 Linker user flags: ${LDFLAGS}\n\
299 Packaging: ${lyx_use_packaging}\n\
300 LyX binary dir: ${real_bindir}\n\
301 LyX files dir: ${real_pkgdatadir}\n"
303 MSYS_AC_CANONICAL_PATH(LYX_ABS_TOP_SRCDIR, ${srcdir})
304 MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_LOCALEDIR, ${real_localedir})
305 MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_DATADIR, ${real_pkgdatadir})
307 AC_SUBST(VERSION_INFO)
308 AC_SUBST(RPM_FRONTEND)
309 AC_SUBST(AM_CPPFLAGS)
310 AC_SUBST(AM_CXXFLAGS)
313 AC_SUBST(LYX_ABS_TOP_SRCDIR)
314 AC_SUBST(LYX_ABS_INSTALLED_LOCALEDIR)
315 AC_SUBST(LYX_ABS_INSTALLED_DATADIR)
317 ## Some config.h stuff
323 * This file is part of LyX, the document processor.
324 * Licence details can be found in the file COPYING.
326 * This is the compilation configuration file for LyX.
327 * It was generated by autoconfs configure.
328 * You might want to change some of the defaults if something goes wrong
329 * during the compilation.
337 /************************************************************
338 ** You should not need to change anything beyond this point */
340 #ifndef HAVE_STRERROR
341 #if defined(__cplusplus)
344 char * strerror(int n);
348 #ifndef HAVE_DECL_MKSTEMP
349 #if defined(__cplusplus)
356 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
357 # define USE_BOOST_FORMAT 1
359 # define USE_BOOST_FORMAT 0
362 #define BOOST_USER_CONFIG <config.h>
364 #if !defined(ENABLE_ASSERTIONS)
365 # define BOOST_DISABLE_ASSERTS 1
367 #define BOOST_ENABLE_ASSERT_HANDLER 1
369 #define BOOST_DISABLE_THREADS 1
370 #define BOOST_NO_WREGEX 1
371 #define BOOST_NO_WSTRING 1
374 # define BOOST_POSIX 1
375 # define BOOST_POSIX_API 1
376 # define BOOST_POSIX_PATH 1
379 #if defined(HAVE_NEWAPIS_H)
380 # define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
384 * the FreeBSD libc uses UCS4, but libstdc++ has no proper wchar_t
385 * support compiled in:
386 * http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#3_9
387 * And we are not interested at all what libc
388 * does: What we need is a 32bit wide wchar_t, and a libstdc++ that
389 * has the needed wchar_t support and uses UCS4. Whether it
390 * implements this with the help of libc, or whether it has own code
391 * does not matter for us, because we don't use libc directly (Georg)
393 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 && ! defined(__FREEBSD__)
401 AC_CONFIG_FILES([Makefile
403 boost/libs/Makefile \
404 boost/libs/filesystem/Makefile \
405 boost/libs/filesystem/src/Makefile \
406 boost/libs/iostreams/Makefile \
407 boost/libs/iostreams/src/Makefile \
408 boost/libs/regex/Makefile \
409 boost/libs/regex/src/Makefile \
410 boost/libs/signals/Makefile \
411 boost/libs/signals/src/Makefile \
413 development/Makefile \
414 development/MacOSX/Makefile \
415 development/MacOSX/spotlight/Makefile \
416 development/lyx.spec \
420 lib/lyx2lyx/lyx2lyx_version.py \
421 lib/lyx2lyx/Makefile \
426 src/client/Makefile \
428 src/version.cpp-tmp:src/version.cpp.in \
429 src/tex2lyx/Makefile \
430 src/mathed/Makefile \
431 src/graphics/Makefile \
432 src/insets/Makefile \
433 src/support/Makefile \
434 src/support/tests/Makefile \
435 src/frontends/Makefile \
436 src/frontends/controllers/Makefile \
437 src/frontends/controllers/tests/Makefile \
438 src/frontends/qt4/Makefile \
439 src/frontends/qt4/ui/Makefile \
443 # show version information
445 printf "$VERSION_INFO"
448 # Display a final warning if there has been a LYX_ERROR