]> git.lyx.org Git - lyx.git/blob - configure.in
stl_string_fwd.h checking improved again. Generalized version also in the works.
[lyx.git] / configure.in
1 dnl Process with autoconf to generate configure script   -*- sh -*-
2
3 AC_INIT(src/lyx.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 LYX_GET_VERSION(${srcdir}/src/version.h)
10
11 AC_CANONICAL_SYSTEM
12 AC_VALIDATE_CACHE_SYSTEM_TYPE
13
14 AM_INIT_AUTOMAKE(lyx, $VERSION)
15
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"
19
20 AC_PREFIX_PROGRAM(lyx)
21
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}'
25
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}
29 done
30
31 ### Check for programs
32 AC_PROG_MAKE_SET
33 AC_PROG_INSTALL
34 #AC_PROG_RANLIB
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.])
39 fi
40
41 ### we will also need a C compiler to compile GNU gettext
42 AC_PROG_CC
43
44 ### check for special systems
45 AC_ISC_POSIX
46 AC_AIX
47 LYX_HPUX
48 LYX_SUNOS4
49 LYX_SCO
50
51 ### Check for program extensions (.exe or nothing)
52 AC_EXEEXT
53
54 ### Check for a C++ compiler
55 AC_LANG_CPLUSPLUS
56 LYX_PROG_CXX
57 AC_PROG_CXXCPP
58 AC_DISABLE_SHARED
59 AC_LIBTOOL_WIN32_DLL
60 AM_PROG_LIBTOOL
61
62 ### check the size of pointers and ints
63 # the defaults are given for cross compilation.
64 LYX_CXX_MUTABLE
65 LYX_CXX_PARTIAL
66 LYX_CXX_EXPLICIT
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. 
69 dnl LYX_CXX_STL_STACK
70 LYX_CXX_STL_STRING
71 LYX_CXX_NAMESPACES
72 LYX_CXX_CHEADERS
73 dnl we disable rtti for now
74 dnl LYX_CXX_RTTI
75 AC_CHECK_HEADERS(ostream istream)
76 LYX_CXX_STL_MODERN_STREAMS
77
78 ### Library Files
79 dnl by testing these we check if it is ok to have
80 dnl -lc and -lm as args to the compiler
81 AC_CHECK_LIB(m, sin)
82 AC_CHECK_LIB(c, fopen)
83
84 ### Add extra directories to check for libraries.
85 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
86 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
87 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
88
89 ### Add extra directories to check for include files.
90 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
91 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
92 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
93
94 ### Add both includes and libraries
95 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
96 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
97 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
98   LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
99  
100 ### Check for the -liberty library
101 test "x$GXX" = xyes && lyx_use_liberty=yes
102 AC_ARG_WITH(liberty,
103   [  --without-liberty       do not try to link against libiberty.a],
104   [lyx_use_liberty=$withval])
105 if test x$lyx_use_liberty = xyes; then
106   # AC_CHECK_LIB(iberty,main,LIBS="-liberty $LIBS")
107   AC_CHECK_LIB(iberty,main)
108 fi
109
110 ### Check for X libraries
111 # Check for the pt library (for SCO, needed for X)
112 AC_CHECK_LIB(pt,ptsname,X_EXTRA_LIBS="-lpt $X_EXTRA_LIBS")
113 # The real thing.
114 AC_PATH_XTRA
115 LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
116 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
117
118 ## Check whether X is new enough to handle the input method stuff
119 AC_CHECK_FUNCS(XOpenIM)
120
121 ### Check for xforms and xpm (only if X has been found).
122 if test "$have_x" = yes ; then
123 # We surely need these two libraries and want to check carefully the
124 # version numbers... 
125 LYX_PATH_XPM
126 LYX_PATH_XFORMS
127 AC_SUBST(LYX_LIBS)
128 else
129 LYX_ERROR(dnl
130 [Cannot find X window libraries and/or headers. Check your installation. 
131    If you use a Linux system, check that you have installed 
132    the development tools.])
133 fi
134
135 ### Setup GNU gettext
136 dnl GNU gettext is written in C
137 AC_LANG_C
138 # Some tests that may be useful for gettext
139 AC_C_CONST
140 AC_C_INLINE
141 # Do the real setup now
142 AM_GNU_GETTEXT
143 # a hack for those who try to change LyX, but do not have gettext installed 
144 case  "${XGETTEXT}" in 
145  *:) XGETTEXT='cp ${srcdir}/lyx.pot ./${PACKAGE}.po ; :'
146 esac
147
148 AC_SUBST(LINGUAS)
149
150 AC_LANG_CPLUSPLUS
151
152 # some standard header files
153 AC_HEADER_DIRENT
154 AC_HEADER_MAJOR
155 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h)
156
157 # some annoying header files
158 #LYX_PATH_HEADER(stl_string_fwd.h)
159 LYX_STL_STRING_FWD
160
161 # some standard structures
162 AC_HEADER_STAT
163 AC_HEADER_TIME
164 AC_STRUCT_ST_BLKSIZE
165 AC_STRUCT_ST_BLOCKS
166 AC_STRUCT_ST_RDEV
167
168 # some standard types
169 AC_TYPE_MODE_T
170 AC_TYPE_OFF_T
171 AC_TYPE_PID_T
172 AC_TYPE_SIGNAL
173 AC_TYPE_SIZE_T
174 AC_TYPE_UID_T
175
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])
184 fi
185 AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo)
186
187 dnl Until this is fixed in autoconf we provide our own version
188 LYX_FUNC_SELECT_ARGTYPES
189
190 # SunOS 4.1.3 does not have strerror and atexit
191 AC_REPLACE_FUNCS(strerror atexit)
192
193 ### and now some special lyx flags.
194 AC_ARG_WITH(two-colors,[  --with-two-colors       use two color pixmaps],
195   [AC_DEFINE(TWO_COLOR_ICONS)
196    lyx_flags="$lyx_flags two-colors"])
197 AC_ARG_ENABLE(assertions,
198   [  --enable-assertions     add runtime sanity checks in the program],,
199   [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
200         enable_assertions=yes;
201     else
202         enable_assertions=no;
203     fi;])
204 if test "x$enable_assertions" = xyes ; then
205    lyx_flags="$lyx_flags assertions"
206    AC_DEFINE(ENABLE_ASSERTIONS,1,
207     [Define if you want assertions to be enabled in the code])
208 fi
209
210 ### Finish the work.
211 AC_CONFIG_SUBDIRS(lib lib/reLyX)
212 AC_OUTPUT([Makefile \
213        development/lyx.spec \
214        lib/Makefile \
215        intl/Makefile \
216        po/Makefile.in \
217        src/Makefile \
218        src/mathed/Makefile \
219        src/insets/Makefile \
220        src/support/Makefile \
221 ],  [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
222
223
224 cat <<EOF
225
226 Configuration:
227   Source code location:       ${srcdir}
228   C++ Compiler:                   ${CXX}
229   C++ Compiler flags:             ${CXXFLAGS}
230   C   Compiler:                   ${CC}
231   C   Compiler flags:             ${CFLAGS}
232   LyX binary dir:             `eval "echo \`eval \"echo ${bindir}\"\`"`
233   LyX files dir:              `eval "echo \`eval \"echo ${datadir}/${PACKAGE}\"\`"`
234   Special flags:              ${lyx_flags}
235
236 EOF
237
238 # Display a final warning if there has been a LYX_ERROR
239 LYX_CHECK_ERRORS
240