diff --git a/acconfig.h b/acconfig.h index c13bfee77e..9abd97ed78 100644 --- a/acconfig.h +++ b/acconfig.h @@ -79,6 +79,10 @@ /* Configure found the function malloc_usable_size */ #define HAVE_MALLOC_USABLE_SIZE +/* g-wrap define */ +#undef GWRAP_OLD_GUILE_SMOB + + /*** Begin i18n ***/ /* internationalization with gettext */ diff --git a/acinclude.m4 b/acinclude.m4 index c857149a9d..188f6ec58a 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,3 +1,107 @@ +dnl g-wrap.m4 +dnl Written by Robert Merkel +dnl Parts ripped off from guile.m4 and ORBit.m4 + +dnl check whether we use the old or new guile smobs + +AC_DEFUN(AC_GWRAP_CHECK_GUILE, +[if test x$GUILE = x ; then + AC_PATH_PROG(GUILE, guile, no) + fi + dnl AC_MSG_WARN(guile is $GUILE) + if test "${GUILE}" = "no" ; then + AC_MSG_ERROR(g-wrap couldn't find guile.) + fi + + dnl If guile uses the old-style smob, then define it. + dnl To make this work, you must have the line + dnl #undef GWRAP_OLD_GUILE_SMOB + dnl in your acconfig.h or config.h.in, and + dnl include that config.h. If not, your code will not + dnl work with guile 1.3 + AC_MSG_CHECKING(for whether guile uses old SMOB format) + if ${GUILE} -c '(if (string=? (version) "1.3") (exit 0) (exit 1))' ; + then + AC_MSG_RESULT(yes) + AC_DEFINE(GWRAP_OLD_GUILE_SMOB) + else + AC_MSG_RESULT(no) + fi +]) + +dnl AM_PATH_GWRAP ([MINIMUM-VERSION, [ACTION-IF-FOUND. +dnl [ACTION-IF-NOT-FOUND]]]) + +dnl tests for minimum versions of g-wrap and g-wrap-config. +dnl sets G_WRAP and G_WRAP_CONFIG + +AC_DEFUN(AM_PATH_GWRAP, +[dnl +dnl +dnl +AC_ARG_WITH(g-wrap-prefix,[ --with-g-wrap-prefix=PFX Prefix where g-wrap is installed (optional)], + gwrap_prefix="$withval", g_wrap_prefix="") + +min_gwrap_version=ifelse([$1], , 0.9.1,$1) + +if test x${GUILE} = x ; then + AC_PATH_PROG(GUILE, guile, no) +fi + +dnl if prefix set, then set them explicitly +if test x${gwrap_prefix} != x ; then + G_WRAP = ${gwrap_prefix}/bin/g-wrap + G_WRAP_CONFIG = ${gwrap_prefix}/bin/g-wrap-config +else + + AC_PATH_PROG(G_WRAP, g-wrap, no) + if test x${G_WRAP} = xno ; then + CHECK_VERSION="no" + ifelse([$3], , true , [AC_MSG_WARN(g-wrap failed) + $3]) + fi + AC_PATH_PROG(G_WRAP_CONFIG, g-wrap-config, no) + if test x${G_WRAP_CONFIG} = xno ; then + CHECK_VERSION="no" + ifelse([$3], , true , [AC_MSG_WARN(g-wrap-config failed) + $3]) + fi +fi + +if test x$CHECK_VERSION != xno ; then +AC_MSG_CHECKING(for g-wrap - version >= ${min_gwrap_version}) + +gwrap_major_version=`${G_WRAP} --version | \ + sed 's/g-wrap \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` +gwrap_minor_version=`${G_WRAP} --version | \ + sed 's/g-wrap \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` +gwrap_micro_version=`${G_WRAP} --version | \ + sed 's/g-wrap \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + +major_required=`echo ${min_gwrap_version} |\ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` +minor_required=`echo ${min_gwrap_version} |\ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` +micro_required=`echo ${min_gwrap_version} |\ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + +if ${GUILE} -c "(cond ((> ${gwrap_major_version} ${major_required}) (exit 0))\ + ((< ${gwrap_major_version} ${major_required}) (exit 1))\ + ((> ${gwrap_minor_version} ${minor_required}) (exit 0))\ + ((< ${gwrap_minor_version} ${minor_required}) (exit 1))\ + ((< ${gwrap_micro_version} ${micro_required}) (exit 1))\ + (else (exit 0)))" ; then + AC_MSG_RESULT(yes) + ifelse([$2], , true, [$2]) +else + AC_MSG_RESULT(no) + ifelse([$3], , true , [AC_MSG_WARN(guile check failed) + $3]) +fi +dnl check version +fi]) + ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- ## Copyright (C) 1996-1999 Free Software Foundation, Inc. ## Originally by Gordon Matzigkeit , 1996 diff --git a/aclocal.m4 b/aclocal.m4 index ca71a5618c..76617dcae2 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -10,6 +10,110 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl PARTICULAR PURPOSE. +dnl g-wrap.m4 +dnl Written by Robert Merkel +dnl Parts ripped off from guile.m4 and ORBit.m4 + +dnl check whether we use the old or new guile smobs + +AC_DEFUN(AC_GWRAP_CHECK_GUILE, +[if test x$GUILE = x ; then + AC_PATH_PROG(GUILE, guile, no) + fi + dnl AC_MSG_WARN(guile is $GUILE) + if test "${GUILE}" = "no" ; then + AC_MSG_ERROR(g-wrap couldn't find guile.) + fi + + dnl If guile uses the old-style smob, then define it. + dnl To make this work, you must have the line + dnl #undef GWRAP_OLD_GUILE_SMOB + dnl in your acconfig.h or config.h.in, and + dnl include that config.h. If not, your code will not + dnl work with guile 1.3 + AC_MSG_CHECKING(for whether guile uses old SMOB format) + if ${GUILE} -c '(if (string=? (version) "1.3") (exit 0) (exit 1))' ; + then + AC_MSG_RESULT(yes) + AC_DEFINE(GWRAP_OLD_GUILE_SMOB) + else + AC_MSG_RESULT(no) + fi +]) + +dnl AM_PATH_GWRAP ([MINIMUM-VERSION, [ACTION-IF-FOUND. +dnl [ACTION-IF-NOT-FOUND]]]) + +dnl tests for minimum versions of g-wrap and g-wrap-config. +dnl sets G_WRAP and G_WRAP_CONFIG + +AC_DEFUN(AM_PATH_GWRAP, +[dnl +dnl +dnl +AC_ARG_WITH(g-wrap-prefix,[ --with-g-wrap-prefix=PFX Prefix where g-wrap is installed (optional)], + gwrap_prefix="$withval", g_wrap_prefix="") + +min_gwrap_version=ifelse([$1], , 0.9.1,$1) + +if test x${GUILE} = x ; then + AC_PATH_PROG(GUILE, guile, no) +fi + +dnl if prefix set, then set them explicitly +if test x${gwrap_prefix} != x ; then + G_WRAP = ${gwrap_prefix}/bin/g-wrap + G_WRAP_CONFIG = ${gwrap_prefix}/bin/g-wrap-config +else + + AC_PATH_PROG(G_WRAP, g-wrap, no) + if test x${G_WRAP} = xno ; then + CHECK_VERSION="no" + ifelse([$3], , true , [AC_MSG_WARN(g-wrap failed) + $3]) + fi + AC_PATH_PROG(G_WRAP_CONFIG, g-wrap-config, no) + if test x${G_WRAP_CONFIG} = xno ; then + CHECK_VERSION="no" + ifelse([$3], , true , [AC_MSG_WARN(g-wrap-config failed) + $3]) + fi +fi + +if test x$CHECK_VERSION != xno ; then +AC_MSG_CHECKING(for g-wrap - version >= ${min_gwrap_version}) + +gwrap_major_version=`${G_WRAP} --version | \ + sed 's/g-wrap \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` +gwrap_minor_version=`${G_WRAP} --version | \ + sed 's/g-wrap \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` +gwrap_micro_version=`${G_WRAP} --version | \ + sed 's/g-wrap \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + +major_required=`echo ${min_gwrap_version} |\ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` +minor_required=`echo ${min_gwrap_version} |\ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` +micro_required=`echo ${min_gwrap_version} |\ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + +if ${GUILE} -c "(cond ((> ${gwrap_major_version} ${major_required}) (exit 0))\ + ((< ${gwrap_major_version} ${major_required}) (exit 1))\ + ((> ${gwrap_minor_version} ${minor_required}) (exit 0))\ + ((< ${gwrap_minor_version} ${minor_required}) (exit 1))\ + ((< ${gwrap_micro_version} ${micro_required}) (exit 1))\ + (else (exit 0)))" ; then + AC_MSG_RESULT(yes) + ifelse([$2], , true, [$2]) +else + AC_MSG_RESULT(no) + ifelse([$3], , true , [AC_MSG_WARN(guile check failed) + $3]) +fi +dnl check version +fi]) + # serial 40 AC_PROG_LIBTOOL AC_DEFUN(AC_PROG_LIBTOOL, diff --git a/config.h.in b/config.h.in index 99967517c3..19a34e7b38 100644 --- a/config.h.in +++ b/config.h.in @@ -77,6 +77,9 @@ #undef HAVE_PNG #undef HAVE_JPEG +/* g-wrap define */ +#undef GWRAP_OLD_GUILE_SMOB + /* Define if you have the __argz_count function. */ #undef HAVE___ARGZ_COUNT diff --git a/configure b/configure index 9ce333c6b3..f47cbc9c74 100755 --- a/configure +++ b/configure @@ -5537,6 +5537,62 @@ then g-wrap 1.1.x will not work with this version of GnuCash." 1>&2; exit 1; } fi +if test x$GUILE = x ; then + # Extract the first word of "guile", so it can be a program name with args. +set dummy guile; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:5545: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GUILE'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GUILE" in + /*) + ac_cv_path_GUILE="$GUILE" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GUILE="$GUILE" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GUILE="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GUILE" && ac_cv_path_GUILE="no" + ;; +esac +fi +GUILE="$ac_cv_path_GUILE" +if test -n "$GUILE"; then + echo "$ac_t""$GUILE" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + if test "${GUILE}" = "no" ; then + { echo "configure: error: g-wrap couldn't find guile." 1>&2; exit 1; } + fi + + echo $ac_n "checking for whether guile uses old SMOB format""... $ac_c" 1>&6 +echo "configure:5584: checking for whether guile uses old SMOB format" >&5 + if ${GUILE} -c '(if (string=? (version) "1.3") (exit 0) (exit 1))' ; + then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define GWRAP_OLD_GUILE_SMOB 1 +EOF + + else + echo "$ac_t""no" 1>&6 + fi + + @@ -5551,7 +5607,7 @@ GUILE_LINK_ARGS="" # Extract the first word of "guile-config", so it can be a program name with args. set dummy guile-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5555: checking for $ac_word" >&5 +echo "configure:5611: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GUILE_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5595,7 +5651,7 @@ fi # Extract the first word of "guile", so it can be a program name with args. set dummy guile; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5599: checking for $ac_word" >&5 +echo "configure:5655: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GUILE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5886,10 +5942,10 @@ s%@GNOME_CFLAGS@%$GNOME_CFLAGS%g s%@GNOME_LIBS@%$GNOME_LIBS%g s%@G_WRAP_CONFIG@%$G_WRAP_CONFIG%g s%@G_WRAP@%$G_WRAP%g +s%@GUILE@%$GUILE%g s%@G_WRAP_COMPILE_ARGS@%$G_WRAP_COMPILE_ARGS%g s%@G_WRAP_LINK_ARGS@%$G_WRAP_LINK_ARGS%g s%@GUILE_CONFIG@%$GUILE_CONFIG%g -s%@GUILE@%$GUILE%g s%@GUILE_COMPILE_ARGS@%$GUILE_COMPILE_ARGS%g s%@GUILE_LINK_ARGS@%$GUILE_LINK_ARGS%g diff --git a/configure.in b/configure.in index 54becf2f5a..fbfc161af7 100644 --- a/configure.in +++ b/configure.in @@ -405,6 +405,8 @@ then g-wrap 1.1.x will not work with this version of GnuCash.]) fi +AC_GWRAP_CHECK_GUILE + AC_SUBST(G_WRAP) AC_SUBST(G_WRAP_CONFIG) AC_SUBST(G_WRAP_COMPILE_ARGS)