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)
9 LYX_GET_VERSION(${srcdir}/src/version.h)
12 AC_VALIDATE_CACHE_SYSTEM_TYPE
14 AM_INIT_AUTOMAKE(lyx, $VERSION)
16 # The list of languages known to LyX
17 # This is needed by GNU gettext
18 ALL_LINGUAS="ca cs da de es fi fr hu it nl no pl pt ru sl sv tr wa"
20 AC_PREFIX_PROGRAM(lyx)
22 # fix the value of the prefixes.
23 test "x$prefix" = xNONE && prefix=$ac_default_prefix
24 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
26 ### Set the execute permissions of the various scripts correctly
27 for file in config/install-sh config/mkinstalldirs lib/configure ; do
28 chmod 755 ${srcdir}/${file}
31 ### Check for programs
35 AC_CHECK_PROG(KPSEWHICH, kpsewhich, kpsewhich, :)
36 if test "x$KPSEWHICH" = xkpsewhich ; then
37 AC_DEFINE(HAVE_KPSEWHICH, 1,
38 [Define this if you have the kpsewhich program working on your system.])
41 ### we will also need a C compiler to compile GNU gettext
44 ### check for special systems
51 ### Check for program extensions (.exe or nothing)
54 ### Check for a C++ compiler
62 ### check the size of pointers and ints
63 # the defaults are given for cross compilation.
67 dnl we do not use stl stack, or at least not on gcc 2.7, which was the
68 dnl cause for this test.
74 dnl we disable rtti for now
76 AC_CHECK_HEADERS(ostream istream)
77 LYX_CXX_STL_MODERN_STREAMS
80 dnl by testing these we check if it is ok to have
81 dnl -lc and -lm as args to the compiler
83 AC_CHECK_LIB(c, fopen)
85 ### Add extra directories to check for libraries.
86 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
87 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
88 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
90 ### Add extra directories to check for include files.
91 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
92 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
93 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
95 ### Add both includes and libraries
96 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
97 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
98 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
99 LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
101 ### Check for the -liberty library
102 test "x$GXX" = xyes && lyx_use_liberty=yes
104 [ --without-liberty do not try to link against libiberty.a],
105 [lyx_use_liberty=$withval])
106 if test x$lyx_use_liberty = xyes; then
107 # AC_CHECK_LIB(iberty,main,LIBS="-liberty $LIBS")
108 AC_CHECK_LIB(iberty,main)
111 ### Check for X libraries
112 # Check for the pt library (for SCO, needed for X)
113 AC_CHECK_LIB(pt,ptsname,X_EXTRA_LIBS="-lpt $X_EXTRA_LIBS")
116 LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
117 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
119 ## Check whether X is new enough to handle the input method stuff
120 AC_CHECK_FUNCS(XOpenIM)
122 ### Check for xforms and xpm (only if X has been found).
123 if test "$have_x" = yes ; then
124 # We surely need these two libraries and want to check carefully the
131 [Cannot find X window libraries and/or headers. Check your installation.
132 If you use a Linux system, check that you have installed
133 the development tools.])
136 ### Setup GNU gettext
137 dnl GNUÂ gettext is written in C
139 # Some tests that may be useful for gettext
142 # Do the real setup now
144 # a hack for those who try to change LyX, but do not have gettext installed
145 case "${XGETTEXT}" in
146 *:) XGETTEXT='cp ${srcdir}/lyx.pot ./${PACKAGE}.po ; :'
153 # some standard header files
156 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h)
158 # some annoying header files
159 #LYX_PATH_HEADER(stl_string_fwd.h)
162 # some standard structures
169 # some standard types
177 # some functions we'd like to have
178 AC_ARG_WITH(broken-headers,
179 [ --with-broken-headers define some functions on SunOS4 and SCO],
180 [lyx_broken_headers=$withval])
181 if test "x$lyx_broken_headers" = "xyes"; then
182 lyx_flags="$lyx_flags broken-headers"
183 AC_DEFINE(BROKEN_HEADERS, 1,
184 [Define on SunOS 4 and SCO, were some functions are missing from the headers])
186 AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo)
188 dnl Until this is fixed in autoconf we provide our own version
189 LYX_FUNC_SELECT_ARGTYPES
191 # SunOS 4.1.3 does not have strerror and atexit
192 AC_REPLACE_FUNCS(strerror atexit)
194 ### and now some special lyx flags.
195 AC_ARG_WITH(two-colors,[ --with-two-colors use two color pixmaps],
196 [AC_DEFINE(TWO_COLOR_ICONS,1,
197 [You might want to define TWO_COLOR_ICONS if you want to spare
198 your colormap. This will use monochrome icons instead of colored ones.])
199 lyx_flags="$lyx_flags two-colors"])
200 AC_ARG_ENABLE(assertions,
201 [ --enable-assertions add runtime sanity checks in the program],,
202 [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
203 enable_assertions=yes;
205 enable_assertions=no;
207 if test "x$enable_assertions" = xyes ; then
208 lyx_flags="$lyx_flags assertions"
209 AC_DEFINE(ENABLE_ASSERTIONS,1,
210 [Define if you want assertions to be enabled in the code])
214 AC_CONFIG_SUBDIRS(lib lib/reLyX)
215 AC_OUTPUT([Makefile \
216 development/lyx.spec \
221 src/mathed/Makefile \
222 src/insets/Makefile \
223 src/support/Makefile \
224 ], [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
230 Source code location: ${srcdir}
232 C++ Compiler flags: ${CXXFLAGS}
234 C Compiler flags: ${CFLAGS}
235 LyX binary dir: `eval "echo \`eval \"echo ${bindir}\"\`"`
236 LyX files dir: `eval "echo \`eval \"echo ${datadir}/${PACKAGE}\"\`"`
237 Special flags: ${lyx_flags}
241 # Display a final warning if there has been a LYX_ERROR