root/lyx-devel/branches/BRANCH-1_2_X/configure.in

Revision 5928, 11.8 kB (checked in by lasgouttes, 6 years ago)

back to 1.2.4cvs

  • Property svn:eol-style set to native
Line 
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.2.4cvs"
12 LYX_CHECK_VERSION
13
14 AC_CANONICAL_SYSTEM
15 AC_VALIDATE_CACHE_SYSTEM_TYPE
16
17 LYX_VERSION_SUFFIX
18
19 AM_INIT_AUTOMAKE($lyxname, $VERSION)
20
21 # The list of languages known to LyX
22 # This is needed by GNU gettext
23 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"
24
25 # fix the value of the prefixes.
26 test "x$prefix" = xNONE && prefix=$ac_default_prefix
27 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
28
29 ### Set the execute permissions of the various scripts correctly
30 for file in config/install-sh config/mkinstalldirs lib/configure ; do
31   chmod 755 ${srcdir}/${file}
32 done
33
34 ### Check for programs
35 AC_PROG_MAKE_SET
36 AC_PROG_INSTALL
37 #AC_PROG_RANLIB
38 AC_CHECK_PROG(KPSEWHICH, kpsewhich, kpsewhich, :)
39 if test "x$KPSEWHICH" = xkpsewhich ; then
40     AC_DEFINE(HAVE_KPSEWHICH, 1,
41     [Define this if you have the kpsewhich program working on your system.])
42 fi
43 AC_CHECK_PROGS(M4, gm4 gnum4 m4, m4)
44
45 # Work around a problem in automake 1.4: when invoking install-strip,
46 # INSTALL_PROGRAM is changed to 'install -s', and since
47 # INSTALL_SCRIPT==INSTALL_PROGRAM, we get errors with fileutils-4.0
48 # which returns an error condition when stripping fails.
49 INSTALL_SCRIPT='${INSTALL}'
50
51 ### we will also need a C compiler to compile GNU gettext
52 AC_PROG_CC
53 # and on some systems with autoconf 2.5x, the gettext test for off_t
54 # will fail because it does not look into sys/types.h. We try here to help
55 # it to do so
56 AC_CHECK_HEADERS(sys/types.h)
57
58 ### check for special systems
59 AC_ISC_POSIX
60 AC_AIX
61 LYX_HPUX
62 LYX_SUNOS4
63 LYX_SCO
64
65 ### Check for program extensions (.exe or nothing)
66 AC_EXEEXT
67
68 ### check which frontend we want to use
69 LYX_USE_FRONTEND
70 dnl The code below is not in a macro, because this would cause big
71 dnl problems with the AC_REQUIRE contained in KDE_DO_IT_ALL.
72 case "$lyx_use_frontend" in
73   gnome)
74     GNOME_INIT
75     GNOME_COMPILE_WARNINGS
76     GNOME_X_CHECKS
77 esac
78
79 ### Check for a C++ compiler
80 LYX_PROG_CXX
81 ### Some checks on what the C++ compiler can(not) do
82 AC_LANG_CPLUSPLUS
83 dnl we do not need that currently (and probably all our supported
84 dnl compiler allow that)
85 dnl LYX_CXX_PARTIAL
86 LYX_CXX_EXPLICIT
87 LYX_CXX_STL_STRING
88 LYX_CXX_GOOD_STD_STRING
89 LYX_CXX_CHEADERS
90 LYX_CXX_GLOBAL_CSTD
91 LYX_STD_COUNT
92 dnl we disable rtti for now
93 dnl LYX_CXX_RTTI
94 AC_CHECK_HEADERS(ostream istream sstream locale limits)
95 LYX_CXX_STL_MODERN_STREAMS
96
97 ### and now some special lyx flags.
98 AC_ARG_ENABLE(assertions,
99   [  --enable-assertions     add runtime sanity checks in the program],,
100   [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
101         enable_assertions=yes;
102     else
103         enable_assertions=no;
104     fi;])
105 if test "x$enable_assertions" = xyes ; then
106    lyx_flags="$lyx_flags assertions"
107    AC_DEFINE(ENABLE_ASSERTIONS,1,
108     [Define if you want assertions to be enabled in the code])
109 fi
110
111 ### We need a regex implementation, so we provide our own if none is found.
112 LYX_REGEX
113
114 ### Library Files
115 dnl by testing these we check if it is ok to have
116 dnl -lc and -lm as args to the compiler
117 AC_CHECK_LIB(m, sin)
118 AC_CHECK_LIB(c, fopen)
119
120 ### Add extra directories to check for libraries.
121 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
122 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
123 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
124
125 ### Add extra directories to check for include files.
126 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
127 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
128 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
129
130 ### Add both includes and libraries
131 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
132 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
133 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
134   LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
135
136 ### Check for the -liberty library
137 test "x$GXX" = xyes && lyx_use_liberty=yes
138 AC_ARG_WITH(liberty,
139   [  --without-liberty       do not try to link against libiberty.a],
140   [lyx_use_liberty=$withval])
141 if test x$lyx_use_liberty = xyes; then
142   # AC_CHECK_LIB(iberty,main,LIBS="-liberty $LIBS")
143   AC_CHECK_LIB(iberty,main)
144 fi
145
146 AC_ARG_WITH(aiksaurus,
147   [  --without-aiksaurus     do not use the Aiksaurus library],
148   [lyx_use_aiksaurus=$withval])
149 if test x$lyx_use_aiksaurus != xno; then
150 AC_CHECK_LIB(Aiksaurus, main,
151         [AC_DEFINE(HAVE_LIBAIKSAURUS,,[Define this if you have the AikSaurus library])
152          AIKSAURUS_LIBS="-lAiksaurus -lbz2"
153         ],,"-lbz2")
154 fi
155 AC_SUBST(AIKSAURUS_LIBS)
156  
157 ### Setup libtool
158 AC_DISABLE_SHARED
159 AC_LIBTOOL_WIN32_DLL
160 #AM_PROG_LIBTOOL
161 LYX_PROG_LIBTOOL
162
163 ### Check which libsigc++ we're using
164 LYX_WITH_SIGC
165
166 ### Check if we want pspell libraries
167 CHECK_WITH_PSPELL
168
169 ### Check for X libraries
170 # The real thing.
171 AC_PATH_XTRA
172 LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
173 # Since solaris X headers use int as implicit return type and modern
174 # gcc's do not like that, let's use -isystem instead of -I.
175 # We should test for gcc version and see whether it supports -isystem,
176 # but since at least gcc 2.6.x supports it and it is still too old for
177 # us, it seems we are safe.
178 if test -n "$GXX" ; then
179   X_CFLAGS=`echo ${X_CFLAGS} | sed -e 's/-I/-isystem /'`
180 fi
181 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
182
183 ## Check whether X is new enough to handle the input method stuff
184 AC_CHECK_FUNCS(XOpenIM)
185
186 ### check which frontend we want to use
187 # Checking for xforms is always needed anyway
188 LYX_PATH_XPM
189 LYX_PATH_XFORMS
190
191 #LYX_USE_FRONTEND
192 dnl The code below is not in a macro, because this would cause big
193 dnl problems with the AC_REQUIRE contained in KDE_DO_IT_ALL.
194 case "$lyx_use_frontend" in
195   xforms)
196   # for now don't set it for xforms as this is always entered
197         FRONTEND="xforms"
198         FRONTEND_GUILIB="xforms/*.lo"
199         FRONTEND_INCLUDES="-I\$(srcdir)/xforms"
200         case "$host" in
201           *cygwin)
202             FRONTEND_LIBS="@XFORMS_LIB@ @XFORMS_IMAGE_LIB@ @XPM_LIB@"
203             ;;
204           *)
205             FRONTEND_LIBS="@XFORMS_IMAGE_LIB@ @XFORMS_LIB@ @XPM_LIB@"
206             ;;
207         esac
208         FRONTEND_INFO="    libXpm version:               ${XPM_VERSION}\n\
209     libforms version:             ${XFORMS_VERSION}\n"
210         ;;
211   gnome)
212     AM_PATH_GTKMM(1.2.1,,
213         AC_MSG_ERROR(Cannot find GTK--: Please install Version 1.2.1+))
214     AM_PATH_GNOMEMM
215
216 dnl ******************************
217 dnl LibGlade checking
218 dnl ******************************
219 dnl Ensure gnome-config is available...
220         AC_PATH_PROG(GNOME_CONFIG, gnome-config, no)
221         AC_MSG_CHECKING(for Glade libraries)
222         if $GNOME_CONFIG --libs libglade > /dev/null 2>&1; then
223         AC_MSG_RESULT(found)
224         else
225             AC_MSG_ERROR(Did not find libGlade installed)
226         fi
227
228     FRONTEND="xforms gnome"
229     FRONTEND_GUILIB="gnome/*.lo"
230     FRONTEND_LDFLAGS="\$(GNOMEMM_LIBDIR)"
231     FRONTEND_INCLUDES="-I\${srcdir}/gnome -I\${srcdir}/xforms \$(GNOMEMM_INCLUDEDIR) \$(GTKMM_CFLAGS) `gnome-config --cflags libglade gnomeui`"
232     FRONTEND_LIBS="@XPM_LIB@ @XFORMS_LIB@ \$(GNOMEMM_LIBS) \$(GTKMM_LIBS) `gnome-config --libs libglade gnomeui`";;
233   qt2)
234     QT2_DO_IT_ALL
235     FRONTEND="qt2"
236     FRONTEND_GUILIB="qt2/*.lo qt2/ui/*.lo qt2/moc/*.lo qt2/ui/moc/*.lo qt2/xforms/*.lo"
237     FRONTEND_LDFLAGS="\$(QT2_LDFLAGS)"
238     FRONTEND_INCLUDES="-I\${srcdir}/qt2 -I\${top_srcdir}/src/frontends/xforms \$(QT2_INCLUDES)"
239     FRONTEND_LIBS="@XPM_LIB@ @XFORMS_LIB@ \$(QT2_LIBS)";;
240   *)
241     LYX_ERROR(Unknown frontend $lyx_use_frontend);;
242 esac
243
244 ### Check for xforms and xpm (only if X has been found).
245 if test "$have_x" = no ; then
246 # We surely need these two libraries and want to check carefully the
247 # version numbers...
248 #LYX_PATH_XPM
249 #LYX_PATH_XFORMS
250 #FRONTEND_INFO=`cat <<EOF
251 #    libXpm version:               ${XPM_VERSION}\n\
252 #    libforms version:             ${XFORMS_VERSION}\n
253 #`
254 #
255 #AC_SUBST(LYX_LIBS)
256 #else
257 LYX_ERROR(dnl
258 [Cannot find X window libraries and/or headers. Check your installation.
259    If you use a Linux system, check that you have installed
260    the development tools.])
261 fi
262
263 ### Check whether the xforms library has a viable image loader
264 ### For now, run this test always so config.h is unchanged by a change in
265 ### frontend
266 LYX_USE_XFORMS_IMAGE_LOADER
267
268 ### Setup GNU gettext
269 dnl GNU gettext is written in C
270 AC_LANG_C
271 # Some tests that may be useful for gettext
272 AC_C_CONST
273 AC_C_INLINE
274 # Do the real setup now
275 AM_GNU_GETTEXT
276 # a hack for those who try to change LyX, but do not have gettext installed
277 case  "${XGETTEXT}" in
278  *:) XGETTEXT='cp ${srcdir}/lyx.pot ./${PACKAGE}.po ; :'
279 esac
280
281 AC_SUBST(LINGUAS)
282
283 AC_LANG_CPLUSPLUS
284
285 # some standard header files
286 AC_HEADER_DIRENT
287 AC_HEADER_MAJOR
288 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h strings.h locale.h)
289
290 # some annoying header files
291 #LYX_PATH_HEADER(stl_string_fwd.h)
292 LYX_STL_STRING_FWD
293
294 # some standard structures
295 AC_HEADER_STAT
296 AC_HEADER_TIME
297 AC_STRUCT_ST_BLKSIZE
298 AC_STRUCT_ST_BLOCKS
299 AC_STRUCT_ST_RDEV
300
301 # some standard types
302 AC_TYPE_MODE_T
303 AC_TYPE_OFF_T
304 AC_TYPE_PID_T
305 AC_TYPE_SIGNAL
306 AC_TYPE_SIZE_T
307 AC_TYPE_UID_T
308
309 # some functions we'd like to have
310 AC_ARG_WITH(broken-headers,
311     [  --with-broken-headers   define some functions on SunOS4 and SCO],
312     [lyx_broken_headers=$withval])
313 if test "x$lyx_broken_headers" = "xyes"; then
314   lyx_flags="$lyx_flags broken-headers"
315   AC_DEFINE(BROKEN_HEADERS, 1,
316     [Define on SunOS 4 and SCO, were some functions are missing from the headers])
317 fi
318 AC_CHECK_FUNCS(snprintf vsnprintf)
319 LYX_CHECK_DECL(snprintf, stdio.h)
320 LYX_CHECK_DECL(vsnprintf, stdio.h)
321 LYX_CHECK_DECL(istreambuf_iterator, iterator)
322
323 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
324 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
325 dnl We aim to remove this eventually, since we should test as much as
326 dnl possible with the compiler which will use the functions (JMarc)
327 AC_LANG_C
328 AC_CHECK_FUNCS(memmove memset strchr putenv setenv mkfifo mkstemp mktemp)
329 # SunOS 4.1.3 does not have strerror and atexit
330 AC_REPLACE_FUNCS(strerror atexit)
331 AC_LANG_CPLUSPLUS
332
333 dnl Until this is fixed in autoconf we provide our own version
334 LYX_FUNC_SELECT_ARGTYPES
335
336 dnl check whether we have to work around solaris broken putenv()
337 LYX_FUNC_PUTENV_ARGTYPE
338
339
340 LYX_CHECK_DECL_HDRS(mkstemp,[unistd.h stdlib.h])
341
342 ### Some information on what just happened
343 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
344 real_datadir=`eval "echo \`eval \"echo ${datadir}/${PACKAGE}\"\`"`
345 VERSION_INFO="Configuration\n\
346   Host type:                      ${host}\n\
347   Special build flags:           ${lyx_flags}\n\
348   C   Compiler:                   ${CC}\n\
349   C   Compiler flags:             ${CFLAGS}\n\
350   C++ Compiler:                   ${CXX} ${CXX_VERSION}\n\
351   C++ Compiler flags:             ${CXXFLAGS}\n\
352   Linker flags:                   ${LDFLAGS}\n\
353   Frontend:                       ${lyx_use_frontend}\n\
354 ${FRONTEND_INFO}\
355   LyX binary dir:                 ${real_bindir}\n\
356   LyX files dir:                  ${real_datadir}\n"
357
358 AC_SUBST(VERSION_INFO)
359
360 ### Finish the work.
361 AC_CONFIG_SUBDIRS(sigc++ lib lib/reLyX)
362 AC_OUTPUT([Makefile \
363        boost/Makefile \
364        config/Makefile \
365        development/lyx.spec \
366        lib/Makefile \
367        intl/Makefile \
368        po/Makefile.in \
369        sourcedoc/Doxyfile \
370        src/Makefile \
371        src/version.C \
372        src/mathed/Makefile \
373        src/graphics/Makefile \
374        src/insets/Makefile \
375        src/support/Makefile \
376        src/frontends/Makefile \
377        src/frontends/controllers/Makefile \
378        src/frontends/xforms/Makefile \
379        src/frontends/xforms/forms/Makefile \
380        src/frontends/qt2/Makefile \
381        src/frontends/qt2/xforms/Makefile \
382        src/frontends/qt2/moc/Makefile \
383        src/frontends/qt2/ui/Makefile \
384        src/frontends/qt2/ui/moc/Makefile \
385        src/frontends/gnome/Makefile \
386 ])
387
388 # show version information
389 echo
390 printf "$VERSION_INFO"
391 echo
392
393 # Display a final warning if there has been a LYX_ERROR
394 LYX_CHECK_ERRORS
Note: See TracBrowser for help on using the browser.