]> git.lyx.org Git - lyx.git/blob - configure.ac
boost: Turn off warning that signals are deprecated
[lyx.git] / configure.ac
1 dnl Process with autoconf to generate configure script   -*- sh -*-
2
3 AC_INIT(LyX,2.2.0dev,[lyx-devel@lists.lyx.org],[lyx])
4 AC_PRESERVE_HELP_ORDER
5 # Use ISO format only. The frontend needs to parse this
6 AC_SUBST(LYX_DATE, ["2014-04-14"])
7 AC_PREREQ(2.60)
8 AC_CONFIG_SRCDIR(src/main.cpp)
9 AC_CONFIG_HEADERS([config.h])
10
11 AC_CONFIG_AUX_DIR(config)
12
13 # First check the version
14 LYX_CHECK_VERSION
15 LYX_VERSION_SUFFIX
16 # Check how the files should be packaged
17 AC_CANONICAL_TARGET
18 LYX_USE_PACKAGING
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])
22
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
26 fi
27 AM_MAINTAINER_MODE
28
29 save_PACKAGE=$PACKAGE
30 dnl The test for _AM_PROG_CC_C_O intends to test for automake 1.14 or newer,
31 dnl which are the versions where subdir-objects can beused.
32 dnl see: https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg181023.html
33 m4_define([LYX_OBJECTS_LAYOUT], m4_ifdef([_AM_PROG_CC_C_O],[subdir-objects],))
34 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.8] LYX_OBJECTS_LAYOUT)
35 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
36 PACKAGE=$save_PACKAGE
37
38 # Allow to build some parts of the code as one big chunk
39 m4_define([ALLPARTS],[boost,client,insets,mathed,core,tex2lyx,frontend_qt4])
40 AC_ARG_ENABLE(monolithic-build,
41   AC_HELP_STRING([--enable-monolithic-build@<:@=LIST@:>@],
42                 [Use monolithic build for modules in LIST (default: ALLPARTS)]),
43   [test "$enable_monolithic_build" = yes && enable_monolithic_build="ALLPARTS"
44    test "$enable_monolithic_build" = no && enable_monolithic_build=
45    IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=" ,"
46    for i in $enable_monolithic_build ; do
47        eval "enable_monolithic_$i=yes"
48    done
49    IFS="$ac_save_ifs"],
50   [enable_monolithic_build=])
51
52 AM_CONDITIONAL(MONOLITHIC_BOOST, test "x$enable_monolithic_boost" = "xyes")
53 AM_CONDITIONAL(MONOLITHIC_CLIENT, test "x$enable_monolithic_client" = "xyes")
54 AM_CONDITIONAL(MONOLITHIC_INSETS, test "x$enable_monolithic_insets" = "xyes")
55 AM_CONDITIONAL(MONOLITHIC_MATHED, test "x$enable_monolithic_mathed" = "xyes")
56 AM_CONDITIONAL(MONOLITHIC_CORE, test "x$enable_monolithic_core" = "xyes")
57 AM_CONDITIONAL(MONOLITHIC_TEX2LYX, test "x$enable_monolithic_tex2lyx" = "xyes")
58 AM_CONDITIONAL(MONOLITHIC_FRONTEND_QT4, test "x$enable_monolithic_frontend_qt4" = "xyes")
59
60 ### Set the execute permissions of the various scripts correctly
61 for file in config/install-sh ; do
62   chmod 755 ${srcdir}/${file}
63 done
64
65 AM_PATH_PYTHON(2.4.0,, :)
66 AC_PROG_RANLIB
67
68 ### Check for a C++ compiler
69 LYX_PROG_CXX
70 AC_LANG(C++)
71
72 ### Objective-C compiler
73 AC_PROG_OBJC
74 _AM_DEPENDENCIES([OBJC])
75
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"
80
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"
85
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)])
91
92 ### These are needed in windows
93 AC_CHECK_LIB(shlwapi, main, [LIBSHLWAPI=-lshlwapi])
94 AC_SUBST(LIBSHLWAPI)
95 AC_CHECK_LIB(psapi, main, [LIBPSAPI=-lpsapi])
96 AC_SUBST(LIBPSAPI)
97 AC_CHECK_LIB(gdi32, main)
98
99 LYX_USE_INCLUDED_BOOST
100 LYX_USE_INCLUDED_MYTHES
101
102 ### we need to know the byte order for unicode conversions
103 AC_C_BIGENDIAN
104
105 # Needed for our char_type
106 AC_CHECK_SIZEOF(wchar_t)
107
108 ### We need iconv for unicode support (Qt4 frontend requires it too)
109 AM_ICONV
110 if test "$am_cv_func_iconv" = no; then
111   AC_MSG_ERROR([cannot find required library iconv.])
112 else
113   LIBS="$LIBS $LIBICONV"
114 fi
115
116 ### check for compression support
117 AC_CHECK_HEADERS(zlib.h,
118  [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
119  [LYX_LIB_ERROR(zlib.h,zlib)])
120
121 ### check for file magic support (currently optional)
122 AC_CHECK_HEADERS(magic.h,
123  [AC_CHECK_LIB(magic, magic_open, [LIBS="$LIBS -lmagic"],
124   LYX_WARNING([cannot find libmagic. Please check that the libmagic library
125    is correctly installed on your system.
126    Falling back to builtin file format detection.]))],
127  [LYX_WARNING([cannot find magic.h. Please check that the libmagic library
128    is correctly installed on your system.
129    Falling back to builtin file format detection.])])
130
131 ### setup the qt4 frontend.
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 QT4_DO_IT_ALL([4.5.0])
135 AC_SUBST([FRONTENDS_SUBDIRS], [qt4])
136 FRONTEND_INFO="${FRONTEND_INFO}\
137   Qt 4 Frontend:\n\
138       Qt 4 version:\t\t${QT4_VERSION}\n"
139
140 # fix the value of the prefixes.
141 test "x$prefix" = xNONE && prefix=$default_prefix
142 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
143 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
144   LYX_WARNING([the installation prefix \"${prefix}\" contains a space, which
145    causes problems with the Makefiles. The installation will be done in
146    directory \"`pwd`/installprefix\" instead. Please move its contents to
147    the right place after installation.])
148   prefix=`pwd`/installprefix
149 fi
150
151 ### Setup po directory
152 AM_PO_SUBDIRS
153 AM_NLS
154 if test $USE_NLS = "yes" ; then
155   AC_DEFINE(ENABLE_NLS, 1,
156     [Define to 1 if translation of program messages to the user's native language
157    is requested.])dnl'
158 fi
159
160 # some standard header files
161 AC_HEADER_MAJOR
162 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h locale.h utime.h sys/utime.h)
163
164 # some standard types
165 AC_CHECK_TYPE(mode_t,[AC_DEFINE(HAVE_MODE_T, 1, [Define this to 1 if your compiler supports the mode_t type.])])
166 AC_TYPE_OFF_T
167 AC_TYPE_PID_T
168 AC_TYPE_SIZE_T
169 AC_TYPE_UID_T
170 # Taken from gettext
171 AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
172    [AC_TRY_COMPILE([#include <stddef.h>
173       wchar_t foo = (wchar_t)'\0';], ,
174       [gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])])
175 if test $gt_cv_c_wchar_t = yes; then
176   AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
177 fi
178
179 LYX_CHECK_DEF(PATH_MAX, limits.h, [int n = PATH_MAX;])
180
181 AC_CHECK_FUNCS(chmod close _close fork getpid _getpid lockf lstat mkfifo open _open pclose _pclose popen _popen readlink putenv setenv strerror unsetenv)
182 # Check the form of mkdir()
183 AC_FUNC_MKDIR
184 AC_FUNC_SELECT_ARGTYPES
185
186 LYX_CHECK_SPELL_ENGINES
187
188 lyx_client_subdir=true
189 dnl AC_LANG_PUSH(C)
190 dnl LIBS already contains some X extra libs that may interfere.
191 save_LIBS="$LIBS"
192 LIBS=
193 AC_CHECK_FUNCS(fcntl,
194   [AC_SEARCH_LIBS([gethostbyname], [nsl])
195    AC_SEARCH_LIBS([socket], [socket], [],
196      [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
197                 [], [-lnsl])])],
198   [lyx_client_subdir=false])
199 AC_SUBST(SOCKET_LIBS,$LIBS)
200 LIBS="$save_LIBS"
201 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
202 dnl AC_LANG_POP(C)
203
204 lyx_win_res=false;
205 case ${host} in
206     *mingw*|*cygwin*) lyx_win_res=true;;
207 esac
208 AM_CONDITIONAL(LYX_WIN_RESOURCE, $lyx_win_res)
209 LYX_SET_VERSION_INFO
210
211
212 ### Some information on what just happened
213 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
214 real_pkgdatadir=`eval "echo \`eval \"echo \\\`eval \\\"echo ${pkgdatadir}\\\"\\\`\"\`"`
215 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
216 VERSION_INFO="Configuration\n\
217   Host type:                    ${host}\n\
218   Special build flags:         ${lyx_flags}\n\
219   C++ Compiler:                 ${CXX} ${CXX_VERSION}\n\
220   C++ Compiler LyX flags:       ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
221   C++ Compiler flags:           ${CPPFLAGS} ${CXXFLAGS}\n\
222   Linker flags:                 ${AM_LDFLAGS}\n\
223   Linker user flags:            ${LDFLAGS}\n\
224 ${FRONTEND_INFO}\
225   Packaging:                    ${lyx_use_packaging}\n\
226   LyX binary dir:               ${real_bindir}\n\
227   LyX files dir:                ${real_pkgdatadir}\n"
228
229 AC_SUBST(VERSION_INFO)
230 AC_SUBST(AM_CPPFLAGS)
231 AC_SUBST(AM_CXXFLAGS)
232 AC_SUBST(AM_CFLAGS)
233 AC_SUBST(AM_LDFLAGS)
234 AC_SUBST(real_pkgdatadir)
235
236 ## Some config.h stuff
237
238 AH_TOP([
239 /* -*- C++ -*- */
240 /*
241  * \file config.h
242  * This file is part of LyX, the document processor.
243  * Licence details can be found in the file COPYING.
244  *
245  * This is the compilation configuration file for LyX.
246  * It was generated by autoconfs configure.
247  * You might want to change some of the defaults if something goes wrong
248  * during the compilation.
249  */
250
251 #ifndef _CONFIG_H
252 #define _CONFIG_H
253 ])
254
255 AH_BOTTOM([
256 /************************************************************
257  ** You should not need to change anything beyond this point */
258
259 #ifndef HAVE_STRERROR
260 #if defined(__cplusplus)
261 extern "C"
262 #endif
263 char * strerror(int n);
264 #endif
265
266 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
267 #  define USE_BOOST_FORMAT 1
268 #else
269 #  define USE_BOOST_FORMAT 0
270 #endif
271
272 #define BOOST_USER_CONFIG <config.h>
273
274 #if !defined(ENABLE_ASSERTIONS)
275 #  define BOOST_DISABLE_ASSERTS 1
276 #endif
277 #define BOOST_ENABLE_ASSERT_HANDLER 1
278
279 #define BOOST_DISABLE_THREADS 1
280 #define BOOST_NO_WREGEX 1
281 #define BOOST_NO_WSTRING 1
282 #define BOOST_SIGNALS_NO_DEPRECATION_WARNING 1
283
284 // TR1 regex not supported in GCC <= 4.5
285 #ifndef LYX_USE_TR1
286 #  if __GNUC__ == 4 
287 #    define LYX_USE_TR1
288 #  endif
289 #endif
290
291 #ifdef __CYGWIN__
292 #  define NOMINMAX
293 #  define BOOST_POSIX 1
294 #  define BOOST_POSIX_API 1
295 #  define BOOST_POSIX_PATH 1
296 #endif
297
298 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4
299 #  define USE_WCHAR_T
300 #endif
301
302 #endif
303 ])
304
305 MSYS_AC_CANONICAL_PATH(lyx_abs_top_srcdir, ${srcdir})
306 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_localedir, ${real_localedir})
307 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_datadir, ${real_pkgdatadir})
308
309 AC_DEFINE_UNQUOTED([LYX_ABS_TOP_SRCDIR],
310         "${lyx_abs_top_srcdir}", [Top source directory])
311 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_LOCALEDIR],
312         "${lyx_abs_installed_localedir}",[Hard coded locale directory])
313 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_DATADIR],
314         "${lyx_abs_installed_datadir}",[Hard system support directory])
315 AC_DEFINE_UNQUOTED([PROGRAM_SUFFIX],
316         "${version_suffix}",[Program version suffix])
317
318 AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
319 AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
320 AC_DEFINE_UNQUOTED([LYX_DIR_VER],"$lyx_dir_ver",[Versioned env var for system dir])
321 AC_DEFINE_UNQUOTED([LYX_USERDIR_VER],"$lyx_userdir_ver",[Versioned env var for user dir])
322 AC_DEFINE_UNQUOTED([LYX_MAJOR_VERSION],$lyx_major,[Major version number])
323 AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
324 AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
325 AC_DEFINE_UNQUOTED([LYX_RELEASE_PATCH],$lyx_patch,[Patch version number])
326
327 AC_CONFIG_FILES([Makefile \
328       lyx.1:lyx.1in \
329       boost/Makefile \
330       config/Makefile \
331       development/Makefile \
332       development/MacOSX/Makefile \
333       development/MacOSX/Info.plist \
334       development/MacOSX/lyxrc.dist \
335       development/MacOSX/spotlight/Makefile \
336       development/cygwin/Makefile \
337       development/cygwin/lyxrc.dist \
338       development/lyx.spec \
339       lib/lyx.desktop-temp:lib/lyx.desktop.in
340       lib/Makefile \
341       lib/doc/Makefile \
342       lib/lyx2lyx/lyx2lyx_version.py \
343       lib/lyx2lyx/Makefile \
344       m4/Makefile \
345       po/Makefile.in \
346       sourcedoc/Doxyfile \
347       sourcedoc/Makefile \
348       src/client/Makefile \
349       src/client/lyxclient.1:src/client/lyxclient.1in \
350       src/Makefile \
351       src/tex2lyx/Makefile \
352       src/tex2lyx/tex2lyx.1:src/tex2lyx/tex2lyx.1in \
353       src/support/Makefile \
354       src/frontends/Makefile \
355       src/frontends/qt4/Makefile
356 ])
357
358
359 AC_OUTPUT
360
361 # show version information
362 echo
363 printf "$VERSION_INFO"
364 echo
365
366 # Display a final warning if there has been a LYX_WARNING
367 LYX_CHECK_WARNINGS
368
369 cat <<EOF
370 Configuration of LyX was successful.
371 Type 'make' to compile the program,
372 and then 'make install' to install it.
373 EOF