1 dnl Process with autoconf to generate configure script -*- sh -*-
3 AC_INIT(LyX,2.1.0svn,[lyx-devel@lists.lyx.org],[lyx])
4 # Use ISO format only. The frontend needs to parse this
5 AC_SUBST(LYX_DATE, ["2011-04-29"])
7 AC_CONFIG_SRCDIR(src/main.cpp)
8 AC_CONFIG_HEADERS([config.h])
10 AC_CONFIG_AUX_DIR(config)
12 # First check the version
15 # Check how the files should be packaged
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
29 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.8])
30 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
33 # Allow to build some parts of the code as one big chunk
34 m4_define([ALLPARTS],[boost,client,insets,mathed,core,tex2lyx,frontend_qt4])
35 AC_ARG_ENABLE(monolithic-build,
36 AC_HELP_STRING([--enable-monolithic-build@<:@=LIST@:>@],
37 [Use monolithic build for modules in LIST (default: ALLPARTS)]),
38 [test "$enable_monolithic_build" = yes && enable_monolithic_build="ALLPARTS"
39 test "$enable_monolithic_build" = no && enable_monolithic_build=
40 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=" ,"
41 for i in $enable_monolithic_build ; do
42 eval "enable_monolithic_$i=yes"
45 [enable_monolithic_build=])
47 AM_CONDITIONAL(MONOLITHIC_BOOST, test "x$enable_monolithic_boost" = "xyes")
48 AM_CONDITIONAL(MONOLITHIC_CLIENT, test "x$enable_monolithic_client" = "xyes")
49 AM_CONDITIONAL(MONOLITHIC_INSETS, test "x$enable_monolithic_insets" = "xyes")
50 AM_CONDITIONAL(MONOLITHIC_MATHED, test "x$enable_monolithic_mathed" = "xyes")
51 AM_CONDITIONAL(MONOLITHIC_CORE, test "x$enable_monolithic_core" = "xyes")
52 AM_CONDITIONAL(MONOLITHIC_TEX2LYX, test "x$enable_monolithic_tex2lyx" = "xyes")
53 AM_CONDITIONAL(MONOLITHIC_FRONTEND_QT4, test "x$enable_monolithic_frontend_qt4" = "xyes")
55 ### Set the execute permissions of the various scripts correctly
56 for file in config/install-sh ; do
57 chmod 755 ${srcdir}/${file}
60 # Check for installed python
61 AM_PATH_PYTHON(2.4.0,, :)
63 ### we need to know the byte order for unicode conversions
66 ### check which frontend we want to use
69 ### Check for a C++ compiler
72 ### Objective-C compiler
74 _AM_DEPENDENCIES([OBJC])
76 ### Add extra directories to check for libraries.
77 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
78 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
79 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
81 ### Add extra directories to check for include files.
82 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
83 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
84 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
86 ### Add both includes and libraries
87 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
88 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
89 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
90 LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
92 ### These are needed in windows
93 AC_CHECK_LIB(shlwapi, main, [LIBSHLWAPI=-lshlwapi])
95 AC_CHECK_LIB(psapi, main, [LIBPSAPI=-lpsapi])
97 AC_CHECK_LIB(gdi32, main)
99 LYX_USE_INCLUDED_BOOST
100 LYX_USE_INCLUDED_MYTHES
102 # Needed for our char_type
103 AC_CHECK_SIZEOF(wchar_t)
105 ### We need iconv for unicode support (Qt4 frontend requires it too)
107 if test "$am_cv_func_iconv" = no; then
108 LYX_ERROR([Cannot find required library iconv])
110 LIBS="$LIBS $LIBICONV"
113 ### check for compression support
114 AC_CHECK_HEADERS(zlib.h,
115 [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
116 [LYX_LIB_ERROR(zlib.h,zlib)])
119 ### check which frontend we want to use
121 dnl The code below is not in a macro, because this would cause big
122 dnl problems with the AC_REQUIRE contained in QT4_DO_IT_ALL.
123 for frontend in $FRONTENDS ; do
127 FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
128 FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt4"
130 FRONTEND_INFO="${FRONTEND_INFO}\
132 Qt 4 version:\t\t${QT4_VERSION}\n"
133 dnl qt 4 build will fail without moc, uic, or bc
134 if test -z "$MOC4"; then
135 LYX_ERROR([moc 4 binary not found !])
137 if test -z "$UIC4"; then
138 LYX_ERROR([uic 4 binary not found !])
140 if test -z "$QT4_LIB"; then
141 LYX_ERROR([qt 4 library not found !])
143 if test "$bc_found" = "no"; then
144 LYX_ERROR([bc binary not found !])
148 LYX_ERROR(Unknown frontend '$frontend');;
152 # fix the value of the prefixes.
153 test "x$prefix" = xNONE && prefix=$default_prefix
154 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
155 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
156 LYX_WARNING([The installation prefix \"${prefix}\" contains a space, which
157 causes problems with the Makefiles. The installation will be done in
158 directory \"`pwd`/installprefix\" instead. Please move its contents to
159 the right place after installation.])
160 prefix=`pwd`/installprefix
163 ### Setup GNU gettext
164 dnl GNU gettext is written in C
166 dnl Dirty trick ahead: disable macro AC_GNU_SOURCE because it triggers a bug with autoconf 2.62.
167 dnl this can be removed if gettext is been updated to avoid that.
168 m4_undefine([AC_GNU_SOURCE])
169 m4_defun([AC_GNU_SOURCE],[])
170 AM_GNU_GETTEXT([no-libtool])
171 AM_GNU_GETTEXT_VERSION([0.16.1])
174 # some standard header files
176 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h locale.h utime.h sys/utime.h)
178 # some standard structures
182 # some standard types
183 AC_CHECK_TYPE(mode_t,[AC_DEFINE(HAVE_MODE_T, 1, [Define this to 1 if your compiler supports the mode_t type.])])
190 LYX_CHECK_DEF(PATH_MAX, limits.h, [int n = PATH_MAX;])
192 AC_CHECK_FUNCS(chmod close _close fork getpid _getpid lstat mkfifo open _open pclose _pclose popen _popen readlink strerror)
193 # Check the form of mkdir()
195 AC_FUNC_SELECT_ARGTYPES
197 LYX_CHECK_SPELL_ENGINES
199 lyx_client_subdir=true
201 dnl LIBS already contains some X extra libs that may interfere.
204 AC_CHECK_FUNCS(fcntl,
205 [AC_SEARCH_LIBS([gethostbyname], [nsl])
206 AC_SEARCH_LIBS([socket], [socket], [],
207 [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
209 [lyx_client_subdir=false])
210 AC_SUBST(SOCKET_LIBS,$LIBS)
212 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
217 *mingw*|*cygwin*) lyx_win_res=true;;
219 AM_CONDITIONAL(LYX_WIN_RESOURCE, $lyx_win_res)
223 ### Some information on what just happened
224 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
225 real_pkgdatadir=`eval "echo \`eval \"echo \\\`eval \\\"echo ${pkgdatadir}\\\"\\\`\"\`"`
226 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
227 VERSION_INFO="Configuration\n\
228 Host type: ${host}\n\
229 Special build flags: ${lyx_flags}\n\
230 C Compiler: ${CC} ${CC_VERSION}\n\
231 C Compiler LyX flags: ${AM_CPPFLAGS} ${AM_CFLAGS}\n\
232 C Compiler flags: ${CPPFLAGS} ${CFLAGS}\n\
233 C++ Compiler: ${CXX} ${CXX_VERSION}\n\
234 C++ Compiler LyX flags: ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
235 C++ Compiler flags: ${CPPFLAGS} ${CXXFLAGS}\n\
236 Linker flags: ${AM_LDFLAGS}\n\
237 Linker user flags: ${LDFLAGS}\n\
239 Packaging: ${lyx_use_packaging}\n\
240 LyX binary dir: ${real_bindir}\n\
241 LyX files dir: ${real_pkgdatadir}\n"
243 AC_SUBST(VERSION_INFO)
244 AC_SUBST(RPM_FRONTEND)
245 AC_SUBST(AM_CPPFLAGS)
246 AC_SUBST(AM_CXXFLAGS)
249 AC_SUBST(real_pkgdatadir)
251 ## Some config.h stuff
257 * This file is part of LyX, the document processor.
258 * Licence details can be found in the file COPYING.
260 * This is the compilation configuration file for LyX.
261 * It was generated by autoconfs configure.
262 * You might want to change some of the defaults if something goes wrong
263 * during the compilation.
271 /************************************************************
272 ** You should not need to change anything beyond this point */
274 #ifndef HAVE_STRERROR
275 #if defined(__cplusplus)
278 char * strerror(int n);
281 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
282 # define USE_BOOST_FORMAT 1
284 # define USE_BOOST_FORMAT 0
287 #define BOOST_USER_CONFIG <config.h>
289 #if !defined(ENABLE_ASSERTIONS)
290 # define BOOST_DISABLE_ASSERTS 1
292 #define BOOST_ENABLE_ASSERT_HANDLER 1
294 #define BOOST_DISABLE_THREADS 1
295 #define BOOST_NO_WREGEX 1
296 #define BOOST_NO_WSTRING 1
298 // TR1 regex not supported in GCC <= 4.5
307 # define BOOST_POSIX 1
308 # define BOOST_POSIX_API 1
309 # define BOOST_POSIX_PATH 1
313 * the FreeBSD libc uses UCS4, but libstdc++ has no proper wchar_t
314 * support compiled in:
315 * http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#3_9
316 * And we are not interested at all what libc
317 * does: What we need is a 32bit wide wchar_t, and a libstdc++ that
318 * has the needed wchar_t support and uses UCS4. Whether it
319 * implements this with the help of libc, or whether it has own code
320 * does not matter for us, because we do not use libc directly (Georg)
322 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
329 MSYS_AC_CANONICAL_PATH(lyx_abs_top_srcdir, ${srcdir})
330 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_localedir, ${real_localedir})
331 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_datadir, ${real_pkgdatadir})
333 AC_DEFINE_UNQUOTED([LYX_ABS_TOP_SRCDIR],
334 "${lyx_abs_top_srcdir}", [Top source directory])
335 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_LOCALEDIR],
336 "${lyx_abs_installed_localedir}",[Hard coded locale directory])
337 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_DATADIR],
338 "${lyx_abs_installed_datadir}",[Hard system support directory])
339 AC_DEFINE_UNQUOTED([PROGRAM_SUFFIX],
340 "${version_suffix}",[Program version suffix])
342 AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
343 AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
344 AC_DEFINE_UNQUOTED([LYX_DIR_VER],"$lyx_dir_ver",[Versioned env var for system dir])
345 AC_DEFINE_UNQUOTED([LYX_USERDIR_VER],"$lyx_userdir_ver",[Versioned env var for user dir])
346 AC_DEFINE_UNQUOTED([LYX_MAJOR_VERSION],$lyx_major,[Major version number])
347 AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
348 AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
349 AC_DEFINE_UNQUOTED([LYX_RELEASE_PATCH],$lyx_patch,[Patch version number])
351 AC_CONFIG_FILES([Makefile \
355 development/Makefile \
356 development/MacOSX/Makefile \
357 development/MacOSX/Info.plist \
358 development/MacOSX/lyxrc.dist \
359 development/MacOSX/spotlight/Makefile \
360 development/cygwin/Makefile \
361 development/cygwin/lyxrc.dist \
362 development/lyx.spec \
364 lib/lyx.desktop-temp:lib/lyx.desktop.in
367 lib/lyx2lyx/lyx2lyx_version.py \
368 lib/lyx2lyx/Makefile \
373 src/client/Makefile \
374 src/client/lyxclient.1:src/client/lyxclient.1in \
376 src/tex2lyx/Makefile \
377 src/tex2lyx/tex2lyx.1:src/tex2lyx/tex2lyx.1in \
378 src/support/Makefile \
379 src/frontends/Makefile \
380 src/frontends/qt4/Makefile
386 # show version information
388 printf "$VERSION_INFO"
391 # Display a final warning if there has been a LYX_ERROR