]> git.lyx.org Git - lyx.git/blob - config/configure.in
bc9caf7a690c52184a83ca4c504fe60151c4c8b6
[lyx.git] / config / configure.in
1 dnl Process with autoconf to generate configure script   -*- sh -*-
2
3 AC_INIT(src/main.C)
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)
9
10 PACKAGE=lyx${program_suffix}
11 VERSION="1.4.0cvs"
12 LYX_CHECK_VERSION
13
14 AC_CANONICAL_SYSTEM
15
16 LYX_VERSION_SUFFIX
17
18 AM_INIT_AUTOMAKE($lyxname, $VERSION)
19
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"
23
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}'
27
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}
31 done
32
33 ### Check for programs
34 AC_PROG_MAKE_SET
35 AC_PROG_INSTALL
36 #AC_PROG_RANLIB
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.])
41 fi
42 AC_CHECK_PROGS(M4, gm4 gnum4 m4, m4)
43
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}'
49
50 ### we will also need a C compiler to compile GNU gettext
51 AC_PROG_CC
52
53 ### check for special systems
54 AC_ISC_POSIX
55 AC_AIX
56
57 ### Check for program extensions (.exe or nothing)
58 AC_EXEEXT
59
60 ### check which frontend we want to use
61 LYX_USE_FRONTEND
62
63 ### Check for a C++ compiler
64 LYX_PROG_CXX
65 ### Some checks on what the C++ compiler can(not) do
66 AC_LANG_CPLUSPLUS
67 dnl we do not need that currently (and probably all our supported
68 dnl compiler allow that)
69 dnl LYX_CXX_PARTIAL
70 LYX_CXX_EXPLICIT
71 LYX_CXX_STL_STRING
72 LYX_CXX_GOOD_STD_STRING
73 LYX_CXX_CHEADERS
74 LYX_CXX_GLOBAL_CSTD
75 LYX_STD_COUNT
76 dnl we disable rtti for now
77 dnl LYX_CXX_RTTI
78 AC_CHECK_HEADERS(ostream istream sstream locale limits)
79 LYX_CXX_STL_MODERN_STREAMS
80
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;
86     else
87         enable_assertions=no;
88     fi;])
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])
93 fi
94
95 ### Library Files
96 dnl by testing these we check if it is ok to have
97 dnl -lc and -lm as args to the compiler
98 AC_CHECK_LIB(m, sin)
99 AC_CHECK_LIB(c, fopen)
100
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"
105
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"
110
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)])
116
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"
124         ],,"-lbz2")
125 fi
126 AC_SUBST(AIKSAURUS_LIBS)
127
128 ### Setup libtool
129 AC_DISABLE_SHARED
130 AC_LIBTOOL_WIN32_DLL
131 #AM_PROG_LIBTOOL
132 LYX_PROG_LIBTOOL
133
134 ### Check if we want spell libraries, prefer new aspell
135 CHECK_WITH_ASPELL
136 if test "$USING_ASPELL" != "yes"; then
137         CHECK_WITH_PSPELL
138 fi
139
140 ### Check for some Cygwin-specific details.
141 CHECK_WITH_CYGWIN
142
143 ### Check for X libraries
144 # The real thing.
145 AC_PATH_XTRA
146 LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
147 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
148
149 ### check which frontend we want to use
150
151 #LYX_USE_FRONTEND
152 dnl The code below is not in a macro, because this would cause big
153 dnl problems with the AC_REQUIRE contained in KDE_DO_IT_ALL.
154 case "$lyx_use_frontend" in
155   xforms)
156         LYX_PATH_XPM
157         LYX_PATH_XFORMS
158         LYX_CHECK_XFORMS_IMAGE_LOADER
159         FRONTEND="xforms"
160         RPM_FRONTEND="xforms"
161         RPM_FRONTEND_DEPS='libforms >= 1.0'
162         FRONTEND_GUILIB="xforms/*.lo xforms/forms/*.lo"
163         FRONTEND_INCLUDES="-I\$(srcdir)/xforms"
164         FRONTEND_LIBS="@XFORMS_IMAGE_LIB@ @XFORMS_LIB@ @XPM_LIB@"
165         FRONTEND_INFO="    libXpm version:               ${XPM_VERSION}\n\
166     libforms version:             ${XFORMS_VERSION}\n"
167         ;;
168 dnl   gnome)
169 dnl # Leaving these tests in means that they are performed twice for the
170 dnl # xforms frontend. No, I don't understand why :-(
171 dnl # Angus 16 Dec 2002.
172 dnl #     LYX_PATH_XPM
173 dnl #     LYX_PATH_XFORMS
174 dnl #     LYX_CHECK_XFORMS_IMAGE_LOADER
175 dnl     PKG_CHECK_MODULES(GNOME_FRONTEND, gtkmm-2.0 libglademm-2.0)
176 dnl     AC_SUBST(GNOME_FRONTEND_CFLAGS)
177 dnl     AC_SUBST(GNOME_FRONTEND_LIBS)
178
179 dnl     FRONTEND="xforms gnome"
180 dnl     FRONTEND_GUILIB="gnome/*.lo"
181 dnl     FRONTEND_LDFLAGS="${GNOME_FRONTEND_LIBS}"
182 dnl     FRONTEND_INCLUDES="-I\${srcdir}/gnome -I\${srcdir}/xforms ${GNOME_FRONTEND_CFLAGS} "
183 dnl     FRONTEND_LIBS="@XPM_LIB@ @XFORMS_LIB@ ${GNOME_FRONTEND_LIBS}";;
184   qt)
185     QT_DO_IT_ALL
186     RPM_FRONTEND="qt"
187     RPM_FRONTEND_DEPS='qt >= 2.2.1'
188     FRONTEND="qt2"
189     FRONTEND_GUILIB="qt2/*.lo qt2/ui/*.lo qt2/moc/*.lo qt2/ui/moc/*.lo"
190     FRONTEND_LDFLAGS="\$(QT_LDFLAGS)"
191     FRONTEND_INCLUDES="-I\${srcdir}/qt2 \$(QT_INCLUDES)"
192     FRONTEND_LIBS="\$(QT_LIB)"
193     FRONTEND_INFO="    Qt version:                   ${QT_VERSION}\n"
194     ;;
195   *)
196     LYX_ERROR(Unknown frontend $lyx_use_frontend);;
197 esac
198
199 ### Check for xforms and xpm (only if X has been found).
200 if test "$have_x" = no ; then
201 LYX_ERROR(dnl
202 [Cannot find X window libraries and/or headers. Check your installation.
203    If you use a Linux system, check that you have installed
204    the development tools.])
205 fi
206
207 ### Setup GNU gettext
208 dnl GNU gettext is written in C
209 AC_LANG_C
210 # Some tests that may be useful for gettext
211 AC_C_CONST
212 AC_C_INLINE
213 # Do the real setup now
214 AM_GNU_GETTEXT
215 # a hack for those who try to change LyX, but do not have gettext installed
216 case  "${XGETTEXT}" in
217  *:) XGETTEXT='cp ${srcdir}/lyx.pot ./${PACKAGE}.po ; :'
218 esac
219
220 AC_SUBST(LINGUAS)
221
222 AC_LANG_CPLUSPLUS
223
224 # some standard header files
225 AC_HEADER_DIRENT
226 AC_HEADER_MAJOR
227 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h strings.h locale.h)
228
229 # some standard structures
230 AC_HEADER_STAT
231 AC_HEADER_TIME
232
233 # some standard types
234 AC_TYPE_MODE_T
235 AC_TYPE_OFF_T
236 AC_TYPE_PID_T
237 AC_TYPE_SIGNAL
238 AC_TYPE_SIZE_T
239 AC_TYPE_UID_T
240
241 AC_CHECK_FUNCS(snprintf vsnprintf strerror)
242 LYX_CHECK_DECL(snprintf, stdio.h)
243 LYX_CHECK_DECL(vsnprintf, stdio.h)
244 LYX_CHECK_DECL(istreambuf_iterator, iterator)
245
246 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
247 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
248 dnl We aim to remove this eventually, since we should test as much as
249 dnl possible with the compiler which will use the functions (JMarc)
250 AC_LANG_C
251 AC_CHECK_FUNCS(memmove memset strchr mkfifo mkstemp mktemp)
252 AC_LANG_CPLUSPLUS
253
254 dnl Until this is fixed in autoconf we provide our own version
255 LYX_FUNC_SELECT_ARGTYPES
256
257 LYX_CHECK_DECL_HDRS(mkstemp,[unistd.h stdlib.h])
258
259 ### Some information on what just happened
260 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
261 real_datadir=`eval "echo \`eval \"echo ${datadir}/${PACKAGE}\"\`"`
262 VERSION_INFO="Configuration\n\
263   Host type:                      ${host}\n\
264   Special build flags:           ${lyx_flags}\n\
265   C   Compiler:                   ${CC}\n\
266   C   Compiler flags:             ${CFLAGS}\n\
267   C++ Compiler:                   ${CXX} ${CXX_VERSION}\n\
268   C++ Compiler flags:             ${CXXFLAGS}\n\
269   Linker flags:                   ${LDFLAGS}\n\
270   Frontend:                       ${lyx_use_frontend}\n\
271 ${FRONTEND_INFO}\
272   LyX binary dir:                 ${real_bindir}\n\
273   LyX files dir:                  ${real_datadir}\n"
274
275
276 AC_SUBST(VERSION_INFO)
277 AC_SUBST(RPM_FRONTEND)
278 AC_SUBST(RPM_FRONTEND_DEPS)
279
280 ### Finish the work.
281 AC_CONFIG_SUBDIRS(lib lib/reLyX)
282 AC_OUTPUT([Makefile \
283        boost/Makefile \
284        boost/libs/Makefile \
285        boost/libs/regex/Makefile \
286        boost/libs/regex/src/Makefile \
287        boost/libs/signals/Makefile \
288        boost/libs/signals/src/Makefile \
289        config/Makefile \
290        development/Makefile \
291        development/lyx.spec \
292        lib/Makefile \
293        intl/Makefile \
294        po/Makefile.in \
295        sourcedoc/Doxyfile \
296        sourcedoc/Makefile \
297        src/Makefile \
298        src/version.C \
299        src/tex2lyx/Makefile \
300        src/mathed/Makefile \
301        src/graphics/Makefile \
302        src/insets/Makefile \
303        src/support/Makefile \
304        src/frontends/Makefile \
305        src/frontends/controllers/Makefile \
306        src/frontends/xforms/Makefile \
307        src/frontends/xforms/forms/Makefile \
308        src/frontends/qt2/Makefile \
309        src/frontends/qt2/moc/Makefile \
310        src/frontends/qt2/ui/Makefile \
311        src/frontends/qt2/ui/moc/Makefile \
312        src/frontends/gnome/Makefile \
313 ])
314
315 # show version information
316 echo
317 printf "$VERSION_INFO"
318 echo
319
320 # Display a final warning if there has been a LYX_ERROR
321 LYX_CHECK_ERRORS