AC_DEFUN([AG_WITHLIB_GUILE],[ AC_ARG_WITH([libguile], AC_HELP_STRING([--with-libguile], [libguile installation prefix]), [ag_cv_with_libguile_root=${with_libguile}], AC_CACHE_CHECK([whether with-libguile was specified], ag_cv_with_libguile_root, ag_cv_with_libguile_root=no) ) # end of AC_ARG_WITH libguile if test "${with_libguile+set}" = set && \ test "${withval}" = no then ## disabled by request ag_cv_with_libguile_root=no ag_cv_with_libguile_cflags=no ag_cv_with_libguile_libs=no else AC_ARG_WITH([libguile-cflags], AC_HELP_STRING([--with-libguile-cflags], [libguile compile flags]), [ag_cv_with_libguile_cflags=${with_guile_cflags}], AC_CACHE_CHECK([whether with-libguile-cflags was specified], ag_cv_with_libguile_cflags, ag_cv_with_libguile_cflags=no) ) # end of AC_ARG_WITH libguile-cflags AC_ARG_WITH([libguile-libs], AC_HELP_STRING([--with-libguile-libs], [libguile link command arguments]), [ag_cv_with_libguile_libs=${with_guile_libs}], AC_CACHE_CHECK([whether with-libguile-libs was specified], ag_cv_with_libguile_libs, ag_cv_with_libguile_libs=no) ) # end of AC_ARG_WITH libguile-libs case "X${ag_cv_with_libguile_cflags}" in Xyes|Xno|X ) case "X${ag_cv_with_libguile_root}" in Xyes|Xno|X ) ag_cv_with_libguile_cflags=no ;; * ) ag_cv_with_libguile_cflags=-I${ag_cv_with_libguile_root}/include ;; esac esac case "X${ag_cv_with_libguile_libs}" in Xyes|Xno|X ) case "X${ag_cv_with_libguile_root}" in Xyes|Xno|X ) ag_cv_with_libguile_libs=no ;; * ) ag_cv_with_libguile_libs="-L${ag_cv_with_libguile_root}/lib -lguile";; esac esac ag_save_CPPFLAGS="${CPPFLAGS}" ag_save_LIBS="${LIBS}" case "X${ag_cv_with_libguile_cflags}" in Xyes|Xno|X ) f=`guile-config compile 2>/dev/null` || f='' test -n "${f}" && ag_cv_with_libguile_cflags="${f}" && \ AC_MSG_NOTICE([guile-config used for CFLAGS: $f]) ;; esac case "X${ag_cv_with_libguile_libs}" in Xyes|Xno|X ) f=`guile-config link 2>/dev/null` || f='' test -n "${f}" && ag_cv_with_libguile_libs="${f}" && \ AC_MSG_NOTICE([guile-config used for LIBS: $f]) ;; esac fi ## disabled by request case "X${ag_cv_with_libguile_cflags}" in Xyes|Xno|X ) ag_cv_with_libguile_cflags="" ;; * ) CPPFLAGS="${CPPFLAGS} ${ag_cv_with_libguile_cflags}" ;; esac case "X${ag_cv_with_libguile_libs}" in Xyes|Xno|X ) LIBS="${LIBS} -lguile" ag_cv_with_libguile_libs="-lguile" ;; * ) LIBS="${LIBS} ${ag_cv_with_libguile_libs}" ;; esac LIBGUILE_CFLAGS="" LIBGUILE_LIBS="" AC_MSG_CHECKING([whether libguile can be linked with]) AC_CACHE_VAL([ag_cv_with_libguile],[ AC_LINK_IFELSE([[@%:@include @%:@include int main () { SCM fumble, bumble, stumble; stumble = scm_cons( fumble, bumble ); stumble = scm_display( fumble, bumble ); stumble = scm_ilength( fumble ); stumble = scm_makstr( 1, 2 ); stumble = gh_eval_str( "stumble" ); scm_misc_error( "oops", "bad", bumble ); stumble = scm_num_eq_p( fumble, bumble ); scm_wrong_type_arg( "oops", 1, bumble ); return 0; }]], [ag_cv_with_libguile=yes], [ag_cv_with_libguile=no]) # end of AC_LINK_IFELSE ]) # end of AC_CACHE_VAL for ag_cv_with_libguile AC_MSG_RESULT([${ag_cv_with_libguile}]) AC_SUBST([LIBGUILE_CFLAGS]) AC_SUBST([LIBGUILE_LIBS]) AC_SUBST([LIBGUILE_PATH]) if test "X${ag_cv_with_libguile}" != Xno then[ LIBGUILE_CFLAGS="${ag_cv_with_libguile_cflags}" LIBGUILE_LIBS="${ag_cv_with_libguile_libs}" case "${LIBGUILE_LIBS}" in *-L* ) LIBGUILE_PATH=`echo ${LIBGUILE_LIBS} | sed 's/.*-L[ ]*//;s/[ ].*//'` ;; * ) LIBGUILE_PATH='' ;; esac] CPPFLAGS="@S|@{ag_save_CPPFLAGS}" LIBS="@S|@{ag_save_LIBS}" else CPPFLAGS="${ag_save_CPPFLAGS}" LIBS="${ag_save_LIBS}" LIBGUILE_CFLAGS='' LIBGUILE_LIBS='' LIBGUILE_PATH='' AC_MSG_ERROR([Cannot find working libguile]) fi AC_SUBST([AG_GUILE]) ]) # end of AC_DEFUN of AG_WITHLIB_GUILE AC_DEFUN([AG_LINK_EVAL_STRING],[ AC_MSG_CHECKING([whether scm_primitive_eval_x links]) AC_CACHE_VAL([ag_cv_link_eval_string],[ ag_save_CPPFLAGS="${CPPFLAGS}" CPPFLAGS="${ag_cv_with_libguile_cflags} ${CPPFLAGS}" ag_save_LIBS="${LIBS}" LIBS="${ag_cv_with_libguile_libs} ${LIBS}" AC_TRY_LINK([@%:@include @%:@include ], [SCM res = scm_primitive_eval_x( SCM_UNDEFINED );], [ag_cv_link_eval_string=yes],[ag_cv_link_eval_string=no] ) # end of TRY_LINK CPPFLAGS="${ag_save_CPPFLAGS}" LIBS="${ag_save_LIBS}" ]) # end of AC_CACHE_VAL for ag_cv_link_eval_string AC_MSG_RESULT([${ag_cv_link_eval_string}]) if test "X${ag_cv_link_eval_string}" = Xno then AC_DEFINE([scm_primitive_eval_x], [scm_eval_x], [Define this if no scm_primitive_eval_x]) AC_DEFINE([scm_t_port], [scm_port], [Define this if no scm_t_port]) fi ]) # end of AC_DEFUN of AG_LINK_EVAL_STRING