Fixes
[texmacs.git] / src / configure.in
blob022353efb1c4229822e756a6b7d9c7104b563bef
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
151 SAVE_CPPFLAGS="$CPPFLAGS"
152 SAVE_LDFLAGS="$LDFLAGS"
153 SAVE_LIBS="$LIBS"
154 if test "$with_iconv" = "no" ; then
155     AC_MSG_RESULT([disabling iconv support])
156 else
157     if test -n "$ICONV_CFLAGS" -a -n "$ICONV_LDFLAGS"; then
158        CPPFLAGS="$ICONV_CFLAGS" # for AC_TRY_LINK
159        LDFLAGS="$ICONV_LDFLAGS"
160     fi
161     if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
162        CPPFLAGS="-I$with_iconv/include" # for AC_TRY_LINK
163        LDFLAGS="-L$with_iconv/lib"
164        ICONV_CFLAGS="-I$with_iconv/include"
165        ICONV_LDFLAGS="-L$with_iconv/lib"
166     fi
168     AC_CHECK_HEADER(iconv.h,
169     AC_MSG_CHECKING(for iconv)
170     AC_TRY_LINK(
172 #include <stdlib.h>
173 #include <iconv.h>
175     iconv_t cd = iconv_open ("","");
176     iconv (cd, NULL, NULL, NULL, NULL);
178     AC_MSG_RESULT(yes)
179     AC_DEFINE(USE_ICONV, 1, [Use iconv library])
181     AC_MSG_RESULT(no)
182     AC_MSG_CHECKING(for iconv in -liconv)
183 #    LDFLAGS="${ICONV_LDFLAGS}"    # for AC_TRY_LINK
184     LIBS="-liconv"                # for AC_TRY_LINK
185     AC_TRY_LINK(
187 #include <stdlib.h>
188 #include <iconv.h>
190       iconv_t cd = iconv_open ("","");
191       iconv (cd, NULL, NULL, NULL, NULL);
193       AC_MSG_RESULT(yes)
194       AC_DEFINE(USE_ICONV, 1, [Use iconv library])
195       ICONV_LDFLAGS="${ICONV_LDFLAGS/-liconv} -liconv"
197       AC_MSG_RESULT(no)
198       AC_MSG_WARN([absence of iconv may crash HTML import])
199   ])]))
202 CPPFLAGS="$SAVE_CPPFLAGS"
203 LDFLAGS="$SAVE_LDFLAGS"
204 LIBS="$SAVE_LIBS"
205 AC_LANG_RESTORE  # restore C++ language
206 AC_SUBST(ICONV_CFLAGS)
207 AC_SUBST(ICONV_LDFLAGS)
209 #--------------------------------------------------------------------
210 # Checks for freetype library
211 #--------------------------------------------------------------------
213 AC_ARG_WITH(freetype,
214 changequote(<<, >>)dnl
215 <<  --with-freetype[=ARG]     with freetype support [ARG=linked]>>dnl
216 changequote([, ])dnl
219 SAVE_CPPFLAGS="$CPPFLAGS"
220 SAVE_LDFLAGS="$LDFLAGS"
221 SAVE_LIBS="$LIBS"
222 if test "$with_freetype" = "no" ; then
223     AC_MSG_RESULT([disabling freetype support])
224 else
225     if test -z "$FREETYPE_CFLAGS"; then
226       FREETYPE_CFLAGS=`freetype-config --cflags`
227     fi
228     CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
229     if test -z "$FREETYPE_LDFLAGS"; then
230       FREETYPE_LDFLAGS=`freetype-config --libs`
231     fi
232     LIBS="$LDFLAGS $FREETYPE_LDFLAGS"
233     AC_CHECK_HEADER(ft2build.h,
234     AC_MSG_CHECKING(for freetype)
235     AC_TRY_LINK(
237 #include <ft2build.h>
238 #include FT_FREETYPE_H 
240     FT_Library ft_library;
241     (void) FT_Init_FreeType (&ft_library);
243     AC_MSG_RESULT(yes)
244     AC_DEFINE(USE_FREETYPE, 1, [Use freetype library])
245     FREETYPE_CFLAGS="$CPPFLAGS"
246     if test "$with_freetype" = "linked" -o "$with_freetype" = "" ; then
247       FREETYPE_LDFLAGS="$LIBS"
248       AC_DEFINE(LINKED_FREETYPE, 1, [Link freetype library with TeXmacs])
249     fi
251     AC_MSG_RESULT(no)]))
254 CPPFLAGS="$SAVE_CPPFLAGS"
255 LDFLAGS="$SAVE_LDFLAGS"
256 LIBS="$SAVE_LIBS"
258 AC_SUBST(FREETYPE_CFLAGS)
259 AC_SUBST(FREETYPE_LDFLAGS)
261 #--------------------------------------------------------------------
262 # Checks for Cairo library
263 #--------------------------------------------------------------------
265 AC_ARG_WITH(cairo,
266 changequote(<<, >>)dnl
267 <<  --with-cairo[=ARG]        with cairo support [ARG=no]>>dnl
268 changequote([, ])dnl
271 SAVE_CPPFLAGS="$CPPFLAGS"
272 SAVE_LDFLAGS="$LDFLAGS"
273 SAVE_LIBS="$LIBS"
274 if test "$with_cairo" = "no" -o "$with_cairo" = "" ; then
275     AC_MSG_RESULT([disabling cairo support])
276 else
277     CPPFLAGS=`pkg-config --cflags cairo`
278     LIBS=`pkg-config --libs cairo`
279     AC_CHECK_HEADER(cairo.h,
280     AC_MSG_CHECKING(for cairo)
281     AC_TRY_LINK(
283 #include <cairo.h>
285     cairo_surface_t *surface;
286     surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 120, 120);
288     AC_MSG_RESULT(yes)
289     AC_DEFINE(USE_CAIRO, 1, [Use cairo library])
290     CAIRO_CFLAGS="$CPPFLAGS"
291     if test "$with_cairo" = "linked" ; then
292       CAIRO_LDFLAGS="$LIBS"
293       AC_DEFINE(LINKED_CAIRO, 1, [Link cairo library with TeXmacs])
294     fi
296     AC_MSG_RESULT(no)]))
299 CPPFLAGS="$SAVE_CPPFLAGS"
300 LDFLAGS="$SAVE_LDFLAGS"
301 LIBS="$SAVE_LIBS"
303 AC_SUBST(CAIRO_CFLAGS)
304 AC_SUBST(CAIRO_LDFLAGS)
306 #--------------------------------------------------------------------
307 # Checks for Imlib2 library
308 #--------------------------------------------------------------------
310 AC_ARG_WITH(imlib2,
311 changequote(<<, >>)dnl
312 <<  --with-imlib2[=ARG]       with imlib2 support [ARG=no]>>dnl
313 changequote([, ])dnl
316 SAVE_CPPFLAGS="$CPPFLAGS"
317 SAVE_LDFLAGS="$LDFLAGS"
318 SAVE_LIBS="$LIBS"
319 if test "$with_imlib2" = "no" -o "$with_imlib2" = "" ; then
320     AC_MSG_RESULT([disabling imlib2 support])
321 else
322     CPPFLAGS=`imlib2-config --cflags`
323     LIBS=`imlib2-config --libs`
324     AC_CHECK_HEADER(Imlib2.h,
325     AC_MSG_CHECKING(for imlib2)
326     AC_TRY_LINK(
328 #include <X11/Xlib.h>
329 #include <Imlib2.h>
330 #include <stdio.h>
331 #include <string.h>
333     Imlib_Image image= imlib_load_image("");
335     AC_MSG_RESULT(yes)
336     AC_DEFINE(USE_IMLIB2, 1, [Use imlib2 library])
337     IMLIB2_CFLAGS="$CPPFLAGS"
338     if test "$with_imlib2" = "linked" ; then
339       IMLIB2_LDFLAGS="$LIBS"
340       AC_DEFINE(LINKED_IMLIB2, 1, [Link imlib2 library with TeXmacs])
341     fi
343     AC_MSG_RESULT(no)]))
346 CPPFLAGS="$SAVE_CPPFLAGS"
347 LDFLAGS="$SAVE_LDFLAGS"
348 LIBS="$SAVE_LIBS"
350 AC_SUBST(IMLIB2_CFLAGS)
351 AC_SUBST(IMLIB2_LDFLAGS)
353 #--------------------------------------------------------------------
354 # Checks for Axel library
355 #--------------------------------------------------------------------
357 AC_ARG_WITH(axel,
358 changequote(<<, >>)dnl
359 <<  --with-axel[=ARG]       with axel support [ARG=no]>>dnl
360 changequote([, ])dnl
363 SAVE_CPPFLAGS="$CPPFLAGS"
364 SAVE_LDFLAGS="$LDFLAGS"
365 SAVE_LIBS="$LIBS"
366 if test "$with_axel" = "no" -o "$with_axel" = "" ; then
367     AC_MSG_RESULT([disabling axel support])
368 else
369     CPPFLAGS=`axel-config --cflags`
370     LIBS=`axel-config --libs`
371     AC_CHECK_HEADER(QGui/Viewer.h,
372     AC_MSG_CHECKING(for axel)
373     AC_TRY_LINK(
375 #include <QGui/Viewer.h>
377     Viewer viewer(0);
379     AC_MSG_RESULT(yes)
380     AC_DEFINE(USE_AXEL, 1, [Use axel library])
381     AXEL_CFLAGS="$CPPFLAGS"
382     if test "$with_axel" = "linked" ; then
383       AXEL_LDFLAGS="$LIBS"
384       AC_DEFINE(LINKED_AXEL, 1, [Link axel library with TeXmacs])
385     fi
387     AC_MSG_RESULT(no)]))
390 CPPFLAGS="$SAVE_CPPFLAGS"
391 LDFLAGS="$SAVE_LDFLAGS"
392 LIBS="$SAVE_LIBS"
394 AC_SUBST(AXEL_CFLAGS)
395 AC_SUBST(AXEL_LDFLAGS)
397 #--------------------------------------------------------------------
398 # Fixes for erroneous behaviour of gcc/g++ and guile on some systems
399 #--------------------------------------------------------------------
401 AC_MSG_CHECKING(whether ... arguments behave correctly)
402 if test -z "$GUILE_CFLAGS"; then
403   CXXFLAGS="`guile-config compile`"
404 else
405   CXXFLAGS="$GUILE_CFLAGS"
407 AC_TRY_COMPILE([
408   #include <guile/gh.h>
409   #include <libguile.h>
410   typedef SCM (*FN)(...);
411   static SCM identity (SCM x) { return x; }
412   void declare () { gh_new_procedure ("identity", (FN) identity, 1, 0, 0); }
415   AC_DEFINE(DOTS_OK, 1, [Defined if ...-style argument passing works])
416   AC_MSG_RESULT(yes)
418   AC_MSG_RESULT(no)
420 CXXFLAGS=""
422 AC_MSG_CHECKING(the size_t of guile strings)
423 if test -z "$GUILE_CFLAGS"; then
424   CXXFLAGS="`guile-config compile`"
425 else
426   CXXFLAGS="$GUILE_CFLAGS"
428 AC_TRY_COMPILE([
429   #include <guile/gh.h>
430   #include <libguile.h>
431   void print_string (SCM s) {
432     int len_r;
433     char* r= gh_scm2newstr (s, &len_r); }
436   AC_DEFINE(guile_str_size_t, int, [Guile string size type])
437   AC_MSG_RESULT(int)
439   AC_DEFINE(guile_str_size_t, size_t, [Guile string size type])
440   AC_MSG_RESULT(size_t)
442 CXXFLAGS=""
444 AC_MSG_CHECKING([if statically linking with guile works])
445 SAVE_CPPFLAGS="$CPPFLAGS"
446 SAVE_LDFLAGS="$LDFLAGS"
447 SAVE_LIBS="$LIBS"
448 CPPFLAGS="$GUILE_CFLAGS"
449 LDFLAGS="-static"
450 LIBS="$GUILE_LDFLAGS"
451 TEXMACS_LINK_GUILE([tm_link_guile_static="yes"],
452                    [tm_link_guile_static="no"])
453 AC_MSG_RESULT(["$tm_link_guile_static"])
454 if test "$tm_link_guile_static" = "no" ; then
455    AC_MSG_CHECKING([if it works with -lltdl])
456    LIBS="$GUILE_LDFLAGS -lltdl"
457    TEXMACS_LINK_GUILE([tm_link_guile_static_ltdl="yes"],
458                       [tm_link_guile_static_ltdl="no"])
459    AC_MSG_RESULT(["$tm_link_guile_static_ltdl"])
460    if test "$tm_link_guile_static_ltdl" = "yes" ; then
461       GUILE_LDFLAGS="$GUILE_LDFLAGS -lltdl"
462    else
463       AC_MSG_CHECKING([if it works with -lltdl -ldl])
464       LIBS="$GUILE_LDFLAGS -lltdl -ldl"
465       TEXMACS_LINK_GUILE([tm_link_guile_static_ltdl_ldl="yes"],
466                          [tm_link_guile_static_ltdl_ldl="no"])
467       AC_MSG_RESULT(["$tm_link_guile_static_ltdl_ldl"])
468       if test "$tm_link_guile_static_ltdl_ldl" = "yes" ; then
469          GUILE_LDFLAGS="$GUILE_LDFLAGS -lltdl -ldl"
470       else
471          AC_MSG_WARN([unable to link statically with guile])
472       fi
473    fi
475 CPPFLAGS="$SAVE_CPPFLAGS"
476 LDFLAGS="$SAVE_LDFLAGS"
477 LIBS="$SAVE_LIBS"
479 #--------------------------------------------------------------------
480 # Handle different systems case by case
481 #--------------------------------------------------------------------
483 CONFIG_OS="GNU_LINUX"
484 CONFIG_OS_SUFFIX="gnu-linux"
485 CONFIG_OS_COMPAT="Unix"
486 CONFIG_MACOS=""
487 CONFIG_CXXFLAGS=""
488 CONFIG_CXXTEMPLATE=""
489 CONFIG_STD_SETENV="#define STD_SETENV"
490 CONFIG_SO="so"
491 CONFIG_LIB_PATH="LD_LIBRARY_PATH"
492 CONFIG_CHMOD="chmod -f"
493 CONFIG_CXXOPTIMIZE="-O2"
494 CONFIG_BSTATIC="-Wl,-Bstatic"
495 CONFIG_BSHARED="-Wl,-Bdynamic"
496 CONFIG_BFLAGS=""
497 CONFIG_BPATH="-Wl,-rpath,"
498 CONFIG_LDRT=""
499 CONFIG_WORD_LENGTH="4"
500 CONFIG_WORD_LENGTH_INC="3"
501 CONFIG_WORD_MASK="0xfffffffc"
502 CONFIG_MAX_FAST="260 // WORD_LENGTH more than power of 2"
503 # tweak for XCode project
504 CONFIG_NATIVE_ARCH_TAG="NATIVE_ARCH"
506 X11_CFLAGS="$X_CFLAGS"
507 X11_LDFLAGS="$X_LIBS -lXext -lX11"
509 AC_CHECK_SIZEOF(void *)
510 AC_MSG_CHECKING(if we are on a 64-bits computer)
511 if test "$ac_cv_sizeof_void_p" = "8"; then
512   AC_MSG_RESULT([yes])
513   CONFIG_WORD_LENGTH="8"
514   CONFIG_WORD_LENGTH_INC="7"
515   CONFIG_WORD_MASK="0xfffffffffffffff8"
516   CONFIG_MAX_FAST="264 // WORD_LENGTH more than power of 2"
517 else
518   AC_MSG_RESULT([no])
521 AC_CANONICAL_HOST
522 case "${host}" in
523   i*86-*-linux* | x86_64-*-linux*)
524     AC_MSG_RESULT(final adjustments for an Intel or AMD GNU/Linux host)
525     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
526   ;;
527   i*86-*-freebsd* | x86_64-*-freebsd*)
528     AC_MSG_RESULT(final adjustments for an Intel or AMD GNU/BSD host)
529     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
530   ;;
531   i*86-*-solaris*)
532     AC_MSG_RESULT(final adjustments for an Intel or AMS Solaris host)
533     CONFIG_CXXOPTIMIZE="-O3"
534     CONFIG_BPATH="-Wl,-R,"
535     X11_LDFLAGS="$X_LIBS -lXext -lX11 -lsocket"
536   ;;
537   *mingw*)
538     AC_MSG_RESULT([final adjustments for mingw host])
539     CONFIG_OS_COMPAT="Windows"
540     CONFIG_LDRT="-lmingw32 -lmingwex"
541   ;;
542   *-*-cygwin)
543     AC_MSG_RESULT(final adjustments for cygwin host)
544     CONFIG_OS="CYGWIN"
545     CONFIG_BFLAGS="-Wl,-stack,8388608"
546 #    CXX="export CYGWIN=check_case:strict; $CXX"
547 #    AC_SUBST(CXX)
548   ;;
549   *apple*darwin*)
550     echo "$ac_t""final adjustments for a MacOS host" 1>&6
551     CONFIG_OS="MACOS"
552     CONFIG_CXXFLAGS="-I${prefix}/include"
553     CONFIG_BSHARED=""
554     CONFIG_BFLAGS="-framework Cocoa"
555     CONFIG_BPATH=""
556     CONFIG_SO="dylib"
557     CONFIG_LIB_PATH="DYLD_LIBRARY_PATH"
558   ;;
559   *darwin*)
560     echo "$ac_t""final adjustments for a generic Darwin host" 1>&6
561     CONFIG_CXXFLAGS="-I${prefix}/include"
562     CONFIG_BSHARED=""
563     CONFIG_BPATH=""
564     CONFIG_SO="dylib"
565     CONFIG_LIB_PATH="DYLD_LIBRARY_PATH"
566   ;;
567   powerpc-*-linux*)
568     AC_MSG_RESULT(final adjustments for a PowerPC/GNU-linux host)
569     CONFIG_OS="POWERPC_GNU_LINUX"
570     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
571   ;;
572   *sun*)
573     AC_MSG_RESULT(final adjustments for a SUN/solaris host)
574     CONFIG_OS="SUN"
575     CONFIG_OS_SUFFIX="sun"
576     CONFIG_BSTATIC=""
577     CONFIG_BSHARED=""
578     CONFIG_BPATH="-Wl,-R,"
579     X11_LDFLAGS="$X_LIBS -lXext -lX11 -lsocket"
580     CONFIG_WORD_LENGTH="8"
581     CONFIG_WORD_LENGTH_INC="7"
582     CONFIG_WORD_MASK="0xfffffff8"
583     CONFIG_MAX_FAST="264 // WORD_LENGTH more than power of 2"
584     CONFIG_STD_SETENV=""
585   ;;
586   sparc*-*-linux*)
587     AC_MSG_RESULT(final adjustments for a Sparc host running GNU/Linux)
588     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
589     CONFIG_WORD_LENGTH="8"
590     CONFIG_WORD_LENGTH_INC="7"
591     CONFIG_WORD_MASK="0xfffffff8"
592     CONFIG_MAX_FAST="264 // WORD_LENGTH more than power of 2"
593     CONFIG_STD_SETENV=""
594   ;;
595   *dec*)
596     AC_MSG_RESULT(final adjustments for a DEC/alpha host)
597     CONFIG_BSTATIC=""
598     CONFIG_BSHARED="-shared"
599     CONFIG_STD_SETENV=""
600   ;;
601   *alpha*-*-linux*)
602     AC_MSG_RESULT(final adjustments for an Alpha GNU/Linux host)
603     CONFIG_BSTATIC=""
604     CONFIG_BSHARED="-shared"
605   ;;
606   s390-*-linux*)
607     AC_MSG_RESULT(final adjustments for an IBM S/390 GNU/Linux host)
608     CONFIG_STD_SETENV=""
609   ;;
610   ia64-*-linux*)
611     AC_MSG_RESULT(final adjustments for an Itanium GNU/Linux host)
612     CONFIG_BSTATIC=""
613     CONFIG_BSHARED="-shared"
614   ;;
615   hppa*-*-linux*)
616     AC_MSG_RESULT(final adjustments for an HP PA_RISC GNU/Linux host)
617     CONFIG_CXXFLAGS="$CONFIG_CXXFLAGS -fPIC"
618     CONFIG_BSTATIC=""
619     CONFIG_BSHARED="-shared"
620   ;;
621   *sgi-irix*)
622     echo "$ac_t""final adjustments for a SGI/Irix host" 1>&6
623     CONFIG_OS="IRIX"
624     CONFIG_CXXFLAGS=""
625     X_LIBS=-L/usr/lib32
626     CONFIG_BSTATIC=""
627     CONFIG_BSHARED=""
628     CONFIG_BPATH=""
629     X11_LDFLAGS="$X_LIBS -lX11"
630     CONFIG_WORD_MASK="0xfffffff8"
631     CONFIG_STD_SETENV=""
632     CONFIG_CHMOD="chmod"
633     CONFIG_LIB_PATH="LD_LIBRARYN32_PATH"
634   ;;
635   m68k-*-linux* | mips-*-linux* | mipsel-*-linux* | arm*-*-linux*)
636     AC_MSG_RESULT(final adjustments for a supported GNU/Linux host)
637   ;;
638   *-linux*)
639     AC_MSG_RESULT(final adjustments for a generic GNU/Linux host)
640   ;;
641   *)
642     AC_MSG_RESULT(final adjustments for a generic host)
643   ;;
644 esac
646 case "${host}" in
647   *apple*darwin10*)
648     echo "$ac_t""Xcode 3.2 project tweak (only MacOSX 10.6)" 1>&6
649     CONFIG_NATIVE_ARCH_TAG="NATIVE_ARCH_ACTUAL"
650   ;;
651 esac
653 #--------------------------------------------------------------------
654 # Temporary fix for link problem
655 #--------------------------------------------------------------------
657 case "$GXX_VERSION" in
658      3.* | 4.*)
659          CONFIG_BSTATIC="-static"
660          CONFIG_BSHARED="-dynamic"
661      ;;
662 esac
664 #--------------------------------------------------------------------
665 # Memory allocation options
666 #--------------------------------------------------------------------
668 AC_ARG_ENABLE(fastalloc,
669 [  --disable-fastalloc     omit fast allocator for small objects],
670     [], [enable_fastalloc="yes"])
671 case "$enable_fastalloc" in
672     yes)
673         ;;
674     no)
675         AC_MSG_RESULT([disabling fast allocator for small objects])
676         AC_DEFINE(NO_FAST_ALLOC, 1, [Disable fast memory allocator])
677         ;;
678     *)
679         AC_MSG_ERROR([bad option --enable-fastalloc=$enable_fastalloc])
680         ;;
681 esac
683 #--------------------------------------------------------------------
684 # Experimental options
685 #--------------------------------------------------------------------
687 AC_ARG_ENABLE(experimental,
688 [  --enable-experimental   support new style rewriting code],
689     [], [enable_experimental="no"])
690 case "$enable_experimental" in
691     yes)
692         AC_MSG_RESULT([enabling experimental style rewriting code])
693         AC_DEFINE(EXPERIMENTAL, 1, [Enable experimental style rewriting code])
694         CONFIG_EXPERIMENTAL="Memorizer Environment Evaluate"
695         ;;
696     no)
697         AC_MSG_RESULT([disabling experimental style rewriting code])
698         CONFIG_EXPERIMENTAL=""
699         ;;
700     *)
701         AC_MSG_ERROR([bad option --enable-experimental=$enable_experimental])
702         ;;
703 esac
704 AC_SUBST(CONFIG_EXPERIMENTAL)
706 #--------------------------------------------------------------------
707 # MacOS X extensions (spellchecker, image loading)
708 #--------------------------------------------------------------------
710 AC_ARG_ENABLE(macosx-extensions,
711 [  --enable-macosx-extensions   support new style rewriting code],
712     [], [enable_macosx_extensions="no"])
713 case "$enable_macosx_extensions" in
714     yes)
715         AC_MSG_RESULT([enabling Mac OSX extensions])
716         AC_DEFINE(MACOSX_EXTENSIONS, 1, [Enabling Mac OSX extensions])
717         CONFIG_MACOS="MacOS"
718         ;;
719     no)
720         AC_MSG_RESULT([disabling Mac OSX extensions])
721         CONFIG_MACOS=""
722         ;;
723     *)
724         AC_MSG_ERROR([bad option --enable-macosx-extensions=$enable_macosx_extensions])
725         ;;
726 esac
727 AC_SUBST(CONFIG_MACOS)
729 #--------------------------------------------------------------------
730 # Gui selection
731 #--------------------------------------------------------------------
733 CONFIG_X11=""
734 CONFIG_COCOA=""
735 CONFIG_GUI="X11"
737 AC_ARG_ENABLE(qt,
738 [  --enable-qt             replace X11 by Qt interface],
739     [], [enable_qt="no"])
741 case "$enable_qt" in
742     yes)
743         HACKED_AT_WITH_QT
744         if test x"$at_cv_qt_build" = xko; then 
745            AC_MSG_ERROR([cannot find Qt!])
746         else
747            AC_MSG_RESULT([enabling experimental Qt port])
748            CONFIG_GUI="QT"
749         fi
750         ;;
751     no)
752         AC_MSG_RESULT([disabling experimental Qt port])
753         ;;
754     *)
755         AC_MSG_ERROR([bad option --enable-qt=$enable_qt])
756         ;;
757 esac
759 AC_ARG_ENABLE(cocoa,
760 [  --enable-cocoa          replace X11 by Cocoa interface],
761     [], [enable_cocoa="no"])
762 case "$enable_cocoa" in
763     yes)
764         AC_MSG_RESULT([enabling experimental Cocoa port])
765         COCOA_CFLAGS=""
766         COCOA_LDFLAGS="-framework Cocoa"
767         CONFIG_GUI="COCOA"
768         ;;
769     no)
770         AC_MSG_RESULT([disabling experimental Cocoa port])
771         ;;
772     *)
773         AC_MSG_ERROR([bad option --enable-cocoa=$enable_cocoa])
774         ;;
775 esac
777 case "$CONFIG_GUI" in
778     X11)
779         CONFIG_X11="X11 Widkit Ghostscript"
780         CONFIG_GUI_DEFINE="X11TEXMACS"
781 #        AC_DEFINE(X11TEXMACS, 1, [Use standard X11 port])
782         ;;
783     COCOA)
784         CONFIG_COCOA="Cocoa"
785         CONFIG_GUI_DEFINE="AQUATEXMACS"
786 #        AC_DEFINE(AQUATEXMACS, 1, [Enable experimental Cocoa port])
787         ;;
788     QT)
789         CONFIG_QT="Qt"
790         CONFIG_GUI_DEFINE="QTTEXMACS"
791 #        AC_DEFINE(QTTEXMACS, 1, [Enable experimental Qt port])
792         ;;
793 esac
795 AC_SUBST(CPPFLAGS)
796 AC_SUBST(LDFLAGS)
797 AC_SUBST(X11_CFLAGS)
798 AC_SUBST(X11_LDFLAGS)
799 AC_SUBST(COCOA_CFLAGS)
800 AC_SUBST(COCOA_LDFLAGS)
802 AC_SUBST(CONFIG_X11)
803 AC_SUBST(CONFIG_COCOA)
804 AC_SUBST(CONFIG_QT)
805 AC_SUBST(CONFIG_GUI)
806 AC_SUBST(CONFIG_GUI_DEFINE)
808 #--------------------------------------------------------------------
809 # Debugging options
810 #--------------------------------------------------------------------
812 STD_DEBUG_FLAGS="-fno-rtti -fno-exceptions"
813 if test "$enable_cocoa" = "yes"; then
814     STD_DEBUG_FLAGS="-fno-exceptions"
817 AC_MSG_CHECKING(if compiler supports $STD_DEBUG_FLAGS)
818 CXXFLAGS="$STD_DEBUG_FLAGS"
819 AC_TRY_COMPILE([
820   int some_variable = 0;
823     CONFIG_CXXDIALECT="$STD_DEBUG_FLAGS"
824     AC_MSG_RESULT(yes)
826     CONFIG_CXXDIALECT=""
827     AC_MSG_RESULT(no)
829 CXXFLAGS=""
830 AC_SUBST(CONFIG_CXXDIALECT)
832 AC_ARG_ENABLE(debug,
833 changequote(<<, >>)dnl
834 <<  --enable-debug[=ARG]      install a debugging enable executable [-ggdb]>>,
835 changequote([, ])dnl
836 [], [enable_debug="no"])
838 if test "$enable_debug" = "yes"; then
839     if test "$GXX" = "yes"; then
840         enable_debug="-ggdb"
841     else
842         enable_debug="-g3"
843     fi
846 if test "$enable_debug" = "no"; then
847     AC_MSG_RESULT([disabling debugging])
848     CONFIG_STRIP="strip"
849     CONFIG_CXXDEBUG=""
850     optimize_default="yes"
851 else
852     AC_MSG_RESULT([enabling debugging, $enable_debug])
853     CONFIG_STRIP="true"
854     CONFIG_CXXDEBUG="$enable_debug"
855     optimize_default="no"
858 AC_ARG_ENABLE(assert,
859 changequote(<<, >>)dnl
860 <<  --enable-assert           exit on failed assertions in code>>,
861 changequote([, ])dnl
862 [], [enable_assert="yes"])
864 if test "$enable_assert" = "no"; then
865     AC_MSG_RESULT([disabling assertion checking])
866 else
867     AC_MSG_RESULT([enabling assertion checking])
868     AC_DEFINE(DEBUG_ASSERT, 1, [check assertions in code])
871 #--------------------------------------------------------------------
872 # Warning options
873 #--------------------------------------------------------------------
875 case "$GXX_VERSION" in
876   none)
877     CONFIG_CXXWARNING="";
878   ;;
879   *)
880     CONFIG_CXXWARNING="-Wall -Wno-return-type"
881   ;;
882 esac
884 AC_ARG_ENABLE(warnings,
885 [  --enable-warnings       print warning messages during compilation],
886     [], [enable_warnings="yes"])
887 case "$enable_warnings" in
888     yes)
889         AC_MSG_RESULT([enabling warning flags $CONFIG_CXXWARNING]) ;;
890     no)
891         CONFIG_CXXWARNING=""
892         AC_MSG_RESULT([disabling warning flags]) ;;
893     *)
894         CONFIG_CXXWARNING="$enable_warnings"
895         AC_MSG_RESULT([enabling warning flags $CONFIG_CXXWARNING]) ;;
896 esac
898 #--------------------------------------------------------------------
899 # Optimization options
900 #--------------------------------------------------------------------
902 if test "$optimize_default" = "yes"; then
903   case "$GXX_VERSION" in
904     3.3.3 | 3.3.4 | 4.*)
905       ;;
906     2.96 | 3.0 | 3.0.* | 3.1 | 3.1.* | 3.2 | 3.2.* | 3.3 | 3.3.*)
907       case "${host}" in
908         i*86-*-linux-gnu* | i*86-*-freebsd*)
909           AC_MSG_WARN([using g++ 3.*, optimize without inline by default])
910           optimize_default="no-inline"
911         ;;
912         *)
913           AC_MSG_WARN([using g++ 3.*, optimize without inline by default])
914           optimize_default="no-inline"
915         ;;
916       esac
917     ;;
918   esac
921 AC_ARG_ENABLE(optimize,
922 changequote(<<, >>)dnl
923 <<  --enable-optimize[=ARG]   compile with optimizations [guessed]>>,
924 changequote([, ])dnl
925 [], [enable_optimize="$optimize_default"])
927 case "$enable_optimize" in
928     yes)
929         # keep optimization options
930         AC_MSG_RESULT([enabling optimizations, $CONFIG_CXXOPTIMIZE]) ;;
931     no-inline)
932         optimize_no_inline="-fno-default-inline -fno-inline"
933         CONFIG_CXXOPTIMIZE="$CONFIG_CXXOPTIMIZE $optimize_no_inline"
934         AC_MSG_RESULT([enabling optimizations, $CONFIG_CXXOPTIMIZE]) ;;
935     no)
936         CONFIG_CXXOPTIMIZE=""
937         AC_MSG_RESULT([disabling optimizations]) ;;
938     *)
939         CONFIG_CXXOPTIMIZE="$enable_optimize"
940         AC_MSG_RESULT([customizing optimizations, $enable_optimize]) ;;
941 esac
943 #--------------------------------------------------------------------
944 # Substitute TeXmacs specific configuration parameters
945 #--------------------------------------------------------------------
947 AC_SUBST(CONFIG_OS)
948 AC_SUBST(CONFIG_OS_SUFFIX)
949 AC_SUBST(CONFIG_OS_COMPAT)
950 AC_SUBST(CONFIG_CXXWARNING)
951 AC_SUBST(CONFIG_CXXTEMPLATE)
952 AC_SUBST(CONFIG_CXXOPTIMIZE)
953 AC_SUBST(CONFIG_CXXDEBUG)
954 AC_SUBST(CONFIG_BFLAGS)
955 AC_SUBST(CONFIG_BSTATIC)
956 AC_SUBST(CONFIG_BSHARED)
957 AC_SUBST(CONFIG_BPATH)
958 AC_SUBST(CONFIG_WORD_LENGTH)
959 AC_SUBST(CONFIG_WORD_LENGTH_INC)
960 AC_SUBST(CONFIG_WORD_MASK)
961 AC_SUBST(CONFIG_MAX_FAST)
962 AC_SUBST(CONFIG_CXXFLAGS)
963 AC_SUBST(CONFIG_STD_SETENV)
964 AC_SUBST(CONFIG_SO)
965 AC_SUBST(CONFIG_LIB_PATH)
966 AC_SUBST(CONFIG_STRIP)
967 AC_SUBST(CONFIG_CHMOD)
968 AC_SUBST(CONFIG_LDRT)
969 AC_SUBST(CONFIG_NATIVE_ARCH_TAG)
971 #--------------------------------------------------------------------
972 # Default paths for installation
973 #--------------------------------------------------------------------
975 if test "$prefix" = ""; then
976   prefix=/usr/local
978 if test "$prefix" = "NONE"; then
979   prefix=/usr/local
981 if test "$exec_prefix" = ""; then
982   exec_prefix='${prefix}'
984 if test "$exec_prefix" = "NONE"; then
985   exec_prefix='${prefix}'
987 if test "$exec_prefix" = '${prefix}'; then
988   exec_prefix='${prefix}'
990 if test "$includedir" = ""; then
991   includedir='${prefix}/include'
993 if test "$includedir" = "NONE"; then
994   includedir='${prefix}/include'
996 if test "$includedir" = '${prefix}/include'; then
997   includedir='${prefix}/include'
999 if test "$libdir" = ""; then
1000   libdir='${exec_prefix}/lib'
1002 if test "$libdir" = "NONE"; then
1003   libdir='${exec_prefix}/lib'
1005 if test "$libdir" = '${exec_prefix}/lib'; then
1006   libdir='${exec_prefix}/lib'
1008 if test "$bindir" = ""; then
1009   bindir='${exec_prefix}/bin'
1011 if test "$bindir" = "NONE"; then
1012   bindir=${exec_prefix}/bin
1014 if test "$bindir" = '${exec_prefix}/bin'; then
1015   bindir='${exec_prefix}/bin'
1017 if test "$datarootdir" = ""; then
1018   datarootdir='${prefix}/share'
1020 if test "$datarootdir" = "NONE"; then
1021   datarootdir='${prefix}/share'
1023 if test "$datarootdir" = '${prefix}/share'; then
1024   datarootdir='${prefix}/share'
1026 if test "$datadir" = ""; then
1027   datadir='${prefix}/share'
1029 if test "$datadir" = "NONE"; then
1030   datadir='${prefix}/share'
1032 if test "$datadir" = '${prefix}/share'; then
1033   datadir='${prefix}/share'
1035 if test "$mandir" = ""; then
1036   mandir='${datarootdir}/man'
1038 if test "$mandir" = "NONE"; then
1039   mandir='${datarootdir}/man'
1041 if test "$mandir" = '${datarootdir}/man'; then
1042   mandir='${datarootdir}/man'
1044 if test "$libexecdir" = ""; then
1045   libexecdir='${exec_prefix}/libexec'
1047 if test "$libexecdir" = "NONE"; then
1048   libexecdir='${exec_prefix}/libexec'
1050 if test "$libexecdir" = '${exec_prefix}/libexec'; then
1051   libexecdir='${exec_prefix}/libexec'
1054 curdir="`pwd`"
1055 tmorig=${curdir}
1056 tmdir=${PACKAGE}
1057 tmsrc=${curdir}/${tmdir}
1058 tmbin=${libexecdir}/${tmdir}
1059 tmdata=${datadir}/${tmdir}
1060 AC_SUBST(tmorig)
1061 AC_SUBST(tmdir)
1062 AC_SUBST(tmsrc)
1063 AC_SUBST(tmbin)
1064 AC_SUBST(tmdata)
1066 if test "$DEVEL_RELEASE" = "1"; then
1067   tmtgz=${PACKAGE}-${DEVEL_VERSION}
1068 else
1069   tmtgz=${PACKAGE}-${DEVEL_VERSION}-R${DEVEL_RELEASE}
1071 tmrpm=${PACKAGE}-${DEVEL_VERSION}-${DEVEL_RELEASE}
1072 if test "$STABLE_RELEASE" = "1"; then
1073   tmstgz=${PACKAGE}-${STABLE_VERSION}
1074 else
1075   tmstgz=${PACKAGE}-${STABLE_VERSION}-R${STABLE_RELEASE}
1077 tmsrpm=${PACKAGE}-${STABLE_VERSION}-${STABLE_RELEASE}
1078 if test "$WINDOWS_RELEASE" = "1"; then
1079   tmwin=wintexmacs-${WINDOWS_VERSION}
1080 else
1081   tmwin=wintexmacs-${WINDOWS_VERSION}-R${WINDOWS_RELEASE}
1083 AC_SUBST(tmtgz)
1084 AC_SUBST(tmrpm)
1085 AC_SUBST(tmstgz)
1086 AC_SUBST(tmsrpm)
1087 AC_SUBST(tmwin)
1089 #--------------------------------------------------------------------
1090 # Done
1091 #--------------------------------------------------------------------
1093 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)