2 dnl GNOME_CHECK_GUILE (failflag)
4 dnl if failflag is "fail" then GNOME_CHECK_GUILE will abort if guile is not found.
7 AC_DEFUN([GNOME_CHECK_GUILE],
9 dnl AC_MSG_WARN([Withval is: $withval])
11 if test x$withval = xno ; then
12 guile_msg = 'disabled'
17 AM_CONDITIONAL(GUILE, /bin/false)
21 saved_ldflags="$LDFLAGS"
22 saved_cppflags="$CPPFLAGS"
23 LDFLAGS="$LDFLAGS $GNOME_LIBDIR"
25 AC_CHECK_LIB(qthreads,qt_null,[
26 QTTHREADS_LIB="-lqthreads"
28 AC_CHECK_LIB(qt, qt_null, QTTHREADS_LIB="-lqt")
30 AC_SUBST(QTTHREADS_LIB)
32 AC_CHECK_LIB(termcap,main,TERMCAP_LIB="-ltermcap")
33 AC_CHECK_LIB(readline,main,READLINE_LIB="-lreadline",,$TERMCAP_LIB)
36 AC_SUBST(READLINE_LIB)
38 if test "x$cross_compiling" = "xyes" ; then
39 name_build_guile="$target_alias-guile-config"
41 name_build_guile="guile-config"
44 AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no)
46 if test "x$BUILD_GUILE" = "xyes"; then
47 AC_MSG_CHECKING(whether $name_build_guile works)
48 if test x`$name_build_guile --version >/dev/null 2>&1 || \
52 AC_MSG_RESULT($BUILD_GUILE)
55 if test "x$cross_compiling" = "xyes" ; then
56 name_build_guile="$target_alias-build-guile"
58 name_build_guile="build-guile"
61 AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no)
63 if test "x$BUILD_GUILE" = "xyes"; then
64 AC_MSG_CHECKING(whether $name_build_guile works)
65 if test x`$name_build_guile --version >/dev/null 2>&1 || \
69 AC_MSG_RESULT($BUILD_GUILE)
75 if test "x$BUILD_GUILE" = "xyes"; then
76 AC_MSG_CHECKING(for guile libraries)
77 GUILE_LIBS="`$name_build_guile link`"
78 AC_MSG_RESULT($GUILE_LIBS)
79 AC_MSG_CHECKING(for guile headers)
80 GUILE_INCS="`$name_build_guile compile`"
81 AC_MSG_RESULT($GUILE_INCS)
83 GUILE_LIBS="$GNOME_LIBDIR"
84 GUILE_INCS="$GNOME_INCLUDEDIR"
85 AC_CHECK_LIB(rx, main, GUILE_LIBS="-lrx $GUILE_LIBS")
86 AC_CHECK_LIB(qt, qt_null, GUILE_LIBS="-lqt $GUILE_LIBS")
87 AC_CHECK_LIB(dl, dlopen, GUILE_LIBS="-ldl $GUILE_LIBS")
88 AC_CHECK_LIB(nsl, t_accept, GUILE_LIBS="$GUILE_LIBS -lnsl")
89 AC_CHECK_LIB(socket, socket, GUILE_LIBS="$GUILE_LIBS -lsocket")
90 GUILE_LIBS="-lguile $GUILE_LIBS $QTTHREADS_LIB $READLINE_LIB $TERMCAP_LIB"
97 LIBS="$LIBS $GUILE_LIBS"
98 CPPFLAGS="$saved_cppflags $GUILE_INCS"
100 AC_MSG_CHECKING(whether guile works)
102 #include <libguile.h>
103 #include <guile/gh.h>
105 gh_eval_str("(newline)");
106 scm_boot_guile(0,NULL,NULL,NULL);
108 ac_cv_guile_found=yes
109 AC_DEFINE(HAVE_GUILE)
113 AC_MSG_RESULT($ac_cv_guile_found)
115 guile_msg=$ac_cv_guile_found
117 if test x$ac_cv_guile_found = xno ; then
118 if test x$1 = xfail ; then
119 AC_MSG_ERROR(Can not find Guile on this system)
121 AC_MSG_WARN(Can not find Guile on this system)
124 GUILE_LIBS= GUILE_INCS=
128 LDFLAGS="$saved_ldflags"
129 CPPFLAGS="$saved_cppflags"
132 AM_CONDITIONAL(GUILE, test x$ac_cv_guile_found = xyes)