_This_ is LyX 1.5.6
[lyx.git] / configure.ac
blob5acc82025c8a6f20e12360af4932c6cd2fd90078
1 dnl Process with autoconf to generate configure script   -*- sh -*-
3 AC_INIT(LyX,1.5.6,[lyx-devel@lists.lyx.org],[lyx])
4 AC_SUBST(LYX_DATE, ["Sun, Jul 27, 2008"])
5 AC_PREREQ(2.52)
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
12 LYX_CHECK_VERSION
13 LYX_VERSION_SUFFIX
14 # Check how the files should be packaged
15 AC_CANONICAL_TARGET
16 LYX_USE_PACKAGING
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
25 AM_MAINTAINER_MODE
27 save_PACKAGE=$PACKAGE
28 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.5])
29 PACKAGE=$save_PACKAGE
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}
34 done
36 ### Check for programs
37 AC_PROG_MAKE_SET
38 AC_PROG_INSTALL
40 AC_PROG_AWK
41 test "$AWK" = gawk && AWK="gawk --posix"
43 #AC_PROG_RANLIB
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
61 AC_PROG_CC
63 ### check for special systems
64 AC_ISC_POSIX
65 AC_AIX
67 ### we need to know the byte order for unicode conversions
68 AC_C_BIGENDIAN
70 ### check which frontend we want to use
71 LYX_USE_FRONTENDS
73 ### Check for a C++ compiler
74 LYX_PROG_CXX
75 ### Some checks on what the C++ compiler can(not) do
76 AC_LANG(C++)
77 dnl we do not need that currently (and probably all our supported
78 dnl compiler allow that)
79 dnl LYX_CXX_PARTIAL
80 LYX_CXX_EXPLICIT
81 LYX_CXX_GLOBAL_CSTD
82 LYX_STD_COUNT
83 dnl we disable rtti for now
84 dnl LYX_CXX_RTTI
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;
93     else
94         enable_assertions=no;
95     fi;])
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])
102 ### Library Files
103 AC_CHECK_LIB(m, sin)
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])
123 AC_SUBST(LIBSHLWAPI)
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"
134         ])
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)
150 ### Setup libtool
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],[])
156 AC_DISABLE_SHARED
157 AC_LIBTOOL_WIN32_DLL
158 #AM_PROG_LIBTOOL
159 LYX_PROG_LIBTOOL
161 ### We need iconv for unicode support (Qt4 frontend requires it too)
162 AM_ICONV
163 if test "$am_cv_func_iconv" = no; then
164   LYX_ERROR([Cannot find required library iconv])
165 else
166   LIBS="$LIBS $LIBICONV"
169 ### check for compression support
170 AC_CHECK_HEADERS(zlib.h,
171  [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
172  [LYX_LIB_ERROR(zlib.h,zlib)])
175 ### Check for X libraries
176 AC_PATH_XTRA
177 case $have_x in
178   yes) LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
179        CPPFLAGS="$CPPFLAGS $X_CFLAGS";;
180   no) LYX_ERROR(dnl
181 [Cannot find X window libraries and/or headers. Check your installation.
182   If you use a Linux system, check that you have installed
183   the development tools.]);;
184   disable) ;;
185 esac
187 ### check which frontend we want to use
189 dnl The code below is not in a macro, because this would cause big
190 dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
191 for frontend in $FRONTENDS ; do
192   case "$frontend" in
193     qt4)
194           QT4_DO_IT_ALL
195           FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
196           FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt4"
197           RPM_FRONTEND="qt4"
198           FRONTEND_INFO="${FRONTEND_INFO}\
199   Qt 4 Frontend:\n\
200       Qt 4 version:\t\t${QT4_VERSION}\n"
201 dnl qt 4 build will fail without moc or uic
202           if test -z "$MOC4"; then
203             LYX_ERROR([moc 4 binary not found !])
204           fi
205           if test -z "$UIC4"; then
206             LYX_ERROR([uic 4 binary not found !])
207           fi
208           if test -z "$QT4_LIB"; then
209             LYX_ERROR([qt 4 library not found !])
210           fi
211       ;;
212     *)
213           LYX_ERROR(Unknown frontend '$frontend');;
214   esac
215 done
217 # fix the value of the prefixes.
218 test "x$prefix" = xNONE && prefix=$default_prefix
219 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
220 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
221   LYX_WARNING([The installation prefix \"${prefix}\" contains a space, which
222    causes problems with the Makefiles. The installation will be done in
223    directory \"`pwd`/installprefix\" instead. Please move its contents to
224    the right place after installation.])
225   prefix=`pwd`/installprefix
228 ### Setup GNU gettext
229 dnl GNU gettext is written in C
230 AC_LANG_PUSH(C)
231 AM_GNU_GETTEXT
232 AC_LANG_POP(C)
234 # some standard header files
235 AC_HEADER_DIRENT
236 AC_HEADER_MAJOR
237 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)
239 # some standard structures
240 AC_HEADER_STAT
241 AC_HEADER_TIME
243 # some standard types
244 AC_CHECK_TYPE(mode_t,[AC_DEFINE(HAVE_MODE_T, 1, [Define this to 1 if your compiler supports the mode_t type.])])
245 AC_TYPE_OFF_T
246 AC_TYPE_PID_T
247 AC_TYPE_SIGNAL
248 AC_TYPE_SIZE_T
249 AC_TYPE_UID_T
251 AC_CHECK_FUNCS(strerror)
252 LYX_CHECK_DECL(istreambuf_iterator, iterator)
253 LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
255 # Check the form of mkdir()
256 AC_FUNC_MKDIR
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)
262 AC_LANG_PUSH(C)
263 AC_CHECK_FUNCS(chmod close _close getpid _getpid lstat mkfifo mkstemp mktemp open _open pclose _pclose popen _popen readlink)
264 AC_LANG_POP(C)
266 LYX_CHECK_SPELL_ENGINES
268 lyx_client_subdir=true
269 AC_LANG_PUSH(C)
270 dnl LIBS already contains some X extra libs that may interfere.
271 save_LIBS="$LIBS"
272 LIBS=
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"],
277                 [], [-lnsl])])],
278   [lyx_client_subdir=false])
279 AC_SUBST(SOCKET_LIBS,$LIBS)
280 LIBS="$save_LIBS"
281 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
282 AC_LANG_POP(C)
284 lyx_win_res=false;
285 case ${host} in
286     *mingw*|*cygwin*) lyx_win_res=true;;
287 esac
288 AM_CONDITIONAL(LYX_WIN_RESOURCE, $lyx_win_res)
289 LYX_SET_VERSION_INFO
291 AC_FUNC_SELECT_ARGTYPES
293 ### Some information on what just happened
294 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
295 real_pkgdatadir=`eval "echo \`eval \"echo \\\`eval \\\"echo ${pkgdatadir}\\\"\\\`\"\`"`
296 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
297 VERSION_INFO="Configuration\n\
298   Host type:                    ${host}\n\
299   Special build flags:          ${lyx_flags}\n\
300   C   Compiler:                 ${CC} ${CC_VERSION}\n\
301   C   Compiler LyX flags:       ${AM_CPPFLAGS} ${AM_CFLAGS}\n\
302   C   Compiler flags:           ${CPPFLAGS} ${CFLAGS}\n\
303   C++ Compiler:                 ${CXX} ${CXX_VERSION}\n\
304   C++ Compiler LyX flags:       ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
305   C++ Compiler flags:           ${CPPFLAGS} ${CXXFLAGS}\n\
306   Linker flags:                 ${AM_LDFLAGS}\n\
307   Linker user flags:            ${LDFLAGS}\n\
308 ${FRONTEND_INFO}\
309   Packaging:                    ${lyx_use_packaging}\n\
310   LyX binary dir:               ${real_bindir}\n\
311   LyX files dir:                ${real_pkgdatadir}\n"
313 MSYS_AC_CANONICAL_PATH(LYX_ABS_TOP_SRCDIR, ${srcdir})
314 MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_LOCALEDIR, ${real_localedir})
315 MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_DATADIR, ${real_pkgdatadir})
317 AC_SUBST(VERSION_INFO)
318 AC_SUBST(RPM_FRONTEND)
319 AC_SUBST(AM_CPPFLAGS)
320 AC_SUBST(AM_CXXFLAGS)
321 AC_SUBST(AM_CFLAGS)
322 AC_SUBST(AM_LDFLAGS)
323 AC_SUBST(LYX_ABS_TOP_SRCDIR)
324 AC_SUBST(LYX_ABS_INSTALLED_LOCALEDIR)
325 AC_SUBST(LYX_ABS_INSTALLED_DATADIR)
327 ## Some config.h stuff
329 AH_TOP([
330 /* -*- C++ -*- */
332  * \file config.h
333  * This file is part of LyX, the document processor.
334  * Licence details can be found in the file COPYING.
336  * This is the compilation configuration file for LyX.
337  * It was generated by autoconfs configure.
338  * You might want to change some of the defaults if something goes wrong
339  * during the compilation.
340  */
342 #ifndef _CONFIG_H
343 #define _CONFIG_H
346 AH_BOTTOM([
347 /************************************************************
348  ** You should not need to change anything beyond this point */
350 #ifndef HAVE_STRERROR
351 #if defined(__cplusplus)
352 extern "C"
353 #endif
354 char * strerror(int n);
355 #endif
357 #ifdef HAVE_MKSTEMP
358 #ifndef HAVE_DECL_MKSTEMP
359 #if defined(__cplusplus)
360 extern "C"
361 #endif
362 int mkstemp(char*);
363 #endif
364 #endif
366 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
367 #  define USE_BOOST_FORMAT 1
368 #else
369 #  define USE_BOOST_FORMAT 0
370 #endif
372 #define BOOST_USER_CONFIG <config.h>
374 #if !defined(ENABLE_ASSERTIONS)
375 #  define BOOST_DISABLE_ASSERTS 1
376 #endif
377 #define BOOST_ENABLE_ASSERT_HANDLER 1
379 #define BOOST_DISABLE_THREADS 1
380 #define BOOST_NO_WREGEX 1
381 #define BOOST_NO_WSTRING 1
383 #ifdef __CYGWIN__
384 #  define BOOST_POSIX 1
385 #  define BOOST_POSIX_API 1
386 #  define BOOST_POSIX_PATH 1
387 #endif
389 #if defined(HAVE_NEWAPIS_H)
390 #  define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
391 #endif
394  * the FreeBSD libc uses UCS4, but libstdc++ has no proper wchar_t
395  * support compiled in:
396  * http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#3_9
397  * And we are not interested at all what libc
398  * does: What we need is a 32bit wide wchar_t, and a libstdc++ that
399  * has the needed wchar_t support and uses UCS4. Whether it
400  * implements this with the help of libc, or whether it has own code
401  * does not matter for us, because we don't use libc directly (Georg)
403 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
404 #  define USE_WCHAR_T
405 #endif
407 #endif
410 AC_DEFINE_UNQUOTED([LYX_MAJOR_VERSION],$lyx_major,[Major version number])
411 AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
412 AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
413 AC_DEFINE_UNQUOTED([LYX_RELEASE_PATCH],$lyx_patch,[Patch version number])
415 ### Finish the work.
416 AC_CONFIG_FILES([Makefile
417        boost/Makefile \
418        boost/libs/Makefile \
419        boost/libs/filesystem/Makefile \
420        boost/libs/filesystem/src/Makefile \
421        boost/libs/iostreams/Makefile \
422        boost/libs/iostreams/src/Makefile \
423        boost/libs/regex/Makefile \
424        boost/libs/regex/src/Makefile \
425        boost/libs/signals/Makefile \
426        boost/libs/signals/src/Makefile \
427        config/Makefile \
428        development/Makefile \
429        development/MacOSX/Makefile \
430        development/MacOSX/Info.plist \
431        development/MacOSX/lyxrc.dist \
432        development/MacOSX/spotlight/Makefile \
433        development/lyx.spec \
434        intl/Makefile \
435        lib/Makefile \
436        lib/doc/Makefile \
437        lib/lyx2lyx/lyx2lyx_version.py \
438        lib/lyx2lyx/Makefile \
439        m4/Makefile \
440        po/Makefile.in \
441        sourcedoc/Doxyfile \
442        sourcedoc/Makefile \
443        src/client/Makefile \
444        src/Makefile \
445        src/version.cpp-tmp:src/version.cpp.in \
446        src/tex2lyx/Makefile \
447        src/mathed/Makefile \
448        src/graphics/Makefile \
449        src/insets/Makefile \
450        src/support/Makefile \
451        src/support/tests/Makefile \
452        src/frontends/Makefile \
453        src/frontends/controllers/Makefile \
454        src/frontends/controllers/tests/Makefile \
455        src/frontends/qt4/Makefile \
456        src/frontends/qt4/ui/Makefile \
459 AC_OUTPUT
460 # show version information
461 echo
462 printf "$VERSION_INFO"
463 echo
465 # Display a final warning if there has been a LYX_ERROR
466 LYX_CHECK_ERRORS