]> git.lyx.org Git - lyx.git/blob - configure.ac
fix include guards
[lyx.git] / configure.ac
1 dnl Process with autoconf to generate configure script   -*- sh -*-
2
3 AC_INIT(lyx,1.4.0cvs,lyx-devel@lists.lyx.org)
4 AC_PREREQ(2.52)
5 AC_CONFIG_SRCDIR(src/main.C)
6 AM_CONFIG_HEADER([src/config.h])
7
8 AC_CONFIG_AUX_DIR(config)
9
10 PACKAGE=lyx${program_suffix}
11 VERSION="1.4.0cvs"
12 LYX_CHECK_VERSION
13
14 AM_MAINTAINER_MODE
15 AC_CANONICAL_TARGET
16
17 LYX_VERSION_SUFFIX
18
19 AM_INIT_AUTOMAKE($lyxname, $VERSION)
20
21 # The list of languages known to LyX
22 # This is needed by GNU gettext
23 ALL_LINGUAS="bg ca cs da de es eu fi fr he hu it nl nn no pl pt ro ru sk sl sv tr wa"
24
25 # fix the value of the prefixes.
26 test "x$prefix" = xNONE && prefix=$ac_default_prefix
27 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
28
29 ### Set the execute permissions of the various scripts correctly
30 for file in config/install-sh config/mkinstalldirs lib/configure ; do
31   chmod 755 ${srcdir}/${file}
32 done
33
34 ### Check for programs
35 AC_PROG_MAKE_SET
36 AC_PROG_INSTALL
37 #AC_PROG_RANLIB
38 AC_CHECK_PROG(KPSEWHICH, kpsewhich, kpsewhich, :)
39 if test "x$KPSEWHICH" = xkpsewhich ; then
40     AC_DEFINE(HAVE_KPSEWHICH, 1,
41     [Define this if you have the kpsewhich program working on your system.])
42 fi
43 AC_CHECK_PROGS(M4, gm4 gnum4 m4, m4)
44
45 # Work around a problem in automake 1.4: when invoking install-strip,
46 # INSTALL_PROGRAM is changed to 'install -s', and since
47 # INSTALL_SCRIPT==INSTALL_PROGRAM, we get errors with fileutils-4.0
48 # which returns an error condition when stripping fails.
49 INSTALL_SCRIPT='${INSTALL}'
50
51 ### we will also need a C compiler to compile GNU gettext
52 AC_PROG_CC
53
54 ### check for special systems
55 AC_ISC_POSIX
56 AC_AIX
57
58 ### check which frontend we want to use
59 LYX_USE_FRONTENDS
60
61 ### Check for a C++ compiler
62 LYX_PROG_CXX
63 ### Some checks on what the C++ compiler can(not) do
64 AC_LANG(C++)
65 dnl we do not need that currently (and probably all our supported
66 dnl compiler allow that)
67 dnl LYX_CXX_PARTIAL
68 LYX_CXX_EXPLICIT
69 LYX_CXX_CHEADERS
70 LYX_CXX_GLOBAL_CSTD
71 LYX_STD_COUNT
72 dnl we disable rtti for now
73 dnl LYX_CXX_RTTI
74 AC_CHECK_HEADERS(ostream istream sstream locale limits ios)
75 LYX_CXX_STL_MODERN_STREAMS
76
77 ### and now some special lyx flags.
78 AC_ARG_ENABLE(assertions,
79   AC_HELP_STRING([--enable-assertions],[add runtime sanity checks in the program]),,
80   [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
81         enable_assertions=yes;
82     else
83         enable_assertions=no;
84     fi;])
85 if test "x$enable_assertions" = xyes ; then
86    lyx_flags="$lyx_flags assertions"
87    AC_DEFINE(ENABLE_ASSERTIONS,1,
88     [Define if you want assertions to be enabled in the code])
89 fi
90
91 ### Library Files
92 dnl by testing these we check if it is ok to have
93 dnl -lc and -lm as args to the compiler
94 AC_CHECK_LIB(m, sin)
95 AC_CHECK_LIB(c, fopen)
96
97 ### Add extra directories to check for libraries.
98 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
99 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
100 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
101
102 ### Add extra directories to check for include files.
103 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
104 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
105 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
106
107 ### Add both includes and libraries
108 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
109 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
110 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
111   LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
112
113 AC_ARG_WITH(aiksaurus,
114   [  --without-aiksaurus     do not use the Aiksaurus library],
115   [lyx_use_aiksaurus=$withval])
116 if test x$lyx_use_aiksaurus != xno; then
117 AC_CHECK_LIB(Aiksaurus, main,
118         [AC_DEFINE(HAVE_LIBAIKSAURUS,1,[Define this if you have the AikSaurus library])
119          AIKSAURUS_LIBS="-lAiksaurus -lbz2"
120         ],,"-lbz2")
121 AC_CHECK_HEADER(Aiksaurus.h,[
122   ac_cv_header_aiksaurus_h=yes
123   lyx_cv_aiksaurus_h_location="<Aiksaurus.h>"])
124 AC_CHECK_HEADER(Aiksaurus/Aiksaurus.h,[
125   ac_cv_header_aiksaurus_h=yes
126   lyx_cv_aiksaurus_h_location="<Aiksaurus/Aiksaurus.h>"])
127 AC_DEFINE_UNQUOTED(AIKSAURUS_H_LOCATION,$lyx_cv_aiksaurus_h_location,[Location of Aiksaurus.h])
128 fi
129 AC_SUBST(AIKSAURUS_LIBS)
130
131 LYX_USE_INCLUDED_BOOST
132
133 ### Setup libtool
134 AC_DISABLE_SHARED
135 AC_LIBTOOL_WIN32_DLL
136 #AM_PROG_LIBTOOL
137 LYX_PROG_LIBTOOL
138
139 ### Check if we want spell libraries, prefer new aspell
140 CHECK_WITH_ASPELL
141 if test "$USING_ASPELL" != "yes"; then
142         CHECK_WITH_PSPELL
143 fi
144
145 ### Check for some Cygwin-specific details.
146 CHECK_WITH_CYGWIN
147
148 ### Check for X libraries
149 AC_PATH_XTRA
150 case $have_x in
151   yes) LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
152        CPPFLAGS="$CPPFLAGS $X_CFLAGS";;
153   no) LYX_ERROR(dnl
154 [Cannot find X window libraries and/or headers. Check your installation.
155   If you use a Linux system, check that you have installed
156   the development tools.]);;
157   disable) ;;
158 esac
159
160 ### check which frontend we want to use
161
162 dnl if the gtk frontend has been specified, then xforms is needed too
163 if echo $FRONTENDS | grep gtk | grep -v xforms ; then
164   FRONTENDS="$FRONTENDS xforms"
165 fi
166
167 dnl The code below is not in a macro, because this would cause big
168 dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
169 for frontend in $FRONTENDS ; do
170   case "$frontend" in
171     xforms)
172           XFORMS_DO_IT_ALL
173           FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-xforms\$(EXEEXT)"
174           FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS xforms"
175           RPM_FRONTEND="xforms"
176           RPM_FRONTEND_DEPS='libforms >= 1.0'
177           FRONTEND_INFO="${FRONTEND_INFO}\
178   XForms Frontend:\n\
179       libXpm version:\t\t${XPM_VERSION}\n\
180       libforms version:\t\t${XFORMS_VERSION}\n"
181           ;;
182   dnl   gnome)
183   dnl     XFORMS_DO_IT_ALL
184   dnl     PKG_CHECK_MODULES(GNOME_FRONTEND, gtkmm-2.0 libglademm-2.0)
185   dnl     AC_SUBST(GNOME_FRONTEND_CFLAGS)
186   dnl     AC_SUBST(GNOME_FRONTEND_LIBS)
187
188   dnl     FRONTEND="xforms gnome"
189   dnl     FRONTEND_GUILIB="gnome/*.lo"
190   dnl     FRONTEND_LDFLAGS="${GNOME_FRONTEND_LIBS}"
191   dnl     FRONTEND_INCLUDES="${GNOME_FRONTEND_CFLAGS}"
192   dnl     FRONTEND_LIBS="@XPM_LIB@ @XFORMS_LIB@ ${GNOME_FRONTEND_LIBS}"
193   dnl   ;;
194     gtk)
195           PKG_CHECK_MODULES(GTK_FRONTEND, gtkmm-2.0 libglademm-2.0)
196           FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-gtk\$(EXEEXT)"
197           FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS gtk"
198           RPM_FRONTEND="gtk"
199           RPM_FRONTEND_DEPS='gtkmm >= 2.2.0'
200           GTKMM_VERSION=`pkg-config --modversion gtkmm-2.0`
201           LIBGLADEMM_VERSION=`pkg-config --modversion libglademm-2.0`
202           FRONTEND_INFO="${FRONTEND_INFO}\
203   GTK Frontend:\n\
204     libgtkmm version:\t\t${GTKMM_VERSION}\n\
205     libglademm version:\t\t${LIBGLADEMM_VERSION}\n"
206           ;;
207
208     qt)
209           QT_DO_IT_ALL
210           FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt\$(EXEEXT)"
211           FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt2"
212           RPM_FRONTEND="qt"
213           RPM_FRONTEND_DEPS='qt >= 2.2.1'
214           FRONTEND_INFO="${FRONTEND_INFO}\
215   Qt Frontend:\n\
216       Qt version:\t\t${QT_VERSION}\n"
217 dnl qt build will fail without moc or uic
218           if test -z "$MOC"; then
219             LYX_ERROR([moc binary not found !])
220           fi
221           if test -z "$UIC"; then
222             LYX_ERROR([uic binary not found !])
223           fi
224       ;;
225     *)
226           LYX_ERROR(Unknown frontend '$frontend');;
227   esac
228 done
229
230 ### Setup GNU gettext
231 dnl GNU gettext is written in C
232 AC_LANG_PUSH(C)
233 # Some tests that may be useful for gettext
234 AC_C_CONST
235 AC_C_INLINE
236 # Do the real setup now
237 AM_GNU_GETTEXT
238 # a hack for those who try to change LyX, but do not have gettext installed
239 case  "${XGETTEXT}" in
240  *:) XGETTEXT='cp ${srcdir}/lyx.pot ./${PACKAGE}.po ; :'
241 esac
242
243 AC_SUBST(LINGUAS)
244
245 AC_LANG_POP(C)
246
247 # some standard header files
248 AC_HEADER_DIRENT
249 AC_HEADER_MAJOR
250 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h strings.h locale.h)
251
252 # some standard structures
253 AC_HEADER_STAT
254 AC_HEADER_TIME
255
256 # some standard types
257 AC_TYPE_MODE_T
258 AC_TYPE_OFF_T
259 AC_TYPE_PID_T
260 AC_TYPE_SIGNAL
261 AC_TYPE_SIZE_T
262 AC_TYPE_UID_T
263
264 AC_CHECK_FUNCS(snprintf vsnprintf strerror)
265 LYX_CHECK_DECL(snprintf, stdio.h)
266 LYX_CHECK_DECL(vsnprintf, stdio.h)
267 LYX_CHECK_DECL(istreambuf_iterator, iterator)
268 LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
269
270 AC_ARG_ENABLE(compression-support, AC_HELP_STRING([--enable-compression-support],[Support for compressed files.]),[
271     case "${enableval}" in
272         yes) use_compression=true ;;
273         no) use_compression=false ;;
274         *) AC_MSG_ERROR(bad value ${enableval} for --enable-compression-support) ;;
275     esac
276 ],[use_compression=true])
277 if test $use_compression=true ; then
278         AC_CHECK_HEADERS(zlib.h, use_compression=true, use_compression=false)
279         AC_CHECK_LIB(z, gzopen,[use_compression=true;LIBS="$LIBS -lz"], use_compression=false)
280         if test $use_compression = true ; then
281                 AC_DEFINE(USE_COMRESSION, 1, [Define as 1 if you want to support compressed files.])
282                 lyx_flags="$lyx_flags compression"
283         fi
284 fi
285 AM_CONDITIONAL(USE_COMPRESSION, test x$use_compression = xtrue)
286 AC_MSG_CHECKING([whether to support compressed files])
287 AC_MSG_RESULT($use_compression)
288
289
290 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
291 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
292 dnl We aim to remove this eventually, since we should test as much as
293 dnl possible with the compiler which will use the functions (JMarc)
294 AC_LANG_PUSH(C)
295 AC_CHECK_FUNCS(memmove memset strchr mkfifo mkstemp mktemp)
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_datadir=`eval "echo \`eval \"echo ${datadir}/${PACKAGE}\"\`"`
303 VERSION_INFO="Configuration\n\
304   Host type:                      ${host}\n\
305   Special build flags:           ${lyx_flags}\n\
306   C   Compiler:                   ${CC}\n\
307   C   Compiler flags:             ${CFLAGS}\n\
308   C++ Compiler:                   ${CXX} ${CXX_VERSION}\n\
309   C++ Compiler flags:             ${CXXFLAGS}\n\
310   Linker flags:                   ${LDFLAGS}\n\
311 ${FRONTEND_INFO}\
312   LyX binary dir:                 ${real_bindir}\n\
313   LyX files dir:                  ${real_datadir}\n"
314
315
316 AC_SUBST(VERSION_INFO)
317 AC_SUBST(RPM_FRONTEND)
318 AC_SUBST(RPM_FRONTEND_DEPS)
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_STRCHR
344 # define strchr(a,b)    index(a,b)
345 #endif
346
347 #ifndef HAVE_MEMMOVE
348 # define memmove(a,b,c) bcopy(b,a,c)
349 #endif
350
351 #ifndef HAVE_STRERROR
352 #if defined(__cplusplus)
353 extern "C"
354 #endif
355 char * strerror(int n);
356 #endif
357
358 #ifdef BROKEN_HEADERS
359 #include "broken_headers.h"
360 #endif
361
362 #ifdef HAVE_MKSTEMP
363 #ifndef HAVE_DECL_MKSTEMP
364 #if defined(__cplusplus)
365 extern "C"
366 #endif
367 int mkstemp(char*);
368 #endif
369 #endif
370
371 #ifdef __EMX__
372 #include "support/os2_defines.h"
373 #endif
374
375 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
376 #define USE_BOOST_FORMAT 1
377 #else
378 #define USE_BOOST_FORMAT 0
379 #endif
380
381 #define BOOST_USER_CONFIG <config.h>
382
383 #if defined(ENABLE_ASSERTIONS)
384 #define BOOST_ENABLE_ASSERT_HANDLER 1
385 #else
386 #define BOOST_DISABLE_ASSERTS 1
387 #endif
388
389 #define BOOST_DISABLE_THREADS 1
390 #define BOOST_NO_WREGEX 1
391 #define BOOST_NO_WSTRING 1
392
393 #endif
394 ])
395
396 ### Finish the work.
397 AC_CONFIG_SUBDIRS(lib lib/reLyX)
398 AC_CONFIG_FILES([Makefile  m4/Makefile \
399        boost/Makefile \
400        boost/libs/Makefile \
401        boost/libs/filesystem/Makefile \
402        boost/libs/filesystem/src/Makefile \
403        boost/libs/regex/Makefile \
404        boost/libs/regex/src/Makefile \
405        boost/libs/signals/Makefile \
406        boost/libs/signals/src/Makefile \
407        config/Makefile \
408        development/Makefile \
409        development/lyx.spec \
410        lib/Makefile \
411        lib/doc/Makefile \
412        intl/Makefile \
413        po/Makefile.in \
414        sourcedoc/Doxyfile \
415        sourcedoc/Makefile \
416        src/client/Makefile \
417        src/Makefile \
418        src/version.C-tmp:src/version.C.in \
419        src/tex2lyx/Makefile \
420        src/mathed/Makefile \
421        src/graphics/Makefile \
422        src/insets/Makefile \
423        src/support/Makefile \
424        src/frontends/Makefile \
425        src/frontends/controllers/Makefile \
426        src/frontends/xforms/Makefile \
427        src/frontends/xforms/lyx_forms.h-tmp:src/frontends/xforms/lyx_forms.h.in \
428        src/frontends/xforms/lyx_xpm.h-tmp:src/frontends/xforms/lyx_xpm.h.in \
429        src/frontends/xforms/forms/Makefile \
430        src/frontends/gtk/Makefile \
431        src/frontends/gtk/gimages/Makefile \
432        src/frontends/gtk/glade/Makefile \
433        src/frontends/qt2/Makefile \
434        src/frontends/qt2/moc/Makefile \
435        src/frontends/qt2/ui/Makefile \
436        src/frontends/qt2/ui/moc/Makefile \
437        src/frontends/gnome/Makefile \
438 ])
439
440 AC_OUTPUT
441 # show version information
442 echo
443 printf "$VERSION_INFO"
444 echo
445
446 # Display a final warning if there has been a LYX_ERROR
447 LYX_CHECK_ERRORS