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 config/hack-gcc \
29 chmod 755 ${srcdir}/${file}
32 ### Check for programs
36 AC_CHECK_PROG(KPSEWHICH, kpsewhich, kpsewhich, :)
37 if test "x$KPSEWHICH" = xkpsewhich ; then
38 AC_DEFINE(HAVE_KPSEWHICH, 1,
39 [Define this if you have the kpsewhich program working on your system.])
42 ### we will also need a C compiler to compile GNU gettext
45 ### check for special systems
52 ### Check for program extensions (.exe or nothing)
55 ### Check for a C++ compiler
60 ### check the size of pointers and ints
61 # the defaults are given for cross compilation.
72 dnl by testing these we check if it is ok to have
73 dnl -lc and -lm as args to the compiler
75 AC_CHECK_LIB(c, fopen)
77 # A hack to work around gcc compiler errors
78 AC_ARG_WITH(gcc-hack,[ --with-gcc-hack add a wrapper around gcc])
79 if test "x$with_gcc_hack" = xyes ; then
80 CXX_COMMAND='${top_srcdir}/config/hack-gcc ${CXX}'
81 lyx_flags="$lyx_flags gcc-hack"
87 ### Add extra directories to check for libraries.
88 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
89 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
90 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
92 ### Add extra directories to check for include files.
93 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
94 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
95 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
97 ### Add both includes and libraries
98 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
99 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
100 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
101 LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
103 ### Check for the -liberty library
104 test "x$GXX" = xyes && lyx_use_liberty=yes
106 [ --without-liberty do not try to link against libiberty.a],
107 [lyx_use_liberty=$withval])
108 if test x$lyx_use_liberty = xyes; then
109 # AC_CHECK_LIB(iberty,main,LIBS="-liberty $LIBS")
110 AC_CHECK_LIB(iberty,main)
113 ### Check for X libraries
114 # Check for the pt library (for SCO, needed for X)
115 AC_CHECK_LIB(pt,ptsname,X_EXTRA_LIBS="-lpt $X_EXTRA_LIBS")
118 LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
119 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
121 ## Check whether X is new enough to handle the input method stuff
122 AC_CHECK_FUNC(XOpenIM)
124 ### Check for xforms and xpm (only if X has been found).
125 if test "$have_x" = yes ; then
126 # We surely need these two libraries and want to check carefully the
133 [Cannot find X window libraries and/or headers. Check your installation.
134 If you use a Linux system, check that you have installed
135 the development tools.])
139 ### Setup GNU gettext
140 dnl GNUÂ gettext is written in C
142 # Some tests that may be useful for gettext
145 # Do the real setup now
147 # a hack for those who try to change LyX, but do not have gettext installed
148 case "${XGETTEXT}" in
149 *:) XGETTEXT='cp ${srcdir}/lyx.pot ./${PACKAGE}.po ; :'
156 # some standard header files
159 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h)
161 # some standard structures
168 # some standard types
176 # some functions we'd like to have
177 AC_ARG_WITH(broken-headers,
178 [ --with-broken-headers define some functions on SunOS4 and SCO],
179 [lyx_broken_headers=$withval])
180 if test "x$lyx_broken_headers" = "xyes"; then
181 lyx_flags="$lyx_flags broken-headers"
182 AC_DEFINE(BROKEN_HEADERS, 1,
183 [Define on SunOS 4 and SCO, were some functions are missing from the headers])
185 AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo)
187 dnl Until this is fixed in autoconf we provide our own version
188 LYX_FUNC_SELECT_ARGTYPES
190 # SunOS 4.1.3 does not have strerror and atexit
191 AC_REPLACE_FUNCS(strerror atexit)
193 dnl This check should be removed. If the compiler does not understand
194 dnl bool it is so broken that we should not support it. (Lgb)
195 dnl AC_CACHE_CHECK([for bool type],lyx_cv_have_bool,[
196 dnl AC_TRY_LINK(, [bool foo = true;], lyx_cv_have_bool=yes,lyx_cv_have_bool=no)])
197 dnl if test $lyx_cv_have_bool = 'yes' ; then
198 dnl AC_DEFINE(HAVE_bool,1,
199 dnl [Define if the bool type is known to your compiler])
202 ### and now some special lyx flags.
203 AC_ARG_WITH(two-colors,[ --with-two-colors use two color pixmaps],
204 [AC_DEFINE(TWO_COLOR_ICONS)
205 lyx_flags="$lyx_flags two-colors"])
206 AC_ARG_WITH(debug,[ --with-debug output debug information by default],
207 [AC_DEFINE(DEBUG_AS_DEFAULT,1,
208 [Define if you want debugging turned on as default.])
209 lyx_flags="$lyx_flags debug"])
212 AC_CONFIG_SUBDIRS(lib lib/reLyX)
213 AC_OUTPUT([Makefile \
214 development/lyx.spec \
219 src/mathed/Makefile \
220 src/insets/Makefile \
221 src/support/Makefile \
222 ], [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
228 Source code location: ${srcdir}
230 C++ Compiler flags: ${CXXFLAGS}
232 C Compiler flags: ${CFLAGS}
233 LyX binary dir: `eval "echo \`eval \"echo ${bindir}\"\`"`
234 LyX files dir: `eval "echo \`eval \"echo ${datadir}/${PACKAGE}\"\`"`
235 Special flags: ${lyx_flags}
239 # Display a final warning if there has been a LYX_ERROR