Bill Nottingham 918e2e9
commit 68999be213755c14b27b89cdca2dfd5bb569b82c
Bill Nottingham 918e2e9
Author: Christian Stimming <stimming@tuhh.de>
Bill Nottingham 918e2e9
Date:   Fri Apr 22 19:43:39 2011 +0000
Bill Nottingham 918e2e9
Bill Nottingham 918e2e9
    Replace guile configure check by PKG_CHECK_MODULE so that it also works in cross-compiling.
Bill Nottingham 918e2e9
    
Bill Nottingham 918e2e9
    git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20585 57a11ea4-9604-0410-9ed3-97b8803252fd
Bill Nottingham 918e2e9
Bill Nottingham 918e2e9
diff --git a/Makefile.am b/Makefile.am
Bill Nottingham 918e2e9
index 012ed5b..965873e 100644
Bill Nottingham 918e2e9
--- a/Makefile.am
Bill Nottingham 918e2e9
+++ b/Makefile.am
Bill Nottingham 918e2e9
@@ -45,7 +45,6 @@ EXTRA_DIST = \
Bill Nottingham 918e2e9
   macros/binreloc.m4 \
Bill Nottingham 918e2e9
   macros/compiler-flags.m4 \
Bill Nottingham 918e2e9
   macros/ac_pkg_swig.m4 \
Bill Nottingham 918e2e9
-  macros/gnome-guile-checks.m4 \
Bill Nottingham 918e2e9
   macros/legacy_macros.m4 \
Bill Nottingham 918e2e9
   po/gnucash.pot \
Bill Nottingham 918e2e9
   po/POTFILES.in \
Bill Nottingham 918e2e9
diff --git a/configure.ac b/configure.ac
Bill Nottingham 918e2e9
index 54c3fc4..8a0f501 100644
Bill Nottingham 918e2e9
--- a/configure.ac
Bill Nottingham 918e2e9
+++ b/configure.ac
Bill Nottingham 918e2e9
@@ -368,8 +368,18 @@ if test "x$GUILE_INCS" != x; then
Bill Nottingham 918e2e9
   saved_GUILE_INCS="$GUILE_INCS"
Bill Nottingham 918e2e9
 fi
Bill Nottingham 918e2e9
 GUILE_LIBS=""
Bill Nottingham 918e2e9
-GNOME_CHECK_GUILE
Bill Nottingham 918e2e9
 
Bill Nottingham 918e2e9
+# Look up GUILE_CFLAGS and GUILE_LIBS, and version check
Bill Nottingham 918e2e9
+PKG_CHECK_MODULES(GUILE, [guile-1.8 >= 1.8.5], , [AC_MSG_ERROR([
Bill Nottingham 918e2e9
+
Bill Nottingham 918e2e9
+  guile does not appear to be installed correctly, or is not in the
Bill Nottingham 918e2e9
+  correct version range.  Perhaps you have not installed the guile
Bill Nottingham 918e2e9
+  development packages?  Gnucash requires at least version 1.8.5 to build.
Bill Nottingham 918e2e9
+])])
Bill Nottingham 918e2e9
+# Look up GUILE executable
Bill Nottingham 918e2e9
+AC_PATH_PROG(GUILE, guile)
Bill Nottingham 918e2e9
+
Bill Nottingham 918e2e9
+GUILE_INCS="${GUILE_CFLAGS}"
Bill Nottingham 918e2e9
 if test "x$saved_GUILE_LIBS" != x; then
Bill Nottingham 918e2e9
   GUILE_LIBS="$saved_GUILE_LIBS"
Bill Nottingham 918e2e9
 fi
Bill Nottingham 918e2e9
@@ -379,26 +389,12 @@ fi
Bill Nottingham 918e2e9
 
Bill Nottingham 918e2e9
 AS_SCRUB_INCLUDE(GUILE_INCS)
Bill Nottingham 918e2e9
 AC_SUBST(GUILE_LIBS)
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-AM_GUILE_VERSION_CHECK(1.8.5, , , [AC_MSG_ERROR([
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-  guile does not appear to be installed correctly, or is not in the
Bill Nottingham 918e2e9
-  correct version range.  Perhaps you have not installed the guile
Bill Nottingham 918e2e9
-  development packages?  Gnucash requires at least version 1.8.5 to build.
Bill Nottingham 918e2e9
-])])
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
 AC_SUBST(GUILE)
Bill Nottingham 918e2e9
-AC_DEFINE_UNQUOTED(GNC_GUILE_MAJOR_VERSION, ${guile_major_version},
Bill Nottingham 918e2e9
-    [Guile Major version number])
Bill Nottingham 918e2e9
-AC_DEFINE_UNQUOTED(GNC_GUILE_MINOR_VERSION, ${guile_minor_version},
Bill Nottingham 918e2e9
-    [Guile Minor version number])
Bill Nottingham 918e2e9
-AC_DEFINE_UNQUOTED(GNC_GUILE_MICRO_VERSION, ${guile_micro_version},
Bill Nottingham 918e2e9
-    [Guile Micro version number])
Bill Nottingham 918e2e9
 
