]> git.lyx.org Git - features.git/blob - configure.ac
remove libtool
[features.git] / configure.ac
1 dnl Process with autoconf to generate configure script   -*- sh -*-
2
3 AC_INIT(LyX,2.0.0svn,[lyx-devel@lists.lyx.org],[lyx])
4 AC_SUBST(LYX_DATE, ["Sat, Nov 15, 2008"])
5 AC_PREREQ(2.52)
6 AC_CONFIG_SRCDIR(src/main.cpp)
7 AC_CONFIG_HEADERS([config.h])
8
9 AC_CONFIG_AUX_DIR(config)
10
11 # First check the version
12 LYX_CHECK_VERSION
13 LYX_VERSION_SUFFIX
14 # Check how the files should be packaged
15 AC_CANONICAL_TARGET
16 LYX_USE_PACKAGING
17 # We need to define these variables here and the no-define option of
18 # AM_INIT_AUTOMAKE above because we alter $PACKAGE in LYX_USE_PACKAGING.
19 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
20
21 dnl default maintainer mode to true for development versions
22 if test "${enable_maintainer_mode+set}" != set; then
23   enable_maintainer_mode=$lyx_devel_version
24 fi
25 AM_MAINTAINER_MODE
26
27 save_PACKAGE=$PACKAGE
28 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-define 1.5])
29 PACKAGE=$save_PACKAGE
30
31 ### Set the execute permissions of the various scripts correctly
32 for file in config/install-sh config/mkinstalldirs ; do
33   chmod 755 ${srcdir}/${file}
34 done
35
36 ### Check for programs
37 dnl AC_PROG_MAKE_SET
38 dnl AC_PROG_INSTALL
39
40 # Check for installed python
41 AM_PATH_PYTHON(2.3.4,, :)
42
43 # Work around a problem in automake 1.4: when invoking install-strip,
44 # INSTALL_PROGRAM is changed to 'install -s', and since
45 # INSTALL_SCRIPT==INSTALL_PROGRAM, we get errors with fileutils-4.0
46 # which returns an error condition when stripping fails.
47 INSTALL_SCRIPT='${INSTALL}'
48
49 ### we will also need a C compiler to compile GNU gettext
50 AC_PROG_CC
51 AC_USE_SYSTEM_EXTENSIONS
52
53 ### we need to know the byte order for unicode conversions
54 AC_C_BIGENDIAN
55
56 ### check which frontend we want to use
57 LYX_USE_FRONTENDS
58
59 ### Check for a C++ compiler
60 LYX_PROG_CXX
61 ### Some checks on what the C++ compiler can(not) do
62 AC_LANG(C++)
63 dnl we do not need that currently (and probably all our supported
64 dnl compiler allow that)
65 dnl LYX_CXX_PARTIAL
66 dnl LYX_CXX_EXPLICIT
67 dnl LYX_CXX_GLOBAL_CSTD
68 dnl LYX_STD_COUNT
69 dnl we disable rtti for now
70 dnl LYX_CXX_RTTI
71 dnl AC_CHECK_HEADERS(ostream istream sstream locale limits ios)
72 dnl LYX_CXX_STL_MODERN_STREAMS
73
74 ### Objective-C compiler
75 AC_PROG_OBJC
76 _AM_DEPENDENCIES([OBJC])
77
78 ### and now some special lyx flags.
79 AC_ARG_ENABLE(assertions,
80   AC_HELP_STRING([--enable-assertions],[add runtime sanity checks in the program]),,
81   [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
82         enable_assertions=yes;
83     else
84         enable_assertions=no;
85     fi;])
86 if test "x$enable_assertions" = xyes ; then
87    lyx_flags="assertions $lyx_flags"
88    AC_DEFINE(ENABLE_ASSERTIONS,1,
89     [Define if you want assertions to be enabled in the code])
90 fi
91
92 ### Library Files
93 dnl AC_CHECK_LIB(m, sin)
94
95 ### Add extra directories to check for libraries.
96 LYX_WITH_DIR([extra-lib],[extra library directory],extra_lib, NONE)
97 LYX_LOOP_DIR($lyx_cv_extra_lib,LYX_ADD_LIB_DIR(lyx_ldflags,$dir))
98 test ! x"$lyx_ldflags" = x && LDFLAGS="$lyx_ldflags $LDFLAGS"
99
100 ### Add extra directories to check for include files.
101 LYX_WITH_DIR([extra-inc],[extra include directory],extra_inc, NONE)
102 LYX_LOOP_DIR($lyx_cv_extra_inc,LYX_ADD_INC_DIR(lyx_cppflags,$dir))
103 test ! x"$lyx_cppflags" = x && CPPFLAGS="$lyx_cppflags $CPPFLAGS"
104
105 ### Add both includes and libraries
106 LYX_WITH_DIR([extra-prefix],[extra lib+include directory],extra_prefix, NONE, ${prefix})
107 LYX_LOOP_DIR($lyx_cv_extra_prefix,[
108 LYX_ADD_INC_DIR(CPPFLAGS,$dir/include)
109   LYX_ADD_LIB_DIR(LDFLAGS,$dir/lib)])
110
111 ### These are needed in windows
112 AC_CHECK_LIB(shlwapi, main, [LIBSHLWAPI=-lshlwapi])
113 AC_SUBST(LIBSHLWAPI)
114 AC_CHECK_LIB(gdi32, main)
115
116 AC_ARG_WITH(aiksaurus,
117   [  --without-aiksaurus     do not use the Aiksaurus library],
118   [lyx_use_aiksaurus=$withval])
119 if test x$lyx_use_aiksaurus != xno; then
120 AC_CHECK_LIB(Aiksaurus, main,
121         [AC_DEFINE(HAVE_LIBAIKSAURUS,1,[Define this if you have the AikSaurus library])
122          AIKSAURUS_LIBS="-lAiksaurus"
123          lyx_flags="aiksaurus $lyx_flags"
124         ])
125 AC_CHECK_HEADER(Aiksaurus.h,[
126   ac_cv_header_aiksaurus_h=yes
127   lyx_cv_aiksaurus_h_location="<Aiksaurus.h>"])
128 AC_CHECK_HEADER(Aiksaurus/Aiksaurus.h,[
129   ac_cv_header_aiksaurus_h=yes
130   lyx_cv_aiksaurus_h_location="<Aiksaurus/Aiksaurus.h>"])
131 AC_DEFINE_UNQUOTED(AIKSAURUS_H_LOCATION,$lyx_cv_aiksaurus_h_location,[Location of Aiksaurus.h])
132 fi
133 AC_SUBST(AIKSAURUS_LIBS)
134
135 LYX_USE_INCLUDED_BOOST
136
137 # Needed for our char_type
138 AC_CHECK_SIZEOF(wchar_t)
139
140 ### Setup libtool
141 dnl Dirty trick ahead: disable libtool checking for a fortran compiler
142 dnl see http://permalink.gmane.org/gmane.comp.gnu.libtool.general/6699
143 dnl Note that this will reportedly not be needed with libtool 2.0
144 m4_undefine([AC_PROG_F77])
145 m4_defun([AC_PROG_F77],[])
146
147 AC_DISABLE_SHARED
148 #AC_DISABLE_STATIC
149
150 ### We need iconv for unicode support (Qt4 frontend requires it too)
151 AM_ICONV
152 if test "$am_cv_func_iconv" = no; then
153   LYX_ERROR([Cannot find required library iconv])
154 else
155   LIBS="$LIBS $LIBICONV"
156 fi
157
158 ### check for compression support
159 AC_CHECK_HEADERS(zlib.h,
160  [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_LIB_ERROR(libz,zlib))],
161  [LYX_LIB_ERROR(zlib.h,zlib)])
162
163
164 ### check which frontend we want to use
165
166 dnl The code below is not in a macro, because this would cause big
167 dnl problems with the AC_REQUIRE contained in QT_DO_IT_ALL.
168 for frontend in $FRONTENDS ; do
169   case "$frontend" in
170     qt4)
171           QT4_DO_IT_ALL
172           FRONTENDS_PROGS="$FRONTENDS_PROGS lyx-qt4\$(EXEEXT)"
173           FRONTENDS_SUBDIRS="$FRONTENDS_SUBDIRS qt4"
174           RPM_FRONTEND="qt4"
175           FRONTEND_INFO="${FRONTEND_INFO}\
176   Qt 4 Frontend:\n\
177       Qt 4 version:\t\t${QT4_VERSION}\n"
178 dnl qt 4 build will fail without moc or uic
179           if test -z "$MOC4"; then
180             LYX_ERROR([moc 4 binary not found !])
181           fi
182           if test -z "$UIC4"; then
183             LYX_ERROR([uic 4 binary not found !])
184           fi
185           if test -z "$QT4_LIB"; then
186             LYX_ERROR([qt 4 library not found !])
187           fi
188       ;;
189     *)
190           LYX_ERROR(Unknown frontend '$frontend');;
191   esac
192 done
193
194 # fix the value of the prefixes.
195 test "x$prefix" = xNONE && prefix=$default_prefix
196 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
197 if echo $prefix |grep ' ' >/dev/null 2>/dev/null ; then
198   LYX_WARNING([The installation prefix \"${prefix}\" contains a space, which
199    causes problems with the Makefiles. The installation will be done in
200    directory \"`pwd`/installprefix\" instead. Please move its contents to
201    the right place after installation.])
202   prefix=`pwd`/installprefix
203 fi
204
205 ### Setup GNU gettext
206 dnl GNU gettext is written in C
207 AC_LANG_PUSH(C)
208 dnl Dirty trick ahead: disable macro AC_GNU_SOURCE because it triggers a bug with autoconf 2.62.
209 dnl this can be removed if gettext is been updated to avoid that.
210 m4_undefine([AC_GNU_SOURCE])
211 m4_defun([AC_GNU_SOURCE],[])
212 AM_GNU_GETTEXT
213 AM_GNU_GETTEXT_VERSION([0.16.1])
214 AC_LANG_POP(C)
215
216 # some standard header files
217 AC_HEADER_DIRENT
218 AC_HEADER_MAJOR
219 AC_CHECK_HEADERS(sys/time.h sys/types.h sys/select.h strings.h locale.h io.h process.h NewAPIs.h utime.h sys/utime.h)
220
221 # some standard structures
222 AC_HEADER_STAT
223 AC_HEADER_TIME
224
225 # some standard types
226 AC_CHECK_TYPE(mode_t,[AC_DEFINE(HAVE_MODE_T, 1, [Define this to 1 if your compiler supports the mode_t type.])])
227 AC_TYPE_OFF_T
228 AC_TYPE_PID_T
229 AC_TYPE_SIGNAL
230 AC_TYPE_SIZE_T
231 AC_TYPE_UID_T
232
233 AC_CHECK_FUNCS(strerror)
234 LYX_CHECK_DECL(istreambuf_iterator, iterator)
235 LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
236
237 # Check the form of mkdir()
238 AC_FUNC_MKDIR
239
240 dnl This is a slight hack: the tests generated by autoconf 2.52 do not
241 dnl work correctly because of some conflict with stdlib.h with g++ 2.96
242 dnl We aim to remove this eventually, since we should test as much as
243 dnl possible with the compiler which will use the functions (JMarc)
244 AC_LANG_PUSH(C)
245 AC_CHECK_FUNCS(chmod close _close getpid _getpid lstat mkfifo mkstemp mktemp open _open pclose _pclose popen _popen readlink)
246 AC_LANG_POP(C)
247
248 LYX_CHECK_SPELL_ENGINES
249
250 lyx_client_subdir=true
251 AC_LANG_PUSH(C)
252 dnl LIBS already contains some X extra libs that may interfere.
253 save_LIBS="$LIBS"
254 LIBS=
255 AC_CHECK_FUNCS(fcntl,
256   [AC_SEARCH_LIBS([gethostbyname], [nsl])
257    AC_SEARCH_LIBS([socket], [socket], [],
258      [AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
259                 [], [-lnsl])])],
260   [lyx_client_subdir=false])
261 AC_SUBST(SOCKET_LIBS,$LIBS)
262 LIBS="$save_LIBS"
263 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
264 AC_LANG_POP(C)
265
266 lyx_win_res=false;
267 case ${host} in
268     *mingw*|*cygwin*) lyx_win_res=true;;
269 esac
270 AM_CONDITIONAL(LYX_WIN_RESOURCE, $lyx_win_res)
271 LYX_SET_VERSION_INFO
272
273 AC_FUNC_SELECT_ARGTYPES
274
275 ### Some information on what just happened
276 real_bindir=`eval "echo \`eval \"echo ${bindir}\"\`"`
277 real_pkgdatadir=`eval "echo \`eval \"echo \\\`eval \\\"echo ${pkgdatadir}\\\"\\\`\"\`"`
278 real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
279 VERSION_INFO="Configuration\n\
280   Host type:                    ${host}\n\
281   Special build flags:          ${lyx_flags}\n\
282   C   Compiler:                 ${CC} ${CC_VERSION}\n\
283   C   Compiler LyX flags:       ${AM_CPPFLAGS} ${AM_CFLAGS}\n\
284   C   Compiler flags:           ${CPPFLAGS} ${CFLAGS}\n\
285   C++ Compiler:                 ${CXX} ${CXX_VERSION}\n\
286   C++ Compiler LyX flags:       ${AM_CPPFLAGS} ${AM_CXXFLAGS}\n\
287   C++ Compiler flags:           ${CPPFLAGS} ${CXXFLAGS}\n\
288   Linker flags:                 ${AM_LDFLAGS}\n\
289   Linker user flags:            ${LDFLAGS}\n\
290 ${FRONTEND_INFO}\
291   Packaging:                    ${lyx_use_packaging}\n\
292   LyX binary dir:               ${real_bindir}\n\
293   LyX files dir:                ${real_pkgdatadir}\n"
294
295 AC_SUBST(VERSION_INFO)
296 AC_SUBST(RPM_FRONTEND)
297 AC_SUBST(AM_CPPFLAGS)
298 AC_SUBST(AM_CXXFLAGS)
299 AC_SUBST(AM_CFLAGS)
300 AC_SUBST(AM_LDFLAGS)
301 AC_SUBST(real_pkgdatadir)
302
303 ## Some config.h stuff
304
305 AH_TOP([
306 /* -*- C++ -*- */
307 /*
308  * \file config.h
309  * This file is part of LyX, the document processor.
310  * Licence details can be found in the file COPYING.
311  *
312  * This is the compilation configuration file for LyX.
313  * It was generated by autoconfs configure.
314  * You might want to change some of the defaults if something goes wrong
315  * during the compilation.
316  */
317
318 #ifndef _CONFIG_H
319 #define _CONFIG_H
320 ])
321
322 AH_BOTTOM([
323 /************************************************************
324  ** You should not need to change anything beyond this point */
325
326 #ifndef HAVE_STRERROR
327 #if defined(__cplusplus)
328 extern "C"
329 #endif
330 char * strerror(int n);
331 #endif
332
333 #if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
334 #  define USE_BOOST_FORMAT 1
335 #else
336 #  define USE_BOOST_FORMAT 0
337 #endif
338
339 #define BOOST_USER_CONFIG <config.h>
340
341 #if !defined(ENABLE_ASSERTIONS)
342 #  define BOOST_DISABLE_ASSERTS 1
343 #endif
344 #define BOOST_ENABLE_ASSERT_HANDLER 1
345
346 #define BOOST_DISABLE_THREADS 1
347 #define BOOST_NO_WREGEX 1
348 #define BOOST_NO_WSTRING 1
349
350 #ifdef __CYGWIN__
351 #  define BOOST_POSIX 1
352 #  define BOOST_POSIX_API 1
353 #  define BOOST_POSIX_PATH 1
354 #endif
355
356 #if defined(HAVE_NEWAPIS_H)
357 #  define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
358 #endif
359
360 /*
361  * the FreeBSD libc uses UCS4, but libstdc++ has no proper wchar_t
362  * support compiled in:
363  * http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#3_9
364  * And we are not interested at all what libc
365  * does: What we need is a 32bit wide wchar_t, and a libstdc++ that
366  * has the needed wchar_t support and uses UCS4. Whether it
367  * implements this with the help of libc, or whether it has own code
368  * does not matter for us, because we do not use libc directly (Georg)
369 */
370 #if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4 && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)
371 #  define USE_WCHAR_T
372 #endif
373
374 #endif
375 ])
376
377
378 AC_ARG_ENABLE(monolithic-boost,
379   AC_HELP_STRING([--enable-monolithic-boost],
380                 [Use monolithic boost compilations]),,
381   [enable_monolithic_boost=no])
382 AM_CONDITIONAL(MONOLITHIC_BOOST, test "$enable_monolithic_boost" = "yes")
383
384 AC_ARG_ENABLE(monolithic-client,
385   AC_HELP_STRING([--enable-monolithic-client],
386                 [Use monolithic client compilations]),,
387   [enable_monolithic_client=no])
388 AM_CONDITIONAL(MONOLITHIC_CLIENT, test "$enable_monolithic_client" = "yes")
389
390 AC_ARG_ENABLE(monolithic-insets,
391   AC_HELP_STRING([--enable-monolithic-insets],
392                 [Use monolithic insets compilations]),,
393   [enable_monolithic_insets=no])
394 AM_CONDITIONAL(MONOLITHIC_INSETS, test "$enable_monolithic_insets" = "yes")
395
396 AC_ARG_ENABLE(monolithic-mathed,
397   AC_HELP_STRING([--enable-monolithic-mathed],
398                 [Use monolithic mathed compilations]),,
399   [enable_monolithic_mathed=no])
400 AM_CONDITIONAL(MONOLITHIC_MATHED, test "$enable_monolithic_mathed" = "yes")
401
402 AC_ARG_ENABLE(monolithic-core,
403   AC_HELP_STRING([--enable-monolithic-core],
404                 [Use monolithic core files compilations]),,
405   [enable_monolithic_core=no])
406 AM_CONDITIONAL(MONOLITHIC_CORE, test "$enable_monolithic_core" = "yes")
407
408 AC_ARG_ENABLE(monolithic-tex2lyx,
409   AC_HELP_STRING([--enable-monolithic-tex2lyx],
410                 [Use monolithic tex2lyx compilations]),,
411   [enable_monolithic_tex2lyx=no])
412 AM_CONDITIONAL(MONOLITHIC_TEX2LYX, test "$enable_monolithic_tex2lyx" = "yes")
413
414 AC_ARG_ENABLE(monolithic-frontend-qt4,
415   AC_HELP_STRING([--enable-monolithic-frontend-qt4],
416                 [Use monolithic compilation of the Qt 4 frontend. Only recommended with > 512 MB of RAM]),,
417   [enable_monolithic_frontend_qt4=no])
418 AM_CONDITIONAL(MONOLITHIC_FRONTEND_QT4, test "$enable_monolithic_frontend_qt4" = "yes")
419
420 MSYS_AC_CANONICAL_PATH(lyx_abs_top_srcdir, ${srcdir})
421 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_localedir, ${real_localedir})
422 MSYS_AC_CANONICAL_PATH(lyx_abs_installed_datadir, ${real_pkgdatadir})
423
424 AC_DEFINE_UNQUOTED([LYX_ABS_TOP_SRCDIR],
425         "${lyx_abs_top_srcdir}", [Top source directory])
426 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_LOCALEDIR],
427         "${lyx_abs_installed_localedir}",[Hard coded locale directory])
428 AC_DEFINE_UNQUOTED([LYX_ABS_INSTALLED_DATADIR],
429         "${lyx_abs_installed_datadir}",[Hard system support directory])
430 AC_DEFINE_UNQUOTED([PROGRAM_SUFFIX],
431         "${version_suffix}",[Program version suffix])
432
433 AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
434 AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
435 AC_DEFINE_UNQUOTED([LYX_DIR_VER],"$lyx_dir_ver",[Versioned env var for system dir])
436 AC_DEFINE_UNQUOTED([LYX_USERDIR_VER],"$lyx_userdir_ver",[Versioned env var for user dir])
437 AC_DEFINE_UNQUOTED([LYX_MAJOR_VERSION],$lyx_major,[Major version number])
438 AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
439 AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
440 AC_DEFINE_UNQUOTED([LYX_RELEASE_PATCH],$lyx_patch,[Patch version number])
441
442 AC_CONFIG_FILES([Makefile \
443       lyx.1:lyx.1in \
444       boost/Makefile \
445       config/Makefile \
446       development/Makefile \
447       development/MacOSX/Makefile \
448       development/MacOSX/Info.plist \
449       development/MacOSX/lyxrc.dist \
450       development/MacOSX/spotlight/Makefile \
451       development/lyx.spec \
452       intl/Makefile \
453       lib/Makefile \
454       lib/doc/Makefile \
455       lib/lyx2lyx/lyx2lyx_version.py \
456       lib/lyx2lyx/Makefile \
457       m4/Makefile \
458       po/Makefile.in \
459       sourcedoc/Doxyfile \
460       sourcedoc/Makefile \
461       src/client/Makefile \
462       src/Makefile \
463       src/tex2lyx/Makefile \
464       src/support/Makefile \
465       src/frontends/Makefile \
466       src/frontends/qt4/Makefile
467 ])
468
469
470 AC_OUTPUT
471
472 # show version information
473 echo
474 printf "$VERSION_INFO"
475 echo
476
477 # Display a final warning if there has been a LYX_ERROR
478 LYX_CHECK_ERRORS