]> git.lyx.org Git - lyx.git/blob - configure.ac
Don't overwrite identical files on export even when FORCE is in effect.
[lyx.git] / configure.ac
1 dnl Process with autoconf to generate configure script   -*- sh -*-
2
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, ["2010-03-15"])
6 AC_PREREQ(2.52)
7 AC_CONFIG_SRCDIR(src/main.cpp)
8 AC_CONFIG_HEADERS([config.h])
9
10 AC_CONFIG_AUX_DIR(config)
11
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])
21
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
25 fi
26 AM_MAINTAINER_MODE
27
28 save_PACKAGE=$PACKAGE
29 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define subdir-objects 1.8])
30 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
31 PACKAGE=$save_PACKAGE
32
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"
43    done
44    IFS="$ac_save_ifs"],
45   [enable_monolithic_build=])
46
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")
54
55 ### Set the execute permissions of the various scripts correctly
56 for file in config/install-sh ; do
57   chmod 755 ${srcdir}/${file}
58 done
59
60 # Check for installed python
61 AM_PATH_PYTHON(2.3.4,, :)
62
63 ### we need to know the byte order for unicode conversions
64 AC_C_BIGENDIAN
65
66 ### check which frontend we want to use
67 LYX_USE_FRONTENDS
68
69 ### Check for a C++ compiler
70 AM_PROG_CC_C_O
71 LYX_PROG_CXX
72
73 ### Objective-C compiler
74 AC_PROG_OBJC
75 _AM_DEPENDENCIES([OBJC])
76
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"
81
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"
86
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)])
92
93 ### These are needed in windows
94 AC_CHECK_LIB(shlwapi, main, [LIBSHLWAPI=-lshlwapi])
95 AC_SUBST(LIBSHLWAPI)
96 AC_CHECK_LIB(psapi, main, [LIBPSAPI=-lpsapi])
97 AC_SUBST(LIBPSAPI)
98 AC_CHECK_LIB(gdi32, main)
99
100 LYX_USE_INCLUDED_BOOST
101
102 # Needed for our char_type
103 AC_CHECK_SIZEOF(wchar_t)
104
105 ### We need iconv for unicode support (Qt4 frontend requires it too)
106 AM_ICONV
107 if test "$am_cv_func_iconv" = no; then
108   LYX_ERROR([Cannot find required library iconv])
109 else
110   LIBS="$LIBS $LIBICONV"
111 fi
112
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)])
117
118
119 ### check which frontend we want to use
120
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
124   case "$frontend" in
125     qt4)
126           QT4_DO_IT_ALL
127           FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
128           FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt4"
129           RPM_FRONTEND="qt4"
130           FRONTEND_INFO="${FRONTEND_INFO}\
131   Qt 4 Frontend:\n\
132       Qt 4 version:\t\t${QT4_VERSION}\n"
133 dnl qt 4 build will fail without moc or uic
134           if test -z "$MOC4"; then
135             LYX_ERROR([moc 4 binary not found !])
136           fi
137           if test -z "$UIC4"; then
138             LYX_ERROR([uic 4 binary not found !])
139           fi
140           if test -z "$QT4_LIB"; then
141             LYX_ERROR([qt 4 library not found !])
142           fi
143       ;;
144     *)
145           LYX_ERROR(Unknown frontend '$frontend');;
146   esac
147 done
148
149 # fix the value of the prefixes.
150 test "x$prefix" = xNONE && prefix=$default_prefix
151 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
152 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
153   LYX_WARNING([The installation prefix \"${prefix}\" contains a space, which
154    causes problems with the Makefiles. The installation will be done in
155    directory \"`pwd`/installprefix\" instead. Please move its contents to
156    the right place after installation.])
157   prefix=`pwd`/installprefix
158 fi
159
160 ### Setup GNU gettext
161 dnl GNU gettext is written in C
162 AC_LANG_PUSH(C)
163 dnl Dirty trick ahead: disable macro AC_GNU_SOURCE because it triggers a bug with autoconf 2.62.
164 dnl this can be removed if gettext is been updated to avoid that.
165 m4_undefine([AC_GNU_SOURCE])
166 m4_defun([AC_GNU_SOURCE],[])
167 AM_GNU_GETTEXT([no-libtool])
168 AM_GNU_GETTEXT_VERSION([0.16.1])
169 AC_LANG_POP(C)
170
171 # some standard header files
172 AC_HEADER_MAJOR
173 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h locale.h utime.h sys/utime.h)
174
175 # some standard structures
176 AC_HEADER_STAT
177 AC_HEADER_TIME
178
179 # some standard types
180 AC_CHECK_TYPE(mode_t,[AC_DEFINE(HAVE_MODE_T, 1, [Define this to 1 if your compiler supports the mode_t type.])])
181 AC_TYPE_OFF_T
182 AC_TYPE_PID_T
183 AC_TYPE_SIGNAL
184 AC_TYPE_SIZE_T
185 AC_TYPE_UID_T
186
187 AC_CHECK_FUNCS(chmod close _close fork getpid _getpid lstat mkfifo open _open pclose _pclose popen _popen readlink strerror)
188 # Check the form of mkdir()
189 AC_FUNC_MKDIR
190 AC_FUNC_SELECT_ARGTYPES
191
192 LYX_CHECK_SPELL_ENGINES
193
194 lyx_client_subdir=true
195 AC_LANG_PUSH(C)
196 dnl LIBS already contains some X extra libs that may interfere.
197 save_LIBS="$LIBS"
198 LIBS=
199 AC_CHECK_FUNCS(fcntl,
200   [AC_SEARCH_LIBS([gethostbyname], [nsl])
201    AC_SEARCH_LIBS([socket], [socket], [],
202      [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
203                 [], [-lnsl])])],
204   [lyx_client_subdir=false])
205 AC_SUBST(SOCKET_LIBS,$LIBS)
206 LIBS="$save_LIBS"
207 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
208 AC_LANG_POP(C)
209
210 lyx_win_res=false;
211 case ${host} in
212     *mingw*|*cygwin*) lyx_win_res=true;;
213 esac
214 AM_CONDITIONAL(LYX_WIN_RESOURCE, $lyx_win_res)
215 LYX_SET_VERSION_INFO
216
217
218 ### Some information on what just happened
219 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
220 real_pkgdatadir=`eval "echo \`eval \"echo \\\`eval \\\"echo ${pkgdatadir}\\\"\\\`\"\`"`
221 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
222 VERSION_INFO="Configuration\n\
223   Host type:                    ${host}\n\
224   Special build flags:          ${lyx_flags}\n\
225   C   Compiler:                 ${CC} ${CC_VERSION}\n\
226   C   Compiler LyX flags:       ${AM_CPPFLAGS} ${AM_CFLAGS}\n\
227   C   Compiler flags:           ${CPPFLAGS} ${CFLAGS}\n\
228   C++ Compiler:                 ${CXX} ${CXX_VERSION}\n\
229   C++ Compiler LyX flags:       ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
230   C++ Compiler flags:           ${CPPFLAGS} ${CXXFLAGS}\n\
231   Linker flags:                 ${AM_LDFLAGS}\n\
232   Linker user flags:            ${LDFLAGS}\n\
233 ${FRONTEND_INFO}\
234   Packaging:                    ${lyx_use_packaging}\n\
235   LyX binary dir:               ${real_bindir}\n\
236   LyX files dir:                ${real_pkgdatadir}\n"
237
238 AC_SUBST(VERSION_INFO)
239 AC_SUBST(RPM_FRONTEND)
240 AC_SUBST(AM_CPPFLAGS)
241 AC_SUBST(AM_CXXFLAGS)
242 AC_SUBST(AM_CFLAGS)
243 AC_SUBST(AM_LDFLAGS)
244 AC_SUBST(real_pkgdatadir)
245
246 ## Some config.h stuff
247
248 AH_TOP([
249 /* -*- C++ -*- */
250 /*
251  * \file config.h
252  * This file is part of LyX, the document processor.
253  * Licence details can be found in the file COPYING.
254  *
255  * This is the compilation configuration file for LyX.
256  * It was generated by autoconfs configure.
257  * You might want to change some of the defaults if something goes wrong
258  * during the compilation.
259  */
260
261 #ifndef _CONFIG_H
262 #define _CONFIG_H
263 ])
264
265 AH_BOTTOM([
266 /************************************************************
267  ** You should not need to change anything beyond this point */
268
269 #ifndef HAVE_STRERROR
270 #if defined(__cplusplus)
271 extern "C"
272 #endif
273 char * strerror(int n);
274 #endif
275
276 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
277 #  define USE_BOOST_FORMAT 1
278 #else
279 #  define USE_BOOST_FORMAT 0
280 #endif
281
282 #define BOOST_USER_CONFIG <config.h>
283
284 #if !defined(ENABLE_ASSERTIONS)
285 #  define BOOST_DISABLE_ASSERTS 1
286 #endif
287 #define BOOST_ENABLE_ASSERT_HANDLER 1
288
289 #define BOOST_DISABLE_THREADS 1
290 #define BOOST_NO_WREGEX 1
291 #define BOOST_NO_WSTRING 1
292
293 #ifdef __CYGWIN__
294 #  define NOMINMAX
295 #  define BOOST_POSIX 1
296 #  define BOOST_POSIX_API 1
297 #  define BOOST_POSIX_PATH 1
298 #endif
299
300 /*
301  * the FreeBSD libc uses UCS4, but libstdc++ has no proper wchar_t
302  * support compiled in:
303  * http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#3_9
304  * And we are not interested at all what libc
305  * does: What we need is a 32bit wide wchar_t, and a libstdc++ that
306  * has the needed wchar_t support and uses UCS4. Whether it
307  * implements this with the help of libc, or whether it has own code
308  * does not matter for us, because we do not use libc directly (Georg)
309 */
310 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
311 #  define USE_WCHAR_T
312 #endif
313
314 #endif
315 ])
316
317 MSYS_AC_CANONICAL_PATH(lyx_abs_top_srcdir, ${srcdir})
318 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_localedir, ${real_localedir})
319 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_datadir, ${real_pkgdatadir})
320
321 AC_DEFINE_UNQUOTED([LYX_ABS_TOP_SRCDIR],
322         "${lyx_abs_top_srcdir}", [Top source directory])
323 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_LOCALEDIR],
324         "${lyx_abs_installed_localedir}",[Hard coded locale directory])
325 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_DATADIR],
326         "${lyx_abs_installed_datadir}",[Hard system support directory])
327 AC_DEFINE_UNQUOTED([PROGRAM_SUFFIX],
328         "${version_suffix}",[Program version suffix])
329
330 AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
331 AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
332 AC_DEFINE_UNQUOTED([LYX_DIR_VER],"$lyx_dir_ver",[Versioned env var for system dir])
333 AC_DEFINE_UNQUOTED([LYX_USERDIR_VER],"$lyx_userdir_ver",[Versioned env var for user dir])
334 AC_DEFINE_UNQUOTED([LYX_MAJOR_VERSION],$lyx_major,[Major version number])
335 AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
336 AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
337 AC_DEFINE_UNQUOTED([LYX_RELEASE_PATCH],$lyx_patch,[Patch version number])
338
339 AC_CONFIG_FILES([Makefile \
340       lyx.1:lyx.1in \
341       boost/Makefile \
342       config/Makefile \
343       development/Makefile \
344       development/MacOSX/Makefile \
345       development/MacOSX/Info.plist \
346       development/MacOSX/lyxrc.dist \
347       development/MacOSX/spotlight/Makefile \
348       development/cygwin/Makefile \
349       development/cygwin/lyxrc.dist \
350       development/lyx.spec \
351       intl/Makefile \
352       lib/Makefile \
353       lib/doc/Makefile \
354       lib/lyx2lyx/lyx2lyx_version.py \
355       lib/lyx2lyx/Makefile \
356       m4/Makefile \
357       po/Makefile.in \
358       sourcedoc/Doxyfile \
359       sourcedoc/Makefile \
360       src/client/Makefile \
361       src/client/lyxclient.1:src/client/lyxclient.1in \
362       src/Makefile \
363       src/tex2lyx/Makefile \
364       src/tex2lyx/tex2lyx.1:src/tex2lyx/tex2lyx.1in \
365       src/support/Makefile \
366       src/frontends/Makefile \
367       src/frontends/qt4/Makefile
368 ])
369
370
371 AC_OUTPUT
372
373 # show version information
374 echo
375 printf "$VERSION_INFO"
376 echo
377
378 # Display a final warning if there has been a LYX_ERROR
379 LYX_CHECK_ERRORS