Bill Nottingham 918e2e9
-AS_SCRUB_INCLUDE(CFLAGS)
Bill Nottingham 918e2e9
 
Bill Nottingham 918e2e9
 ### Check size of long_long - some guile's are broken.
Bill Nottingham 918e2e9
 AC_MSG_CHECKING(if guile long_long is at least as big as gint64)
Bill Nottingham 918e2e9
+AS_SCRUB_INCLUDE(CFLAGS)
Bill Nottingham 918e2e9
 GNC_OLDCFLAGS="$CFLAGS"
Bill Nottingham 918e2e9
 GNC_OLDLDFLAGS="$LDFLAGS"
Bill Nottingham 918e2e9
 CFLAGS="${GNOME_CFLAGS} ${GUILE_INCS} ${CFLAGS} ${GLIB_CFLAGS}"
Bill Nottingham 918e2e9
diff --git a/macros/gnome-guile-checks.m4 b/macros/gnome-guile-checks.m4
Bill Nottingham 918e2e9
deleted file mode 100644
Bill Nottingham 918e2e9
index da2aa93..0000000
Bill Nottingham 918e2e9
--- a/macros/gnome-guile-checks.m4
Bill Nottingham 918e2e9
+++ /dev/null
Bill Nottingham 918e2e9
@@ -1,118 +0,0 @@
Bill Nottingham 918e2e9
-dnl
Bill Nottingham 918e2e9
-dnl GNOME_CHECK_GUILE (failflag)
Bill Nottingham 918e2e9
-dnl
Bill Nottingham 918e2e9
-dnl if failflag is "fail" then GNOME_CHECK_GUILE will abort if guile is not found.
Bill Nottingham 918e2e9
-dnl
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-AC_DEFUN([GNOME_CHECK_GUILE],
Bill Nottingham 918e2e9
-[
Bill Nottingham 918e2e9
-	saved_ldflags="$LDFLAGS"
Bill Nottingham 918e2e9
-	saved_cppflags="$CPPFLAGS"
Bill Nottingham 918e2e9
-	LDFLAGS="$LDFLAGS $GNOME_LIBDIR"
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	AC_CHECK_LIB(qthreads,qt_null,[
Bill Nottingham 918e2e9
-		QTTHREADS_LIB="-lqthreads"
Bill Nottingham 918e2e9
-	],[
Bill Nottingham 918e2e9
-		AC_CHECK_LIB(qt, qt_null, QTTHREADS_LIB="-lqt")
Bill Nottingham 918e2e9
-	],$LIBS)
Bill Nottingham 918e2e9
-	AC_SUBST(QTTHREADS_LIB)
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	AC_CHECK_LIB(termcap,main,TERMCAP_LIB="-ltermcap")
Bill Nottingham 918e2e9
-	AC_CHECK_LIB(readline,main,READLINE_LIB="-lreadline",,$TERMCAP_LIB)
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	AC_SUBST(TERMCAP_LIB)
Bill Nottingham 918e2e9
-	AC_SUBST(READLINE_LIB)
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	if test "x$cross_compiling" = "xyes" ; then
Bill Nottingham 918e2e9
-	  name_build_guile="$target_alias-guile-config"
Bill Nottingham 918e2e9
-	else
Bill Nottingham 918e2e9
-	  name_build_guile="guile-config"
Bill Nottingham 918e2e9
-	fi
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no)
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	if test "x$BUILD_GUILE" = "xyes"; then
Bill Nottingham 918e2e9
-	    AC_MSG_CHECKING(whether $name_build_guile works)
Bill Nottingham 918e2e9
-	    if test x`$name_build_guile --version >/dev/null 2>&1 || \
Bill Nottingham 918e2e9
-		echo no` = xno; then
Bill Nottingham 918e2e9
-		BUILD_GUILE=no
Bill Nottingham 918e2e9
-	    fi
Bill Nottingham 918e2e9
-	    AC_MSG_RESULT($BUILD_GUILE)
Bill Nottingham 918e2e9
-	else
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	    if test "x$cross_compiling" = "xyes" ; then
Bill Nottingham 918e2e9
-		name_build_guile="$target_alias-build-guile"
Bill Nottingham 918e2e9
-	    else	
Bill Nottingham 918e2e9
-		name_build_guile="build-guile"
Bill Nottingham 918e2e9
-	    fi
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	    AC_CHECK_PROG(BUILD_GUILE, $name_build_guile, yes, no)
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	    if test "x$BUILD_GUILE" = "xyes"; then
Bill Nottingham 918e2e9
-		AC_MSG_CHECKING(whether $name_build_guile works)
Bill Nottingham 918e2e9
-		if test x`$name_build_guile --version >/dev/null 2>&1 || \
Bill Nottingham 918e2e9
-	 	    echo no` = xno; then
Bill Nottingham 918e2e9
-		    BUILD_GUILE=no
Bill Nottingham 918e2e9
-		fi
Bill Nottingham 918e2e9
-		AC_MSG_RESULT($BUILD_GUILE)
Bill Nottingham 918e2e9
-	    fi
Bill Nottingham 918e2e9
-	fi
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	AC_CHECK_LIB(m, sin)
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	if test "x$BUILD_GUILE" = "xyes"; then
Bill Nottingham 918e2e9
-		AC_MSG_CHECKING(for guile libraries)
Bill Nottingham 918e2e9
-		GUILE_LIBS="`$name_build_guile link`"
Bill Nottingham 918e2e9
-		AC_MSG_RESULT($GUILE_LIBS)
Bill Nottingham 918e2e9
-		AC_MSG_CHECKING(for guile headers)
Bill Nottingham 918e2e9
-		GUILE_INCS="`$name_build_guile compile`"
Bill Nottingham 918e2e9
-		AC_MSG_RESULT($GUILE_INCS)
Bill Nottingham 918e2e9
-	else
Bill Nottingham 918e2e9
-		GUILE_LIBS="$GNOME_LIBDIR"
Bill Nottingham 918e2e9
-		GUILE_INCS="$GNOME_INCLUDEDIR"
Bill Nottingham 918e2e9
-		AC_CHECK_LIB(rx, main, GUILE_LIBS="-lrx $GUILE_LIBS")
Bill Nottingham 918e2e9
-		AC_CHECK_LIB(qt, qt_null, GUILE_LIBS="-lqt $GUILE_LIBS")
Bill Nottingham 918e2e9
-		AC_CHECK_LIB(dl, dlopen, GUILE_LIBS="-ldl $GUILE_LIBS")
Bill Nottingham 918e2e9
-		AC_CHECK_LIB(nsl, t_accept, GUILE_LIBS="$GUILE_LIBS -lnsl")
Bill Nottingham 918e2e9
-		AC_CHECK_LIB(socket, socket, GUILE_LIBS="$GUILE_LIBS -lsocket")
Bill Nottingham 918e2e9
-		GUILE_LIBS="-lguile $GUILE_LIBS $QTTHREADS_LIB $READLINE_LIB $TERMCAP_LIB"
Bill Nottingham 918e2e9
-	fi
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	AC_SUBST(GUILE_LIBS)
Bill Nottingham 918e2e9
-	AC_SUBST(GUILE_INCS)
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	saved_LIBS="$LIBS"
Bill Nottingham 918e2e9
-	LIBS="$LIBS $GUILE_LIBS"
Bill Nottingham 918e2e9
-	CPPFLAGS="$saved_cppflags $GUILE_INCS"
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	AC_MSG_CHECKING(whether guile works)
Bill Nottingham 918e2e9
-	AC_TRY_LINK([
Bill Nottingham 918e2e9
-		#include <libguile.h>
Bill Nottingham 918e2e9
-	],[
Bill Nottingham 918e2e9
-		scm_c_eval_string("(newline)");
Bill Nottingham 918e2e9
-		scm_boot_guile(0,NULL,NULL,NULL);
Bill Nottingham 918e2e9
-	],[
Bill Nottingham 918e2e9
-		ac_cv_guile_found=yes
Bill Nottingham 918e2e9
-		AC_DEFINE(HAVE_GUILE,1,[Guile present])
Bill Nottingham 918e2e9
-	],[
Bill Nottingham 918e2e9
-		ac_cv_guile_found=no
Bill Nottingham 918e2e9
-	])
Bill Nottingham 918e2e9
-	AC_MSG_RESULT($ac_cv_guile_found)
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	if test x$ac_cv_guile_found = xno ; then
Bill Nottingham 918e2e9
-		if test x$1 = xfail ; then
Bill Nottingham 918e2e9
-		  AC_MSG_ERROR(Can not find Guile on this system)
Bill Nottingham 918e2e9
-		else
Bill Nottingham 918e2e9
-		  AC_MSG_WARN(Can not find Guile on this system)
Bill Nottingham 918e2e9
-		fi
Bill Nottingham 918e2e9
-		ac_cv_guile_found=no
Bill Nottingham 918e2e9
-		GUILE_LIBS= GUILE_INCS=
Bill Nottingham 918e2e9
-	fi
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	LIBS="$saved_LIBS"
Bill Nottingham 918e2e9
-	LDFLAGS="$saved_ldflags"
Bill Nottingham 918e2e9
-	CPPFLAGS="$saved_cppflags"
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-	AC_SUBST(GUILE_LIBS)
Bill Nottingham 918e2e9
-	AM_CONDITIONAL(GUILE, test x$ac_cv_guile_found = xyes)
Bill Nottingham 918e2e9
-])