]> git.lyx.org Git - lyx.git/blob - configure.ac
* src/mathed/math_scriptinset.C
[lyx.git] / configure.ac
1 dnl Process with autoconf to generate configure script   -*- sh -*-
2
3 AC_INIT(LyX,1.5.0svn,[lyx-devel@lists.lyx.org],[lyx])
4 AC_PREREQ(2.52)
5 AC_CONFIG_SRCDIR(src/main.C)
6 AC_CONFIG_HEADERS([src/config.h])
7
8 AC_CONFIG_AUX_DIR(config)
9
10 # First check the version
11 LYX_CHECK_VERSION
12 LYX_VERSION_SUFFIX
13 # Check how the files should be packaged
14 AC_CANONICAL_TARGET
15 LYX_USE_PACKAGING
16 # We need to define these variables here and the no-define option of
17 # AM_INIT_AUTOMAKE above because we alter $PACKAGE in LYX_USE_PACKAGING.
18 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
19
20 dnl default maintainer mode to true for development versions
21 if test "${enable_maintainer_mode+set}" != set; then
22   enable_maintainer_mode=$lyx_devel_version
23 fi
24 AM_MAINTAINER_MODE
25
26 save_PACKAGE=$PACKAGE
27 AM_INIT_AUTOMAKE([foreign dist-bzip2 tar-ustar no-define 1.9])
28 PACKAGE=$save_PACKAGE
29
30 ### Set the execute permissions of the various scripts correctly
31 for file in config/install-sh config/mkinstalldirs ; do
32   chmod 755 ${srcdir}/${file}
33 done
34
35 ### Check for programs
36 AC_PROG_MAKE_SET
37 AC_PROG_INSTALL
38
39 AC_PROG_AWK
40 test "$AWK" = gawk && AWK="gawk --posix"
41
42 #AC_PROG_RANLIB
43 AC_CHECK_PROG(KPSEWHICH, kpsewhich, kpsewhich, :)
44 if test "x$KPSEWHICH" = xkpsewhich ; then
45     AC_DEFINE(HAVE_KPSEWHICH, 1,
46     [Define this if you have the kpsewhich program working on your system.])
47 fi
48 AC_CHECK_PROGS(M4, gm4 gnum4 m4, m4)
49
50 # Check for installed python
51 AM_PATH_PYTHON(2.3,, :)
52
53 # Work around a problem in automake 1.4: when invoking install-strip,
54 # INSTALL_PROGRAM is changed to 'install -s', and since
55 # INSTALL_SCRIPT==INSTALL_PROGRAM, we get errors with fileutils-4.0
56 # which returns an error condition when stripping fails.
57 INSTALL_SCRIPT='${INSTALL}'
58
59 ### we will also need a C compiler to compile GNU gettext
60 AC_PROG_CC
61
62 ### check for special systems
63 AC_ISC_POSIX
64 AC_AIX
65
66 ### check which frontend we want to use
67 LYX_USE_FRONTENDS
68
69 ### Check for a C++ compiler
70 LYX_PROG_CXX
71 ### Some checks on what the C++ compiler can(not) do
72 AC_LANG(C++)
73 dnl we do not need that currently (and probably all our supported
74 dnl compiler allow that)
75 dnl LYX_CXX_PARTIAL
76 LYX_CXX_EXPLICIT
77 LYX_CXX_GLOBAL_CSTD
78 LYX_STD_COUNT
79 dnl we disable rtti for now
80 dnl LYX_CXX_RTTI
81 AC_CHECK_HEADERS(ostream istream sstream locale limits ios)
82 LYX_CXX_STL_MODERN_STREAMS
83
84 ### and now some special lyx flags.
85 AC_ARG_ENABLE(assertions,
86   AC_HELP_STRING([--enable-assertions],[add runtime sanity checks in the program]),,
87   [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
88         enable_assertions=yes;
89     else
90         enable_assertions=no;
91     fi;])
92 if test "x$enable_assertions" = xyes ; then
93    lyx_flags="assertions $lyx_flags"
94    AC_DEFINE(ENABLE_ASSERTIONS,1,
95     [Define if you want assertions to be enabled in the code])
96 fi
97
98 ### Library Files
99 dnl by testing these we check if it is ok to have
100 dnl -lc and -lm as args to the compiler
101 AC_CHECK_LIB(m, sin)
102 AC_CHECK_LIB(c, fopen)
103
104 ### Add extra directories to check for libraries.
105 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
106 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
107 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
108
109 ### Add extra directories to check for include files.
110 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
111 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
112 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
113
114 ### Add both includes and libraries
115 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
116 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
117 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
118   LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
119
120 ### These are needed in windows
121 AC_CHECK_LIB(shlwapi, main, [LIBSHLWAPI=-lshlwapi])
122 AC_SUBST(LIBSHLWAPI)
123 AC_CHECK_LIB(gdi32, main)
124
125 AC_ARG_WITH(aiksaurus,
126   [  --without-aiksaurus     do not use the Aiksaurus library],
127   [lyx_use_aiksaurus=$withval])
128 if test x$lyx_use_aiksaurus != xno; then
129 AC_CHECK_LIB(Aiksaurus, main,
130         [AC_DEFINE(HAVE_LIBAIKSAURUS,1,[Define this if you have the AikSaurus library])
131          AIKSAURUS_LIBS="-lAiksaurus"
132          lyx_flags="aiksaurus $lyx_flags"
133         ])
134 AC_CHECK_HEADER(Aiksaurus.h,[
135   ac_cv_header_aiksaurus_h=yes
136   lyx_cv_aiksaurus_h_location="<Aiksaurus.h>"])
137 AC_CHECK_HEADER(Aiksaurus/Aiksaurus.h,[
138   ac_cv_header_aiksaurus_h=yes
139   lyx_cv_aiksaurus_h_location="<Aiksaurus/Aiksaurus.h>"])
140 AC_DEFINE_UNQUOTED(AIKSAURUS_H_LOCATION,$lyx_cv_aiksaurus_h_location,[Location of Aiksaurus.h])
141 fi
142 AC_SUBST(AIKSAURUS_LIBS)
143
144 LYX_USE_INCLUDED_BOOST
145
146 ### Setup libtool
147 AC_DISABLE_SHARED
148 AC_LIBTOOL_WIN32_DLL
149 #AM_PROG_LIBTOOL
150 LYX_PROG_LIBTOOL
151
152 ### Check for X libraries
153 AC_PATH_XTRA
154 case $have_x in
155   yes) LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
156        CPPFLAGS="$CPPFLAGS $X_CFLAGS";;
157   no) LYX_ERROR(dnl
158 [Cannot find X window libraries and/or headers. Check your installation.
159   If you use a Linux system, check that you have installed
160   the development tools.]);;
161   disable) ;;
162 esac
163
164 ### check which frontend we want to use
165
166 dnl The code below is not in a macro, because this would cause big
167 dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
168 for frontend in $FRONTENDS ; do
169   case "$frontend" in
170     gtk)
171           PKG_CHECK_MODULES(GTK_FRONTEND, gtkmm-2.4 libglademm-2.4 xft)
172           FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-gtk\$(EXEEXT)"
173           FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS gtk"
174           RPM_FRONTEND="gtk"
175           GTKMM_VERSION=`pkg-config --modversion gtkmm-2.4`
176           LIBGLADEMM_VERSION=`pkg-config --modversion libglademm-2.4`
177           FRONTEND_INFO="${FRONTEND_INFO}\
178   GTK Frontend:\n\
179     libgtkmm version:\t\t${GTKMM_VERSION}\n\
180     libglademm version:\t\t${LIBGLADEMM_VERSION}\n"
181           ;;
182
183     qt3)
184           QT_DO_IT_ALL
185           FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt3\$(EXEEXT)"
186           FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt3"
187           RPM_FRONTEND="qt3"
188           FRONTEND_INFO="${FRONTEND_INFO}\
189   Qt Frontend:\n\
190       Qt version:\t\t${QT_VERSION}\n"
191 dnl qt build will fail without moc or uic
192           if test -z "$MOC"; then
193             LYX_ERROR([moc binary not found !])
194           fi
195           if test -z "$UIC"; then
196             LYX_ERROR([uic binary not found !])
197           fi
198           if test -z "$QT_LIB"; then
199             LYX_ERROR([qt library not found !])
200           fi
201       ;;
202     qt4)
203           QT4_DO_IT_ALL
204           FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
205           FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt4"
206           RPM_FRONTEND="qt4"
207           FRONTEND_INFO="${FRONTEND_INFO}\
208   Qt 4 Frontend:\n\
209       Qt 4 version:\t\t${QT4_VERSION}\n"
210 dnl qt 4 build will fail without moc or uic
211           if test -z "$MOC4"; then
212             LYX_ERROR([moc 4 binary not found !])
213           fi
214           if test -z "$UIC4"; then
215             LYX_ERROR([uic 4 binary not found !])
216           fi
217           if test -z "$QT4_LIB"; then
218             LYX_ERROR([qt 4 library not found !])
219           fi
220       ;;
221     *)
222           LYX_ERROR(Unknown frontend '$frontend');;
223   esac
224 done
225
226 # fix the value of the prefixes.
227 test "x$prefix" = xNONE && prefix=$default_prefix
228 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
229 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
230   LYX_WARNING([The installation prefix \"${prefix}\" contains a space, which
231    causes problems with the Makefiles. The installation will be done in
232    directory \"`pwd`/installprefix\" instead. Please move its contents to
233    the right place after installation.])
234   prefix=`pwd`/installprefix
235 fi
236
237 ### Setup GNU gettext
238 dnl GNU gettext is written in C
239 AC_LANG_PUSH(C)
240 AM_GNU_GETTEXT
241 AC_LANG_POP(C)
242
243 # some standard header files
244 AC_HEADER_DIRENT
245 AC_HEADER_MAJOR
246 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h strings.h locale.h utime.h sys/utime.h io.h process.h NewAPIs.h)
247
248 # some standard structures
249 AC_HEADER_STAT
250 AC_HEADER_TIME
251
252 # some standard types
253 AC_TYPE_MODE_T
254 AC_TYPE_OFF_T
255 AC_TYPE_PID_T
256 AC_TYPE_SIGNAL
257 AC_TYPE_SIZE_T
258 AC_TYPE_UID_T
259
260 AC_CHECK_FUNCS(strerror)
261 LYX_CHECK_DECL(istreambuf_iterator, iterator)
262 LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
263
264 # Check the form of mkdir()
265 AC_FUNC_MKDIR
266
267 # check for compression support
268 AC_CHECK_HEADERS(zlib.h,
269  [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
270  [LYX_LIB_ERROR(zlib.h,zlib)])
271
272 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
273 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
274 dnl We aim to remove this eventually, since we should test as much as
275 dnl possible with the compiler which will use the functions (JMarc)
276 AC_LANG_PUSH(C)
277 AC_CHECK_FUNCS(close _close getpid _getpid lstat mkfifo mkstemp mktemp open _open pclose _pclose popen _popen readlink)
278 AC_LANG_POP(C)
279
280 LYX_CHECK_SPELL_ENGINES
281
282 lyx_client_subdir=true
283 AC_LANG_PUSH(C)
284 dnl LIBS already contains some X extra libs that may interfere.
285 save_LIBS="$LIBS"
286 LIBS=
287 AC_CHECK_FUNCS(fcntl,
288   [AC_SEARCH_LIBS([gethostbyname], [nsl])
289    AC_SEARCH_LIBS([socket], [socket], [],
290      [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
291                 [], [-lnsl])])],
292   [lyx_client_subdir=false])
293 AC_SUBST(SOCKET_LIBS,$LIBS)
294 LIBS="$save_LIBS"
295 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
296 AC_LANG_POP(C)
297
298 AC_FUNC_SELECT_ARGTYPES
299
300 ### Some information on what just happened
301 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
302 real_pkgdatadir=`eval "echo \`eval \"echo ${pkgdatadir}\"\`"`
303 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
304 VERSION_INFO="Configuration\n\
305   Host type:                      ${host}\n\
306   Special build flags:            ${lyx_flags}\n\
307   C   Compiler:                   ${CC} ${CC_VERSION}\n\
308   C   Compiler LyX flags:         ${AM_CPPFLAGS} ${AM_CFLAGS}\n\
309   C   Compiler flags:             ${CPPFLAGS} ${CFLAGS}\n\
310   C++ Compiler:                   ${CXX} ${CXX_VERSION}\n\
311   C++ Compiler LyX flags:         ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
312   C++ Compiler flags:             ${CPPFLAGS} ${CXXFLAGS}\n\
313   Linker flags:                   ${AM_LDFLAGS}\n\
314   Linker user flags:              ${LDFLAGS}\n\
315 ${FRONTEND_INFO}\
316   Packaging:                      ${lyx_use_packaging}\n\
317   LyX binary dir:                 ${real_bindir}\n\
318   LyX files dir:                  ${real_pkgdatadir}\n"
319
320 MSYS_AC_CANONICAL_PATH(LYX_ABS_TOP_SRCDIR, ${srcdir})
321 MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_LOCALEDIR, ${real_localedir})
322 MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_DATADIR, ${real_pkgdatadir})
323
324 AC_SUBST(VERSION_INFO)
325 AC_SUBST(RPM_FRONTEND)
326 AC_SUBST(AM_CPPFLAGS)
327 AC_SUBST(AM_CXXFLAGS)
328 AC_SUBST(AM_CFLAGS)
329 AC_SUBST(AM_LDFLAGS)
330 AC_SUBST(LYX_ABS_TOP_SRCDIR)
331 AC_SUBST(LYX_ABS_INSTALLED_LOCALEDIR)
332 AC_SUBST(LYX_ABS_INSTALLED_DATADIR)
333
334 ## Some config.h stuff
335
336 AH_TOP([
337 /* -*- C++ -*- */
338 /*
339  * \file config.h
340  * This file is part of LyX, the document processor.
341  * Licence details can be found in the file COPYING.
342  *
343  * This is the compilation configuration file for LyX.
344  * It was generated by autoconfs configure.
345  * You might want to change some of the defaults if something goes wrong
346  * during the compilation.
347  */
348
349 #ifndef _CONFIG_H
350 #define _CONFIG_H
351 ])
352
353 AH_BOTTOM([
354 /************************************************************
355  ** You should not need to change anything beyond this point */
356
357 #ifndef HAVE_STRERROR
358 #if defined(__cplusplus)
359 extern "C"
360 #endif
361 char * strerror(int n);
362 #endif
363
364 #ifdef HAVE_MKSTEMP
365 #ifndef HAVE_DECL_MKSTEMP
366 #if defined(__cplusplus)
367 extern "C"
368 #endif
369 int mkstemp(char*);
370 #endif
371 #endif
372
373 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
374 #  define USE_BOOST_FORMAT 1
375 #else
376 #  define USE_BOOST_FORMAT 0
377 #endif
378
379 #define BOOST_USER_CONFIG <config.h>
380
381 #if !defined(ENABLE_ASSERTIONS)
382 #  define BOOST_DISABLE_ASSERTS 1
383 #endif
384 #define BOOST_ENABLE_ASSERT_HANDLER 1
385
386 #define BOOST_DISABLE_THREADS 1
387 #define BOOST_NO_WREGEX 1
388 #define BOOST_NO_WSTRING 1
389
390 #ifdef __CYGWIN__
391 #  define BOOST_POSIX 1
392 #endif
393
394 #if defined(HAVE_NEWAPIS_H)
395 #  define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
396 #endif
397
398 #endif
399 ])
400
401 ### Finish the work.
402 AC_CONFIG_FILES([Makefile  m4/Makefile \
403        boost/Makefile \
404        boost/libs/Makefile \
405        boost/libs/filesystem/Makefile \
406        boost/libs/filesystem/src/Makefile \
407        boost/libs/iostreams/Makefile \
408        boost/libs/iostreams/src/Makefile \
409        boost/libs/regex/Makefile \
410        boost/libs/regex/src/Makefile \
411        boost/libs/signals/Makefile \
412        boost/libs/signals/src/Makefile \
413        config/Makefile \
414        development/Makefile \
415        development/lyx.spec \
416        lib/Makefile \
417        lib/doc/Makefile \
418        lib/lyx2lyx/lyx2lyx_version.py \
419        lib/lyx2lyx/Makefile \
420        intl/Makefile \
421        po/Makefile.in \
422        sourcedoc/Doxyfile \
423        sourcedoc/Makefile \
424        src/client/Makefile \
425        src/Makefile \
426        src/version.C-tmp:src/version.C.in \
427        src/tex2lyx/Makefile \
428        src/mathed/Makefile \
429        src/graphics/Makefile \
430        src/insets/Makefile \
431        src/support/Makefile \
432        src/support/tests/Makefile \
433        src/frontends/Makefile \
434        src/frontends/controllers/Makefile \
435        src/frontends/controllers/tests/Makefile \
436        src/frontends/gtk/Makefile \
437        src/frontends/gtk/gimages/Makefile \
438        src/frontends/gtk/glade/Makefile \
439        src/frontends/qt3/Makefile \
440        src/frontends/qt3/moc/Makefile \
441        src/frontends/qt3/ui/Makefile \
442        src/frontends/qt3/ui/moc/Makefile \
443        src/frontends/qt4/Makefile \
444        src/frontends/qt4/ui/Makefile \
445 ])
446
447 AC_OUTPUT
448 # show version information
449 echo
450 printf "$VERSION_INFO"
451 echo
452
453 # Display a final warning if there has been a LYX_ERROR
454 LYX_CHECK_ERRORS