]> git.lyx.org Git - lyx.git/blob - configure.ac
remove mourning border from workarea
[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 AC_SUBST(LYX_DATE, ["Sat, Nov 15, 2008"])
5 AC_PREREQ(2.52)
6 AC_CONFIG_SRCDIR(src/main.cpp)
7 AC_CONFIG_HEADERS([config.h])
8
9 AC_CONFIG_AUX_DIR(config)
10
11 # First check the version
12 LYX_CHECK_VERSION
13 LYX_VERSION_SUFFIX
14 # Check how the files should be packaged
15 AC_CANONICAL_TARGET
16 LYX_USE_PACKAGING
17 # We need to define these variables here and the no-define option of
18 # AM_INIT_AUTOMAKE above because we alter $PACKAGE in LYX_USE_PACKAGING.
19 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
20
21 dnl default maintainer mode to true for development versions
22 if test "${enable_maintainer_mode+set}" != set; then
23   enable_maintainer_mode=$lyx_devel_version
24 fi
25 AM_MAINTAINER_MODE
26
27 save_PACKAGE=$PACKAGE
28 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.5])
29 PACKAGE=$save_PACKAGE
30
31 ### Set the execute permissions of the various scripts correctly
32 for file in config/install-sh config/mkinstalldirs ; do
33   chmod 755 ${srcdir}/${file}
34 done
35
36 ### Check for programs
37 dnl AC_PROG_MAKE_SET
38 dnl AC_PROG_INSTALL
39
40 # Check for installed python
41 AM_PATH_PYTHON(2.3.4,, :)
42
43 # Work around a problem in automake 1.4: when invoking install-strip,
44 # INSTALL_PROGRAM is changed to 'install -s', and since
45 # INSTALL_SCRIPT==INSTALL_PROGRAM, we get errors with fileutils-4.0
46 # which returns an error condition when stripping fails.
47 INSTALL_SCRIPT='${INSTALL}'
48
49 ### we will also need a C compiler to compile GNU gettext
50 AC_PROG_CC
51 AC_USE_SYSTEM_EXTENSIONS
52
53 ### we need to know the byte order for unicode conversions
54 AC_C_BIGENDIAN
55
56 ### check which frontend we want to use
57 LYX_USE_FRONTENDS
58
59 ### Check for a C++ compiler
60 LYX_PROG_CXX
61 ### Some checks on what the C++ compiler can(not) do
62 AC_LANG(C++)
63 dnl we do not need that currently (and probably all our supported
64 dnl compiler allow that)
65 dnl LYX_CXX_PARTIAL
66 dnl LYX_CXX_EXPLICIT
67 dnl LYX_CXX_GLOBAL_CSTD
68 dnl LYX_STD_COUNT
69 dnl we disable rtti for now
70 dnl LYX_CXX_RTTI
71 dnl AC_CHECK_HEADERS(ostream istream sstream locale limits ios)
72 dnl LYX_CXX_STL_MODERN_STREAMS
73
74 ### Objective-C compiler
75 AC_PROG_OBJC
76 _AM_DEPENDENCIES([OBJC])
77
78 ### and now some special lyx flags.
79 AC_ARG_ENABLE(assertions,
80   AC_HELP_STRING([--enable-assertions],[add runtime sanity checks in the program]),,
81   [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
82         enable_assertions=yes;
83     else
84         enable_assertions=no;
85     fi;])
86 if test "x$enable_assertions" = xyes ; then
87    lyx_flags="assertions $lyx_flags"
88    AC_DEFINE(ENABLE_ASSERTIONS,1,
89     [Define if you want assertions to be enabled in the code])
90 fi
91
92 ### Library Files
93 dnl AC_CHECK_LIB(m, sin)
94
95 ### Add extra directories to check for libraries.
96 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
97 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
98 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
99
100 ### Add extra directories to check for include files.
101 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
102 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
103 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
104
105 ### Add both includes and libraries
106 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
107 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
108 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
109   LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
110
111 ### These are needed in windows
112 AC_CHECK_LIB(shlwapi, main, [LIBSHLWAPI=-lshlwapi])
113 AC_SUBST(LIBSHLWAPI)
114 AC_CHECK_LIB(gdi32, main)
115
116 AC_ARG_WITH(aiksaurus,
117   [  --without-aiksaurus     do not use the Aiksaurus library],
118   [lyx_use_aiksaurus=$withval])
119 if test x$lyx_use_aiksaurus != xno; then
120 AC_CHECK_LIB(Aiksaurus, main,
121         [AC_DEFINE(HAVE_LIBAIKSAURUS,1,[Define this if you have the AikSaurus library])
122          AIKSAURUS_LIBS="-lAiksaurus"
123          lyx_flags="aiksaurus $lyx_flags"
124         ])
125 AC_CHECK_HEADER(Aiksaurus.h,[
126   ac_cv_header_aiksaurus_h=yes
127   lyx_cv_aiksaurus_h_location="<Aiksaurus.h>"])
128 AC_CHECK_HEADER(Aiksaurus/Aiksaurus.h,[
129   ac_cv_header_aiksaurus_h=yes
130   lyx_cv_aiksaurus_h_location="<Aiksaurus/Aiksaurus.h>"])
131 AC_DEFINE_UNQUOTED(AIKSAURUS_H_LOCATION,$lyx_cv_aiksaurus_h_location,[Location of Aiksaurus.h])
132 fi
133 AC_SUBST(AIKSAURUS_LIBS)
134
135 LYX_USE_INCLUDED_BOOST
136
137 # Needed for our char_type
138 AC_CHECK_SIZEOF(wchar_t)
139
140 ### We need iconv for unicode support (Qt4 frontend requires it too)
141 AM_ICONV
142 if test "$am_cv_func_iconv" = no; then
143   LYX_ERROR([Cannot find required library iconv])
144 else
145   LIBS="$LIBS $LIBICONV"
146 fi
147
148 ### check for compression support
149 AC_CHECK_HEADERS(zlib.h,
150  [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
151  [LYX_LIB_ERROR(zlib.h,zlib)])
152
153
154 ### check which frontend we want to use
155
156 dnl The code below is not in a macro, because this would cause big
157 dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
158 for frontend in $FRONTENDS ; do
159   case "$frontend" in
160     qt4)
161           QT4_DO_IT_ALL
162           FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
163           FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt4"
164           RPM_FRONTEND="qt4"
165           FRONTEND_INFO="${FRONTEND_INFO}\
166   Qt 4 Frontend:\n\
167       Qt 4 version:\t\t${QT4_VERSION}\n"
168 dnl qt 4 build will fail without moc or uic
169           if test -z "$MOC4"; then
170             LYX_ERROR([moc 4 binary not found !])
171           fi
172           if test -z "$UIC4"; then
173             LYX_ERROR([uic 4 binary not found !])
174           fi
175           if test -z "$QT4_LIB"; then
176             LYX_ERROR([qt 4 library not found !])
177           fi
178       ;;
179     *)
180           LYX_ERROR(Unknown frontend '$frontend');;
181   esac
182 done
183
184 # fix the value of the prefixes.
185 test "x$prefix" = xNONE && prefix=$default_prefix
186 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
187 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
188   LYX_WARNING([The installation prefix \"${prefix}\" contains a space, which
189    causes problems with the Makefiles. The installation will be done in
190    directory \"`pwd`/installprefix\" instead. Please move its contents to
191    the right place after installation.])
192   prefix=`pwd`/installprefix
193 fi
194
195 ### Setup GNU gettext
196 dnl GNU gettext is written in C
197 AC_LANG_PUSH(C)
198 dnl Dirty trick ahead: disable macro AC_GNU_SOURCE because it triggers a bug with autoconf 2.62.
199 dnl this can be removed if gettext is been updated to avoid that.
200 m4_undefine([AC_GNU_SOURCE])
201 m4_defun([AC_GNU_SOURCE],[])
202 AM_GNU_GETTEXT
203 AM_GNU_GETTEXT_VERSION([0.16.1])
204 AC_LANG_POP(C)
205
206 # some standard header files
207 AC_HEADER_DIRENT
208 AC_HEADER_MAJOR
209 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h strings.h locale.h io.h process.h NewAPIs.h utime.h sys/utime.h)
210
211 # some standard structures
212 AC_HEADER_STAT
213 AC_HEADER_TIME
214
215 # some standard types
216 AC_CHECK_TYPE(mode_t,[AC_DEFINE(HAVE_MODE_T, 1, [Define this to 1 if your compiler supports the mode_t type.])])
217 AC_TYPE_OFF_T
218 AC_TYPE_PID_T
219 AC_TYPE_SIGNAL
220 AC_TYPE_SIZE_T
221 AC_TYPE_UID_T
222
223 AC_CHECK_FUNCS(strerror)
224 LYX_CHECK_DECL(istreambuf_iterator, iterator)
225 LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
226
227 # Check the form of mkdir()
228 AC_FUNC_MKDIR
229
230 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
231 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
232 dnl We aim to remove this eventually, since we should test as much as
233 dnl possible with the compiler which will use the functions (JMarc)
234 AC_LANG_PUSH(C)
235 AC_CHECK_FUNCS(chmod close _close getpid _getpid lstat mkfifo mkstemp mktemp open _open pclose _pclose popen _popen readlink)
236 AC_LANG_POP(C)
237
238 LYX_CHECK_SPELL_ENGINES
239
240 lyx_client_subdir=true
241 AC_LANG_PUSH(C)
242 dnl LIBS already contains some X extra libs that may interfere.
243 save_LIBS="$LIBS"
244 LIBS=
245 AC_CHECK_FUNCS(fcntl,
246   [AC_SEARCH_LIBS([gethostbyname], [nsl])
247    AC_SEARCH_LIBS([socket], [socket], [],
248      [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
249                 [], [-lnsl])])],
250   [lyx_client_subdir=false])
251 AC_SUBST(SOCKET_LIBS,$LIBS)
252 LIBS="$save_LIBS"
253 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
254 AC_LANG_POP(C)
255
256 lyx_win_res=false;
257 case ${host} in
258     *mingw*|*cygwin*) lyx_win_res=true;;
259 esac
260 AM_CONDITIONAL(LYX_WIN_RESOURCE, $lyx_win_res)
261 LYX_SET_VERSION_INFO
262
263 AC_FUNC_SELECT_ARGTYPES
264
265 ### Some information on what just happened
266 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
267 real_pkgdatadir=`eval "echo \`eval \"echo \\\`eval \\\"echo ${pkgdatadir}\\\"\\\`\"\`"`
268 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
269 VERSION_INFO="Configuration\n\
270   Host type:                    ${host}\n\
271   Special build flags:          ${lyx_flags}\n\
272   C   Compiler:                 ${CC} ${CC_VERSION}\n\
273   C   Compiler LyX flags:       ${AM_CPPFLAGS} ${AM_CFLAGS}\n\
274   C   Compiler flags:           ${CPPFLAGS} ${CFLAGS}\n\
275   C++ Compiler:                 ${CXX} ${CXX_VERSION}\n\
276   C++ Compiler LyX flags:       ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
277   C++ Compiler flags:           ${CPPFLAGS} ${CXXFLAGS}\n\
278   Linker flags:                 ${AM_LDFLAGS}\n\
279   Linker user flags:            ${LDFLAGS}\n\
280 ${FRONTEND_INFO}\
281   Packaging:                    ${lyx_use_packaging}\n\
282   LyX binary dir:               ${real_bindir}\n\
283   LyX files dir:                ${real_pkgdatadir}\n"
284
285 AC_SUBST(VERSION_INFO)
286 AC_SUBST(RPM_FRONTEND)
287 AC_SUBST(AM_CPPFLAGS)
288 AC_SUBST(AM_CXXFLAGS)
289 AC_SUBST(AM_CFLAGS)
290 AC_SUBST(AM_LDFLAGS)
291 AC_SUBST(real_pkgdatadir)
292
293 ## Some config.h stuff
294
295 AH_TOP([
296 /* -*- C++ -*- */
297 /*
298  * \file config.h
299  * This file is part of LyX, the document processor.
300  * Licence details can be found in the file COPYING.
301  *
302  * This is the compilation configuration file for LyX.
303  * It was generated by autoconfs configure.
304  * You might want to change some of the defaults if something goes wrong
305  * during the compilation.
306  */
307
308 #ifndef _CONFIG_H
309 #define _CONFIG_H
310 ])
311
312 AH_BOTTOM([
313 /************************************************************
314  ** You should not need to change anything beyond this point */
315
316 #ifndef HAVE_STRERROR
317 #if defined(__cplusplus)
318 extern "C"
319 #endif
320 char * strerror(int n);
321 #endif
322
323 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
324 #  define USE_BOOST_FORMAT 1
325 #else
326 #  define USE_BOOST_FORMAT 0
327 #endif
328
329 #define BOOST_USER_CONFIG <config.h>
330
331 #if !defined(ENABLE_ASSERTIONS)
332 #  define BOOST_DISABLE_ASSERTS 1
333 #endif
334 #define BOOST_ENABLE_ASSERT_HANDLER 1
335
336 #define BOOST_DISABLE_THREADS 1
337 #define BOOST_NO_WREGEX 1
338 #define BOOST_NO_WSTRING 1
339
340 #ifdef __CYGWIN__
341 #  define BOOST_POSIX 1
342 #  define BOOST_POSIX_API 1
343 #  define BOOST_POSIX_PATH 1
344 #endif
345
346 #if defined(HAVE_NEWAPIS_H)
347 #  define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
348 #endif
349
350 /*
351  * the FreeBSD libc uses UCS4, but libstdc++ has no proper wchar_t
352  * support compiled in:
353  * http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#3_9
354  * And we are not interested at all what libc
355  * does: What we need is a 32bit wide wchar_t, and a libstdc++ that
356  * has the needed wchar_t support and uses UCS4. Whether it
357  * implements this with the help of libc, or whether it has own code
358  * does not matter for us, because we do not use libc directly (Georg)
359 */
360 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
361 #  define USE_WCHAR_T
362 #endif
363
364 #endif
365 ])
366
367
368 AC_ARG_ENABLE(monolithic-boost,
369   AC_HELP_STRING([--enable-monolithic-boost],
370                 [Use monolithic boost compilations]),,
371   [enable_monolithic_boost=no])
372 AM_CONDITIONAL(MONOLITHIC_BOOST, test "$enable_monolithic_boost" = "yes")
373
374 AC_ARG_ENABLE(monolithic-client,
375   AC_HELP_STRING([--enable-monolithic-client],
376                 [Use monolithic client compilations]),,
377   [enable_monolithic_client=no])
378 AM_CONDITIONAL(MONOLITHIC_CLIENT, test "$enable_monolithic_client" = "yes")
379
380 AC_ARG_ENABLE(monolithic-insets,
381   AC_HELP_STRING([--enable-monolithic-insets],
382                 [Use monolithic insets compilations]),,
383   [enable_monolithic_insets=no])
384 AM_CONDITIONAL(MONOLITHIC_INSETS, test "$enable_monolithic_insets" = "yes")
385
386 AC_ARG_ENABLE(monolithic-mathed,
387   AC_HELP_STRING([--enable-monolithic-mathed],
388                 [Use monolithic mathed compilations]),,
389   [enable_monolithic_mathed=no])
390 AM_CONDITIONAL(MONOLITHIC_MATHED, test "$enable_monolithic_mathed" = "yes")
391
392 AC_ARG_ENABLE(monolithic-core,
393   AC_HELP_STRING([--enable-monolithic-core],
394                 [Use monolithic core files compilations]),,
395   [enable_monolithic_core=no])
396 AM_CONDITIONAL(MONOLITHIC_CORE, test "$enable_monolithic_core" = "yes")
397
398 AC_ARG_ENABLE(monolithic-tex2lyx,
399   AC_HELP_STRING([--enable-monolithic-tex2lyx],
400                 [Use monolithic tex2lyx compilations]),,
401   [enable_monolithic_tex2lyx=no])
402 AM_CONDITIONAL(MONOLITHIC_TEX2LYX, test "$enable_monolithic_tex2lyx" = "yes")
403
404 AC_ARG_ENABLE(monolithic-frontend-qt4,
405   AC_HELP_STRING([--enable-monolithic-frontend-qt4],
406                 [Use monolithic compilation of the Qt 4 frontend. Only recommended with > 512 MB of RAM]),,
407   [enable_monolithic_frontend_qt4=no])
408 AM_CONDITIONAL(MONOLITHIC_FRONTEND_QT4, test "$enable_monolithic_frontend_qt4" = "yes")
409
410 MSYS_AC_CANONICAL_PATH(lyx_abs_top_srcdir, ${srcdir})
411 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_localedir, ${real_localedir})
412 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_datadir, ${real_pkgdatadir})
413
414 AC_DEFINE_UNQUOTED([LYX_ABS_TOP_SRCDIR],
415         "${lyx_abs_top_srcdir}", [Top source directory])
416 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_LOCALEDIR],
417         "${lyx_abs_installed_localedir}",[Hard coded locale directory])
418 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_DATADIR],
419         "${lyx_abs_installed_datadir}",[Hard system support directory])
420 AC_DEFINE_UNQUOTED([PROGRAM_SUFFIX],
421         "${version_suffix}",[Program version suffix])
422
423 AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
424 AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
425 AC_DEFINE_UNQUOTED([LYX_DIR_VER],"$lyx_dir_ver",[Versioned env var for system dir])
426 AC_DEFINE_UNQUOTED([LYX_USERDIR_VER],"$lyx_userdir_ver",[Versioned env var for user dir])
427 AC_DEFINE_UNQUOTED([LYX_MAJOR_VERSION],$lyx_major,[Major version number])
428 AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
429 AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
430 AC_DEFINE_UNQUOTED([LYX_RELEASE_PATCH],$lyx_patch,[Patch version number])
431
432 AC_CONFIG_FILES([Makefile \
433       lyx.1:lyx.1in \
434       boost/Makefile \
435       config/Makefile \
436       development/Makefile \
437       development/MacOSX/Makefile \
438       development/MacOSX/Info.plist \
439       development/MacOSX/lyxrc.dist \
440       development/MacOSX/spotlight/Makefile \
441       development/lyx.spec \
442       intl/Makefile \
443       lib/Makefile \
444       lib/doc/Makefile \
445       lib/lyx2lyx/lyx2lyx_version.py \
446       lib/lyx2lyx/Makefile \
447       m4/Makefile \
448       po/Makefile.in \
449       sourcedoc/Doxyfile \
450       sourcedoc/Makefile \
451       src/client/Makefile \
452       src/Makefile \
453       src/tex2lyx/Makefile \
454       src/support/Makefile \
455       src/frontends/Makefile \
456       src/frontends/qt4/Makefile
457 ])
458
459
460 AC_OUTPUT
461
462 # show version information
463 echo
464 printf "$VERSION_INFO"
465 echo
466
467 # Display a final warning if there has been a LYX_ERROR
468 LYX_CHECK_ERRORS