* paragraph_funcs.cpp: sanitize setLabelWidthStringToSequence. Patch by rgheck.
[lyx.git] / configure.ac
blobf81818aa406519edae12134c38d53368c26b9079
1 dnl Process with autoconf to generate configure script   -*- sh -*-
3 AC_INIT(LyX,2.0.0svn,[lyx-devel@lists.lyx.org],[lyx])
4 # Use ISO format only. The frontend needs to parse this
5 AC_SUBST(LYX_DATE, ["2009-03-25"])
6 AC_PREREQ(2.52)
7 AC_CONFIG_SRCDIR(src/main.cpp)
8 AC_CONFIG_HEADERS([config.h])
10 AC_CONFIG_AUX_DIR(config)
12 # First check the version
13 LYX_CHECK_VERSION
14 LYX_VERSION_SUFFIX
15 # Check how the files should be packaged
16 AC_CANONICAL_TARGET
17 LYX_USE_PACKAGING
18 # We need to define these variables here and the no-define option of
19 # AM_INIT_AUTOMAKE above because we alter $PACKAGE in LYX_USE_PACKAGING.
20 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
22 dnl Default maintainer mode to true for development versions
23 if test "${enable_maintainer_mode+set}" != set; then
24   enable_maintainer_mode=$lyx_devel_version
26 AM_MAINTAINER_MODE
28 save_PACKAGE=$PACKAGE
29 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.5])
30 PACKAGE=$save_PACKAGE
32 ### Set the execute permissions of the various scripts correctly
33 for file in config/install-sh config/mkinstalldirs ; do
34   chmod 755 ${srcdir}/${file}
35 done
37 ### Check for programs
38 dnl AC_PROG_MAKE_SET
39 dnl AC_PROG_INSTALL
41 # Check for installed python
42 AM_PATH_PYTHON(2.3.4,, :)
44 # Work around a problem in automake 1.4: when invoking install-strip,
45 # INSTALL_PROGRAM is changed to 'install -s', and since
46 # INSTALL_SCRIPT==INSTALL_PROGRAM, we get errors with fileutils-4.0
47 # which returns an error condition when stripping fails.
48 INSTALL_SCRIPT='${INSTALL}'
50 ### we will also need a C compiler to compile GNU gettext
51 AC_PROG_CC
52 AC_USE_SYSTEM_EXTENSIONS
54 ### we need to know the byte order for unicode conversions
55 AC_C_BIGENDIAN
57 ### check which frontend we want to use
58 LYX_USE_FRONTENDS
60 ### Check for a C++ compiler
61 LYX_PROG_CXX
62 ### Some checks on what the C++ compiler can(not) do
63 AC_LANG(C++)
64 dnl we do not need that currently (and probably all our supported
65 dnl compiler allow that)
66 dnl LYX_CXX_PARTIAL
67 dnl LYX_CXX_EXPLICIT
68 dnl LYX_CXX_GLOBAL_CSTD
69 dnl LYX_STD_COUNT
70 dnl we disable rtti for now
71 dnl LYX_CXX_RTTI
72 dnl AC_CHECK_HEADERS(ostream istream sstream locale limits ios)
73 dnl LYX_CXX_STL_MODERN_STREAMS
75 ### Objective-C compiler
76 AC_PROG_OBJC
77 _AM_DEPENDENCIES([OBJC])
79 ### and now some special lyx flags.
80 AC_ARG_ENABLE(assertions,
81   AC_HELP_STRING([--enable-assertions],[add runtime sanity checks in the program]),,
82   [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
83         enable_assertions=yes;
84     else
85         enable_assertions=no;
86     fi;])
87 if test "x$enable_assertions" = xyes ; then
88    lyx_flags="assertions $lyx_flags"
89    AC_DEFINE(ENABLE_ASSERTIONS,1,
90     [Define if you want assertions to be enabled in the code])
93 ### Library Files
94 dnl AC_CHECK_LIB(m, sin)
96 ### Add extra directories to check for libraries.
97 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
98 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
99 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
101 ### Add extra directories to check for include files.
102 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
103 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
104 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
106 ### Add both includes and libraries
107 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
108 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
109 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
110   LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
112 ### These are needed in windows
113 AC_CHECK_LIB(shlwapi, main, [LIBSHLWAPI=-lshlwapi])
114 AC_SUBST(LIBSHLWAPI)
115 AC_CHECK_LIB(psapi, main, [LIBPSAPI=-lpsapi])
116 AC_SUBST(LIBPSAPI)
117 AC_CHECK_LIB(gdi32, main)
119 LYX_USE_INCLUDED_BOOST
121 # Needed for our char_type
122 AC_CHECK_SIZEOF(wchar_t)
124 ### We need iconv for unicode support (Qt4 frontend requires it too)
125 AM_ICONV
126 if test "$am_cv_func_iconv" = no; then
127   LYX_ERROR([Cannot find required library iconv])
128 else
129   LIBS="$LIBS $LIBICONV"
132 ### check for compression support
133 AC_CHECK_HEADERS(zlib.h,
134  [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
135  [LYX_LIB_ERROR(zlib.h,zlib)])
138 ### check which frontend we want to use
140 dnl The code below is not in a macro, because this would cause big
141 dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
142 for frontend in $FRONTENDS ; do
143   case "$frontend" in
144     qt4)
145           QT4_DO_IT_ALL
146           FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
147           FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt4"
148           RPM_FRONTEND="qt4"
149           FRONTEND_INFO="${FRONTEND_INFO}\
150   Qt 4 Frontend:\n\
151       Qt 4 version:\t\t${QT4_VERSION}\n"
152 dnl qt 4 build will fail without moc or uic
153           if test -z "$MOC4"; then
154             LYX_ERROR([moc 4 binary not found !])
155           fi
156           if test -z "$UIC4"; then
157             LYX_ERROR([uic 4 binary not found !])
158           fi
159           if test -z "$QT4_LIB"; then
160             LYX_ERROR([qt 4 library not found !])
161           fi
162       ;;
163     *)
164           LYX_ERROR(Unknown frontend '$frontend');;
165   esac
166 done
168 # fix the value of the prefixes.
169 test "x$prefix" = xNONE && prefix=$default_prefix
170 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
171 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
172   LYX_WARNING([The installation prefix \"${prefix}\" contains a space, which
173    causes problems with the Makefiles. The installation will be done in
174    directory \"`pwd`/installprefix\" instead. Please move its contents to
175    the right place after installation.])
176   prefix=`pwd`/installprefix
179 ### Setup GNU gettext
180 dnl GNU gettext is written in C
181 AC_LANG_PUSH(C)
182 dnl Dirty trick ahead: disable macro AC_GNU_SOURCE because it triggers a bug with autoconf 2.62.
183 dnl this can be removed if gettext is been updated to avoid that.
184 m4_undefine([AC_GNU_SOURCE])
185 m4_defun([AC_GNU_SOURCE],[])
186 AM_GNU_GETTEXT
187 AM_GNU_GETTEXT_VERSION([0.16.1])
188 AC_LANG_POP(C)
190 # some standard header files
191 AC_HEADER_DIRENT
192 AC_HEADER_MAJOR
193 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h strings.h locale.h io.h process.h NewAPIs.h utime.h sys/utime.h)
195 # some standard structures
196 AC_HEADER_STAT
197 AC_HEADER_TIME
199 # some standard types
200 AC_CHECK_TYPE(mode_t,[AC_DEFINE(HAVE_MODE_T, 1, [Define this to 1 if your compiler supports the mode_t type.])])
201 AC_TYPE_OFF_T
202 AC_TYPE_PID_T
203 AC_TYPE_SIGNAL
204 AC_TYPE_SIZE_T
205 AC_TYPE_UID_T
207 AC_CHECK_FUNCS(strerror)
208 LYX_CHECK_DECL(istreambuf_iterator, iterator)
209 LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
211 # Check the form of mkdir()
212 AC_FUNC_MKDIR
214 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
215 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
216 dnl We aim to remove this eventually, since we should test as much as
217 dnl possible with the compiler which will use the functions (JMarc)
218 AC_LANG_PUSH(C)
219 AC_CHECK_FUNCS(chmod close _close getpid _getpid lstat mkfifo mkstemp mktemp open _open pclose _pclose popen _popen readlink)
220 AC_LANG_POP(C)
222 LYX_CHECK_SPELL_ENGINES
224 lyx_client_subdir=true
225 AC_LANG_PUSH(C)
226 dnl LIBS already contains some X extra libs that may interfere.
227 save_LIBS="$LIBS"
228 LIBS=
229 AC_CHECK_FUNCS(fcntl,
230   [AC_SEARCH_LIBS([gethostbyname], [nsl])
231    AC_SEARCH_LIBS([socket], [socket], [],
232      [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
233                 [], [-lnsl])])],
234   [lyx_client_subdir=false])
235 AC_SUBST(SOCKET_LIBS,$LIBS)
236 LIBS="$save_LIBS"
237 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
238 AC_LANG_POP(C)
240 lyx_win_res=false;
241 case ${host} in
242     *mingw*|*cygwin*) lyx_win_res=true;;
243 esac
244 AM_CONDITIONAL(LYX_WIN_RESOURCE, $lyx_win_res)
245 LYX_SET_VERSION_INFO
247 AC_FUNC_SELECT_ARGTYPES
249 ### Some information on what just happened
250 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
251 real_pkgdatadir=`eval "echo \`eval \"echo \\\`eval \\\"echo ${pkgdatadir}\\\"\\\`\"\`"`
252 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
253 VERSION_INFO="Configuration\n\
254   Host type:                    ${host}\n\
255   Special build flags:          ${lyx_flags}\n\
256   C   Compiler:                 ${CC} ${CC_VERSION}\n\
257   C   Compiler LyX flags:       ${AM_CPPFLAGS} ${AM_CFLAGS}\n\
258   C   Compiler flags:           ${CPPFLAGS} ${CFLAGS}\n\
259   C++ Compiler:                 ${CXX} ${CXX_VERSION}\n\
260   C++ Compiler LyX flags:       ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
261   C++ Compiler flags:           ${CPPFLAGS} ${CXXFLAGS}\n\
262   Linker flags:                 ${AM_LDFLAGS}\n\
263   Linker user flags:            ${LDFLAGS}\n\
264 ${FRONTEND_INFO}\
265   Packaging:                    ${lyx_use_packaging}\n\
266   LyX binary dir:               ${real_bindir}\n\
267   LyX files dir:                ${real_pkgdatadir}\n"
269 AC_SUBST(VERSION_INFO)
270 AC_SUBST(RPM_FRONTEND)
271 AC_SUBST(AM_CPPFLAGS)
272 AC_SUBST(AM_CXXFLAGS)
273 AC_SUBST(AM_CFLAGS)
274 AC_SUBST(AM_LDFLAGS)
275 AC_SUBST(real_pkgdatadir)
277 ## Some config.h stuff
279 AH_TOP([
280 /* -*- C++ -*- */
282  * \file config.h
283  * This file is part of LyX, the document processor.
284  * Licence details can be found in the file COPYING.
286  * This is the compilation configuration file for LyX.
287  * It was generated by autoconfs configure.
288  * You might want to change some of the defaults if something goes wrong
289  * during the compilation.
290  */
292 #ifndef _CONFIG_H
293 #define _CONFIG_H
296 AH_BOTTOM([
297 /************************************************************
298  ** You should not need to change anything beyond this point */
300 #ifndef HAVE_STRERROR
301 #if defined(__cplusplus)
302 extern "C"
303 #endif
304 char * strerror(int n);
305 #endif
307 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
308 #  define USE_BOOST_FORMAT 1
309 #else
310 #  define USE_BOOST_FORMAT 0
311 #endif
313 #define BOOST_USER_CONFIG <config.h>
315 #if !defined(ENABLE_ASSERTIONS)
316 #  define BOOST_DISABLE_ASSERTS 1
317 #endif
318 #define BOOST_ENABLE_ASSERT_HANDLER 1
320 #define BOOST_DISABLE_THREADS 1
321 #define BOOST_NO_WREGEX 1
322 #define BOOST_NO_WSTRING 1
324 #ifdef __CYGWIN__
325 #  define NOMINMAX
326 #  define BOOST_POSIX 1
327 #  define BOOST_POSIX_API 1
328 #  define BOOST_POSIX_PATH 1
329 #endif
331 #if defined(HAVE_NEWAPIS_H)
332 #  define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
333 #endif
336  * the FreeBSD libc uses UCS4, but libstdc++ has no proper wchar_t
337  * support compiled in:
338  * http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#3_9
339  * And we are not interested at all what libc
340  * does: What we need is a 32bit wide wchar_t, and a libstdc++ that
341  * has the needed wchar_t support and uses UCS4. Whether it
342  * implements this with the help of libc, or whether it has own code
343  * does not matter for us, because we do not use libc directly (Georg)
345 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
346 #  define USE_WCHAR_T
347 #endif
349 #endif
352 m4_define([ALLPARTS],[boost,client,insets,mathed,core,tex2lyx,frontend_qt4])
353 AC_ARG_ENABLE(monolithic-build,
354   AC_HELP_STRING([--enable-monolithic-build@<:@=LIST@:>@],
355                 [Use monolithic build for modules in LIST (default: ALLPARTS)]),
356   [test "$enable_monolithic_build" = yes && enable_monolithic_build="ALLPARTS"
357    test "$enable_monolithic_build" = no && enable_monolithic_build=
358    IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=" ,"
359    for i in $enable_monolithic_build ; do
360        eval "enable_monolithic_$i=yes"
361    done
362    IFS="$ac_save_ifs"],
363   [enable_monolithic_build=])
365 AM_CONDITIONAL(MONOLITHIC_BOOST, test "x$enable_monolithic_boost" = "xyes")
366 AM_CONDITIONAL(MONOLITHIC_CLIENT, test "x$enable_monolithic_client" = "xyes")
367 AM_CONDITIONAL(MONOLITHIC_INSETS, test "x$enable_monolithic_insets" = "xyes")
368 AM_CONDITIONAL(MONOLITHIC_MATHED, test "x$enable_monolithic_mathed" = "xyes")
369 AM_CONDITIONAL(MONOLITHIC_CORE, test "x$enable_monolithic_core" = "xyes")
370 AM_CONDITIONAL(MONOLITHIC_TEX2LYX, test "x$enable_monolithic_tex2lyx" = "xyes")
371 AM_CONDITIONAL(MONOLITHIC_FRONTEND_QT4, test "x$enable_monolithic_frontend_qt4" = "xyes")
373 MSYS_AC_CANONICAL_PATH(lyx_abs_top_srcdir, ${srcdir})
374 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_localedir, ${real_localedir})
375 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_datadir, ${real_pkgdatadir})
377 AC_DEFINE_UNQUOTED([LYX_ABS_TOP_SRCDIR],
378         "${lyx_abs_top_srcdir}", [Top source directory])
379 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_LOCALEDIR],
380         "${lyx_abs_installed_localedir}",[Hard coded locale directory])
381 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_DATADIR],
382         "${lyx_abs_installed_datadir}",[Hard system support directory])
383 AC_DEFINE_UNQUOTED([PROGRAM_SUFFIX],
384         "${version_suffix}",[Program version suffix])
386 AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
387 AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
388 AC_DEFINE_UNQUOTED([LYX_DIR_VER],"$lyx_dir_ver",[Versioned env var for system dir])
389 AC_DEFINE_UNQUOTED([LYX_USERDIR_VER],"$lyx_userdir_ver",[Versioned env var for user dir])
390 AC_DEFINE_UNQUOTED([LYX_MAJOR_VERSION],$lyx_major,[Major version number])
391 AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
392 AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
393 AC_DEFINE_UNQUOTED([LYX_RELEASE_PATCH],$lyx_patch,[Patch version number])
395 AC_CONFIG_FILES([Makefile \
396       lyx.1:lyx.1in \
397       boost/Makefile \
398       config/Makefile \
399       development/Makefile \
400       development/MacOSX/Makefile \
401       development/MacOSX/Info.plist \
402       development/MacOSX/lyxrc.dist \
403       development/MacOSX/spotlight/Makefile \
404       development/cygwin/Makefile \
405       development/cygwin/lyxrc.dist \
406       development/lyx.spec \
407       intl/Makefile \
408       lib/Makefile \
409       lib/doc/Makefile \
410       lib/lyx2lyx/lyx2lyx_version.py \
411       lib/lyx2lyx/Makefile \
412       m4/Makefile \
413       po/Makefile.in \
414       sourcedoc/Doxyfile \
415       sourcedoc/Makefile \
416       src/client/Makefile \
417       src/client/lyxclient.1:src/client/lyxclient.1in \
418       src/Makefile \
419       src/tex2lyx/Makefile \
420       src/tex2lyx/tex2lyx.1:src/tex2lyx/tex2lyx.1in \
421       src/support/Makefile \
422       src/frontends/Makefile \
423       src/frontends/qt4/Makefile
427 AC_OUTPUT
429 # show version information
430 echo
431 printf "$VERSION_INFO"
432 echo
434 # Display a final warning if there has been a LYX_ERROR
435 LYX_CHECK_ERRORS