]> git.lyx.org Git - lyx.git/blob - configure.ac
Update ru.po
[lyx.git] / configure.ac
1 dnl Process with autoconf to generate configure script   -*- sh -*-
2
3 AC_INIT([LyX],[2.3.7dev],[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, ["2020-11-30"])
7 AC_PREREQ([2.65])
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 LYX_CHECK_QT5
17 # Check how the files should be packaged
18 AC_CANONICAL_TARGET
19 LYX_USE_PACKAGING
20 # We need to define these variables here and the no-define option of
21 # AM_INIT_AUTOMAKE above because we alter $PACKAGE in LYX_USE_PACKAGING.
22 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
23
24 dnl Default maintainer mode to true for development versions
25 if test "${enable_maintainer_mode+set}" != set; then
26   enable_maintainer_mode=$lyx_devel_version
27 fi
28 AM_MAINTAINER_MODE
29 AM_SILENT_RULES([yes])
30 # Automake is pulling the historical V7 format. This tar format supports
31 # file names only up to 99 characters. tar-ustar selects the ustar format defined
32 # by POSIX 1003.1-1988. This format is believed to be old enough to be portable.
33 save_PACKAGE=$PACKAGE
34 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.14 tar-ustar subdir-objects])
35 PACKAGE=$save_PACKAGE
36
37 # Allow to build some parts of the code as one big chunk
38 m4_define([ALLPARTS],[boost,client,insets,mathed,core,tex2lyx,frontend_qt])
39 AC_ARG_ENABLE(monolithic-build,
40   AS_HELP_STRING([--enable-monolithic-build@<:@=LIST@:>@],[Use monolithic build for modules in LIST (default: ALLPARTS)]),
41   [test "$enable_monolithic_build" = yes && enable_monolithic_build="ALLPARTS"
42    test "$enable_monolithic_build" = no && enable_monolithic_build=
43    IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=" ,"
44    for i in $enable_monolithic_build ; do
45        eval "enable_monolithic_$i=yes"
46    done
47    IFS="$ac_save_ifs"],
48   [enable_monolithic_build=])
49
50 AM_CONDITIONAL(MONOLITHIC_BOOST, test "x$enable_monolithic_boost" = "xyes")
51 AM_CONDITIONAL(MONOLITHIC_CLIENT, test "x$enable_monolithic_client" = "xyes")
52 AM_CONDITIONAL(MONOLITHIC_INSETS, test "x$enable_monolithic_insets" = "xyes")
53 AM_CONDITIONAL(MONOLITHIC_MATHED, test "x$enable_monolithic_mathed" = "xyes")
54 AM_CONDITIONAL(MONOLITHIC_CORE, test "x$enable_monolithic_core" = "xyes")
55 AM_CONDITIONAL(MONOLITHIC_TEX2LYX, test "x$enable_monolithic_tex2lyx" = "xyes")
56 AM_CONDITIONAL(MONOLITHIC_FRONTEND_QT, test "x$enable_monolithic_frontend_qt" = "xyes")
57
58 ### Set the execute permissions of the various scripts correctly
59 for file in config/install-sh ; do
60   chmod 755 ${srcdir}/${file}
61 done
62
63 # Find a suitable python interpreter
64 LYX_PATH_PYTHON23([2.7.0], [3.3.0])
65 # do the usual python setup stuff
66 AM_PATH_PYTHON
67
68 # Tools for creating libraries (note that we do not use libtool)
69 AM_PROG_AR
70 AC_PROG_RANLIB
71 dnl Recent debian/ubuntu (at least) have built 'ar' so that deterministic mode is the default.
72 dnl This means that it does not make sense to use the 'u' flag (default ARFLAGS is 'cru').
73 AC_SUBST([ARFLAGS], [cr])
74
75 ### Check for a C++ compiler
76 dnl We have to do weird tricks so that autoconf does not touch CXXFLAGS even
77 dnl if it is not set. We do not use autoconf defaults.
78 lyx_has_CXXFLAGS=${CXXFLAGS+yes}
79 if ! test "$lyx_has_CXXFLAGS" = yes; then
80   dnl set to a dummy value so that AC_PROG_CXX does not try to set CXXFLAGS
81   CXXFLAGS=" "
82 fi
83 LYX_PROG_CXX
84 if ! test "$lyx_has_CXXFLAGS" = yes; then
85   unset CXXFLAGS
86 fi
87 AC_LANG(C++)
88
89 ### Objective-C compiler
90 AC_PROG_OBJC
91 _AM_DEPENDENCIES([OBJC])
92
93 ### Add extra directories to check for libraries.
94 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
95 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
96 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
97
98 ### Add extra directories to check for include files.
99 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
100 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
101 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
102
103 ### Add both includes and libraries
104 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
105 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
106   LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
107   LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)
108 ])
109
110 ### These are needed in windows
111 AC_CHECK_LIB(shlwapi, main, [LIBSHLWAPI=-lshlwapi])
112 AC_SUBST(LIBSHLWAPI)
113 AC_CHECK_LIB(psapi, main, [LIBPSAPI=-lpsapi])
114 AC_SUBST(LIBPSAPI)
115 AC_CHECK_LIB(gdi32, main)
116 AC_CHECK_LIB(ole32, main)
117
118 LYX_USE_INCLUDED_BOOST
119
120 ### we need to know the byte order for unicode conversions
121 AC_C_BIGENDIAN
122
123 # Nice to have when an assertion triggers
124 LYX_CHECK_CALLSTACK_PRINTING
125
126 # C++14 only
127 LYX_CHECK_DEF(make_unique, memory, [using std::make_unique;])
128
129 # Needed for our char_type
130 AC_CHECK_SIZEOF(wchar_t)
131
132 # Taken from gettext, needed for libiconv
133 AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
134    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
135       wchar_t foo = (wchar_t)'\0';]], [[]])],[gt_cv_c_wchar_t=yes],[gt_cv_c_wchar_t=no])])
136 if test $gt_cv_c_wchar_t = yes; then
137   AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
138   HAVE_WCHAR_T=1
139 else
140   HAVE_WCHAR_T=0
141 fi
142 AC_SUBST([HAVE_WCHAR_T])
143
144 # Needed for Mingw-w64
145 AC_TYPE_LONG_LONG_INT
146 if test "$ac_cv_type_long_long_int" = yes; then
147   AC_CHECK_SIZEOF(long)
148   AC_CHECK_SIZEOF(long long)
149 fi
150
151 ### We need iconv for unicode support (Qt4 frontend requires it too)
152 LYX_USE_INCLUDED_ICONV
153
154 ### check for compression support
155 LYX_USE_INCLUDED_ZLIB
156
157 ### check for file magic support (currently optional)
158 AC_CHECK_HEADERS(magic.h,
159  [AC_CHECK_LIB(magic, magic_open, [LIBS="$LIBS -lmagic"],
160   LYX_WARNING([cannot find libmagic. Please check that the libmagic library
161    is correctly installed on your system.
162    Falling back to builtin file format detection.]))],
163  [LYX_WARNING([cannot find magic.h. Please check that the libmagic library
164    is correctly installed on your system.
165    Falling back to builtin file format detection.])])
166
167 ### setup the qt frontend.
168 dnl The code below is not in a macro, because this would cause big
169 dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
170 QT_DO_IT_ALL([4.5.0])
171 AC_SUBST([FRONTENDS_SUBDIRS], [qt4])
172 FRONTEND_INFO="${FRONTEND_INFO}\
173   Qt Frontend:\n\
174       Qt version:\t   ${QTLIB_VERSION}\n"
175
176 # fix the value of the prefixes.
177 test "x$prefix" = xNONE && prefix=$default_prefix
178 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
179 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
180   LYX_WARNING([the installation prefix \"${prefix}\" contains a space, which
181    causes problems with the Makefiles. The installation will be done in
182    directory \"`pwd`/installprefix\" instead. Please move its contents to
183    the right place after installation.])
184   prefix=`pwd`/installprefix
185 fi
186
187 ### Setup po directory
188 AM_NLS
189 if test $USE_NLS = "yes" ; then
190   AC_DEFINE(ENABLE_NLS, 1,
191     [Define to 1 if translation of program messages to the user's native language
192    is requested.])dnl'
193 fi
194 AM_PO_SUBDIRS
195
196 # some standard header files
197 AC_HEADER_MAJOR
198 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h locale.h utime.h sys/utime.h)
199
200 # some standard types
201 AC_CHECK_TYPE(mode_t,[AC_DEFINE(HAVE_MODE_T, 1, [Define this to 1 if your compiler supports the mode_t type.])])
202 AC_TYPE_OFF_T
203 AC_TYPE_PID_T
204 AC_TYPE_SIZE_T
205 AC_TYPE_UID_T
206
207 LYX_CHECK_DEF(PATH_MAX, limits.h, [int n = PATH_MAX;])
208
209 AC_CHECK_FUNCS(chmod close _close fork getpid _getpid lockf lstat mkfifo open _open pclose _pclose popen _popen readlink putenv setenv strerror unsetenv)
210 # Check the form of mkdir()
211 AC_FUNC_MKDIR
212 AC_FUNC_SELECT_ARGTYPES
213
214 LYX_CHECK_SPELL_ENGINES
215 LYX_USE_INCLUDED_MYTHES
216
217 lyx_client_subdir=true
218 dnl AC_LANG_PUSH(C)
219 dnl LIBS already contains some X extra libs that may interfere.
220 save_LIBS="$LIBS"
221 LIBS=
222 AC_CHECK_FUNCS(fcntl,
223   [AC_SEARCH_LIBS([gethostbyname], [nsl])
224    AC_SEARCH_LIBS([socket], [socket network], [],
225      [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
226                 [], [-lnsl])])],
227   [lyx_client_subdir=false])
228 AC_SUBST(SOCKET_LIBS,$LIBS)
229 LIBS="$save_LIBS"
230 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
231 dnl AC_LANG_POP(C)
232
233 lyx_win_res=false;
234 case ${host} in
235     *mingw*|*cygwin*) lyx_win_res=true;;
236     *freebsd*) AC_SEARCH_LIBS(backtrace_symbols, [execinfo])
237 esac
238 if test "x$lyx_win_res" = "xtrue"; then
239     AC_CHECK_TOOL(RC, windres,)
240     if test -z "$RC"; then
241       AC_MSG_ERROR(Could not find a resource compiler)
242     fi
243 fi
244 AM_CONDITIONAL(LYX_WIN_RESOURCE, $lyx_win_res)
245 LYX_SET_VERSION_INFO
246
247
248 ### Some information on what just happened
249 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
250 real_pkgdatadir=`eval "echo \`eval \"echo \\\`eval \\\"echo ${pkgdatadir}\\\"\\\`\"\`"`
251 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
252 test -z "${lyx_included_libs}" && lyx_included_libs="(none)"
253 VERSION_INFO="Configuration\n\
254   Host type:               ${host}\n\
255   Special build flags:     ${lyx_flags}\n\
256   Bundled libraries:       ${lyx_included_libs}\n\
257   C++ Compiler:            ${CXX} ${CXX_VERSION}\n\
258   C++ Compiler flags:      ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
259   C++ Compiler user flags: ${CPPFLAGS} ${CXXFLAGS}\n\
260   Linker flags:            ${AM_LDFLAGS}\n\
261   Linker user flags:       ${LDFLAGS}\n\
262 ${FRONTEND_INFO}\
263   Packaging:               ${lyx_use_packaging}\n\
264   LyX binary dir:          ${real_bindir}\n\
265   LyX files dir:           ${real_pkgdatadir}\n"
266
267 AC_SUBST(VERSION_INFO)
268 AC_SUBST(AM_CPPFLAGS)
269 AC_SUBST(AM_CXXFLAGS)
270 AC_SUBST(AM_LDFLAGS)
271 AC_SUBST(real_pkgdatadir)
272
273 ## Some config.h stuff
274
275 AH_TOP([
276 /* -*- C++ -*- */
277 /*
278  * \file config.h
279  * This file is part of LyX, the document processor.
280  * Licence details can be found in the file COPYING.
281  *
282  * This is the compilation configuration file for LyX.
283  * It was generated by autoconfs configure.
284  * You might want to change some of the defaults if something goes wrong
285  * during the compilation.
286  */
287
288 #ifndef _CONFIG_H
289 #define _CONFIG_H
290 ])
291
292 AH_BOTTOM([
293 /************************************************************
294  ** You should not need to change anything beyond this point */
295
296 #ifndef HAVE_STRERROR
297 #if defined(__cplusplus)
298 extern "C"
299 #endif
300 char * strerror(int n);
301 #endif
302
303 #define BOOST_USER_CONFIG <config.h>
304
305 #if !defined(ENABLE_ASSERTIONS)
306 #  define BOOST_DISABLE_ASSERTS 1
307 #endif
308 #define BOOST_ENABLE_ASSERT_HANDLER 1
309
310 #define BOOST_DISABLE_THREADS 1
311 #define BOOST_NO_WREGEX 1
312 #define BOOST_NO_WSTRING 1
313
314 #ifdef __CYGWIN__
315 #  define _DEFAULT_SOURCE
316 #  define NOMINMAX
317 #  define BOOST_POSIX 1
318 #  define BOOST_POSIX_API 1
319 #  define BOOST_POSIX_PATH 1
320 #endif
321
322 #ifdef __sparc__
323 #  ifndef __BIG_ENDIAN__
324 #    define __BIG_ENDIAN__ 1
325 #  endif
326 #endif
327
328 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4
329 #  define USE_WCHAR_T
330 #endif
331
332 #ifdef HAVE_LONG_LONG_INT
333 #if SIZEOF_LONG_LONG > SIZEOF_LONG
334 #define LYX_USE_LONG_LONG
335 #endif
336 #endif
337
338 #endif
339 ])
340
341 MSYS_AC_CANONICAL_PATH(lyx_abs_top_srcdir, ${srcdir})
342 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_localedir, ${real_localedir})
343 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_datadir, ${real_pkgdatadir})
344
345 AC_DEFINE_UNQUOTED([LYX_ABS_TOP_SRCDIR],
346         "${lyx_abs_top_srcdir}", [Top source directory])
347 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_LOCALEDIR],
348         "${lyx_abs_installed_localedir}",[Hard coded locale directory])
349 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_DATADIR],
350         "${lyx_abs_installed_datadir}",[Hard system support directory])
351 AC_DEFINE_UNQUOTED([PROGRAM_SUFFIX],
352         "${version_suffix}",[Program version suffix])
353
354 AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
355 AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
356 AC_DEFINE_UNQUOTED([LYX_DIR_VER],"$lyx_dir_ver",[Versioned env var for system dir])
357 AC_DEFINE_UNQUOTED([LYX_USERDIR_VER],"$lyx_userdir_ver",[Versioned env var for user dir])
358 AC_DEFINE_UNQUOTED([LYX_MAJOR_VERSION],$lyx_major,[Major version number])
359 AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
360 AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
361 AC_DEFINE_UNQUOTED([LYX_RELEASE_PATCH],$lyx_patch,[Patch version number])
362
363 AC_CONFIG_FILES([Makefile \
364       lyx.1:lyx.1in \
365       3rdparty/Makefile \
366       3rdparty/boost/Makefile \
367       3rdparty/hunspell/Makefile \
368       3rdparty/mythes/Makefile \
369       3rdparty/libiconv/Makefile \
370       $ICONV_ICONV_H_IN \
371       3rdparty/zlib/Makefile \
372       autotests/Makefile \
373       config/Makefile \
374       development/Makefile \
375       development/MacOSX/Makefile \
376       development/MacOSX/Info.plist \
377       development/MacOSX/lyxrc.dist \
378       development/MacOSX/spotlight/Makefile \
379       development/cygwin/Makefile \
380       development/cygwin/lyxrc.dist \
381       development/lyx.spec \
382       lib/lyx.desktop-temp:lib/lyx.desktop.in
383       lib/Makefile \
384       lib/doc/Makefile \
385       lib/lyx2lyx/lyx2lyx_version.py \
386       lib/lyx2lyx/Makefile \
387       m4/Makefile \
388       po/Makefile.in \
389       sourcedoc/Doxyfile \
390       sourcedoc/Makefile \
391       src/client/Makefile \
392       src/client/lyxclient.1:src/client/lyxclient.1in \
393       src/Makefile \
394       src/tex2lyx/Makefile \
395       src/tex2lyx/tex2lyx.1:src/tex2lyx/tex2lyx.1in \
396       src/convert/Makefile \
397       src/support/Makefile \
398       src/frontends/Makefile \
399       src/frontends/qt4/Makefile
400 ])
401
402
403 AC_OUTPUT
404
405 # show version information
406 echo
407 printf "$VERSION_INFO"
408 echo
409
410 # Display a final warning if there has been a LYX_WARNING
411 LYX_CHECK_WARNINGS
412
413 cat <<EOF
414 Configuration of LyX was successful.
415 Type 'make' to compile the program,
416 and then 'make install' to install it.
417 EOF