1 dnl Process with autoconf to generate configure script -*- sh -*-
3 AC_INIT(LyX,2.1.0dev,[lyx-devel@lists.lyx.org],[lyx])
5 # Use ISO format only. The frontend needs to parse this
6 AC_SUBST(LYX_DATE, ["2011-04-29"])
8 AC_CONFIG_SRCDIR(src/main.cpp)
9 AC_CONFIG_HEADERS([config.h])
11 AC_CONFIG_AUX_DIR(config)
13 # First check the version
16 # Check how the files should be packaged
19 # We need to define these variables here and the no-define option of
20 # AM_INIT_AUTOMAKE above because we alter $PACKAGE in LYX_USE_PACKAGING.
21 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
23 dnl Default maintainer mode to true for development versions
24 if test "${enable_maintainer_mode+set}" != set; then
25 enable_maintainer_mode=$lyx_devel_version
30 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.8])
31 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
34 # Allow to build some parts of the code as one big chunk
35 m4_define([ALLPARTS],[boost,client,insets,mathed,core,tex2lyx,frontend_qt4])
36 AC_ARG_ENABLE(monolithic-build,
37 AC_HELP_STRING([--enable-monolithic-build@<:@=LIST@:>@],
38 [Use monolithic build for modules in LIST (default: ALLPARTS)]),
39 [test "$enable_monolithic_build" = yes && enable_monolithic_build="ALLPARTS"
40 test "$enable_monolithic_build" = no && enable_monolithic_build=
41 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=" ,"
42 for i in $enable_monolithic_build ; do
43 eval "enable_monolithic_$i=yes"
46 [enable_monolithic_build=])
48 AM_CONDITIONAL(MONOLITHIC_BOOST, test "x$enable_monolithic_boost" = "xyes")
49 AM_CONDITIONAL(MONOLITHIC_CLIENT, test "x$enable_monolithic_client" = "xyes")
50 AM_CONDITIONAL(MONOLITHIC_INSETS, test "x$enable_monolithic_insets" = "xyes")
51 AM_CONDITIONAL(MONOLITHIC_MATHED, test "x$enable_monolithic_mathed" = "xyes")
52 AM_CONDITIONAL(MONOLITHIC_CORE, test "x$enable_monolithic_core" = "xyes")
53 AM_CONDITIONAL(MONOLITHIC_TEX2LYX, test "x$enable_monolithic_tex2lyx" = "xyes")
54 AM_CONDITIONAL(MONOLITHIC_FRONTEND_QT4, test "x$enable_monolithic_frontend_qt4" = "xyes")
56 ### Set the execute permissions of the various scripts correctly
57 for file in config/install-sh ; do
58 chmod 755 ${srcdir}/${file}
61 # Check for installed python
62 AM_PATH_PYTHON(2.4.0,, :)
64 ### we need to know the byte order for unicode conversions
67 ### check which frontend we want to use
70 ### Check for a C++ compiler
73 ### Objective-C compiler
75 _AM_DEPENDENCIES([OBJC])
77 ### Add extra directories to check for libraries.
78 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
79 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
80 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
82 ### Add extra directories to check for include files.
83 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
84 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
85 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
87 ### Add both includes and libraries
88 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
89 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
90 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
91 LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
93 ### These are needed in windows
94 AC_CHECK_LIB(shlwapi, main, [LIBSHLWAPI=-lshlwapi])
96 AC_CHECK_LIB(psapi, main, [LIBPSAPI=-lpsapi])
98 AC_CHECK_LIB(gdi32, main)
100 LYX_USE_INCLUDED_BOOST
101 LYX_USE_INCLUDED_MYTHES
103 # Needed for our char_type
104 AC_CHECK_SIZEOF(wchar_t)
106 ### We need iconv for unicode support (Qt4 frontend requires it too)
108 if test "$am_cv_func_iconv" = no; then
109 AC_MSG_ERROR([cannot find required library iconv.])
111 LIBS="$LIBS $LIBICONV"
114 ### check for compression support
115 AC_CHECK_HEADERS(zlib.h,
116 [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
117 [LYX_LIB_ERROR(zlib.h,zlib)])
119 ### check for file magic support (currently optional)
120 AC_CHECK_HEADERS(magic.h,
121 [AC_CHECK_LIB(magic, magic_open, [LIBS="$LIBS -lmagic"],
122 LYX_WARNING([cannot find libmagic. Please check that the libmagic library
123 is correctly installed on your system.
124 Falling back to builtin file format detection.]))],
125 [LYX_WARNING([cannot find magic.h. Please check that the libmagic library
126 is correctly installed on your system.
127 Falling back to builtin file format detection.])])
130 ### check which frontend we want to use
132 dnl The code below is not in a macro, because this would cause big
133 dnl problems with the AC_REQUIRE contained in QT4_DO_IT_ALL.
134 for frontend in $FRONTENDS ; do
137 QT4_DO_IT_ALL([4.5.0])
138 FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
139 FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt4"
141 FRONTEND_INFO="${FRONTEND_INFO}\
143 Qt 4 version:\t\t${QT4_VERSION}\n"
144 dnl qt 4 build will fail without moc, uic, or bc
145 if test -z "$MOC4"; then
146 AC_MSG_ERROR([cannot find moc binary.])
148 if test -z "$UIC4"; then
149 AC_MSG_ERROR([cannot find uic binary.!])
151 if test -z "$QT4_LIB"; then
152 AC_MSG_ERROR([cannot find qt4 library.])
154 if test "$bc_found" = "no"; then
155 AC_MSG_ERROR([cannot find bc program.])
159 AC_MSG_ERROR([unknown frontend '$frontend'.]);;
163 # fix the value of the prefixes.
164 test "x$prefix" = xNONE && prefix=$default_prefix
165 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
166 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
167 LYX_WARNING([the installation prefix \"${prefix}\" contains a space, which
168 causes problems with the Makefiles. The installation will be done in
169 directory \"`pwd`/installprefix\" instead. Please move its contents to
170 the right place after installation.])
171 prefix=`pwd`/installprefix
174 ### Setup GNU gettext
175 dnl GNU gettext is written in C
177 dnl Dirty trick ahead: disable macro AC_GNU_SOURCE because it triggers a bug with autoconf 2.62.
178 dnl this can be removed if gettext is been updated to avoid that.
179 m4_undefine([AC_GNU_SOURCE])
180 m4_defun([AC_GNU_SOURCE],[])
181 AM_GNU_GETTEXT([no-libtool])
182 AM_GNU_GETTEXT_VERSION([0.16.1])
185 # some standard header files
187 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h locale.h utime.h sys/utime.h)
189 # some standard types
190 AC_CHECK_TYPE(mode_t,[AC_DEFINE(HAVE_MODE_T, 1, [Define this to 1 if your compiler supports the mode_t type.])])
196 LYX_CHECK_DEF(PATH_MAX, limits.h, [int n = PATH_MAX;])
198 AC_CHECK_FUNCS(chmod close _close fork getpid _getpid lstat mkfifo open _open pclose _pclose popen _popen readlink strerror unsetenv)
199 # Check the form of mkdir()
201 AC_FUNC_SELECT_ARGTYPES
203 LYX_CHECK_SPELL_ENGINES
205 lyx_client_subdir=true
207 dnl LIBS already contains some X extra libs that may interfere.
210 AC_CHECK_FUNCS(fcntl,
211 [AC_SEARCH_LIBS([gethostbyname], [nsl])
212 AC_SEARCH_LIBS([socket], [socket], [],
213 [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
215 [lyx_client_subdir=false])
216 AC_SUBST(SOCKET_LIBS,$LIBS)
218 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
223 *mingw*|*cygwin*) lyx_win_res=true;;
225 AM_CONDITIONAL(LYX_WIN_RESOURCE, $lyx_win_res)
229 ### Some information on what just happened
230 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
231 real_pkgdatadir=`eval "echo \`eval \"echo \\\`eval \\\"echo ${pkgdatadir}\\\"\\\`\"\`"`
232 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
233 VERSION_INFO="Configuration\n\
234 Host type: ${host}\n\
235 Special build flags: ${lyx_flags}\n\
236 C++ Compiler: ${CXX} ${CXX_VERSION}\n\
237 C++ Compiler LyX flags: ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
238 C++ Compiler flags: ${CPPFLAGS} ${CXXFLAGS}\n\
239 Linker flags: ${AM_LDFLAGS}\n\
240 Linker user flags: ${LDFLAGS}\n\
242 Packaging: ${lyx_use_packaging}\n\
243 LyX binary dir: ${real_bindir}\n\
244 LyX files dir: ${real_pkgdatadir}\n"
246 AC_SUBST(VERSION_INFO)
247 AC_SUBST(RPM_FRONTEND)
248 AC_SUBST(AM_CPPFLAGS)
249 AC_SUBST(AM_CXXFLAGS)
252 AC_SUBST(real_pkgdatadir)
254 ## Some config.h stuff
260 * This file is part of LyX, the document processor.
261 * Licence details can be found in the file COPYING.
263 * This is the compilation configuration file for LyX.
264 * It was generated by autoconfs configure.
265 * You might want to change some of the defaults if something goes wrong
266 * during the compilation.
274 /************************************************************
275 ** You should not need to change anything beyond this point */
277 #ifndef HAVE_STRERROR
278 #if defined(__cplusplus)
281 char * strerror(int n);
284 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
285 # define USE_BOOST_FORMAT 1
287 # define USE_BOOST_FORMAT 0
290 #define BOOST_USER_CONFIG <config.h>
292 #if !defined(ENABLE_ASSERTIONS)
293 # define BOOST_DISABLE_ASSERTS 1
295 #define BOOST_ENABLE_ASSERT_HANDLER 1
297 #define BOOST_DISABLE_THREADS 1
298 #define BOOST_NO_WREGEX 1
299 #define BOOST_NO_WSTRING 1
301 // TR1 regex not supported in GCC <= 4.5
310 # define BOOST_POSIX 1
311 # define BOOST_POSIX_API 1
312 # define BOOST_POSIX_PATH 1
316 * the FreeBSD libc uses UCS4, but libstdc++ has no proper wchar_t
317 * support compiled in:
318 * http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#3_9
319 * And we are not interested at all what libc
320 * does: What we need is a 32bit wide wchar_t, and a libstdc++ that
321 * has the needed wchar_t support and uses UCS4. Whether it
322 * implements this with the help of libc, or whether it has own code
323 * does not matter for us, because we do not use libc directly (Georg)
325 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
332 MSYS_AC_CANONICAL_PATH(lyx_abs_top_srcdir, ${srcdir})
333 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_localedir, ${real_localedir})
334 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_datadir, ${real_pkgdatadir})
336 AC_DEFINE_UNQUOTED([LYX_ABS_TOP_SRCDIR],
337 "${lyx_abs_top_srcdir}", [Top source directory])
338 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_LOCALEDIR],
339 "${lyx_abs_installed_localedir}",[Hard coded locale directory])
340 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_DATADIR],
341 "${lyx_abs_installed_datadir}",[Hard system support directory])
342 AC_DEFINE_UNQUOTED([PROGRAM_SUFFIX],
343 "${version_suffix}",[Program version suffix])
345 AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
346 AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
347 AC_DEFINE_UNQUOTED([LYX_DIR_VER],"$lyx_dir_ver",[Versioned env var for system dir])
348 AC_DEFINE_UNQUOTED([LYX_USERDIR_VER],"$lyx_userdir_ver",[Versioned env var for user dir])
349 AC_DEFINE_UNQUOTED([LYX_MAJOR_VERSION],$lyx_major,[Major version number])
350 AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
351 AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
352 AC_DEFINE_UNQUOTED([LYX_RELEASE_PATCH],$lyx_patch,[Patch version number])
354 AC_CONFIG_FILES([Makefile \
358 development/Makefile \
359 development/MacOSX/Makefile \
360 development/MacOSX/Info.plist \
361 development/MacOSX/lyxrc.dist \
362 development/MacOSX/spotlight/Makefile \
363 development/cygwin/Makefile \
364 development/cygwin/lyxrc.dist \
365 development/lyx.spec \
367 lib/lyx.desktop-temp:lib/lyx.desktop.in
370 lib/lyx2lyx/lyx2lyx_version.py \
371 lib/lyx2lyx/Makefile \
376 src/client/Makefile \
377 src/client/lyxclient.1:src/client/lyxclient.1in \
379 src/tex2lyx/Makefile \
380 src/tex2lyx/tex2lyx.1:src/tex2lyx/tex2lyx.1in \
381 src/support/Makefile \
382 src/frontends/Makefile \
383 src/frontends/qt4/Makefile
389 # show version information
391 printf "$VERSION_INFO"
394 # Display a final warning if there has been a LYX_WARNING
398 Configuration of LyX was successful.
399 Type 'make' to compile the program,
400 and then 'make install' to install it.