Minor cleaning
[texmacs.git] / src / configure.in
blobefcafc82d426adc04e3f173c19a24e2cc0a7f9b0
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])
16 AC_CANONICAL_HOST
18 PACKAGE="TeXmacs"
19 DEVEL_VERSION="1.0.7.3"
20 DEVEL_RELEASE="1"
21 STABLE_VERSION="1.0.7"
22 STABLE_RELEASE="1"
23 WINDOWS_VERSION="1.0.5"
24 WINDOWS_RELEASE="1"
25 AC_SUBST(PACKAGE)
26 AC_SUBST(DEVEL_VERSION)
27 AC_SUBST(DEVEL_RELEASE)
28 AC_SUBST(STABLE_VERSION)
29 AC_SUBST(STABLE_RELEASE)
31 #--------------------------------------------------------------------
32 # Checks for C++ compiler
33 #--------------------------------------------------------------------
35 AC_PROG_CC
36 AC_PROG_CXX
37 AC_LANG_CPLUSPLUS
38 AH_TEMPLATE([OLD_GNU_COMPILER],[Use g++ strictly prior to g++ 3.0])
39 AC_MSG_CHECKING(whether GNU C++ compiler is default)
40 case "$GXX" in
41   yes )
42     GCC_VERSION=`$CC -dumpversion`
43     GXX_VERSION=`$CXX -dumpversion`
44     AC_MSG_RESULT(yes)
45     AC_MSG_CHECKING(version of gcc)
46     AC_MSG_RESULT($GCC_VERSION)
47     AC_MSG_CHECKING(version of g++)
48     AC_MSG_RESULT($GXX_VERSION)
49     case "$GXX_VERSION" in
50       0* | 1* | 2*)
51         echo "old style GNU compiler"
52         AC_DEFINE([OLD_GNU_COMPILER],[])
53       ;;
54     esac
55   ;;
56   *)
57     GCC_VERSION="none"
58     GXX_VERSION="none"
59     AC_MSG_RESULT(no)
60     AC_MSG_WARN(cannot find GNU C++ compiler)
61   ;;
62 esac
64 #--------------------------------------------------------------------
65 # Checks for Guile
66 #--------------------------------------------------------------------
68 if test -z "$GUILE_CFLAGS" -a -z "$GUILE_LDFLAGS"; then
69   GUILE_FLAGS
71 AC_MSG_CHECKING(version of guile)
72 if test -z "$GUILE_VERSION" ; then
73   GUILE_VERSION=`guile --version | grep 'Guile \([[0-9]]\)' | sed 's/Guile \([[0-9]]*\)/\1/'`
75 AC_MSG_RESULT($GUILE_VERSION)
77 case "$GUILE_VERSION" in
78   1.0* | 1.1* | 1.2* | 1.3* | 1.4* | 1.5*)
79     CONFIG_GUILE_SERIAL="A"
80   ;;
81   1.6* | 1.7*)
82     CONFIG_GUILE_SERIAL="B"
83   ;;
84   *)
85     CONFIG_GUILE_SERIAL="C"
86   ;;
87 esac
88 AC_SUBST(CONFIG_GUILE_SERIAL)
90 #--------------------------------------------------------------------
91 # Checks for standard functionality
92 #--------------------------------------------------------------------
94 CPP_X_HEADERS
95 AC_CHECK_TYPES(FILE)
96 AC_CHECK_TYPES(intptr_t)
97 AC_CHECK_TYPES(time_t)
98 AC_PATH_X
99 AC_PATH_XTRA
100 AC_CHECK_HEADERS(pty.h util.h)
101 AC_CHECK_FUNCS(gettimeofday)
103 #--------------------------------------------------------------------
104 # Checks for dl library
105 #--------------------------------------------------------------------
107 AC_CHECK_FUNC(dlopen)
108 if test "$ac_cv_func_dl" = "yes"; then
109   AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
110 else
111   AC_CHECK_LIB(dl,dlopen)
112   if test "$ac_cv_lib_dl_dlopen" = "yes"; then
113     AC_CHECK_FUNCS(dlopen)
114     CONFIG_BDL="-ldl"
115     AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
116   else
117     AC_CHECK_LIB(dld,dld_link)
118     if test "$ac_cv_lib_dld_dld_link" = "yes"; then
119       CONFIG_BDL="-ldl"
120       AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
121     else
122       AC_CHECK_FUNCS(shl_load)
123       if test "$ac_cv_func_shl_load" = "yes"; then
124         CONFIG_BDL="-ldl"
125         AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
126       else
127         AC_CHECK_FUNCS(dlopen)
128         if test "$ac_cv_func_dlopen" = "yes"; then
129           AC_DEFINE(DYNAMIC_LINKING, 1, [Dynamic linking works])
130         fi
131       fi
132     fi
133   fi
135 AC_SUBST(CONFIG_BDL)
137 #--------------------------------------------------------------------
138 # Checks for iconv library
139 #--------------------------------------------------------------------
141 AC_ARG_WITH(iconv,
142 changequote(<<, >>)dnl
143 <<  --with-iconv[=DIR]        where to find iconv [system]>>dnl
144 changequote([, ])dnl
147 # Check for iconv
148 # Modified from GNOME's libxml2 configure.in
149 AC_LANG_SAVE
150 AC_LANG_C  # compile C to avoid the 'const char**' problem
152 SAVE_CPPFLAGS="$CPPFLAGS"
153 SAVE_LDFLAGS="$LDFLAGS"
154 SAVE_LIBS="$LIBS"
155 if test "$with_iconv" = "no" ; then
156     AC_MSG_RESULT([disabling iconv support])
157 else
158     if test -n "$ICONV_CFLAGS" -a -n "$ICONV_LDFLAGS"; then
159        CPPFLAGS="$ICONV_CFLAGS" # for AC_TRY_LINK
160        LDFLAGS="$ICONV_LDFLAGS"
161     fi
162     if test "$with_iconv" != "yes" -a "$with_iconv" != "" ; then
163        CPPFLAGS="-I$with_iconv/include" # for AC_TRY_LINK
164        LDFLAGS="-L$with_iconv/lib"
165        ICONV_CFLAGS="-I$with_iconv/include"
166        ICONV_LDFLAGS="-L$with_iconv/lib"
167     fi
169     AC_CHECK_HEADER(iconv.h,
170     AC_MSG_CHECKING(for iconv)
171     AC_TRY_LINK(
173 #include <stdlib.h>
174 #include <iconv.h>
176     iconv_t cd = iconv_open ("","");
177     iconv (cd, NULL, NULL, NULL, NULL);
179     AC_MSG_RESULT(yes)
180     AC_DEFINE(USE_ICONV, 1, [Use iconv library])
182     AC_MSG_RESULT(no)
183     AC_MSG_CHECKING(for iconv in -liconv)
184 #    LDFLAGS="${ICONV_LDFLAGS}"    # for AC_TRY_LINK
185     LIBS="-liconv"                # for AC_TRY_LINK
186     AC_TRY_LINK(
188 #include <stdlib.h>
189 #include <iconv.h>
191       iconv_t cd = iconv_open ("","");
192       iconv (cd, NULL, NULL, NULL, NULL);
194       AC_MSG_RESULT(yes)
195       AC_DEFINE(USE_ICONV, 1, [Use iconv library])
196       ICONV_LDFLAGS="${ICONV_LDFLAGS/-liconv} -liconv"
198       AC_MSG_RESULT(no)
199       AC_MSG_WARN([absence of iconv may crash HTML import])
200   ])]))
203 CPPFLAGS="$SAVE_CPPFLAGS"
204 LDFLAGS="$SAVE_LDFLAGS"
205 LIBS="$SAVE_LIBS"
206 AC_LANG_RESTORE  # restore C++ language
207 AC_SUBST(ICONV_CFLAGS)
208 AC_SUBST(ICONV_LDFLAGS)
210 #--------------------------------------------------------------------
211 # Checks for freetype library
212 #--------------------------------------------------------------------
214 AC_ARG_WITH(freetype,
215 changequote(<<, >>)dnl
216 <<  --with-freetype[=ARG]     with freetype support [ARG=linked]>>dnl
217 changequote([, ])dnl
220 SAVE_CPPFLAGS="$CPPFLAGS"
221 SAVE_LDFLAGS="$LDFLAGS"
222 SAVE_LIBS="$LIBS"
223 if test "$with_freetype" = "no" ; then
224     AC_MSG_RESULT([disabling freetype support])
225 else
226     if test -z "$FREETYPE_CFLAGS"; then
227       FREETYPE_CFLAGS=`freetype-config --cflags`
228     fi
229     CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
230     if test -z "$FREETYPE_LDFLAGS"; then
231       FREETYPE_LDFLAGS=`freetype-config --libs`
232     fi
233     LIBS="$LDFLAGS $FREETYPE_LDFLAGS"
234     AC_CHECK_HEADER(ft2build.h,
235     AC_MSG_CHECKING(for freetype)
236     AC_TRY_LINK(
238 #include <ft2build.h>
239 #include FT_FREETYPE_H 
241     FT_Library ft_library;
242     (void) FT_Init_FreeType (&ft_library);
244     AC_MSG_RESULT(yes)
245     AC_DEFINE(USE_FREETYPE, 1, [Use freetype library])
246     FREETYPE_CFLAGS="$CPPFLAGS"
247     if test "$with_freetype" = "linked" -o "$with_freetype" = "" ; then
248       FREETYPE_LDFLAGS="$LIBS"
249       AC_DEFINE(LINKED_FREETYPE, 1, [Link freetype library with TeXmacs])
250     fi
252     AC_MSG_RESULT(no)]))
255 CPPFLAGS="$SAVE_CPPFLAGS"
256 LDFLAGS="$SAVE_LDFLAGS"
257 LIBS="$SAVE_LIBS"
259 AC_SUBST(FREETYPE_CFLAGS)
260 AC_SUBST(FREETYPE_LDFLAGS)
262 #--------------------------------------------------------------------
263 # Checks for Cairo library
264 #--------------------------------------------------------------------
266 AC_ARG_WITH(cairo,
267 changequote(<<, >>)dnl
268 <<  --with-cairo[=ARG]        with cairo support [ARG=no]>>dnl
269 changequote([, ])dnl
272 SAVE_CPPFLAGS="$CPPFLAGS"
273 SAVE_LDFLAGS="$LDFLAGS"
274 SAVE_LIBS="$LIBS"
275 if test "$with_cairo" = "no" -o "$with_cairo" = "" ; then
276     AC_MSG_RESULT([disabling cairo support])
277 else
278     CPPFLAGS=`pkg-config --cflags cairo`
279     LIBS=`pkg-config --libs cairo`
280     AC_CHECK_HEADER(cairo.h,
281     AC_MSG_CHECKING(for cairo)
282     AC_TRY_LINK(
284 #include <cairo.h>
286     cairo_surface_t *surface;
287     surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 120, 120);
289     AC_MSG_RESULT(yes)
290     AC_DEFINE(USE_CAIRO, 1, [Use cairo library])
291     CAIRO_CFLAGS="$CPPFLAGS"
292     if test "$with_cairo" = "linked" ; then
293       CAIRO_LDFLAGS="$LIBS"
294       AC_DEFINE(LINKED_CAIRO, 1, [Link cairo library with TeXmacs])
295     fi
297     AC_MSG_RESULT(no)]))
300 CPPFLAGS="$SAVE_CPPFLAGS"
301 LDFLAGS="$SAVE_LDFLAGS"
302 LIBS="$SAVE_LIBS"
304 AC_SUBST(CAIRO_CFLAGS)
305 AC_SUBST(CAIRO_LDFLAGS)
307 #--------------------------------------------------------------------
308 # Checks for Imlib2 library
309 #--------------------------------------------------------------------
311 AC_ARG_WITH(imlib2,
312 changequote(<<, >>)dnl
313 <<  --with-imlib2[=ARG]       with imlib2 support [ARG=no]>>dnl
314 changequote([, ])dnl
317 SAVE_CPPFLAGS="$CPPFLAGS"
318 SAVE_LDFLAGS="$LDFLAGS"
319 SAVE_LIBS="$LIBS"
320 if test "$with_imlib2" = "no" -o "$with_imlib2" = "" ; then
321     AC_MSG_RESULT([disabling imlib2 support])
322 else
323     CPPFLAGS=`imlib2-config --cflags`
324     LIBS=`imlib2-config --libs`
325     AC_CHECK_HEADER(Imlib2.h,
326     AC_MSG_CHECKING(for imlib2)
327     AC_TRY_LINK(
329 #include <X11/Xlib.h>
330 #include <Imlib2.h>
331 #include <stdio.h>
332 #include <string.h>
334     Imlib_Image image= imlib_load_image("");
336     AC_MSG_RESULT(yes)
337     AC_DEFINE(USE_IMLIB2, 1, [Use imlib2 library])
338     IMLIB2_CFLAGS="$CPPFLAGS"
339     if test "$with_imlib2" = "linked" ; then
340       IMLIB2_LDFLAGS="$LIBS"
341       AC_DEFINE(LINKED_IMLIB2, 1, [Link imlib2 library with TeXmacs])
342     fi
344     AC_MSG_RESULT(no)]))
347 CPPFLAGS="$SAVE_CPPFLAGS"
348 LDFLAGS="$SAVE_LDFLAGS"
349 LIBS="$SAVE_LIBS"
351 AC_SUBST(IMLIB2_CFLAGS)
352 AC_SUBST(IMLIB2_LDFLAGS)
354 #--------------------------------------------------------------------
355 # Checks for Axel library
356 #--------------------------------------------------------------------
358 AC_ARG_WITH(axel,
359 changequote(<<, >>)dnl
360 <<  --with-axel[=ARG]       with axel support [ARG=no]>>dnl
361 changequote([, ])dnl
364 SAVE_CPPFLAGS="$CPPFLAGS"
365 SAVE_LDFLAGS="$LDFLAGS"
366 SAVE_LIBS="$LIBS"
367 if test "$with_axel" = "no" -o "$with_axel" = "" ; then
368     AC_MSG_RESULT([disabling axel support])
369 else
370     CPPFLAGS=`axel-config --cflags`
371     LIBS=`axel-config --libs`
372     AC_CHECK_HEADER(QGui/Viewer.h,
373     AC_MSG_CHECKING(for axel)
374     AC_TRY_LINK(
376 #include <QGui/Viewer.h>
378     Viewer viewer(0);
380     AC_MSG_RESULT(yes)
381     AC_DEFINE(USE_AXEL, 1, [Use axel library])
382     AXEL_CFLAGS="$CPPFLAGS"
383     if test "$with_axel" = "linked" ; then
384       AXEL_LDFLAGS="$LIBS"
385       AC_DEFINE(LINKED_AXEL, 1, [Link axel library with TeXmacs])
386     fi
388     AC_MSG_RESULT(no)]))
391 CPPFLAGS="$SAVE_CPPFLAGS"
392 LDFLAGS="$SAVE_LDFLAGS"
393 LIBS="$SAVE_LIBS"
395 AC_SUBST(AXEL_CFLAGS)
396 AC_SUBST(AXEL_LDFLAGS)
398 #--------------------------------------------------------------------
399 # Checks for ghostscript library
400 #--------------------------------------------------------------------
402 case "${host}" in
403   *mingw* | *-*-cygwin)
404     GS_EXE="gswin32c.exe"
405     GS_DLL="gsdll32.dll"
406     AC_CHECK_PROG([HAS_GS_EXE], [${GS_EXE}], [yes], [no])
407     AC_CHECK_PROG([HAS_GS_LIB], [${GS_DLL}], [yes], [no])
408   ;;
409   *)
410     AC_CHECK_PROG([HAS_GS_EXE], [gs], [yes], [no])
411     HAS_GS_LIB="yes"
412   ;;
413 esac
414 if test "x${HAS_GS_EXE}" = "xyes" -a "x${HAS_GS_LIB}" = "xyes"; then
415   AC_DEFINE([USE_GS], [1], [Use ghostscript])
416   CONFIG_GS="Ghostscript"
417   AC_SUBST([CONFIG_GS])
418   AC_SUBST([GS_EXE])
419   AC_SUBST([GS_DLL])
420 else
421   AC_MSG_RESULT([disabling ghostscript support])
424 #--------------------------------------------------------------------
425 # Fixes for erroneous behaviour of gcc/g++ and guile on some systems
426 #--------------------------------------------------------------------
428 AC_MSG_CHECKING(whether ... arguments behave correctly)
429 if test -z "$GUILE_CFLAGS"; then
430   CXXFLAGS="`guile-config compile`"
431 else
432   CXXFLAGS="$GUILE_CFLAGS"
434 AC_TRY_COMPILE([
435   #include <guile/gh.h>
436   #include <libguile.h>
437   typedef SCM (*FN)(...);
438   static SCM identity (SCM x) { return x; }
439   void declare () { gh_new_procedure ("identity", (FN) identity, 1, 0, 0); }
442   AC_DEFINE(DOTS_OK, 1, [Defined if ...-style argument passing works])
443   AC_MSG_RESULT(yes)
445   AC_MSG_RESULT(no)
447 CXXFLAGS=""
449 AC_MSG_CHECKING(the size_t of guile strings)
450 if test -z "$GUILE_CFLAGS"; then
451   CXXFLAGS="`guile-config compile`"
452 else
453   CXXFLAGS="$GUILE_CFLAGS"
455 AC_TRY_COMPILE([
456   #include <guile/gh.h>
457   #include <libguile.h>
458   void print_string (SCM s) {
459     int len_r;
460     char* r= gh_scm2newstr (s, &len_r); }
463   AC_DEFINE(guile_str_size_t, int, [Guile string size type])
464   AC_MSG_RESULT(int)
466   AC_DEFINE(guile_str_size_t, size_t, [Guile string size type])
467   AC_MSG_RESULT(size_t)
469 CXXFLAGS=""
471 AC_MSG_CHECKING([if statically linking with guile works])
472 SAVE_CPPFLAGS="$CPPFLAGS"
473 SAVE_LDFLAGS="$LDFLAGS"
474 SAVE_LIBS="$LIBS"
475 CPPFLAGS="$GUILE_CFLAGS"
476 LDFLAGS="-static"
477 LIBS="$GUILE_LDFLAGS"
478 TEXMACS_LINK_GUILE([tm_link_guile_static="yes"],
479                    [tm_link_guile_static="no"])
480 AC_MSG_RESULT(["$tm_link_guile_static"])
481 if test "$tm_link_guile_static" = "no" ; then
482    AC_MSG_CHECKING([if it works with -lltdl])
483    LIBS="$GUILE_LDFLAGS -lltdl"
484    TEXMACS_LINK_GUILE([tm_link_guile_static_ltdl="yes"],
485                       [tm_link_guile_static_ltdl="no"])
486    AC_MSG_RESULT(["$tm_link_guile_static_ltdl"])
487    if test "$tm_link_guile_static_ltdl" = "yes" ; then
488       GUILE_LDFLAGS="$GUILE_LDFLAGS -lltdl"
489    else
490       AC_MSG_CHECKING([if it works with -lltdl -ldl])
491       LIBS="$GUILE_LDFLAGS -lltdl -ldl"
492       TEXMACS_LINK_GUILE([tm_link_guile_static_ltdl_ldl="yes"],
493                          [tm_link_guile_static_ltdl_ldl="no"])
494       AC_MSG_RESULT(["$tm_link_guile_static_ltdl_ldl"])
495       if test "$tm_link_guile_static_ltdl_ldl" = "yes" ; then
496          GUILE_LDFLAGS="$GUILE_LDFLAGS -lltdl -ldl"
497       else
498          AC_MSG_WARN([unable to link statically with guile])
499       fi
500    fi
502 CPPFLAGS="$SAVE_CPPFLAGS"
503 LDFLAGS="$SAVE_LDFLAGS"
504 LIBS="$SAVE_LIBS"
506 #--------------------------------------------------------------------
507 # Handle different systems case by case
508 #--------------------------------------------------------------------
510 CONFIG_OS="GNU_LINUX"
511 CONFIG_OS_SUFFIX="gnu-linux"
512 CONFIG_OS_COMPAT="Unix"
513 CONFIG_MACOS=""
514 CONFIG_CXXFLAGS=""
515 CONFIG_CXXTEMPLATE=""
516 CONFIG_STD_SETENV="#define STD_SETENV"
517 CONFIG_SO="so"
518 CONFIG_LIB_PATH="LD_LIBRARY_PATH"
519 CONFIG_CHMOD="chmod -f"
520 CONFIG_CXXOPTIMIZE="-O2"
521 CONFIG_BSTATIC="-Wl,-Bstatic"
522 CONFIG_BSHARED="-Wl,-Bdynamic"
523 CONFIG_BFLAGS=""
524 CONFIG_BPATH="-Wl,-rpath,"
525 CONFIG_LDRT=""
526 CONFIG_WORD_LENGTH="4"
527 CONFIG_WORD_LENGTH_INC="3"
528 CONFIG_WORD_MASK="0xfffffffc"
529 CONFIG_MAX_FAST="260 // WORD_LENGTH more than power of 2"
530 # tweak for XCode project
531 CONFIG_NATIVE_ARCH_TAG="NATIVE_ARCH"
533 X11_CFLAGS="$X_CFLAGS"
534 X11_LDFLAGS="$X_LIBS -lXext -lX11"
536 AC_CHECK_SIZEOF(void *)
537 AC_MSG_CHECKING(if we are on a 64-bits computer)
538 if test "$ac_cv_sizeof_void_p" = "8"; then
539   AC_MSG_RESULT([yes])
540   CONFIG_WORD_LENGTH="8"
541   CONFIG_WORD_LENGTH_INC="7"
542   CONFIG_WORD_MASK="0xfffffffffffffff8"
543   CONFIG_MAX_FAST="264 // WORD_LENGTH more than power of 2"
544 else
545   AC_MSG_RESULT([no])
548 case "${host}" in
549   i*86-*-linux* | x86_64-*-linux*)
550     AC_MSG_RESULT(final adjustments for an Intel or AMD GNU/Linux host)
551     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
552   ;;
553   i*86-*-freebsd* | x86_64-*-freebsd*)
554     AC_MSG_RESULT(final adjustments for an Intel or AMD GNU/BSD host)
555     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
556   ;;
557   i*86-*-solaris*)
558     AC_MSG_RESULT(final adjustments for an Intel or AMS Solaris host)
559     CONFIG_CXXOPTIMIZE="-O3"
560     CONFIG_BPATH="-Wl,-R,"
561     X11_LDFLAGS="$X_LIBS -lXext -lX11 -lsocket"
562   ;;
563   *mingw*)
564     AC_MSG_RESULT([final adjustments for mingw host])
565     CONFIG_OS_COMPAT="Windows"
566     CONFIG_LDRT="-lmingw32 -lmingwex"
567   ;;
568   *-*-cygwin)
569     AC_MSG_RESULT(final adjustments for cygwin host)
570     CONFIG_OS="CYGWIN"
571     CONFIG_BFLAGS="-Wl,-stack,8388608"
572 #    CXX="export CYGWIN=check_case:strict; $CXX"
573 #    AC_SUBST(CXX)
574   ;;
575   *apple*darwin*)
576     echo "$ac_t""final adjustments for a MacOS host" 1>&6
577     CONFIG_OS="MACOS"
578     CONFIG_CXXFLAGS="-I${prefix}/include"
579     CONFIG_BSHARED=""
580     CONFIG_BFLAGS="-framework Cocoa"
581     CONFIG_BPATH=""
582     CONFIG_SO="dylib"
583     CONFIG_LIB_PATH="DYLD_LIBRARY_PATH"
584   ;;
585   *darwin*)
586     echo "$ac_t""final adjustments for a generic Darwin host" 1>&6
587     CONFIG_CXXFLAGS="-I${prefix}/include"
588     CONFIG_BSHARED=""
589     CONFIG_BPATH=""
590     CONFIG_SO="dylib"
591     CONFIG_LIB_PATH="DYLD_LIBRARY_PATH"
592   ;;
593   powerpc-*-linux*)
594     AC_MSG_RESULT(final adjustments for a PowerPC/GNU-linux host)
595     CONFIG_OS="POWERPC_GNU_LINUX"
596     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
597   ;;
598   *sun*)
599     AC_MSG_RESULT(final adjustments for a SUN/solaris host)
600     CONFIG_OS="SUN"
601     CONFIG_OS_SUFFIX="sun"
602     CONFIG_BSTATIC=""
603     CONFIG_BSHARED=""
604     CONFIG_BPATH="-Wl,-R,"
605     X11_LDFLAGS="$X_LIBS -lXext -lX11 -lsocket"
606     CONFIG_WORD_LENGTH="8"
607     CONFIG_WORD_LENGTH_INC="7"
608     CONFIG_WORD_MASK="0xfffffff8"
609     CONFIG_MAX_FAST="264 // WORD_LENGTH more than power of 2"
610     CONFIG_STD_SETENV=""
611   ;;
612   sparc*-*-linux*)
613     AC_MSG_RESULT(final adjustments for a Sparc host running GNU/Linux)
614     CONFIG_CXXOPTIMIZE="-O3 -fexpensive-optimizations"
615     CONFIG_WORD_LENGTH="8"
616     CONFIG_WORD_LENGTH_INC="7"
617     CONFIG_WORD_MASK="0xfffffff8"
618     CONFIG_MAX_FAST="264 // WORD_LENGTH more than power of 2"
619     CONFIG_STD_SETENV=""
620   ;;
621   *dec*)
622     AC_MSG_RESULT(final adjustments for a DEC/alpha host)
623     CONFIG_BSTATIC=""
624     CONFIG_BSHARED="-shared"
625     CONFIG_STD_SETENV=""
626   ;;
627   *alpha*-*-linux*)
628     AC_MSG_RESULT(final adjustments for an Alpha GNU/Linux host)
629     CONFIG_BSTATIC=""
630     CONFIG_BSHARED="-shared"
631   ;;
632   s390-*-linux*)
633     AC_MSG_RESULT(final adjustments for an IBM S/390 GNU/Linux host)
634     CONFIG_STD_SETENV=""
635   ;;
636   ia64-*-linux*)
637     AC_MSG_RESULT(final adjustments for an Itanium GNU/Linux host)
638     CONFIG_BSTATIC=""
639     CONFIG_BSHARED="-shared"
640   ;;
641   hppa*-*-linux*)
642     AC_MSG_RESULT(final adjustments for an HP PA_RISC GNU/Linux host)
643     CONFIG_CXXFLAGS="$CONFIG_CXXFLAGS -fPIC"
644     CONFIG_BSTATIC=""
645     CONFIG_BSHARED="-shared"
646   ;;
647   *sgi-irix*)
648     echo "$ac_t""final adjustments for a SGI/Irix host" 1>&6
649     CONFIG_OS="IRIX"
650     CONFIG_CXXFLAGS=""
651     X_LIBS=-L/usr/lib32
652     CONFIG_BSTATIC=""
653     CONFIG_BSHARED=""
654     CONFIG_BPATH=""
655     X11_LDFLAGS="$X_LIBS -lX11"
656     CONFIG_WORD_MASK="0xfffffff8"
657     CONFIG_STD_SETENV=""
658     CONFIG_CHMOD="chmod"
659     CONFIG_LIB_PATH="LD_LIBRARYN32_PATH"
660   ;;
661   m68k-*-linux* | mips-*-linux* | mipsel-*-linux* | arm*-*-linux*)
662     AC_MSG_RESULT(final adjustments for a supported GNU/Linux host)
663   ;;
664   *-linux*)
665     AC_MSG_RESULT(final adjustments for a generic GNU/Linux host)
666   ;;
667   *)
668     AC_MSG_RESULT(final adjustments for a generic host)
669   ;;
670 esac
672 case "${host}" in
673   *apple*darwin10*)
674     echo "$ac_t""Xcode 3.2 project tweak (only MacOSX 10.6)" 1>&6
675     CONFIG_NATIVE_ARCH_TAG="NATIVE_ARCH_ACTUAL"
676   ;;
677 esac
679 #--------------------------------------------------------------------
680 # Temporary fix for link problem
681 #--------------------------------------------------------------------
683 case "$GXX_VERSION" in
684      3.* | 4.*)
685          CONFIG_BSTATIC="-static"
686          CONFIG_BSHARED="-dynamic"
687      ;;
688 esac
690 #--------------------------------------------------------------------
691 # Memory allocation options
692 #--------------------------------------------------------------------
694 AC_ARG_ENABLE(fastalloc,
695 [  --disable-fastalloc     omit fast allocator for small objects],
696     [], [enable_fastalloc="yes"])
697 case "$enable_fastalloc" in
698     yes)
699         ;;
700     no)
701         AC_MSG_RESULT([disabling fast allocator for small objects])
702         AC_DEFINE(NO_FAST_ALLOC, 1, [Disable fast memory allocator])
703         ;;
704     *)
705         AC_MSG_ERROR([bad option --enable-fastalloc=$enable_fastalloc])
706         ;;
707 esac
709 #--------------------------------------------------------------------
710 # Experimental options
711 #--------------------------------------------------------------------
713 AC_ARG_ENABLE(experimental,
714 [  --enable-experimental   support new style rewriting code],
715     [], [enable_experimental="no"])
716 case "$enable_experimental" in
717     yes)
718         AC_MSG_RESULT([enabling experimental style rewriting code])
719         AC_DEFINE(EXPERIMENTAL, 1, [Enable experimental style rewriting code])
720         CONFIG_EXPERIMENTAL="Memorizer Environment Evaluate"
721         ;;
722     no)
723         AC_MSG_RESULT([disabling experimental style rewriting code])
724         CONFIG_EXPERIMENTAL=""
725         ;;
726     *)
727         AC_MSG_ERROR([bad option --enable-experimental=$enable_experimental])
728         ;;
729 esac
730 AC_SUBST(CONFIG_EXPERIMENTAL)
732 #--------------------------------------------------------------------
733 # MacOS X extensions (spellchecker, image loading)
734 #--------------------------------------------------------------------
736 AC_ARG_ENABLE(macosx-extensions,
737 [  --enable-macosx-extensions   support new style rewriting code],
738     [], [enable_macosx_extensions="no"])
739 case "$enable_macosx_extensions" in
740     yes)
741         AC_MSG_RESULT([enabling Mac OSX extensions])
742         AC_DEFINE(MACOSX_EXTENSIONS, 1, [Enabling Mac OSX extensions])
743         CONFIG_MACOS="MacOS"
744         ;;
745     no)
746         AC_MSG_RESULT([disabling Mac OSX extensions])
747         CONFIG_MACOS=""
748         ;;
749     *)
750         AC_MSG_ERROR([bad option --enable-macosx-extensions=$enable_macosx_extensions])
751         ;;
752 esac
753 AC_SUBST(CONFIG_MACOS)
755 #--------------------------------------------------------------------
756 # Gui selection
757 #--------------------------------------------------------------------
759 CONFIG_X11=""
760 CONFIG_COCOA=""
761 CONFIG_GUI="X11"
763 AC_ARG_ENABLE(qt,
764 [  --enable-qt             replace X11 by Qt interface],
765     [], [enable_qt="no"])
767 case "$enable_qt" in
768     yes)
769         HACKED_AT_WITH_QT
770         if test x"$at_cv_qt_build" = xko; then 
771            AC_MSG_ERROR([cannot find Qt!])
772         else
773            AC_MSG_RESULT([enabling experimental Qt port])
774            CONFIG_GUI="QT"
775         fi
776         ;;
777     no)
778         AC_MSG_RESULT([disabling experimental Qt port])
779         ;;
780     *)
781         AC_MSG_ERROR([bad option --enable-qt=$enable_qt])
782         ;;
783 esac
785 AC_ARG_ENABLE(cocoa,
786 [  --enable-cocoa          replace X11 by Cocoa interface],
787     [], [enable_cocoa="no"])
788 case "$enable_cocoa" in
789     yes)
790         AC_MSG_RESULT([enabling experimental Cocoa port])
791         COCOA_CFLAGS=""
792         COCOA_LDFLAGS="-framework Cocoa"
793         CONFIG_GUI="COCOA"
794         ;;
795     no)
796         AC_MSG_RESULT([disabling experimental Cocoa port])
797         ;;
798     *)
799         AC_MSG_ERROR([bad option --enable-cocoa=$enable_cocoa])
800         ;;
801 esac
803 case "$CONFIG_GUI" in
804     X11)
805         CONFIG_X11="X11 Widkit Ghostscript"
806         CONFIG_GUI_DEFINE="X11TEXMACS"
807 #        AC_DEFINE(X11TEXMACS, 1, [Use standard X11 port])
808         ;;
809     COCOA)
810         CONFIG_COCOA="Cocoa"
811         CONFIG_GUI_DEFINE="AQUATEXMACS"
812 #        AC_DEFINE(AQUATEXMACS, 1, [Enable experimental Cocoa port])
813         ;;
814     QT)
815         CONFIG_QT="Qt"
816         CONFIG_GUI_DEFINE="QTTEXMACS"
817 #        AC_DEFINE(QTTEXMACS, 1, [Enable experimental Qt port])
818         ;;
819 esac
821 AC_SUBST(CPPFLAGS)
822 AC_SUBST(LDFLAGS)
823 AC_SUBST(X11_CFLAGS)
824 AC_SUBST(X11_LDFLAGS)
825 AC_SUBST(COCOA_CFLAGS)
826 AC_SUBST(COCOA_LDFLAGS)
828 AC_SUBST(CONFIG_X11)
829 AC_SUBST(CONFIG_COCOA)
830 AC_SUBST(CONFIG_QT)
831 AC_SUBST(CONFIG_GUI)
832 AC_SUBST(CONFIG_GUI_DEFINE)
834 #--------------------------------------------------------------------
835 # Debugging options
836 #--------------------------------------------------------------------
838 STD_DEBUG_FLAGS="-fno-rtti -fno-exceptions"
839 if test "$enable_cocoa" = "yes"; then
840     STD_DEBUG_FLAGS="-fno-exceptions"
843 AC_MSG_CHECKING(if compiler supports $STD_DEBUG_FLAGS)
844 CXXFLAGS="$STD_DEBUG_FLAGS"
845 AC_TRY_COMPILE([
846   int some_variable = 0;
849     CONFIG_CXXDIALECT="$STD_DEBUG_FLAGS"
850     AC_MSG_RESULT(yes)
852     CONFIG_CXXDIALECT=""
853     AC_MSG_RESULT(no)
855 CXXFLAGS=""
856 AC_SUBST(CONFIG_CXXDIALECT)
858 AC_ARG_ENABLE(debug,
859 changequote(<<, >>)dnl
860 <<  --enable-debug[=ARG]      install a debugging enable executable [-ggdb]>>,
861 changequote([, ])dnl
862 [], [enable_debug="no"])
864 if test "$enable_debug" = "yes"; then
865     if test "$GXX" = "yes"; then
866         enable_debug="-ggdb"
867     else
868         enable_debug="-g3"
869     fi
872 if test "$enable_debug" = "no"; then
873     AC_MSG_RESULT([disabling debugging])
874     CONFIG_STRIP="strip"
875     CONFIG_CXXDEBUG=""
876     optimize_default="yes"
877 else
878     AC_MSG_RESULT([enabling debugging, $enable_debug])
879     CONFIG_STRIP="true"
880     CONFIG_CXXDEBUG="$enable_debug"
881     optimize_default="no"
884 AC_ARG_ENABLE(assert,
885 changequote(<<, >>)dnl
886 <<  --enable-assert           exit on failed assertions in code>>,
887 changequote([, ])dnl
888 [], [enable_assert="yes"])
890 if test "$enable_assert" = "no"; then
891     AC_MSG_RESULT([disabling assertion checking])
892 else
893     AC_MSG_RESULT([enabling assertion checking])
894     AC_DEFINE(DEBUG_ASSERT, 1, [check assertions in code])
897 #--------------------------------------------------------------------
898 # Warning options
899 #--------------------------------------------------------------------
901 case "$GXX_VERSION" in
902   none)
903     CONFIG_CXXWARNING="";
904   ;;
905   *)
906     CONFIG_CXXWARNING="-Wall -Wno-return-type"
907   ;;
908 esac
910 AC_ARG_ENABLE(warnings,
911 [  --enable-warnings       print warning messages during compilation],
912     [], [enable_warnings="yes"])
913 case "$enable_warnings" in
914     yes)
915         AC_MSG_RESULT([enabling warning flags $CONFIG_CXXWARNING]) ;;
916     no)
917         CONFIG_CXXWARNING=""
918         AC_MSG_RESULT([disabling warning flags]) ;;
919     *)
920         CONFIG_CXXWARNING="$enable_warnings"
921         AC_MSG_RESULT([enabling warning flags $CONFIG_CXXWARNING]) ;;
922 esac
924 #--------------------------------------------------------------------
925 # Optimization options
926 #--------------------------------------------------------------------
928 if test "$optimize_default" = "yes"; then
929   case "$GXX_VERSION" in
930     3.3.3 | 3.3.4 | 4.*)
931       ;;
932     2.96 | 3.0 | 3.0.* | 3.1 | 3.1.* | 3.2 | 3.2.* | 3.3 | 3.3.*)
933       case "${host}" in
934         i*86-*-linux-gnu* | i*86-*-freebsd*)
935           AC_MSG_WARN([using g++ 3.*, optimize without inline by default])
936           optimize_default="no-inline"
937         ;;
938         *)
939           AC_MSG_WARN([using g++ 3.*, optimize without inline by default])
940           optimize_default="no-inline"
941         ;;
942       esac
943     ;;
944   esac
947 AC_ARG_ENABLE(optimize,
948 changequote(<<, >>)dnl
949 <<  --enable-optimize[=ARG]   compile with optimizations [guessed]>>,
950 changequote([, ])dnl
951 [], [enable_optimize="$optimize_default"])
953 case "$enable_optimize" in
954     yes)
955         # keep optimization options
956         AC_MSG_RESULT([enabling optimizations, $CONFIG_CXXOPTIMIZE]) ;;
957     no-inline)
958         optimize_no_inline="-fno-default-inline -fno-inline"
959         CONFIG_CXXOPTIMIZE="$CONFIG_CXXOPTIMIZE $optimize_no_inline"
960         AC_MSG_RESULT([enabling optimizations, $CONFIG_CXXOPTIMIZE]) ;;
961     no)
962         CONFIG_CXXOPTIMIZE=""
963         AC_MSG_RESULT([disabling optimizations]) ;;
964     *)
965         CONFIG_CXXOPTIMIZE="$enable_optimize"
966         AC_MSG_RESULT([customizing optimizations, $enable_optimize]) ;;
967 esac
969 #--------------------------------------------------------------------
970 # Substitute TeXmacs specific configuration parameters
971 #--------------------------------------------------------------------
973 AC_SUBST(CONFIG_OS)
974 AC_SUBST(CONFIG_OS_SUFFIX)
975 AC_SUBST(CONFIG_OS_COMPAT)
976 AC_SUBST(CONFIG_CXXWARNING)
977 AC_SUBST(CONFIG_CXXTEMPLATE)
978 AC_SUBST(CONFIG_CXXOPTIMIZE)
979 AC_SUBST(CONFIG_CXXDEBUG)
980 AC_SUBST(CONFIG_BFLAGS)
981 AC_SUBST(CONFIG_BSTATIC)
982 AC_SUBST(CONFIG_BSHARED)
983 AC_SUBST(CONFIG_BPATH)
984 AC_SUBST(CONFIG_WORD_LENGTH)
985 AC_SUBST(CONFIG_WORD_LENGTH_INC)
986 AC_SUBST(CONFIG_WORD_MASK)
987 AC_SUBST(CONFIG_MAX_FAST)
988 AC_SUBST(CONFIG_CXXFLAGS)
989 AC_SUBST(CONFIG_STD_SETENV)
990 AC_SUBST(CONFIG_SO)
991 AC_SUBST(CONFIG_LIB_PATH)
992 AC_SUBST(CONFIG_STRIP)
993 AC_SUBST(CONFIG_CHMOD)
994 AC_SUBST(CONFIG_LDRT)
995 AC_SUBST(CONFIG_NATIVE_ARCH_TAG)
997 #--------------------------------------------------------------------
998 # Default paths for installation
999 #--------------------------------------------------------------------
1001 if test "$prefix" = ""; then
1002   prefix=/usr/local
1004 if test "$prefix" = "NONE"; then
1005   prefix=/usr/local
1007 if test "$exec_prefix" = ""; then
1008   exec_prefix='${prefix}'
1010 if test "$exec_prefix" = "NONE"; then
1011   exec_prefix='${prefix}'
1013 if test "$exec_prefix" = '${prefix}'; then
1014   exec_prefix='${prefix}'
1016 if test "$includedir" = ""; then
1017   includedir='${prefix}/include'
1019 if test "$includedir" = "NONE"; then
1020   includedir='${prefix}/include'
1022 if test "$includedir" = '${prefix}/include'; then
1023   includedir='${prefix}/include'
1025 if test "$libdir" = ""; then
1026   libdir='${exec_prefix}/lib'
1028 if test "$libdir" = "NONE"; then
1029   libdir='${exec_prefix}/lib'
1031 if test "$libdir" = '${exec_prefix}/lib'; then
1032   libdir='${exec_prefix}/lib'
1034 if test "$bindir" = ""; then
1035   bindir='${exec_prefix}/bin'
1037 if test "$bindir" = "NONE"; then
1038   bindir=${exec_prefix}/bin
1040 if test "$bindir" = '${exec_prefix}/bin'; then
1041   bindir='${exec_prefix}/bin'
1043 if test "$datarootdir" = ""; then
1044   datarootdir='${prefix}/share'
1046 if test "$datarootdir" = "NONE"; then
1047   datarootdir='${prefix}/share'
1049 if test "$datarootdir" = '${prefix}/share'; then
1050   datarootdir='${prefix}/share'
1052 if test "$datadir" = ""; then
1053   datadir='${prefix}/share'
1055 if test "$datadir" = "NONE"; then
1056   datadir='${prefix}/share'
1058 if test "$datadir" = '${prefix}/share'; then
1059   datadir='${prefix}/share'
1061 if test "$mandir" = ""; then
1062   mandir='${datarootdir}/man'
1064 if test "$mandir" = "NONE"; then
1065   mandir='${datarootdir}/man'
1067 if test "$mandir" = '${datarootdir}/man'; then
1068   mandir='${datarootdir}/man'
1070 if test "$libexecdir" = ""; then
1071   libexecdir='${exec_prefix}/libexec'
1073 if test "$libexecdir" = "NONE"; then
1074   libexecdir='${exec_prefix}/libexec'
1076 if test "$libexecdir" = '${exec_prefix}/libexec'; then
1077   libexecdir='${exec_prefix}/libexec'
1080 curdir="`pwd`"
1081 tmorig=${curdir}
1082 tmdir=${PACKAGE}
1083 tmsrc=${curdir}/${tmdir}
1084 tmbin=${libexecdir}/${tmdir}
1085 tmdata=${datadir}/${tmdir}
1086 AC_SUBST(tmorig)
1087 AC_SUBST(tmdir)
1088 AC_SUBST(tmsrc)
1089 AC_SUBST(tmbin)
1090 AC_SUBST(tmdata)
1092 if test "$DEVEL_RELEASE" = "1"; then
1093   tmtgz=${PACKAGE}-${DEVEL_VERSION}
1094 else
1095   tmtgz=${PACKAGE}-${DEVEL_VERSION}-R${DEVEL_RELEASE}
1097 tmrpm=${PACKAGE}-${DEVEL_VERSION}-${DEVEL_RELEASE}
1098 if test "$STABLE_RELEASE" = "1"; then
1099   tmstgz=${PACKAGE}-${STABLE_VERSION}
1100 else
1101   tmstgz=${PACKAGE}-${STABLE_VERSION}-R${STABLE_RELEASE}
1103 tmsrpm=${PACKAGE}-${STABLE_VERSION}-${STABLE_RELEASE}
1104 if test "$WINDOWS_RELEASE" = "1"; then
1105   tmwin=wintexmacs-${WINDOWS_VERSION}
1106 else
1107   tmwin=wintexmacs-${WINDOWS_VERSION}-R${WINDOWS_RELEASE}
1109 AC_SUBST(tmtgz)
1110 AC_SUBST(tmrpm)
1111 AC_SUBST(tmstgz)
1112 AC_SUBST(tmsrpm)
1113 AC_SUBST(tmwin)
1115 #--------------------------------------------------------------------
1116 # Done
1117 #--------------------------------------------------------------------
1119 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)