]> git.lyx.org Git - features.git/blob - config/configure.in
4aba413089689841ce55bcb9371cb7c7bd3207c1
[features.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.3.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 #old gnome stuff removed by Michael Koziarski 25-05-2002
64
65 ### Check for a C++ compiler
66 LYX_PROG_CXX
67 ### Some checks on what the C++ compiler can(not) do
68 AC_LANG_CPLUSPLUS
69 dnl we do not need that currently (and probably all our supported
70 dnl compiler allow that)
71 dnl LYX_CXX_PARTIAL
72 LYX_CXX_EXPLICIT
73 LYX_CXX_STL_STRING
74 LYX_CXX_GOOD_STD_STRING
75 LYX_CXX_CHEADERS
76 LYX_CXX_GLOBAL_CSTD
77 LYX_STD_COUNT
78 dnl we disable rtti for now
79 dnl LYX_CXX_RTTI
80 AC_CHECK_HEADERS(ostream istream sstream locale limits)
81 LYX_CXX_STL_MODERN_STREAMS
82
83 ### and now some special lyx flags.
84 AC_ARG_ENABLE(assertions,
85   [  --enable-assertions     add runtime sanity checks in the program],,
86   [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
87         enable_assertions=yes;
88     else
89         enable_assertions=no;
90     fi;])
91 if test "x$enable_assertions" = xyes ; then
92    lyx_flags="$lyx_flags assertions"
93    AC_DEFINE(ENABLE_ASSERTIONS,1,
94     [Define if you want assertions to be enabled in the code])
95 fi
96
97 ### Library Files
98 dnl by testing these we check if it is ok to have
99 dnl -lc and -lm as args to the compiler
100 AC_CHECK_LIB(m, sin)
101 AC_CHECK_LIB(c, fopen)
102
103 ### Add extra directories to check for libraries.
104 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
105 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
106 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
107
108 ### Add extra directories to check for include files.
109 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
110 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
111 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
112
113 ### Add both includes and libraries
114 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
115 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
116 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
117   LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
118
119 AC_ARG_WITH(aiksaurus,
120   [  --without-aiksaurus     do not use the Aiksaurus library],
121   [lyx_use_aiksaurus=$withval])
122 if test x$lyx_use_aiksaurus != xno; then
123 AC_CHECK_LIB(Aiksaurus, main,
124         [AC_DEFINE(HAVE_LIBAIKSAURUS,,[Define this if you have the AikSaurus library])
125          AIKSAURUS_LIBS="-lAiksaurus -lbz2"
126         ],,"-lbz2")
127 fi
128 AC_SUBST(AIKSAURUS_LIBS)
129
130 ### Setup libtool
131 AC_DISABLE_SHARED
132 AC_LIBTOOL_WIN32_DLL
133 #AM_PROG_LIBTOOL
134 LYX_PROG_LIBTOOL
135
136 ### Check if we want pspell libraries
137 CHECK_WITH_PSPELL
138
139 ### Check for X libraries
140 # The real thing.
141 AC_PATH_XTRA
142 LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
143 # Since solaris X headers use int as implicit return type and modern
144 # gcc's do not like that, let's use -isystem instead of -I.
145 # We should test for gcc version and see whether it supports -isystem,
146 # but since at least gcc 2.6.x supports it and it is still too old for
147 # us, it seems we are safe.
148 if test -n "$GXX" ; then
149   X_CFLAGS=`echo ${X_CFLAGS} | sed -e 's/-I/-isystem /'`
150 fi
151 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
152
153 ## Check whether X is new enough to handle the input method stuff
154 AC_CHECK_FUNCS(XOpenIM)
155
156 ### check which frontend we want to use
157
158 #LYX_USE_FRONTEND
159 dnl The code below is not in a macro, because this would cause big
160 dnl problems with the AC_REQUIRE contained in KDE_DO_IT_ALL.
161 case "$lyx_use_frontend" in
162   xforms)
163         LYX_PATH_XPM
164         LYX_PATH_XFORMS
165         LYX_CHECK_XFORMS_IMAGE_LOADER
166         FRONTEND="xforms"
167         FRONTEND_GUILIB="xforms/*.lo xforms/forms/*.lo"
168         FRONTEND_INCLUDES="-I\$(srcdir)/xforms"
169         case "$host" in
170           *cygwin)
171             FRONTEND_LIBS="@XFORMS_LIB@ @XFORMS_IMAGE_LIB@ @XPM_LIB@"
172             ;;
173           *)
174             FRONTEND_LIBS="@XFORMS_IMAGE_LIB@ @XFORMS_LIB@ @XPM_LIB@"
175             ;;
176         esac
177         FRONTEND_INFO="    libXpm version:               ${XPM_VERSION}\n\
178     libforms version:             ${XFORMS_VERSION}\n"
179         ;;
180   gnome)
181 # Leaving these tests in means that they are performed twice for the
182 # xforms frontend. No, I don't understand why :-(
183 # Angus 16 Dec 2002.
184 #     LYX_PATH_XPM
185 #     LYX_PATH_XFORMS
186 #     LYX_CHECK_XFORMS_IMAGE_LOADER
187     PKG_CHECK_MODULES(GNOME_FRONTEND, gtkmm-2.0 libglademm-2.0)
188     AC_SUBST(GNOME_FRONTEND_CFLAGS)
189     AC_SUBST(GNOME_FRONTEND_LIBS)
190
191     FRONTEND="xforms gnome"
192     FRONTEND_GUILIB="gnome/*.lo"
193     FRONTEND_LDFLAGS="${GNOME_FRONTEND_LIBS}"
194     FRONTEND_INCLUDES="-I\${srcdir}/gnome -I\${srcdir}/xforms ${GNOME_FRONTEND_CFLAGS} "
195     FRONTEND_LIBS="@XPM_LIB@ @XFORMS_LIB@ ${GNOME_FRONTEND_LIBS}";;
196   qt)
197     QT_DO_IT_ALL
198     FRONTEND="qt2"
199     FRONTEND_GUILIB="qt2/*.lo qt2/ui/*.lo qt2/moc/*.lo qt2/ui/moc/*.lo"
200     FRONTEND_LDFLAGS="\$(QT_LDFLAGS)"
201     FRONTEND_INCLUDES="-I\${srcdir}/qt2 \$(QT_INCLUDES)"
202     FRONTEND_LIBS="\$(QT_LIB)"
203     FRONTEND_INFO="    Qt version:                   ${QT_VERSION}\n"
204     ;;
205   *)
206     LYX_ERROR(Unknown frontend $lyx_use_frontend);;
207 esac
208
209 ### Check for xforms and xpm (only if X has been found).
210 if test "$have_x" = no ; then
211 LYX_ERROR(dnl
212 [Cannot find X window libraries and/or headers. Check your installation.
213    If you use a Linux system, check that you have installed
214    the development tools.])
215 fi
216
217 ### Setup GNU gettext
218 dnl GNU gettext is written in C
219 AC_LANG_C
220 # Some tests that may be useful for gettext
221 AC_C_CONST
222 AC_C_INLINE
223 # Do the real setup now
224 AM_GNU_GETTEXT
225 # a hack for those who try to change LyX, but do not have gettext installed
226 case  "${XGETTEXT}" in
227  *:) XGETTEXT='cp ${srcdir}/lyx.pot ./${PACKAGE}.po ; :'
228 esac
229
230 AC_SUBST(LINGUAS)
231
232 AC_LANG_CPLUSPLUS
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)
238
239 # some standard structures
240 AC_HEADER_STAT
241 AC_HEADER_TIME
242
243 # some standard types
244 AC_TYPE_MODE_T
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(snprintf vsnprintf)
252 LYX_CHECK_DECL(snprintf, stdio.h)
253 LYX_CHECK_DECL(vsnprintf, stdio.h)
254 LYX_CHECK_DECL(istreambuf_iterator, iterator)
255
256 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
257 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
258 dnl We aim to remove this eventually, since we should test as much as
259 dnl possible with the compiler which will use the functions (JMarc)
260 AC_LANG_C
261 AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo mkstemp mktemp)
262 AC_LANG_CPLUSPLUS
263
264 dnl Until this is fixed in autoconf we provide our own version
265 LYX_FUNC_SELECT_ARGTYPES
266
267 dnl check whether we have to work around solaris broken putenv()
268 LYX_FUNC_PUTENV_ARGTYPE
269
270
271 LYX_CHECK_DECL_HDRS(mkstemp,[unistd.h stdlib.h])
272
273 ### Some information on what just happened
274 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
275 real_datadir=`eval "echo \`eval \"echo ${datadir}/${PACKAGE}\"\`"`
276 VERSION_INFO="Configuration\n\
277   Host type:                      ${host}\n\
278   Special build flags:           ${lyx_flags}\n\
279   C   Compiler:                   ${CC}\n\
280   C   Compiler flags:             ${CFLAGS}\n\
281   C++ Compiler:                   ${CXX} ${CXX_VERSION}\n\
282   C++ Compiler flags:             ${CXXFLAGS}\n\
283   Linker flags:                   ${LDFLAGS}\n\
284   Frontend:                       ${lyx_use_frontend}\n\
285 ${FRONTEND_INFO}\
286   LyX binary dir:                 ${real_bindir}\n\
287   LyX files dir:                  ${real_datadir}\n"
288
289
290 AC_SUBST(VERSION_INFO)
291
292 ### Finish the work.
293 AC_CONFIG_SUBDIRS(lib lib/reLyX)
294 AC_OUTPUT([Makefile \
295        boost/Makefile \
296        boost/libs/Makefile \
297        boost/libs/regex/Makefile \
298        boost/libs/regex/src/Makefile \
299        boost/libs/signals/Makefile \
300        boost/libs/signals/src/Makefile \
301        config/Makefile \
302        development/lyx.spec \
303        lib/Makefile \
304        intl/Makefile \
305        po/Makefile.in \
306        sourcedoc/Doxyfile \
307        src/Makefile \
308        src/version.C \
309        src/mathed/Makefile \
310        src/graphics/Makefile \
311        src/insets/Makefile \
312        src/support/Makefile \
313        src/frontends/Makefile \
314        src/frontends/controllers/Makefile \
315        src/frontends/xforms/Makefile \
316        src/frontends/xforms/forms/Makefile \
317        src/frontends/qt2/Makefile \
318        src/frontends/qt2/moc/Makefile \
319        src/frontends/qt2/ui/Makefile \
320        src/frontends/qt2/ui/moc/Makefile \
321        src/frontends/gnome/Makefile \
322 ])
323
324 # show version information
325 echo
326 printf "$VERSION_INFO"
327 echo
328
329 # Display a final warning if there has been a LYX_ERROR
330 LYX_CHECK_ERRORS