Cleaning of headers (part I)
[texmacs.git] / src / configure.in
blob68625c30db28f344ce0931ac996333907aa41ebd
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.3"
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 if test -z "$GUILE_CFLAGS" -a -z "$GUILE_LDFLAGS"; then
68   GUILE_FLAGS
70 AC_MSG_CHECKING(version of guile)
71 if test -z "$GUILE_VERSION" ; then
72   GUILE_VERSION=`guile --version | grep 'Guile \([[0-9]]\)' | sed 's/Guile \([[0-9]]*\)/\1/'`
74 AC_MSG_RESULT($GUILE_VERSION)
76 case "$GUILE_VERSION" in
77   1.0* | 1.1* | 1.2* | 1.3* | 1.4* | 1.5*)
78     CONFIG_GUILE_SERIAL="A"
79   ;;
80   1.6* | 1.7*)
81     CONFIG_GUILE_SERIAL="B"
82   ;;
83   *)
84     CONFIG_GUILE_SERIAL="C"
85   ;;
86 esac
87 AC_SUBST(CONFIG_GUILE_SERIAL)
89 #--------------------------------------------------------------------
90 # Checks for standard functionality
91 #--------------------------------------------------------------------
93 CPP_X_HEADERS
94 AC_CHECK_TYPES(FILE)
95 AC_CHECK_TYPES(intptr_t)
96 AC_CHECK_TYPES(time_t)
97 AC_PATH_X
98 AC_PATH_XTRA
99 AC_CHECK_HEADERS(pty.h util.h)
100 AC_CHECK_FUNCS(gettimeofday)
102 #--------------------------------------------------------------------
103 # Checks for dl library
104 #--------------------------------------------------------------------
106 AC_CHECK_FUNC(dlopen)
107 if test "$ac_cv_func_dl" = "yes"; then
108   AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
109 else
110   AC_CHECK_LIB(dl,dlopen)
111   if test "$ac_cv_lib_dl_dlopen" = "yes"; then
112     AC_CHECK_FUNCS(dlopen)
113     CONFIG_BDL="-ldl"
114     AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
115   else
116     AC_CHECK_LIB(dld,dld_link)
117     if test "$ac_cv_lib_dld_dld_link" = "yes"; then
118       CONFIG_BDL="-ldl"
119       AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
120     else
121       AC_CHECK_FUNCS(shl_load)
122       if test "$ac_cv_func_shl_load" = "yes"; then
123         CONFIG_BDL="-ldl"
124         AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
125       else
126         AC_CHECK_FUNCS(dlopen)
127         if test "$ac_cv_func_dlopen" = "yes"; then
128           AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
129         fi
130       fi
131     fi
132   fi
134 AC_SUBST(CONFIG_BDL)
136 #--------------------------------------------------------------------
137 # Checks for iconv library
138 #--------------------------------------------------------------------
140 AC_ARG_WITH(iconv,
141 changequote(<<, >>)dnl
142 <<  --with-iconv[=DIR]        where to find iconv [system]>>dnl
143 changequote([, ])dnl
146 # Check for iconv
147 # Modified from GNOME's libxml2 configure.in
148 AC_LANG_SAVE
149 AC_LANG_C  # compile C to avoid the 'const char**' problem
150 SAVE_CPPFLAGS="$CPPFLAGS"
151 SAVE_LDFLAGS="$LDFLAGS"
152 SAVE_LIBS="$LIBS"
153 if test "$with_iconv" = "no" ; then
154     AC_MSG_RESULT([disabling iconv support])
155 else
156     if test -n "$ICONV_CFLAGS" -a -n "$ICONV_LDFLAGS"; then
157        CPPFLAGS="$ICONV_CFLAGS" # for AC_TRY_LINK
158     fi
159     if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
160        CPPFLAGS="-I$with_iconv/include" # for AC_TRY_LINK
161        ICONV_CFLAGS="-I$with_iconv/include"
162        ICONV_LDFLAGS="-L$with_iconv/lib"
163     fi
165     AC_CHECK_HEADER(iconv.h,
166     AC_MSG_CHECKING(for iconv)
167     AC_TRY_LINK(
169 #include <stdlib.h>
170 #include <iconv.h>
172     iconv_t cd = iconv_open ("","");
173     iconv (cd, NULL, NULL, NULL, NULL);
175     AC_MSG_RESULT(yes)
176     AC_DEFINE(USE_ICONV, 1, [Use iconv library])
178     AC_MSG_RESULT(no)
179     AC_MSG_CHECKING(for iconv in -liconv)
180     LDFLAGS="${ICONV_LDFLAGS}"    # for AC_TRY_LINK
181     LIBS="-liconv"                # for AC_TRY_LINK
182     AC_TRY_LINK(
184 #include <stdlib.h>
185 #include <iconv.h>
187       iconv_t cd = iconv_open ("","");
188       iconv (cd, NULL, NULL, NULL, NULL);
190       AC_MSG_RESULT(yes)
191       AC_DEFINE(USE_ICONV, 1, [Use iconv library])
192       ICONV_LDFLAGS="${ICONV_LDFLAGS/-liconv} -liconv"
194       AC_MSG_RESULT(no)
195       AC_MSG_WARN([absence of iconv may crash HTML import])
196   ])]))
199 CPPFLAGS="$SAVE_CPPFLAGS"
200 LDFLAGS="$SAVE_LDFLAGS"
201 LIBS="$SAVE_LIBS"
202 AC_LANG_RESTORE  # restore C++ language
203 AC_SUBST(ICONV_CFLAGS)
204 AC_SUBST(ICONV_LDFLAGS)
206 #--------------------------------------------------------------------
207 # Checks for freetype library
208 #--------------------------------------------------------------------
210 AC_ARG_WITH(freetype,
211 changequote(<<, >>)dnl
212 <<  --with-freetype[=ARG]     with freetype support [ARG=linked]>>dnl
213 changequote([, ])dnl
216 SAVE_CPPFLAGS="$CPPFLAGS"
217 SAVE_LDFLAGS="$LDFLAGS"
218 SAVE_LIBS="$LIBS"
219 if test "$with_freetype" = "no" ; then
220     AC_MSG_RESULT([disabling freetype support])
221 else
222     if test -z "$FREETYPE_CFLAGS"; then
223       FREETYPE_CFLAGS=`freetype-config --cflags`
224     fi
225     CPPFLAGS="$FREETYPE_CFLAGS"
226     if test -z "$FREETYPE_LDFLAGS"; then
227       FREETYPE_LDFLAGS=`freetype-config --libs`
228     fi
229     LIBS="$FREETYPE_LDFLAGS"
230     AC_CHECK_HEADER(ft2build.h,
231     AC_MSG_CHECKING(for freetype)
232     AC_TRY_LINK(
234 #include <ft2build.h>
235 #include FT_FREETYPE_H 
237     FT_Library ft_library;
238     (void) FT_Init_FreeType (&ft_library);
240     AC_MSG_RESULT(yes)
241     AC_DEFINE(USE_FREETYPE, 1, [Use freetype library])
242     FREETYPE_CFLAGS="$CPPFLAGS"
243     if test "$with_freetype" = "linked" -o "$with_freetype" = "" ; then
244       FREETYPE_LDFLAGS="$LIBS"
245       AC_DEFINE(LINKED_FREETYPE, 1, [Link freetype library with TeXmacs])
246     fi
248     AC_MSG_RESULT(no)]))
251 CPPFLAGS="$SAVE_CPPFLAGS"
252 LDFLAGS="$SAVE_LDFLAGS"
253 LIBS="$SAVE_LIBS"
255 AC_SUBST(FREETYPE_CFLAGS)
256 AC_SUBST(FREETYPE_LDFLAGS)
258 #--------------------------------------------------------------------
259 # Checks for Cairo library
260 #--------------------------------------------------------------------
262 AC_ARG_WITH(cairo,
263 changequote(<<, >>)dnl
264 <<  --with-cairo[=ARG]        with cairo support [ARG=no]>>dnl
265 changequote([, ])dnl
268 SAVE_CPPFLAGS="$CPPFLAGS"
269 SAVE_LDFLAGS="$LDFLAGS"
270 SAVE_LIBS="$LIBS"
271 if test "$with_cairo" = "no" -o "$with_cairo" = "" ; then
272     AC_MSG_RESULT([disabling cairo support])
273 else
274     CPPFLAGS=`pkg-config --cflags cairo`
275     LIBS=`pkg-config --libs cairo`
276     AC_CHECK_HEADER(cairo.h,
277     AC_MSG_CHECKING(for cairo)
278     AC_TRY_LINK(
280 #include <cairo.h>
282     cairo_surface_t *surface;
283     surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 120, 120);
285     AC_MSG_RESULT(yes)
286     AC_DEFINE(USE_CAIRO, 1, [Use cairo library])
287     CAIRO_CFLAGS="$CPPFLAGS"
288     if test "$with_cairo" = "linked" ; then
289       CAIRO_LDFLAGS="$LIBS"
290       AC_DEFINE(LINKED_CAIRO, 1, [Link cairo library with TeXmacs])
291     fi
293     AC_MSG_RESULT(no)]))
296 CPPFLAGS="$SAVE_CPPFLAGS"
297 LDFLAGS="$SAVE_LDFLAGS"
298 LIBS="$SAVE_LIBS"
300 AC_SUBST(CAIRO_CFLAGS)
301 AC_SUBST(CAIRO_LDFLAGS)
303 #--------------------------------------------------------------------
304 # Checks for Imlib2 library
305 #--------------------------------------------------------------------
307 AC_ARG_WITH(imlib2,
308 changequote(<<, >>)dnl
309 <<  --with-imlib2[=ARG]       with imlib2 support [ARG=no]>>dnl
310 changequote([, ])dnl
313 SAVE_CPPFLAGS="$CPPFLAGS"
314 SAVE_LDFLAGS="$LDFLAGS"
315 SAVE_LIBS="$LIBS"
316 if test "$with_imlib2" = "no" -o "$with_imlib2" = "" ; then
317     AC_MSG_RESULT([disabling imlib2 support])
318 else
319     CPPFLAGS=`imlib2-config --cflags`
320     LIBS=`imlib2-config --libs`
321     AC_CHECK_HEADER(Imlib2.h,
322     AC_MSG_CHECKING(for imlib2)
323     AC_TRY_LINK(
325 #include <X11/Xlib.h>
326 #include <Imlib2.h>
327 #include <stdio.h>
328 #include <string.h>
330     Imlib_Image image= imlib_load_image("");
332     AC_MSG_RESULT(yes)
333     AC_DEFINE(USE_IMLIB2, 1, [Use imlib2 library])
334     IMLIB2_CFLAGS="$CPPFLAGS"
335     if test "$with_imlib2" = "linked" ; then
336       IMLIB2_LDFLAGS="$LIBS"
337       AC_DEFINE(LINKED_IMLIB2, 1, [Link imlib2 library with TeXmacs])
338     fi
340     AC_MSG_RESULT(no)]))
343 CPPFLAGS="$SAVE_CPPFLAGS"
344 LDFLAGS="$SAVE_LDFLAGS"
345 LIBS="$SAVE_LIBS"
347 AC_SUBST(IMLIB2_CFLAGS)
348 AC_SUBST(IMLIB2_LDFLAGS)
350 #--------------------------------------------------------------------
351 # Checks for Axel library
352 #--------------------------------------------------------------------
354 AC_ARG_WITH(axel,
355 changequote(<<, >>)dnl
356 <<  --with-axel[=ARG]       with axel support [ARG=no]>>dnl
357 changequote([, ])dnl
360 SAVE_CPPFLAGS="$CPPFLAGS"
361 SAVE_LDFLAGS="$LDFLAGS"
362 SAVE_LIBS="$LIBS"
363 if test "$with_axel" = "no" -o "$with_axel" = "" ; then
364     AC_MSG_RESULT([disabling axel support])
365 else
366     CPPFLAGS=`axel-config --cflags`
367     LIBS=`axel-config --libs`
368     AC_CHECK_HEADER(QGui/Viewer.h,
369     AC_MSG_CHECKING(for axel)
370     AC_TRY_LINK(
372 #include <QGui/Viewer.h>
374     Viewer viewer(0);
376     AC_MSG_RESULT(yes)
377     AC_DEFINE(USE_AXEL, 1, [Use axel library])
378     AXEL_CFLAGS="$CPPFLAGS"
379     if test "$with_axel" = "linked" ; then
380       AXEL_LDFLAGS="$LIBS"
381       AC_DEFINE(LINKED_AXEL, 1, [Link axel library with TeXmacs])
382     fi
384     AC_MSG_RESULT(no)]))
387 CPPFLAGS="$SAVE_CPPFLAGS"
388 LDFLAGS="$SAVE_LDFLAGS"
389 LIBS="$SAVE_LIBS"
391 AC_SUBST(AXEL_CFLAGS)
392 AC_SUBST(AXEL_LDFLAGS)
394 #--------------------------------------------------------------------
395 # Fixes for erroneous behaviour of gcc/g++ and guile on some systems
396 #--------------------------------------------------------------------
398 AC_MSG_CHECKING(whether ... arguments behave correctly)
399 if test -z "$GUILE_CFLAGS"; then
400   CXXFLAGS="`guile-config compile`"
401 else
402   CXXFLAGS="$GUILE_CFLAGS"
404 AC_TRY_COMPILE([
405   #include <guile/gh.h>
406   #include <libguile.h>
407   typedef SCM (*FN)(...);
408   static SCM identity (SCM x) { return x; }
409   void declare () { gh_new_procedure ("identity", (FN) identity, 1, 0, 0); }
412   AC_DEFINE(DOTS_OK, 1, [Defined if ...-style argument passing works])
413   AC_MSG_RESULT(yes)
415   AC_MSG_RESULT(no)
417 CXXFLAGS=""
419 AC_MSG_CHECKING(the size_t of guile strings)
420 if test -z "$GUILE_CFLAGS"; then
421   CXXFLAGS="`guile-config compile`"
422 else
423   CXXFLAGS="$GUILE_CFLAGS"
425 AC_TRY_COMPILE([
426   #include <guile/gh.h>
427   #include <libguile.h>
428   void print_string (SCM s) {
429     int len_r;
430     char* r= gh_scm2newstr (s, &len_r); }
433   AC_DEFINE(guile_str_size_t, int, [Guile string size type])
434   AC_MSG_RESULT(int)
436   AC_DEFINE(guile_str_size_t, size_t, [Guile string size type])
437   AC_MSG_RESULT(size_t)
439 CXXFLAGS=""
441 AC_MSG_CHECKING([if statically linking with guile works])
442 SAVE_CPPFLAGS="$CPPFLAGS"
443 SAVE_LDFLAGS="$LDFLAGS"
444 SAVE_LIBS="$LIBS"
445 CPPFLAGS="$GUILE_CFLAGS"
446 LDFLAGS="-static"
447 LIBS="$GUILE_LDFLAGS"
448 TEXMACS_LINK_GUILE([tm_link_guile_static="yes"],
449                    [tm_link_guile_static="no"])
450 AC_MSG_RESULT(["$tm_link_guile_static"])
451 if test "$tm_link_guile_static" = "no" ; then
452    AC_MSG_CHECKING([if it works with -lltdl])
453    LIBS="$GUILE_LDFLAGS -lltdl"
454    TEXMACS_LINK_GUILE([tm_link_guile_static_ltdl="yes"],
455                       [tm_link_guile_static_ltdl="no"])
456    AC_MSG_RESULT(["$tm_link_guile_static_ltdl"])
457    if test "$tm_link_guile_static_ltdl" = "yes" ; then
458       GUILE_LDFLAGS="$GUILE_LDFLAGS -lltdl"
459    else
460       AC_MSG_CHECKING([if it works with -lltdl -ldl])
461       LIBS="$GUILE_LDFLAGS -lltdl -ldl"
462       TEXMACS_LINK_GUILE([tm_link_guile_static_ltdl_ldl="yes"],
463                          [tm_link_guile_static_ltdl_ldl="no"])
464       AC_MSG_RESULT(["$tm_link_guile_static_ltdl_ldl"])
465       if test "$tm_link_guile_static_ltdl_ldl" = "yes" ; then
466          GUILE_LDFLAGS="$GUILE_LDFLAGS -lltdl -ldl"
467       else
468          AC_MSG_WARN([unable to link statically with guile])
469       fi
470    fi
472 CPPFLAGS="$SAVE_CPFLAGS"
473 LDFLAGS="$SAVE_LDFLAGS"
474 LIBS="$SAVE_LIBS"
476 #--------------------------------------------------------------------
477 # Handle different systems case by case
478 #--------------------------------------------------------------------
480 CONFIG_OS="GNU_LINUX"
481 CONFIG_OS_SUFFIX="gnu-linux"
482 CONFIG_MACOS=""
483 CONFIG_CXXFLAGS=""
484 CONFIG_CXXTEMPLATE=""
485 CONFIG_STD_SETENV="#define STD_SETENV"
486 CONFIG_SO="so"
487 CONFIG_LIB_PATH="LD_LIBRARY_PATH"
488 CONFIG_CHMOD="chmod -f"
489 CONFIG_CXXOPTIMIZE="-O2"
490 CONFIG_BSTATIC="-Wl,-Bstatic"
491 CONFIG_BSHARED="-Wl,-Bdynamic"
492 CONFIG_BFLAGS=""
493 CONFIG_BPATH="-Wl,-rpath,"
494 CONFIG_WORD_LENGTH="4"
495 CONFIG_WORD_LENGTH_INC="3"
496 CONFIG_WORD_MASK="0xfffffffc"
497 CONFIG_MAX_FAST="260 // WORD_LENGTH more than power of 2"
499 X11_CFLAGS="$X_CFLAGS"
500 X11_LDFLAGS="$X_LIBS -lXext -lX11"
502 AC_CHECK_SIZEOF(void *)
503 AC_MSG_CHECKING(if we are on a 64-bits computer)
504 if test "$ac_cv_sizeof_void_p" = "8"; then
505   AC_MSG_RESULT([yes])
506   CONFIG_WORD_LENGTH="8"
507   CONFIG_WORD_LENGTH_INC="7"
508   CONFIG_WORD_MASK="0xfffffffffffffff8"
509   CONFIG_MAX_FAST="264 // WORD_LENGTH more than power of 2"
510 else
511   AC_MSG_RESULT([no])
514 AC_CANONICAL_HOST
515 case "${host}" in
516   i*86-*-linux* | x86_64-*-linux*)
517     AC_MSG_RESULT(final adjustments for an Intel or AMD GNU/Linux host)
518     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
519   ;;
520   i*86-*-freebsd* | x86_64-*-freebsd*)
521     AC_MSG_RESULT(final adjustments for an Intel or AMD GNU/BSD host)
522     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
523   ;;
524   i*86-*-solaris*)
525     AC_MSG_RESULT(final adjustments for an Intel or AMS Solaris host)
526     CONFIG_CXXOPTIMIZE="-O3"
527     CONFIG_BPATH="-Wl,-R,"
528     X11_LDFLAGS="$X_LIBS -lXext -lX11 -lsocket"
529   ;;
530   *mingw*)
531     AC_MSG_RESULT([final adjustments for mingw host])
532     LDRT="-lmingwex"
533   ;;
534   *-*-cygwin)
535     AC_MSG_RESULT(final adjustments for cygwin host)
536     CONFIG_OS="CYGWIN"
537     CONFIG_BFLAGS="-Wl,-stack,8388608"
538 #    CXX="export CYGWIN=check_case:strict; $CXX"
539 #    AC_SUBST(CXX)
540   ;;
541   *apple*darwin*)
542     echo "$ac_t""final adjustments for a MacOS host" 1>&6
543     CONFIG_OS="MACOS"
544     CONFIG_CXXFLAGS="-I${prefix}/include"
545     CONFIG_BSHARED=""
546     CONFIG_BFLAGS="-framework Cocoa"
547     CONFIG_BPATH=""
548     CONFIG_SO="dylib"
549     CONFIG_LIB_PATH="DYLD_LIBRARY_PATH"
550   ;;
551   *darwin*)
552     echo "$ac_t""final adjustments for a generic Darwin host" 1>&6
553     CONFIG_CXXFLAGS="-I${prefix}/include"
554     CONFIG_BSHARED=""
555     CONFIG_BPATH=""
556     CONFIG_SO="dylib"
557     CONFIG_LIB_PATH="DYLD_LIBRARY_PATH"
558   ;;
559   powerpc-*-linux*)
560     AC_MSG_RESULT(final adjustments for a PowerPC/GNU-linux host)
561     CONFIG_OS="POWERPC_GNU_LINUX"
562     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
563   ;;
564   *sun*)
565     AC_MSG_RESULT(final adjustments for a SUN/solaris host)
566     CONFIG_OS="SUN"
567     CONFIG_OS_SUFFIX="sun"
568     CONFIG_BSTATIC=""
569     CONFIG_BSHARED=""
570     CONFIG_BPATH="-Wl,-R,"
571     X11_LDFLAGS="$X_LIBS -lXext -lX11 -lsocket"
572     CONFIG_WORD_LENGTH="8"
573     CONFIG_WORD_LENGTH_INC="7"
574     CONFIG_WORD_MASK="0xfffffff8"
575     CONFIG_MAX_FAST="264 // WORD_LENGTH more than power of 2"
576     CONFIG_STD_SETENV=""
577   ;;
578   sparc*-*-linux*)
579     AC_MSG_RESULT(final adjustments for a Sparc host running GNU/Linux)
580     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
581     CONFIG_WORD_LENGTH="8"
582     CONFIG_WORD_LENGTH_INC="7"
583     CONFIG_WORD_MASK="0xfffffff8"
584     CONFIG_MAX_FAST="264 // WORD_LENGTH more than power of 2"
585     CONFIG_STD_SETENV=""
586   ;;
587   *dec*)
588     AC_MSG_RESULT(final adjustments for a DEC/alpha host)
589     CONFIG_BSTATIC=""
590     CONFIG_BSHARED="-shared"
591     CONFIG_STD_SETENV=""
592   ;;
593   *alpha*-*-linux*)
594     AC_MSG_RESULT(final adjustments for an Alpha GNU/Linux host)
595     CONFIG_BSTATIC=""
596     CONFIG_BSHARED="-shared"
597   ;;
598   s390-*-linux*)
599     AC_MSG_RESULT(final adjustments for an IBM S/390 GNU/Linux host)
600     CONFIG_STD_SETENV=""
601   ;;
602   ia64-*-linux*)
603     AC_MSG_RESULT(final adjustments for an Itanium GNU/Linux host)
604     CONFIG_BSTATIC=""
605     CONFIG_BSHARED="-shared"
606   ;;
607   hppa*-*-linux*)
608     AC_MSG_RESULT(final adjustments for an HP PA_RISC GNU/Linux host)
609     CONFIG_CXXFLAGS="$CONFIG_CXXFLAGS -fPIC"
610     CONFIG_BSTATIC=""
611     CONFIG_BSHARED="-shared"
612   ;;
613   *sgi-irix*)
614     echo "$ac_t""final adjustments for a SGI/Irix host" 1>&6
615     CONFIG_OS="IRIX"
616     CONFIG_CXXFLAGS=""
617     X_LIBS=-L/usr/lib32
618     CONFIG_BSTATIC=""
619     CONFIG_BSHARED=""
620     CONFIG_BPATH=""
621     X11_LDFLAGS="$X_LIBS -lX11"
622     CONFIG_WORD_MASK="0xfffffff8"
623     CONFIG_STD_SETENV=""
624     CONFIG_CHMOD="chmod"
625     CONFIG_LIB_PATH="LD_LIBRARYN32_PATH"
626   ;;
627   m68k-*-linux* | mips-*-linux* | mipsel-*-linux* | arm*-*-linux*)
628     AC_MSG_RESULT(final adjustments for a supported GNU/Linux host)
629   ;;
630   *-linux*)
631     AC_MSG_RESULT(final adjustments for a generic GNU/Linux host)
632   ;;
633   *)
634     AC_MSG_RESULT(final adjustments for a generic host)
635   ;;
636 esac
638 #--------------------------------------------------------------------
639 # Temporary fix for link problem
640 #--------------------------------------------------------------------
642 case "$GXX_VERSION" in
643      3.* | 4.*)
644          CONFIG_BSTATIC="-static"
645          CONFIG_BSHARED="-dynamic"
646      ;;
647 esac
649 #--------------------------------------------------------------------
650 # Memory allocation options
651 #--------------------------------------------------------------------
653 AC_ARG_ENABLE(fastalloc,
654 [  --disable-fastalloc     omit fast allocator for small objects],
655     [], [enable_fastalloc="yes"])
656 case "$enable_fastalloc" in
657     yes)
658         ;;
659     no)
660         AC_MSG_RESULT([disabling fast allocator for small objects])
661         AC_DEFINE(NO_FAST_ALLOC, 1, [Disable fast memory allocator])
662         ;;
663     *)
664         AC_MSG_ERROR([bad option --enable-fastalloc=$enable_fastalloc])
665         ;;
666 esac
668 #--------------------------------------------------------------------
669 # Experimental options
670 #--------------------------------------------------------------------
672 AC_ARG_ENABLE(experimental,
673 [  --enable-experimental   support new style rewriting code],
674     [], [enable_experimental="no"])
675 case "$enable_experimental" in
676     yes)
677         AC_MSG_RESULT([enabling experimental style rewriting code])
678         AC_DEFINE(EXPERIMENTAL, 1, [Enable experimental style rewriting code])
679         CONFIG_EXPERIMENTAL="Memorizer Environment Evaluate"
680         ;;
681     no)
682         AC_MSG_RESULT([disabling experimental style rewriting code])
683         CONFIG_EXPERIMENTAL=""
684         ;;
685     *)
686         AC_MSG_ERROR([bad option --enable-experimental=$enable_experimental])
687         ;;
688 esac
689 AC_SUBST(CONFIG_EXPERIMENTAL)
691 #--------------------------------------------------------------------
692 # MacOS X extensions (spellchecker, image loading)
693 #--------------------------------------------------------------------
695 AC_ARG_ENABLE(macosx-extensions,
696 [  --enable-macosx-extensions   support new style rewriting code],
697     [], [enable_macosx_extensions="no"])
698 case "$enable_macosx_extensions" in
699     yes)
700         AC_MSG_RESULT([enabling Mac OSX extensions])
701         AC_DEFINE(MACOSX_EXTENSIONS, 1, [Enabling Mac OSX extensions])
702         CONFIG_MACOS="MacOS"
703         ;;
704     no)
705         AC_MSG_RESULT([disabling Mac OSX extensions])
706         CONFIG_MACOS=""
707         ;;
708     *)
709         AC_MSG_ERROR([bad option --enable-macosx-extensions=$enable_macosx_extensions])
710         ;;
711 esac
712 AC_SUBST(CONFIG_MACOS)
714 #--------------------------------------------------------------------
715 # Gui selection
716 #--------------------------------------------------------------------
718 CONFIG_X11=""
719 CONFIG_COCOA=""
720 CONFIG_GUI="X11"
722 AC_ARG_ENABLE(qt,
723 [  --enable-qt             replace X11 by Qt interface],
724     [], [enable_qt="no"])
726 case "$enable_qt" in
727     yes)
728         HACKED_AT_WITH_QT
729         if test x"$at_cv_qt_build" = xko; then 
730            AC_MSG_ERROR([cannot find Qt!])
731         else
732            AC_MSG_RESULT([enabling experimental Qt port])
733            CONFIG_GUI="QT"
734         fi
735         ;;
736     no)
737         AC_MSG_RESULT([disabling experimental Qt port])
738         ;;
739     *)
740         AC_MSG_ERROR([bad option --enable-qt=$enable_qt])
741         ;;
742 esac
744 AC_ARG_ENABLE(cocoa,
745 [  --enable-cocoa          replace X11 by Cocoa interface],
746     [], [enable_cocoa="no"])
747 case "$enable_cocoa" in
748     yes)
749         AC_MSG_RESULT([enabling experimental Cocoa port])
750         COCOA_CFLAGS=""
751         COCOA_LDFLAGS="-framework Cocoa"
752         CONFIG_GUI="COCOA"
753         ;;
754     no)
755         AC_MSG_RESULT([disabling experimental Cocoa port])
756         ;;
757     *)
758         AC_MSG_ERROR([bad option --enable-cocoa=$enable_cocoa])
759         ;;
760 esac
762 case "$CONFIG_GUI" in
763     X11)
764         CONFIG_X11="X11 Widkit Ghostscript"
765         CONFIG_GUI_DEFINE="X11TEXMACS"
766 #        AC_DEFINE(X11TEXMACS, 1, [Use standard X11 port])
767         ;;
768     COCOA)
769         CONFIG_COCOA="Cocoa"
770         CONFIG_GUI_DEFINE="AQUATEXMACS"
771 #        AC_DEFINE(AQUATEXMACS, 1, [Enable experimental Cocoa port])
772         ;;
773     QT)
774         CONFIG_QT="Qt"
775         CONFIG_GUI_DEFINE="QTTEXMACS"
776 #        AC_DEFINE(QTTEXMACS, 1, [Enable experimental Qt port])
777         ;;
778 esac
780 AC_SUBST(X11_CFLAGS)
781 AC_SUBST(X11_LDFLAGS)
782 AC_SUBST(COCOA_CFLAGS)
783 AC_SUBST(COCOA_LDFLAGS)
785 AC_SUBST(CONFIG_X11)
786 AC_SUBST(CONFIG_COCOA)
787 AC_SUBST(CONFIG_QT)
788 AC_SUBST(CONFIG_GUI)
789 AC_SUBST(CONFIG_GUI_DEFINE)
791 #--------------------------------------------------------------------
792 # Debugging options
793 #--------------------------------------------------------------------
795 STD_DEBUG_FLAGS="-fno-rtti -fno-exceptions"
796 if test "$enable_cocoa" = "yes"; then
797     STD_DEBUG_FLAGS="-fno-exceptions"
800 AC_MSG_CHECKING(if compiler supports $STD_DEBUG_FLAGS)
801 CXXFLAGS="$STD_DEBUG_FLAGS"
802 AC_TRY_COMPILE([
803   int some_variable = 0;
806     CONFIG_CXXDIALECT="$STD_DEBUG_FLAGS"
807     AC_MSG_RESULT(yes)
809     CONFIG_CXXDIALECT=""
810     AC_MSG_RESULT(no)
812 CXXFLAGS=""
813 AC_SUBST(CONFIG_CXXDIALECT)
815 AC_ARG_ENABLE(debug,
816 changequote(<<, >>)dnl
817 <<  --enable-debug[=ARG]      install a debugging enable executable [-ggdb]>>,
818 changequote([, ])dnl
819 [], [enable_debug="no"])
821 if test "$enable_debug" = "yes"; then
822     if test "$GXX" = "yes"; then
823         enable_debug="-ggdb"
824     else
825         enable_debug="-g3"
826     fi
829 if test "$enable_debug" = "no"; then
830     AC_MSG_RESULT([disabling debugging])
831     CONFIG_STRIP="strip"
832     CONFIG_CXXDEBUG=""
833     optimize_default="yes"
834 else
835     AC_MSG_RESULT([enabling debugging, $enable_debug])
836     CONFIG_STRIP="true"
837     CONFIG_CXXDEBUG="$enable_debug"
838     optimize_default="no"
841 AC_ARG_ENABLE(assert,
842 changequote(<<, >>)dnl
843 <<  --enable-assert           exit on failed assertions in code>>,
844 changequote([, ])dnl
845 [], [enable_assert="yes"])
847 if test "$enable_assert" = "no"; then
848     AC_MSG_RESULT([disabling assertion checking])
849 else
850     AC_MSG_RESULT([enabling assertion checking])
851     AC_DEFINE(DEBUG_ASSERT, 1, [check assertions in code])
854 #--------------------------------------------------------------------
855 # Warning options
856 #--------------------------------------------------------------------
858 case "$GXX_VERSION" in
859   none)
860     CONFIG_CXXWARNING="";
861   ;;
862   *)
863     CONFIG_CXXWARNING="-Wall -Wno-return-type"
864   ;;
865 esac
867 AC_ARG_ENABLE(warnings,
868 [  --enable-warnings       print warning messages during compilation],
869     [], [enable_warnings="yes"])
870 case "$enable_warnings" in
871     yes)
872         AC_MSG_RESULT([enabling warning flags $CONFIG_CXXWARNING]) ;;
873     no)
874         CONFIG_CXXWARNING=""
875         AC_MSG_RESULT([disabling warning flags]) ;;
876     *)
877         CONFIG_CXXWARNING="$enable_warnings"
878         AC_MSG_RESULT([enabling warning flags $CONFIG_CXXWARNING]) ;;
879 esac
881 #--------------------------------------------------------------------
882 # Optimization options
883 #--------------------------------------------------------------------
885 if test "$optimize_default" = "yes"; then
886   case "$GXX_VERSION" in
887     3.3.3 | 3.3.4 | 4.*)
888       ;;
889     2.96 | 3.0 | 3.0.* | 3.1 | 3.1.* | 3.2 | 3.2.* | 3.3 | 3.3.*)
890       case "${host}" in
891         i*86-*-linux-gnu* | i*86-*-freebsd*)
892           AC_MSG_WARN([using g++ 3.*, optimize without inline by default])
893           optimize_default="no-inline"
894         ;;
895         *)
896           AC_MSG_WARN([using g++ 3.*, optimize without inline by default])
897           optimize_default="no-inline"
898         ;;
899       esac
900     ;;
901   esac
904 AC_ARG_ENABLE(optimize,
905 changequote(<<, >>)dnl
906 <<  --enable-optimize[=ARG]   compile with optimizations [guessed]>>,
907 changequote([, ])dnl
908 [], [enable_optimize="$optimize_default"])
910 case "$enable_optimize" in
911     yes)
912         # keep optimization options
913         AC_MSG_RESULT([enabling optimizations, $CONFIG_CXXOPTIMIZE]) ;;
914     no-inline)
915         optimize_no_inline="-fno-default-inline -fno-inline"
916         CONFIG_CXXOPTIMIZE="$CONFIG_CXXOPTIMIZE $optimize_no_inline"
917         AC_MSG_RESULT([enabling optimizations, $CONFIG_CXXOPTIMIZE]) ;;
918     no)
919         CONFIG_CXXOPTIMIZE=""
920         AC_MSG_RESULT([disabling optimizations]) ;;
921     *)
922         CONFIG_CXXOPTIMIZE="$enable_optimize"
923         AC_MSG_RESULT([customizing optimizations, $enable_optimize]) ;;
924 esac
926 #--------------------------------------------------------------------
927 # Substitute TeXmacs specific configuration parameters
928 #--------------------------------------------------------------------
930 AC_SUBST(CONFIG_OS)
931 AC_SUBST(CONFIG_OS_SUFFIX)
932 AC_SUBST(CONFIG_CXXWARNING)
933 AC_SUBST(CONFIG_CXXTEMPLATE)
934 AC_SUBST(CONFIG_CXXOPTIMIZE)
935 AC_SUBST(CONFIG_CXXDEBUG)
936 AC_SUBST(CONFIG_BFLAGS)
937 AC_SUBST(CONFIG_BSTATIC)
938 AC_SUBST(CONFIG_BSHARED)
939 AC_SUBST(CONFIG_BPATH)
940 AC_SUBST(CONFIG_WORD_LENGTH)
941 AC_SUBST(CONFIG_WORD_LENGTH_INC)
942 AC_SUBST(CONFIG_WORD_MASK)
943 AC_SUBST(CONFIG_MAX_FAST)
944 AC_SUBST(CONFIG_CXXFLAGS)
945 AC_SUBST(CONFIG_STD_SETENV)
946 AC_SUBST(CONFIG_SO)
947 AC_SUBST(CONFIG_LIB_PATH)
948 AC_SUBST(CONFIG_STRIP)
949 AC_SUBST(CONFIG_CHMOD)
950 AC_SUBST(LDRT)
952 #--------------------------------------------------------------------
953 # Default paths for installation
954 #--------------------------------------------------------------------
956 if test "$prefix" = ""; then
957   prefix=/usr/local
959 if test "$prefix" = "NONE"; then
960   prefix=/usr/local
962 if test "$exec_prefix" = ""; then
963   exec_prefix='${prefix}'
965 if test "$exec_prefix" = "NONE"; then
966   exec_prefix='${prefix}'
968 if test "$exec_prefix" = '${prefix}'; then
969   exec_prefix='${prefix}'
971 if test "$includedir" = ""; then
972   includedir='${prefix}/include'
974 if test "$includedir" = "NONE"; then
975   includedir='${prefix}/include'
977 if test "$includedir" = '${prefix}/include'; then
978   includedir='${prefix}/include'
980 if test "$libdir" = ""; then
981   libdir='${exec_prefix}/lib'
983 if test "$libdir" = "NONE"; then
984   libdir='${exec_prefix}/lib'
986 if test "$libdir" = '${exec_prefix}/lib'; then
987   libdir='${exec_prefix}/lib'
989 if test "$bindir" = ""; then
990   bindir='${exec_prefix}/bin'
992 if test "$bindir" = "NONE"; then
993   bindir=${exec_prefix}/bin
995 if test "$bindir" = '${exec_prefix}/bin'; then
996   bindir='${exec_prefix}/bin'
998 if test "$datarootdir" = ""; then
999   datarootdir='${prefix}/share'
1001 if test "$datarootdir" = "NONE"; then
1002   datarootdir='${prefix}/share'
1004 if test "$datarootdir" = '${prefix}/share'; then
1005   datarootdir='${prefix}/share'
1007 if test "$datadir" = ""; then
1008   datadir='${prefix}/share'
1010 if test "$datadir" = "NONE"; then
1011   datadir='${prefix}/share'
1013 if test "$datadir" = '${prefix}/share'; then
1014   datadir='${prefix}/share'
1016 if test "$mandir" = ""; then
1017   mandir='${datarootdir}/man'
1019 if test "$mandir" = "NONE"; then
1020   mandir='${datarootdir}/man'
1022 if test "$mandir" = '${datarootdir}/man'; then
1023   mandir='${datarootdir}/man'
1025 if test "$libexecdir" = ""; then
1026   libexecdir='${exec_prefix}/libexec'
1028 if test "$libexecdir" = "NONE"; then
1029   libexecdir='${exec_prefix}/libexec'
1031 if test "$libexecdir" = '${exec_prefix}/libexec'; then
1032   libexecdir='${exec_prefix}/libexec'
1035 curdir="`pwd`"
1036 tmorig=${curdir}
1037 tmdir=${PACKAGE}
1038 tmsrc=${curdir}/${tmdir}
1039 tmbin=${libexecdir}/${tmdir}
1040 tmdata=${datadir}/${tmdir}
1041 AC_SUBST(tmorig)
1042 AC_SUBST(tmdir)
1043 AC_SUBST(tmsrc)
1044 AC_SUBST(tmbin)
1045 AC_SUBST(tmdata)
1047 if test "$DEVEL_RELEASE" = "1"; then
1048   tmtgz=${PACKAGE}-${DEVEL_VERSION}
1049 else
1050   tmtgz=${PACKAGE}-${DEVEL_VERSION}-R${DEVEL_RELEASE}
1052 tmrpm=${PACKAGE}-${DEVEL_VERSION}-${DEVEL_RELEASE}
1053 if test "$STABLE_RELEASE" = "1"; then
1054   tmstgz=${PACKAGE}-${STABLE_VERSION}
1055 else
1056   tmstgz=${PACKAGE}-${STABLE_VERSION}-R${STABLE_RELEASE}
1058 tmsrpm=${PACKAGE}-${STABLE_VERSION}-${STABLE_RELEASE}
1059 if test "$WINDOWS_RELEASE" = "1"; then
1060   tmwin=wintexmacs-${WINDOWS_VERSION}
1061 else
1062   tmwin=wintexmacs-${WINDOWS_VERSION}-R${WINDOWS_RELEASE}
1064 AC_SUBST(tmtgz)
1065 AC_SUBST(tmrpm)
1066 AC_SUBST(tmstgz)
1067 AC_SUBST(tmsrpm)
1068 AC_SUBST(tmwin)
1070 #--------------------------------------------------------------------
1071 # Done
1072 #--------------------------------------------------------------------
1074 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 misc/bundle/Base.xcconfig:misc/bundle/Base.xcconfig.in)