1 dnl Process with autoconf to generate configure script -*- sh -*-
4 AC_PREREQ(2.13) dnl We want to use autoconf 2.13
5 AM_CONFIG_HEADER(src/config.h)
6 dnl This is a trick to make autoheader do the right thing
7 dnl AM_CONFIG_HEADER(src/config.h)
8 AC_CONFIG_AUX_DIR(config)
10 PACKAGE=lyx${program_suffix}
18 AM_INIT_AUTOMAKE($lyxname, $VERSION)
20 # The list of languages known to LyX
21 # This is needed by GNU gettext
22 ALL_LINGUAS="bg ca cs da de es eu fi fr he hu it nl no pl pt ro ru sk sl sv tr wa"
24 # fix the value of the prefixes.
25 test "x$prefix" = xNONE && prefix=$ac_default_prefix
26 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
28 ### Set the execute permissions of the various scripts correctly
29 for file in config/install-sh config/mkinstalldirs lib/configure ; do
30 chmod 755 ${srcdir}/${file}
33 ### Check for programs
37 AC_CHECK_PROG(KPSEWHICH, kpsewhich, kpsewhich, :)
38 if test "x$KPSEWHICH" = xkpsewhich ; then
39 AC_DEFINE(HAVE_KPSEWHICH, 1,
40 [Define this if you have the kpsewhich program working on your system.])
42 AC_CHECK_PROGS(M4, gm4 gnum4 m4, m4)
44 # Work around a problem in automake 1.4: when invoking install-strip,
45 # INSTALL_PROGRAM is changed to 'install -s', and since
46 # INSTALL_SCRIPT==INSTALL_PROGRAM, we get errors with fileutils-4.0
47 # which returns an error condition when stripping fails.
48 INSTALL_SCRIPT='${INSTALL}'
50 ### we will also need a C compiler to compile GNU gettext
53 ### check for special systems
57 ### Check for program extensions (.exe or nothing)
60 ### check which frontend we want to use
63 ### Check for a C++ compiler
65 ### Some checks on what the C++ compiler can(not) do
67 dnl we do not need that currently (and probably all our supported
68 dnl compiler allow that)
72 LYX_CXX_GOOD_STD_STRING
76 dnl we disable rtti for now
78 AC_CHECK_HEADERS(ostream istream sstream locale limits)
79 LYX_CXX_STL_MODERN_STREAMS
81 ### and now some special lyx flags.
82 AC_ARG_ENABLE(assertions,
83 [ --enable-assertions add runtime sanity checks in the program],,
84 [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
85 enable_assertions=yes;
89 if test "x$enable_assertions" = xyes ; then
90 lyx_flags="$lyx_flags assertions"
91 AC_DEFINE(ENABLE_ASSERTIONS,1,
92 [Define if you want assertions to be enabled in the code])
96 dnl by testing these we check if it is ok to have
97 dnl -lc and -lm as args to the compiler
99 AC_CHECK_LIB(c, fopen)
101 ### Add extra directories to check for libraries.
102 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
103 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
104 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
106 ### Add extra directories to check for include files.
107 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
108 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
109 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
111 ### Add both includes and libraries
112 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
113 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
114 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
115 LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
117 AC_ARG_WITH(aiksaurus,
118 [ --without-aiksaurus do not use the Aiksaurus library],
119 [lyx_use_aiksaurus=$withval])
120 if test x$lyx_use_aiksaurus != xno; then
121 AC_CHECK_LIB(Aiksaurus, main,
122 [AC_DEFINE(HAVE_LIBAIKSAURUS,,[Define this if you have the AikSaurus library])
123 AIKSAURUS_LIBS="-lAiksaurus -lbz2"
126 AC_SUBST(AIKSAURUS_LIBS)
134 ### Check if we want pspell libraries
137 ### Check for X libraries
140 LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
141 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
143 ### check which frontend we want to use
146 dnl The code below is not in a macro, because this would cause big
147 dnl problems with the AC_REQUIRE contained in KDE_DO_IT_ALL.
148 case "$lyx_use_frontend" in
152 LYX_CHECK_XFORMS_IMAGE_LOADER
154 RPM_FRONTEND="xforms"
155 RPM_FRONTEND_DEPS='libforms >= 1.0'
156 FRONTEND_GUILIB="xforms/*.lo xforms/forms/*.lo"
157 FRONTEND_INCLUDES="-I\$(srcdir)/xforms"
158 FRONTEND_LIBS="@XFORMS_IMAGE_LIB@ @XFORMS_LIB@ @XPM_LIB@"
159 FRONTEND_INFO=" libXpm version: ${XPM_VERSION}\n\
160 libforms version: ${XFORMS_VERSION}\n"
163 dnl # Leaving these tests in means that they are performed twice for the
164 dnl # xforms frontend. No, I don't understand why :-(
165 dnl # Angus 16 Dec 2002.
167 dnl # LYX_PATH_XFORMS
168 dnl # LYX_CHECK_XFORMS_IMAGE_LOADER
169 dnl PKG_CHECK_MODULES(GNOME_FRONTEND, gtkmm-2.0 libglademm-2.0)
170 dnl AC_SUBST(GNOME_FRONTEND_CFLAGS)
171 dnl AC_SUBST(GNOME_FRONTEND_LIBS)
173 dnl FRONTEND="xforms gnome"
174 dnl FRONTEND_GUILIB="gnome/*.lo"
175 dnl FRONTEND_LDFLAGS="${GNOME_FRONTEND_LIBS}"
176 dnl FRONTEND_INCLUDES="-I\${srcdir}/gnome -I\${srcdir}/xforms ${GNOME_FRONTEND_CFLAGS} "
177 dnl FRONTEND_LIBS="@XPM_LIB@ @XFORMS_LIB@ ${GNOME_FRONTEND_LIBS}";;
181 RPM_FRONTEND_DEPS='qt >= 2.2.1'
183 FRONTEND_GUILIB="qt2/*.lo qt2/ui/*.lo qt2/moc/*.lo qt2/ui/moc/*.lo"
184 FRONTEND_LDFLAGS="\$(QT_LDFLAGS)"
185 FRONTEND_INCLUDES="-I\${srcdir}/qt2 \$(QT_INCLUDES)"
186 FRONTEND_LIBS="\$(QT_LIB)"
187 FRONTEND_INFO=" Qt version: ${QT_VERSION}\n"
190 LYX_ERROR(Unknown frontend $lyx_use_frontend);;
193 ### Check for xforms and xpm (only if X has been found).
194 if test "$have_x" = no ; then
196 [Cannot find X window libraries and/or headers. Check your installation.
197 If you use a Linux system, check that you have installed
198 the development tools.])
201 ### Setup GNU gettext
202 dnl GNUÂ gettext is written in C
204 # Some tests that may be useful for gettext
207 # Do the real setup now
209 # a hack for those who try to change LyX, but do not have gettext installed
210 case "${XGETTEXT}" in
211 *:) XGETTEXT='cp ${srcdir}/lyx.pot ./${PACKAGE}.po ; :'
218 # some standard header files
221 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h strings.h locale.h)
223 # some standard structures
227 # some standard types
235 AC_CHECK_FUNCS(snprintf vsnprintf strerror)
236 LYX_CHECK_DECL(snprintf, stdio.h)
237 LYX_CHECK_DECL(vsnprintf, stdio.h)
238 LYX_CHECK_DECL(istreambuf_iterator, iterator)
240 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
241 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
242 dnl We aim to remove this eventually, since we should test as much as
243 dnl possible with the compiler which will use the functions (JMarc)
245 AC_CHECK_FUNCS(memmove memset strchr mkfifo mkstemp mktemp)
248 dnl Until this is fixed in autoconf we provide our own version
249 LYX_FUNC_SELECT_ARGTYPES
251 LYX_CHECK_DECL_HDRS(mkstemp,[unistd.h stdlib.h])
253 ### Some information on what just happened
254 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
255 real_datadir=`eval "echo \`eval \"echo ${datadir}/${PACKAGE}\"\`"`
256 VERSION_INFO="Configuration\n\
257 Host type: ${host}\n\
258 Special build flags: ${lyx_flags}\n\
260 C Compiler flags: ${CFLAGS}\n\
261 C++ Compiler: ${CXX} ${CXX_VERSION}\n\
262 C++ Compiler flags: ${CXXFLAGS}\n\
263 Linker flags: ${LDFLAGS}\n\
264 Frontend: ${lyx_use_frontend}\n\
266 LyX binary dir: ${real_bindir}\n\
267 LyX files dir: ${real_datadir}\n"
270 AC_SUBST(VERSION_INFO)
271 AC_SUBST(RPM_FRONTEND, 'xforms')
272 AC_SUBST(RPM_FRONTEND_DEPS, 'libforms >= 1.0')
275 AC_CONFIG_SUBDIRS(lib lib/reLyX)
276 AC_OUTPUT([Makefile \
278 boost/libs/Makefile \
279 boost/libs/regex/Makefile \
280 boost/libs/regex/src/Makefile \
281 boost/libs/signals/Makefile \
282 boost/libs/signals/src/Makefile \
284 development/Makefile \
285 development/lyx.spec \
293 src/tex2lyx/Makefile \
294 src/mathed/Makefile \
295 src/graphics/Makefile \
296 src/insets/Makefile \
297 src/support/Makefile \
298 src/frontends/Makefile \
299 src/frontends/controllers/Makefile \
300 src/frontends/xforms/Makefile \
301 src/frontends/xforms/forms/Makefile \
302 src/frontends/qt2/Makefile \
303 src/frontends/qt2/moc/Makefile \
304 src/frontends/qt2/ui/Makefile \
305 src/frontends/qt2/ui/moc/Makefile \
306 src/frontends/gnome/Makefile \
309 # show version information
311 printf "$VERSION_INFO"
314 # Display a final warning if there has been a LYX_ERROR