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