Fixes for MinGW build
[texmacs.git] / src / aclocal.m4
blob65f81a9775fba9e2ce3c79abedbc6d4043322dc8
2 #-------------------------------------------------------------------
3 # Modified version of GUILE_FLAGS in guile.m4
4 # from the official guile distribution
5 #-------------------------------------------------------------------
7 AC_DEFUN([GUILE_FLAGS],[
8 ## The GUILE_FLAGS macro.
9   ## First, let's just see if we can find Guile at all.
10   AC_MSG_CHECKING(for Guile)
11   guile-config link > /dev/null || {
12     echo "configure: cannot find guile-config; is Guile installed?" 1>&2
13     exit 1
14   }
15   GUILE_ORIGINAL_CFLAGS="`guile-config compile`"
16   GUILE_CFLAGS="$GUILE_ORIGINAL_CFLAGS"
17   GUILE_VARIANT_CFLAGS="$GUILE_ORIGINAL_CFLAGS $GUILE_ORIGINAL_CFLAGS/guile $GUILE_ORIGINAL_CFLAGS/libguile"
18   GUILE_LDFLAGS="`guile-config link`"
19   GUILE_VARIANT_LDFLAGS="-L`guile-config info libdir` -lguile -lreadline -ltermcap"
20   AC_SUBST(GUILE_CFLAGS)
21   AC_SUBST(GUILE_LDFLAGS)
22   AC_MSG_RESULT(yes)
25 #-------------------------------------------------------------------
26 # For autodetection of flags required to link statically with Guile
27 #-------------------------------------------------------------------
29 AC_DEFUN(TEXMACS_LINK_GUILE,
30 [AC_TRY_LINK([
31 #include <guile/gh.h>
32 $CONFIG_DOTS
33 ],[
34   struct dummy {
35     static void my_main (int argc, char** argv) {}
36     static void install_guile () {
37 #ifdef DOTS_OK
38       gh_enter (0, NULL, (void (*)(...)) ((void*) my_main));
39 #else
40       gh_enter (0, NULL, my_main);
41 #endif
42     }
43   };
44   dummy::install_guile ();
45 ], $1, $2)
48 #-------------------------------------------------------------------
49 # Modify the X include files to make them C++-compatible, if needed
50 #-------------------------------------------------------------------
52 AC_DEFUN(CPP_X_HEADERS,[
53 AC_MSG_CHECKING(for C++-compatible X header files)
54 ac_save_cppflags="$CPPFLAGS"
55 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
56 AC_TRY_COMPILE([#include <X11/Xlib.h>
57 #include <X11/Xutil.h>],,
58 echo yes,
59 [rm -rf X11
60 mkdir X11
61 for ac_dir in                \
62   /usr/X11/include           \
63   /usr/X11R6/include         \
64   /usr/X11R5/include         \
65   /usr/X11R4/include         \
66                              \
67   /usr/include/X11           \
68   /usr/include/X11R6         \
69   /usr/include/X11R5         \
70   /usr/include/X11R4         \
71                              \
72   /usr/local/X11/include     \
73   /usr/local/X11R6/include   \
74   /usr/local/X11R5/include   \
75   /usr/local/X11R4/include   \
76                              \
77   /usr/local/include/X11     \
78   /usr/local/include/X11R6   \
79   /usr/local/include/X11R5   \
80   /usr/local/include/X11R4   \
81                              \
82   /usr/X386/include          \
83   /usr/x386/include          \
84   /usr/XFree86/include/X11   \
85                              \
86   /usr/include               \
87   /usr/local/include         \
88   /usr/unsupported/include   \
89   /usr/athena/include        \
90   /usr/local/x11r5/include   \
91   /usr/lpp/Xamples/include   \
92                              \
93   /usr/openwin/include       \
94   /usr/openwin/share/include \
95   ; \
97   if test -r "$ac_dir/X11/Xlib.h"; then
98     tm_x_includes=$ac_dir
99     break
100   fi
101 done
102 sed 's/^extern \(X[[a-zA-Z0-9]]*(\)/extern int \1/' \
103   < "$tm_x_includes/X11/Xlib.h" > X11/Xlib.h
104 sed 's/^extern \(X[[a-zA-Z0-9]]*(\)/extern int \1/' \
105   < "$tm_x_includes/X11/Xutil.h" > X11/Xutil.h
106 X_CFLAGS="-I.. $X_CFLAGS"
107 echo "no; fixing"])
108 CPPFLAGS="$ac_save_cppflags"
111 #-------------------------------------------------------------------
112 # Support for Qt
113 #-------------------------------------------------------------------
115 m4_include([misc/autotroll/autotroll.m4])
117 AC_DEFUN([HACKED_AT_WITH_QT],[
118   if test -r "/c/Qt"; then
119     moc_bin="`which moc`"
120     moc_dir="`dirname $moc_bin`"
121     qt_home="`dirname $moc_dir`"
122     QT_CPPFLAGS="-I$qt_home/mkspecs/macx-g++ -I$qt_home/include/QtCore -I$qt_home/include/QtGui -I$qt_home/include -I/$qt_home/include/ActiveQt -I."
123     QT_CXXFLAGS="-pipe -g -Wall -W -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT"
124     QT_LDFLAGS=""
125     QT_LDFLAGS="-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows"
126     QT_LIBS="-L'c:$qt_home/lib' -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4"
127     if test "$moc_bin" = ""; then
128       at_cv_qt_build="ko"
129     fi
130   else
131     AT_WITH_QT
132   fi