Context sensitive patches
[texmacs.git] / src / configure.in
blob0f1e2259e4def3a0486f09bec394669216c80734
2 #--------------------------------------------------------------------
4 # MODULE      : configure.in
5 # DESCRIPTION : TeXmacs configuration file for autoconf
6 # COPYRIGHT   : (C) 2000  Joris van der Hoeven
8 # This software falls under the GNU general public license version 3 or later.
9 # It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
10 # in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
12 #--------------------------------------------------------------------
14 AC_INIT
15 AC_CONFIG_HEADERS([src/System/config.h:src/System/config.in])
17 PACKAGE="TeXmacs"
18 DEVEL_VERSION="1.0.7.2"
19 DEVEL_RELEASE="1"
20 STABLE_VERSION="1.0.7"
21 STABLE_RELEASE="1"
22 WINDOWS_VERSION="1.0.5"
23 WINDOWS_RELEASE="1"
24 AC_SUBST(PACKAGE)
25 AC_SUBST(DEVEL_VERSION)
26 AC_SUBST(DEVEL_RELEASE)
27 AC_SUBST(STABLE_VERSION)
28 AC_SUBST(STABLE_RELEASE)
30 #--------------------------------------------------------------------
31 # Checks for C++ compiler
32 #--------------------------------------------------------------------
34 AC_PROG_CC
35 AC_PROG_CXX
36 AC_LANG_CPLUSPLUS
37 AH_TEMPLATE([OLD_GNU_COMPILER],[Use g++ strictly prior to g++ 3.0])
38 AC_MSG_CHECKING(whether GNU C++ compiler is default)
39 case "$GXX" in
40   yes )
41     GCC_VERSION=`$CC -dumpversion`
42     GXX_VERSION=`$CXX -dumpversion`
43     AC_MSG_RESULT(yes)
44     AC_MSG_CHECKING(version of gcc)
45     AC_MSG_RESULT($GCC_VERSION)
46     AC_MSG_CHECKING(version of g++)
47     AC_MSG_RESULT($GXX_VERSION)
48     case "$GXX_VERSION" in
49       0* | 1* | 2*)
50         echo "old style GNU compiler"
51         AC_DEFINE([OLD_GNU_COMPILER],[])
52       ;;
53     esac
54   ;;
55   *)
56     GCC_VERSION="none"
57     GXX_VERSION="none"
58     AC_MSG_RESULT(no)
59     AC_MSG_WARN(cannot find GNU C++ compiler)
60   ;;
61 esac
63 #--------------------------------------------------------------------
64 # Checks for Guile
65 #--------------------------------------------------------------------
67 GUILE_FLAGS
68 AC_MSG_CHECKING(version of guile)
69 GUILE_VERSION=`guile --version | grep 'Guile \([[0-9]]\)' | sed 's/Guile \([[0-9]]*\)/\1/'`
70 AC_MSG_RESULT($GUILE_VERSION)
72 case "$GUILE_VERSION" in
73   1.0* | 1.1* | 1.2* | 1.3* | 1.4* | 1.5*)
74     CONFIG_GUILE_SERIAL="A"
75   ;;
76   1.6* | 1.7*)
77     CONFIG_GUILE_SERIAL="B"
78   ;;
79   *)
80     CONFIG_GUILE_SERIAL="C"
81   ;;
82 esac
83 AC_SUBST(CONFIG_GUILE_SERIAL)
85 #--------------------------------------------------------------------
86 # Checks for standard functionality
87 #--------------------------------------------------------------------
89 CPP_X_HEADERS
90 AC_CHECK_TYPES(FILE)
91 AC_CHECK_TYPES(intptr_t)
92 AC_CHECK_TYPES(time_t)
93 AC_PATH_X
94 AC_PATH_XTRA
95 AC_CHECK_HEADERS(pty.h util.h)
96 AC_CHECK_FUNCS(gettimeofday)
98 #--------------------------------------------------------------------
99 # Checks for dl library
100 #--------------------------------------------------------------------
102 AC_CHECK_FUNC(dlopen)
103 if test "$ac_cv_func_dl" = "yes"; then
104   AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
105 else
106   AC_CHECK_LIB(dl,dlopen)
107   if test "$ac_cv_lib_dl_dlopen" = "yes"; then
108     AC_CHECK_FUNCS(dlopen)
109     CONFIG_BDL="-ldl"
110     AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
111   else
112     AC_CHECK_LIB(dld,dld_link)
113     if test "$ac_cv_lib_dld_dld_link" = "yes"; then
114       CONFIG_BDL="-ldl"
115       AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
116     else
117       AC_CHECK_FUNCS(shl_load)
118       if test "$ac_cv_func_shl_load" = "yes"; then
119         CONFIG_BDL="-ldl"
120         AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
121       else
122         AC_CHECK_FUNCS(dlopen)
123         if test "$ac_cv_func_dlopen" = "yes"; then
124           AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
125         fi
126       fi
127     fi
128   fi
130 AC_SUBST(CONFIG_BDL)
132 #--------------------------------------------------------------------
133 # Checks for iconv library
134 #--------------------------------------------------------------------
136 AC_ARG_WITH(iconv,
137 changequote(<<, >>)dnl
138 <<  --with-iconv[=DIR]        where to find iconv [system]>>dnl
139 changequote([, ])dnl
142 # Check for iconv
143 # Modified from GNOME's libxml2 configure.in
144 AC_LANG_SAVE
145 AC_LANG_C  # compile C to avoid the 'const char**' problem
146 SAVE_CPPFLAGS="$CPPFLAGS"
147 SAVE_LDFLAGS="$LDFLAGS"
148 SAVE_LIBS="$LIBS"
149 if test "$with_iconv" = "no" ; then
150     AC_MSG_RESULT([disabling iconv support])
151 else
152     if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
153        CPPFLAGS="-I$with_iconv/include" # for AC_TRY_LINK
154        ICONV_CFLAGS="-I$with_iconv/include"
155        ICONV_LDFLAGS="-L$with_iconv/lib"
156     fi
158     AC_CHECK_HEADER(iconv.h,
159     AC_MSG_CHECKING(for iconv)
160     AC_TRY_LINK(
162 #include <stdlib.h>
163 #include <iconv.h>
165     iconv_t cd = iconv_open ("","");
166     iconv (cd, NULL, NULL, NULL, NULL);
168     AC_MSG_RESULT(yes)
169     AC_DEFINE(USE_ICONV, 1, [Use iconv library])
171     AC_MSG_RESULT(no)
172     AC_MSG_CHECKING(for iconv in -liconv)
173     LDFLAGS="${ICONV_LDFLAGS}"    # for AC_TRY_LINK
174     LIBS="-liconv"                # for AC_TRY_LINK
175     AC_TRY_LINK(
177 #include <stdlib.h>
178 #include <iconv.h>
180       iconv_t cd = iconv_open ("","");
181       iconv (cd, NULL, NULL, NULL, NULL);
183       AC_MSG_RESULT(yes)
184       AC_DEFINE(USE_ICONV, 1, [Use iconv library])
185       ICONV_LDFLAGS="${ICONV_LDFLAGS} -liconv"
187       AC_MSG_RESULT(no)
188       AC_MSG_WARN([absence of iconv may crash HTML import])
189   ])]))
192 CPPFLAGS="$SAVE_CPPFLAGS"
193 LDFLAGS="$SAVE_LDFLAGS"
194 LIBS="$SAVE_LIBS"
195 AC_LANG_RESTORE  # restore C++ language
197 AC_SUBST(ICONV_CFLAGS)
198 AC_SUBST(ICONV_LDFLAGS)
200 #--------------------------------------------------------------------
201 # Checks for freetype library
202 #--------------------------------------------------------------------
204 AC_ARG_WITH(freetype,
205 changequote(<<, >>)dnl
206 <<  --with-freetype[=ARG]     with freetype support [ARG=linked]>>dnl
207 changequote([, ])dnl
210 SAVE_CPPFLAGS="$CPPFLAGS"
211 SAVE_LDFLAGS="$LDFLAGS"
212 SAVE_LIBS="$LIBS"
213 if test "$with_freetype" = "no" ; then
214     AC_MSG_RESULT([disabling freetype support])
215 else
216     CPPFLAGS=`freetype-config --cflags`
217     LIBS=`freetype-config --libs`
218     AC_CHECK_HEADER(ft2build.h,
219     AC_MSG_CHECKING(for freetype)
220     AC_TRY_LINK(
222 #include <ft2build.h>
223 #include FT_FREETYPE_H 
225     FT_Library ft_library;
226     (void) FT_Init_FreeType (&ft_library);
228     AC_MSG_RESULT(yes)
229     AC_DEFINE(USE_FREETYPE, 1, [Use freetype library])
230     FREETYPE_CFLAGS="$CPPFLAGS"
231     if test "$with_freetype" = "linked" -o "$with_freetype" = "" ; then
232       FREETYPE_LDFLAGS="$LIBS"
233       AC_DEFINE(LINKED_FREETYPE, 1, [Link freetype library with TeXmacs])
234     fi
236     AC_MSG_RESULT(no)]))
239 CPPFLAGS="$SAVE_CPPFLAGS"
240 LDFLAGS="$SAVE_LDFLAGS"
241 LIBS="$SAVE_LIBS"
243 AC_SUBST(FREETYPE_CFLAGS)
244 AC_SUBST(FREETYPE_LDFLAGS)
246 #--------------------------------------------------------------------
247 # Checks for Cairo library
248 #--------------------------------------------------------------------
250 AC_ARG_WITH(cairo,
251 changequote(<<, >>)dnl
252 <<  --with-cairo[=ARG]        with cairo support [ARG=no]>>dnl
253 changequote([, ])dnl
256 SAVE_CPPFLAGS="$CPPFLAGS"
257 SAVE_LDFLAGS="$LDFLAGS"
258 SAVE_LIBS="$LIBS"
259 if test "$with_cairo" = "no" -o "$with_cairo" = "" ; then
260     AC_MSG_RESULT([disabling cairo support])
261 else
262     CPPFLAGS=`pkg-config --cflags cairo`
263     LIBS=`pkg-config --libs cairo`
264     AC_CHECK_HEADER(cairo.h,
265     AC_MSG_CHECKING(for cairo)
266     AC_TRY_LINK(
268 #include <cairo.h>
270     cairo_surface_t *surface;
271     surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 120, 120);
273     AC_MSG_RESULT(yes)
274     AC_DEFINE(USE_CAIRO, 1, [Use cairo library])
275     CAIRO_CFLAGS="$CPPFLAGS"
276     if test "$with_cairo" = "linked" ; then
277       CAIRO_LDFLAGS="$LIBS"
278       AC_DEFINE(LINKED_CAIRO, 1, [Link cairo library with TeXmacs])
279     fi
281     AC_MSG_RESULT(no)]))
284 CPPFLAGS="$SAVE_CPPFLAGS"
285 LDFLAGS="$SAVE_LDFLAGS"
286 LIBS="$SAVE_LIBS"
288 AC_SUBST(CAIRO_CFLAGS)
289 AC_SUBST(CAIRO_LDFLAGS)
291 #--------------------------------------------------------------------
292 # Checks for Imlib2 library
293 #--------------------------------------------------------------------
295 AC_ARG_WITH(imlib2,
296 changequote(<<, >>)dnl
297 <<  --with-imlib2[=ARG]       with imlib2 support [ARG=no]>>dnl
298 changequote([, ])dnl
301 SAVE_CPPFLAGS="$CPPFLAGS"
302 SAVE_LDFLAGS="$LDFLAGS"
303 SAVE_LIBS="$LIBS"
304 if test "$with_imlib2" = "no" -o "$with_imlib2" = "" ; then
305     AC_MSG_RESULT([disabling imlib2 support])
306 else
307     CPPFLAGS=`imlib2-config --cflags`
308     LIBS=`imlib2-config --libs`
309     AC_CHECK_HEADER(Imlib2.h,
310     AC_MSG_CHECKING(for imlib2)
311     AC_TRY_LINK(
313 #include <X11/Xlib.h>
314 #include <Imlib2.h>
315 #include <stdio.h>
316 #include <string.h>
318     Imlib_Image image= imlib_load_image("");
320     AC_MSG_RESULT(yes)
321     AC_DEFINE(USE_IMLIB2, 1, [Use imlib2 library])
322     IMLIB2_CFLAGS="$CPPFLAGS"
323     if test "$with_imlib2" = "linked" ; then
324       IMLIB2_LDFLAGS="$LIBS"
325       AC_DEFINE(LINKED_IMLIB2, 1, [Link imlib2 library with TeXmacs])
326     fi
328     AC_MSG_RESULT(no)]))
331 CPPFLAGS="$SAVE_CPPFLAGS"
332 LDFLAGS="$SAVE_LDFLAGS"
333 LIBS="$SAVE_LIBS"
335 AC_SUBST(IMLIB2_CFLAGS)
336 AC_SUBST(IMLIB2_LDFLAGS)
338 #--------------------------------------------------------------------
339 # Checks for Axel library
340 #--------------------------------------------------------------------
342 AC_ARG_WITH(axel,
343 changequote(<<, >>)dnl
344 <<  --with-axel[=ARG]       with axel support [ARG=no]>>dnl
345 changequote([, ])dnl
348 SAVE_CPPFLAGS="$CPPFLAGS"
349 SAVE_LDFLAGS="$LDFLAGS"
350 SAVE_LIBS="$LIBS"
351 if test "$with_axel" = "no" -o "$with_axel" = "" ; then
352     AC_MSG_RESULT([disabling axel support])
353 else
354     CPPFLAGS=`axel-config --cflags`
355     LIBS=`axel-config --libs`
356     AC_CHECK_HEADER(QGui/Viewer.h,
357     AC_MSG_CHECKING(for axel)
358     AC_TRY_LINK(
360 #include <QGui/Viewer.h>
362     Viewer viewer(0);
364     AC_MSG_RESULT(yes)
365     AC_DEFINE(USE_AXEL, 1, [Use axel library])
366     AXEL_CFLAGS="$CPPFLAGS"
367     if test "$with_axel" = "linked" ; then
368       AXEL_LDFLAGS="$LIBS"
369       AC_DEFINE(LINKED_AXEL, 1, [Link axel library with TeXmacs])
370     fi
372     AC_MSG_RESULT(no)]))
375 CPPFLAGS="$SAVE_CPPFLAGS"
376 LDFLAGS="$SAVE_LDFLAGS"
377 LIBS="$SAVE_LIBS"
379 AC_SUBST(AXEL_CFLAGS)
380 AC_SUBST(AXEL_LDFLAGS)
382 #--------------------------------------------------------------------
383 # Fixes for erroneous behaviour of gcc/g++ and guile on some systems
384 #--------------------------------------------------------------------
386 AC_MSG_CHECKING(whether ... arguments behave correctly)
387 CXXFLAGS="`guile-config compile`"
388 AC_TRY_COMPILE([
389   #include <guile/gh.h>
390   #include <libguile.h>
391   typedef SCM (*FN)(...);
392   static SCM identity (SCM x) { return x; }
393   void declare () { gh_new_procedure ("identity", (FN) identity, 1, 0, 0); }
396   AC_DEFINE(DOTS_OK, 1, [Defined if ...-style argument passing works])
397   AC_MSG_RESULT(yes)
399   AC_MSG_RESULT(no)
401 CXXFLAGS=""
403 AC_MSG_CHECKING(the size_t of guile strings)
404 CXXFLAGS="`guile-config compile`"
405 AC_TRY_COMPILE([
406   #include <guile/gh.h>
407   #include <libguile.h>
408   void print_string (SCM s) {
409     int len_r;
410     char* r= gh_scm2newstr (s, &len_r); }
413   AC_DEFINE(guile_str_size_t, int, [Guile string size type])
414   AC_MSG_RESULT(int)
416   AC_DEFINE(guile_str_size_t, size_t, [Guile string size type])
417   AC_MSG_RESULT(size_t)
419 CXXFLAGS=""
421 AC_MSG_CHECKING([if statically linking with guile works])
422 CPPFLAGS="$GUILE_CFLAGS"
423 LDFLAGS="-static"
424 LIBS="$GUILE_LDFLAGS"
425 TEXMACS_LINK_GUILE([tm_link_guile_static="yes"],
426                    [tm_link_guile_static="no"])
427 AC_MSG_RESULT(["$tm_link_guile_static"])
428 if test "$tm_link_guile_static" = "no" ; then
429    AC_MSG_CHECKING([if it works with -lltdl])
430    LIBS="$GUILE_LDFLAGS -lltdl"
431    TEXMACS_LINK_GUILE([tm_link_guile_static_ltdl="yes"],
432                       [tm_link_guile_static_ltdl="no"])
433    AC_MSG_RESULT(["$tm_link_guile_static_ltdl"])
434    if test "$tm_link_guile_static_ltdl" = "yes" ; then
435       GUILE_LDFLAGS="$GUILE_LDFLAGS -lltdl"
436    else
437       AC_MSG_CHECKING([if it works with -lltdl -ldl])
438       LIBS="$GUILE_LDFLAGS -lltdl -ldl"
439       TEXMACS_LINK_GUILE([tm_link_guile_static_ltdl_ldl="yes"],
440                          [tm_link_guile_static_ltdl_ldl="no"])
441       AC_MSG_RESULT(["$tm_link_guile_static_ltdl_ldl"])
442       if test "$tm_link_guile_static_ltdl_ldl" = "yes" ; then
443          GUILE_LDFLAGS="$GUILE_LDFLAGS -lltdl -ldl"
444       else
445          AC_MSG_WARN([unable to link statically with guile])
446       fi
447    fi
449 CPPFLAGS=""
450 LDFLAGS=""
451 LIBS=""
453 #--------------------------------------------------------------------
454 # Handle different systems case by case
455 #--------------------------------------------------------------------
457 CONFIG_OS="GNU_LINUX"
458 CONFIG_OS_SUFFIX="gnu-linux"
459 CONFIG_MACOS=""
460 CONFIG_CXXFLAGS=""
461 CONFIG_CXXTEMPLATE=""
462 CONFIG_STD_SETENV="#define STD_SETENV"
463 CONFIG_SO="so"
464 CONFIG_LIB_PATH="LD_LIBRARY_PATH"
465 CONFIG_CHMOD="chmod -f"
466 CONFIG_CXXOPTIMIZE="-O2"
467 CONFIG_BSTATIC="-Wl,-Bstatic"
468 CONFIG_BSHARED="-Wl,-Bdynamic"
469 CONFIG_BFLAGS=""
470 CONFIG_BPATH="-Wl,-rpath,"
471 CONFIG_WORD_LENGTH="4"
472 CONFIG_WORD_LENGTH_INC="3"
473 CONFIG_WORD_MASK="0xfffffffc"
474 CONFIG_MAX_FAST="260 // WORD_LENGTH more than power of 2"
476 X11_CFLAGS="$X_CFLAGS"
477 X11_LDFLAGS="$X_LIBS -lXext -lX11"
479 AC_MSG_CHECKING(if we are on a 64-bits computer)
480 AC_RUN_IFELSE([AC_LANG_PROGRAM([],[return(sizeof(void*))])],
481   [void_size=0],[void_size=$?])
482 if test "$void_size" = "8"; then
483   AC_MSG_RESULT([yes])
484   CONFIG_WORD_LENGTH="8"
485   CONFIG_WORD_LENGTH_INC="7"
486   CONFIG_WORD_MASK="0xfffffffffffffff8"
487   CONFIG_MAX_FAST="264 // WORD_LENGTH more than power of 2"
488 else
489   AC_MSG_RESULT([no])
492 AC_CANONICAL_HOST
493 case "${host}" in
494   i*86-*-linux* | x86_64-*-linux*)
495     AC_MSG_RESULT(final adjustments for an Intel or AMD GNU/Linux host)
496     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
497   ;;
498   i*86-*-freebsd* | x86_64-*-freebsd*)
499     AC_MSG_RESULT(final adjustments for an Intel or AMD GNU/BSD host)
500     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
501   ;;
502   i*86-*-solaris*)
503     AC_MSG_RESULT(final adjustments for an Intel or AMS Solaris host)
504     CONFIG_CXXOPTIMIZE="-O3"
505     CONFIG_BPATH="-Wl,-R,"
506     X11_LDFLAGS="$X_LIBS -lXext -lX11 -lsocket"
507   ;;
508   *-*-cygwin)
509     AC_MSG_RESULT(final adjustments for cygwin host)
510     CONFIG_OS="CYGWIN"
511     CONFIG_BFLAGS="-Wl,-stack,8388608"
512 #    CXX="export CYGWIN=check_case:strict; $CXX"
513 #    AC_SUBST(CXX)
514   ;;
515   *apple*darwin*)
516     echo "$ac_t""final adjustments for a MacOS host" 1>&6
517     CONFIG_OS="MACOS"
518     CONFIG_CXXFLAGS="-I${prefix}/include"
519     CONFIG_BSHARED=""
520     CONFIG_BFLAGS="-framework Cocoa"
521     CONFIG_BPATH=""
522     CONFIG_SO="dylib"
523     CONFIG_LIB_PATH="DYLD_LIBRARY_PATH"
524   ;;
525   *darwin*)
526     echo "$ac_t""final adjustments for a generic Darwin host" 1>&6
527     CONFIG_CXXFLAGS="-I${prefix}/include"
528     CONFIG_BSHARED=""
529     CONFIG_BPATH=""
530     CONFIG_SO="dylib"
531     CONFIG_LIB_PATH="DYLD_LIBRARY_PATH"
532   ;;
533   powerpc-*-linux*)
534     AC_MSG_RESULT(final adjustments for a PowerPC/GNU-linux host)
535     CONFIG_OS="POWERPC_GNU_LINUX"
536     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
537   ;;
538   *sun*)
539     AC_MSG_RESULT(final adjustments for a SUN/solaris host)
540     CONFIG_OS="SUN"
541     CONFIG_OS_SUFFIX="sun"
542     CONFIG_BSTATIC=""
543     CONFIG_BSHARED=""
544     CONFIG_BPATH="-Wl,-R,"
545     X11_LDFLAGS="$X_LIBS -lXext -lX11 -lsocket"
546     CONFIG_WORD_LENGTH="8"
547     CONFIG_WORD_LENGTH_INC="7"
548     CONFIG_WORD_MASK="0xfffffff8"
549     CONFIG_MAX_FAST="264 // WORD_LENGTH more than power of 2"
550     CONFIG_STD_SETENV=""
551   ;;
552   sparc*-*-linux*)
553     AC_MSG_RESULT(final adjustments for a Sparc host running GNU/Linux)
554     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
555     CONFIG_WORD_LENGTH="8"
556     CONFIG_WORD_LENGTH_INC="7"
557     CONFIG_WORD_MASK="0xfffffff8"
558     CONFIG_MAX_FAST="264 // WORD_LENGTH more than power of 2"
559     CONFIG_STD_SETENV=""
560   ;;
561   *dec*)
562     AC_MSG_RESULT(final adjustments for a DEC/alpha host)
563     CONFIG_BSTATIC=""
564     CONFIG_BSHARED="-shared"
565     CONFIG_STD_SETENV=""
566   ;;
567   *alpha*-*-linux*)
568     AC_MSG_RESULT(final adjustments for an Alpha GNU/Linux host)
569     CONFIG_BSTATIC=""
570     CONFIG_BSHARED="-shared"
571   ;;
572   s390-*-linux*)
573     AC_MSG_RESULT(final adjustments for an IBM S/390 GNU/Linux host)
574     CONFIG_STD_SETENV=""
575   ;;
576   ia64-*-linux*)
577     AC_MSG_RESULT(final adjustments for an Itanium GNU/Linux host)
578     CONFIG_BSTATIC=""
579     CONFIG_BSHARED="-shared"
580   ;;
581   hppa*-*-linux*)
582     AC_MSG_RESULT(final adjustments for an HP PA_RISC GNU/Linux host)
583     CONFIG_CXXFLAGS="$CONFIG_CXXFLAGS -fPIC"
584     CONFIG_BSTATIC=""
585     CONFIG_BSHARED="-shared"
586   ;;
587   *sgi-irix*)
588     echo "$ac_t""final adjustments for a SGI/Irix host" 1>&6
589     CONFIG_OS="IRIX"
590     CONFIG_CXXFLAGS=""
591     X_LIBS=-L/usr/lib32
592     CONFIG_BSTATIC=""
593     CONFIG_BSHARED=""
594     CONFIG_BPATH=""
595     X11_LDFLAGS="$X_LIBS -lX11"
596     CONFIG_WORD_MASK="0xfffffff8"
597     CONFIG_STD_SETENV=""
598     CONFIG_CHMOD="chmod"
599     CONFIG_LIB_PATH="LD_LIBRARYN32_PATH"
600   ;;
601   m68k-*-linux* | mips-*-linux* | mipsel-*-linux* | arm*-*-linux*)
602     AC_MSG_RESULT(final adjustments for a supported GNU/Linux host)
603   ;;
604   *-linux*)
605     AC_MSG_RESULT(final adjustments for a generic GNU/Linux host)
606   ;;
607   *)
608     AC_MSG_RESULT(final adjustments for a generic host)
609   ;;
610 esac
612 #--------------------------------------------------------------------
613 # Temporary fix for link problem
614 #--------------------------------------------------------------------
616 case "$GXX_VERSION" in
617      3.* | 4.*)
618          CONFIG_BSTATIC="-static"
619          CONFIG_BSHARED="-dynamic"
620      ;;
621 esac
623 #--------------------------------------------------------------------
624 # Memory allocation options
625 #--------------------------------------------------------------------
627 AC_ARG_ENABLE(fastalloc,
628 [  --disable-fastalloc     omit fast allocator for small objects],
629     [], [enable_fastalloc="yes"])
630 case "$enable_fastalloc" in
631     yes)
632         ;;
633     no)
634         AC_MSG_RESULT([disabling fast allocator for small objects])
635         AC_DEFINE(NO_FAST_ALLOC, 1, [Disable fast memory allocator])
636         ;;
637     *)
638         AC_MSG_ERROR([bad option --enable-fastalloc=$enable_fastalloc])
639         ;;
640 esac
642 #--------------------------------------------------------------------
643 # Experimental options
644 #--------------------------------------------------------------------
646 AC_ARG_ENABLE(experimental,
647 [  --enable-experimental   support new style rewriting code],
648     [], [enable_experimental="no"])
649 case "$enable_experimental" in
650     yes)
651         AC_MSG_RESULT([enabling experimental style rewriting code])
652         AC_DEFINE(EXPERIMENTAL, 1, [Enable experimental style rewriting code])
653         CONFIG_EXPERIMENTAL="Memorizer Environment Evaluate"
654         ;;
655     no)
656         AC_MSG_RESULT([disabling experimental style rewriting code])
657         CONFIG_EXPERIMENTAL=""
658         ;;
659     *)
660         AC_MSG_ERROR([bad option --enable-experimental=$enable_experimental])
661         ;;
662 esac
663 AC_SUBST(CONFIG_EXPERIMENTAL)
665 #--------------------------------------------------------------------
666 # MacOS X extensions (spellchecker, image loading)
667 #--------------------------------------------------------------------
669 AC_ARG_ENABLE(macosx-extensions,
670 [  --enable-macosx-extensions   support new style rewriting code],
671     [], [enable_macosx_extensions="no"])
672 case "$enable_macosx_extensions" in
673     yes)
674         AC_MSG_RESULT([enabling Mac OSX extensions])
675         AC_DEFINE(MACOSX_EXTENSIONS, 1, [Enabling Mac OSX extensions])
676         CONFIG_MACOS="MacOS"
677         ;;
678     no)
679         AC_MSG_RESULT([disabling Mac OSX extensions])
680         CONFIG_MACOS=""
681         ;;
682     *)
683         AC_MSG_ERROR([bad option --enable-macosx-extensions=$enable_macosx_extensions])
684         ;;
685 esac
686 AC_SUBST(CONFIG_MACOS)
688 #--------------------------------------------------------------------
689 # Gui selection
690 #--------------------------------------------------------------------
692 CONFIG_X11=""
693 CONFIG_COCOA=""
694 CONFIG_GUI="X11"
696 AC_ARG_ENABLE(qt,
697 [  --enable-qt             replace X11 by Qt interface],
698     [], [enable_qt="no"])
700 case "$enable_qt" in
701     yes)
702         HACKED_AT_WITH_QT
703         if test x"$at_cv_qt_build" = xko; then 
704            AC_MSG_ERROR([cannot find Qt!])
705         else
706            AC_MSG_RESULT([enabling experimental Qt port])
707            CONFIG_GUI="QT"
708         fi
709         ;;
710     no)
711         AC_MSG_RESULT([disabling experimental Qt port])
712         ;;
713     *)
714         AC_MSG_ERROR([bad option --enable-qt=$enable_qt])
715         ;;
716 esac
718 AC_ARG_ENABLE(cocoa,
719 [  --enable-cocoa          replace X11 by Cocoa interface],
720     [], [enable_cocoa="no"])
721 case "$enable_cocoa" in
722     yes)
723         AC_MSG_RESULT([enabling experimental Cocoa port])
724         COCOA_CFLAGS=""
725         COCOA_LDFLAGS="-framework Cocoa"
726         CONFIG_GUI="COCOA"
727         ;;
728     no)
729         AC_MSG_RESULT([disabling experimental Cocoa port])
730         ;;
731     *)
732         AC_MSG_ERROR([bad option --enable-cocoa=$enable_cocoa])
733         ;;
734 esac
736 case "$CONFIG_GUI" in
737     X11)
738         CONFIG_X11="X11 Widkit Ghostscript"
739         AC_DEFINE(X11TEXMACS, 1, [Use standard X11 port])
740         ;;
741     COCOA)
742         CONFIG_COCOA="Cocoa"
743         AC_DEFINE(AQUATEXMACS, 1, [Enable experimental Cocoa port])
744         ;;
745     QT)
746         CONFIG_QT="Qt"
747         AC_DEFINE(QTTEXMACS, 1, [Enable experimental Qt port])
748         ;;
749 esac
751 AC_SUBST(X11_CFLAGS)
752 AC_SUBST(X11_LDFLAGS)
753 AC_SUBST(COCOA_CFLAGS)
754 AC_SUBST(COCOA_LDFLAGS)
756 AC_SUBST(CONFIG_X11)
757 AC_SUBST(CONFIG_COCOA)
758 AC_SUBST(CONFIG_QT)
759 AC_SUBST(CONFIG_GUI)
761 #--------------------------------------------------------------------
762 # Debugging options
763 #--------------------------------------------------------------------
765 STD_DEBUG_FLAGS="-fno-rtti -fno-exceptions"
766 if test "$enable_cocoa" = "yes"; then
767     STD_DEBUG_FLAGS="-fno-exceptions"
770 AC_MSG_CHECKING(if compiler supports $STD_DEBUG_FLAGS)
771 CXXFLAGS="$STD_DEBUG_FLAGS"
772 AC_TRY_COMPILE([
773   int some_variable = 0;
776     CONFIG_CXXDIALECT="$STD_DEBUG_FLAGS"
777     AC_MSG_RESULT(yes)
779     CONFIG_CXXDIALECT=""
780     AC_MSG_RESULT(no)
782 CXXFLAGS=""
783 AC_SUBST(CONFIG_CXXDIALECT)
785 AC_ARG_ENABLE(debug,
786 changequote(<<, >>)dnl
787 <<  --enable-debug[=ARG]      install a debugging enable executable [-ggdb]>>,
788 changequote([, ])dnl
789 [], [enable_debug="no"])
791 if test "$enable_debug" = "yes"; then
792     if test "$GXX" = "yes"; then
793         enable_debug="-ggdb"
794     else
795         enable_debug="-g3"
796     fi
799 if test "$enable_debug" = "no"; then
800     AC_MSG_RESULT([disabling debugging])
801     CONFIG_STRIP="strip"
802     CONFIG_CXXDEBUG=""
803     optimize_default="yes"
804 else
805     AC_MSG_RESULT([enabling debugging, $enable_debug])
806     CONFIG_STRIP="true"
807     CONFIG_CXXDEBUG="$enable_debug"
808     optimize_default="no"
811 AC_ARG_ENABLE(assert,
812 changequote(<<, >>)dnl
813 <<  --enable-assert           exit on failed assertions in code>>,
814 changequote([, ])dnl
815 [], [enable_assert="yes"])
817 if test "$enable_assert" = "no"; then
818     AC_MSG_RESULT([disabling assertion checking])
819 else
820     AC_MSG_RESULT([enabling assertion checking])
821     AC_DEFINE(DEBUG_ASSERT, 1, [check assertions in code])
824 #--------------------------------------------------------------------
825 # Warning options
826 #--------------------------------------------------------------------
828 case "$GXX_VERSION" in
829   none)
830     CONFIG_CXXWARNING="";
831   ;;
832   *)
833     CONFIG_CXXWARNING="-Wall -Wno-return-type"
834   ;;
835 esac
837 AC_ARG_ENABLE(warnings,
838 [  --enable-warnings       print warning messages during compilation],
839     [], [enable_warnings="yes"])
840 case "$enable_warnings" in
841     yes)
842         AC_MSG_RESULT([enabling warning flags $CONFIG_CXXWARNING]) ;;
843     no)
844         CONFIG_CXXWARNING=""
845         AC_MSG_RESULT([disabling warning flags]) ;;
846     *)
847         CONFIG_CXXWARNING="$enable_warnings"
848         AC_MSG_RESULT([enabling warning flags $CONFIG_CXXWARNING]) ;;
849 esac
851 #--------------------------------------------------------------------
852 # Optimization options
853 #--------------------------------------------------------------------
855 if test "$optimize_default" = "yes"; then
856   case "$GXX_VERSION" in
857     3.3.3 | 3.3.4 | 4.*)
858       ;;
859     2.96 | 3.0 | 3.0.* | 3.1 | 3.1.* | 3.2 | 3.2.* | 3.3 | 3.3.*)
860       case "${host}" in
861         i*86-*-linux-gnu* | i*86-*-freebsd*)
862           AC_MSG_WARN([using g++ 3.*, optimize without inline by default])
863           optimize_default="no-inline"
864         ;;
865         *)
866           AC_MSG_WARN([using g++ 3.*, optimize without inline by default])
867           optimize_default="no-inline"
868         ;;
869       esac
870     ;;
871   esac
874 AC_ARG_ENABLE(optimize,
875 changequote(<<, >>)dnl
876 <<  --enable-optimize[=ARG]   compile with optimizations [guessed]>>,
877 changequote([, ])dnl
878 [], [enable_optimize="$optimize_default"])
880 case "$enable_optimize" in
881     yes)
882         # keep optimization options
883         AC_MSG_RESULT([enabling optimizations, $CONFIG_CXXOPTIMIZE]) ;;
884     no-inline)
885         optimize_no_inline="-fno-default-inline -fno-inline"
886         CONFIG_CXXOPTIMIZE="$CONFIG_CXXOPTIMIZE $optimize_no_inline"
887         AC_MSG_RESULT([enabling optimizations, $CONFIG_CXXOPTIMIZE]) ;;
888     no)
889         CONFIG_CXXOPTIMIZE=""
890         AC_MSG_RESULT([disabling optimizations]) ;;
891     *)
892         CONFIG_CXXOPTIMIZE="$enable_optimize"
893         AC_MSG_RESULT([customizing optimizations, $enable_optimize]) ;;
894 esac
896 #--------------------------------------------------------------------
897 # Substitute TeXmacs specific configuration parameters
898 #--------------------------------------------------------------------
900 AC_SUBST(CONFIG_OS)
901 AC_SUBST(CONFIG_OS_SUFFIX)
902 AC_SUBST(CONFIG_CXXWARNING)
903 AC_SUBST(CONFIG_CXXTEMPLATE)
904 AC_SUBST(CONFIG_CXXOPTIMIZE)
905 AC_SUBST(CONFIG_CXXDEBUG)
906 AC_SUBST(CONFIG_BFLAGS)
907 AC_SUBST(CONFIG_BSTATIC)
908 AC_SUBST(CONFIG_BSHARED)
909 AC_SUBST(CONFIG_BPATH)
910 AC_SUBST(CONFIG_WORD_LENGTH)
911 AC_SUBST(CONFIG_WORD_LENGTH_INC)
912 AC_SUBST(CONFIG_WORD_MASK)
913 AC_SUBST(CONFIG_MAX_FAST)
914 AC_SUBST(CONFIG_CXXFLAGS)
915 AC_SUBST(CONFIG_STD_SETENV)
916 AC_SUBST(CONFIG_SO)
917 AC_SUBST(CONFIG_LIB_PATH)
918 AC_SUBST(CONFIG_STRIP)
919 AC_SUBST(CONFIG_CHMOD)
921 #--------------------------------------------------------------------
922 # Default paths for installation
923 #--------------------------------------------------------------------
925 if test "$prefix" = ""; then
926   prefix=/usr/local
928 if test "$prefix" = "NONE"; then
929   prefix=/usr/local
931 if test "$exec_prefix" = ""; then
932   exec_prefix='${prefix}'
934 if test "$exec_prefix" = "NONE"; then
935   exec_prefix='${prefix}'
937 if test "$exec_prefix" = '${prefix}'; then
938   exec_prefix='${prefix}'
940 if test "$includedir" = ""; then
941   includedir='${prefix}/include'
943 if test "$includedir" = "NONE"; then
944   includedir='${prefix}/include'
946 if test "$includedir" = '${prefix}/include'; then
947   includedir='${prefix}/include'
949 if test "$libdir" = ""; then
950   libdir='${exec_prefix}/lib'
952 if test "$libdir" = "NONE"; then
953   libdir='${exec_prefix}/lib'
955 if test "$libdir" = '${exec_prefix}/lib'; then
956   libdir='${exec_prefix}/lib'
958 if test "$bindir" = ""; then
959   bindir='${exec_prefix}/bin'
961 if test "$bindir" = "NONE"; then
962   bindir=${exec_prefix}/bin
964 if test "$bindir" = '${exec_prefix}/bin'; then
965   bindir='${exec_prefix}/bin'
967 if test "$datarootdir" = ""; then
968   datarootdir='${prefix}/share'
970 if test "$datarootdir" = "NONE"; then
971   datarootdir='${prefix}/share'
973 if test "$datarootdir" = '${prefix}/share'; then
974   datarootdir='${prefix}/share'
976 if test "$datadir" = ""; then
977   datadir='${prefix}/share'
979 if test "$datadir" = "NONE"; then
980   datadir='${prefix}/share'
982 if test "$datadir" = '${prefix}/share'; then
983   datadir='${prefix}/share'
985 if test "$mandir" = ""; then
986   mandir='${datarootdir}/man'
988 if test "$mandir" = "NONE"; then
989   mandir='${datarootdir}/man'
991 if test "$mandir" = '${datarootdir}/man'; then
992   mandir='${datarootdir}/man'
994 if test "$libexecdir" = ""; then
995   libexecdir='${exec_prefix}/libexec'
997 if test "$libexecdir" = "NONE"; then
998   libexecdir='${exec_prefix}/libexec'
1000 if test "$libexecdir" = '${exec_prefix}/libexec'; then
1001   libexecdir='${exec_prefix}/libexec'
1004 curdir="`pwd`"
1005 tmorig=${curdir}
1006 tmdir=${PACKAGE}
1007 tmsrc=${curdir}/${tmdir}
1008 tmbin=${libexecdir}/${tmdir}
1009 tmdata=${datadir}/${tmdir}
1010 AC_SUBST(tmorig)
1011 AC_SUBST(tmdir)
1012 AC_SUBST(tmsrc)
1013 AC_SUBST(tmbin)
1014 AC_SUBST(tmdata)
1016 if test "$DEVEL_RELEASE" = "1"; then
1017   tmtgz=${PACKAGE}-${DEVEL_VERSION}
1018 else
1019   tmtgz=${PACKAGE}-${DEVEL_VERSION}-R${DEVEL_RELEASE}
1021 tmrpm=${PACKAGE}-${DEVEL_VERSION}-${DEVEL_RELEASE}
1022 if test "$STABLE_RELEASE" = "1"; then
1023   tmstgz=${PACKAGE}-${STABLE_VERSION}
1024 else
1025   tmstgz=${PACKAGE}-${STABLE_VERSION}-R${STABLE_RELEASE}
1027 tmsrpm=${PACKAGE}-${STABLE_VERSION}-${STABLE_RELEASE}
1028 if test "$WINDOWS_RELEASE" = "1"; then
1029   tmwin=wintexmacs-${WINDOWS_VERSION}
1030 else
1031   tmwin=wintexmacs-${WINDOWS_VERSION}-R${WINDOWS_RELEASE}
1033 AC_SUBST(tmtgz)
1034 AC_SUBST(tmrpm)
1035 AC_SUBST(tmstgz)
1036 AC_SUBST(tmsrpm)
1037 AC_SUBST(tmwin)
1039 #--------------------------------------------------------------------
1040 # Done
1041 #--------------------------------------------------------------------
1043 AC_OUTPUT(Makefile:Makefile.in src/makefile:src/makefile.in src/System/tm_configure.hpp:src/System/tm_configure.in misc/admin/admin.makefile:misc/admin/admin.makefile.in misc/doxygen/Doxyfile:misc/doxygen/Doxyfile.in misc/man/texmacs.1:misc/man/texmacs.1.in misc/rpm/TeXmacs.spec:misc/rpm/TeXmacs.spec.in misc/scripts/fig2ps:misc/scripts/fig2ps.in misc/scripts/texmacs:misc/scripts/texmacs.in TeXmacs/examples/plugins/dynlink/Makefile:TeXmacs/examples/plugins/dynlink/Makefile.in)