This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Cross-development with guile: simple patch


Hi List,

In this new patch, I've included a simple solution for 'guile-config'
when using guile in a cross-development environment.  A simple shell
script, named $build-guile-config will be installed (eg: 
i686-pc-cygwin-guile-config).

This way, packages that need guile-config can get sane results doing
something like this in their configure.in (or, aclocal.m4):


    ## First, let's just see if we can find Guile at all.
    AC_MSG_CHECKING("for guile-config")
    for guile_config in guile-config $build-guile-config; do
        AC_MSG_RESULT("$guile_config")
        if ! $guile_config --version > /dev/null 2>&1 ; then
            AC_MSG_WARN("cannot execute $guile_config")
            AC_MSG_CHECKING("if we are cross compiling")
            guile_config=error
        else
            break
        fi
    done
    if test "$guile_config" = "error"; then
        AC_MSG_ERROR("cannot find guile-config; is Guile installed?")
        exit 1
    fi
    if $guile_config --version 2>&1 | grep -q 'version 1\.[012]'; then
        AC_STEPMAKE_WARN(Guile version 1.3 or better needed)
    fi


What do you think?

Greetings,
Jan.


diff -urN ../guile-core/ChangeLog ./ChangeLog
--- ../guile-core/ChangeLog	Thu Mar 23 12:32:21 2000
+++ ./ChangeLog	Fri Mar 24 11:50:13 2000
@@ -1,3 +1,18 @@
+2000-03-24    <janneke@gnu.org>
+
+	* guile-config/cross-guile-config.in: Simple shell script to
+	take over guile-config's functionality for cross-compilation.
+	It will be installed as ${build}-guile-config.
+
+	* guile-config/Makefile.am: Provide for cross-guile-config.in
+	and its targets.
+
+2000-03-23    <janneke@gnu.org>
+
+	* configure.in: added options to enable cross-compilation:
+	--enable-sizeof-int, --enable-sizeof-long,
+	--enable-restartable-syscalls.
+
 2000-03-19  Mikael Djurfeldt  <mdj@thalamus.nada.kth.se>
 
 	* devel: New directory.  Intended to carry documentation related
diff -urN ../guile-core/configure.in ./configure.in
--- ../guile-core/configure.in	Thu Mar 23 12:32:21 2000
+++ ./configure.in	Fri Mar 24 11:49:48 2000
@@ -68,6 +68,21 @@
   [  --disable-regex         omit regular expression interfaces],,
   enable_regex=yes)
 
+sizeof_int=0
+AC_ARG_ENABLE(sizeof-int, 
+  [  --enable-sizeof-int     Set size of int (for cross compilation)],
+  [sizeof_int=$enableval])
+    
+sizeof_long=0
+AC_ARG_ENABLE(sizeof-long, 
+  [  --enable-sizeof-long    Set size of long (for cross compilation)],
+  [sizeof_long=$enableval])
+    
+restartable_syscalls=test
+AC_ARG_ENABLE(restartable-syscalls,
+  [  --enable-restartable syscalls  Are interrupted syscalls restarted (for cross compilation)],
+  [restartable_syscalls=$enableval])
+    
 dnl The --disable-debug used to control these two.  But now they are
 dnl a required part of the distribution.
 AC_DEFINE(DEBUG_EXTENSIONS)
@@ -108,8 +123,8 @@
 
 AC_C_CONST
 AC_C_INLINE
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(int, $sizeof_int)
+AC_CHECK_SIZEOF(long, $sizeof_long)
 AC_CACHE_CHECK([for long longs], scm_cv_long_longs,
 	       AC_TRY_COMPILE(,
 			      [long long a],
@@ -299,7 +314,15 @@
 dnl behaviour for some reason: e.g., different versions of linux seem
 dnl to behave differently.)
 
-AC_SYS_RESTARTABLE_SYSCALLS
+if test "$restartable_syscalls" = yes ||
+   test "$restartable_syscalls" = y; then
+   AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS)
+elif test "$restartable_syscalls" = no ||
+     test "$restartable_syscalls" = n; then
+   ;
+else
+   AC_SYS_RESTARTABLE_SYSCALLS
+fi
 
 if test "$enable_regex" = yes; then
    if test "$ac_cv_header_regex_h" = yes ||
@@ -362,7 +385,7 @@
 AC_TRY_RUN(aux (l) unsigned long l;
 	     { int x; exit (l >= ((unsigned long)&x)); }
 	   main () { int q; aux((unsigned long)&q); }, 
-	   AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in))
+	   AC_DEFINE(SCM_STACK_GROWS_UP),,AC_MSG_WARN(Guessing that stack grows down -- see scmconfig.h.in), AC_DEFINE(SCM_STACK_GROWS_DOWN))
 
 AC_CACHE_CHECK([whether floats fit in longs], guile_cv_type_float_fits_long,
     [AC_TRY_RUN([main () { exit (sizeof(float) > sizeof(long)); }],
diff -urN ../guile-core/guile-config/Makefile.am ./guile-config/Makefile.am
--- ../guile-core/guile-config/Makefile.am	Tue Feb  1 12:43:56 2000
+++ ./guile-config/Makefile.am	Fri Mar 24 11:50:18 2000
@@ -20,9 +20,9 @@
 ##   to the Free Software Foundation, Inc., 59 Temple Place, Suite
 ##   330, Boston, MA 02111-1307 USA
 
-bin_SCRIPTS=guile-config
-CLEANFILES=guile-config
-EXTRA_DIST=guile-config.in guile.m4
+bin_SCRIPTS=guile-config @build@-guile-config
+CLEANFILES=guile-config @build@-guile-config
+EXTRA_DIST=guile-config.in guile.m4 cross-guile-config.in
 
 ## FIXME: in the future there will be direct automake support for
 ## doing this.  When that happens, switch over.
@@ -39,6 +39,15 @@
 	    -e s:@-GUILE_VERSION-@:${GUILE_VERSION}:
 	chmod +x guile-config.tmp
 	mv guile-config.tmp guile-config
+
+@build@-guile-config: cross-guile-config.in
+	rm -f $<.tmp
+	sed < ${srcdir}/$< > $<.tmp \
+	    -e s:@-SHELL-@:${SHELL}: \
+	    -e s:@-GUILE_VERSION-@:${GUILE_VERSION}:\
+	    -e s:@-PREFIX-@:${prefix}:
+	chmod +x $<.tmp
+	mv $<.tmp $@
 
 ## Get rid of any copies of the configuration script under the old
 ## name, so people don't end up running ancient copies of it.
diff -urN ../guile-core/guile-config/cross-guile-config.in ./guile-config/cross-guile-config.in
--- ../guile-core/guile-config/cross-guile-config.in	Thu Jan  1 01:00:00 1970
+++ ./guile-config/cross-guile-config.in	Fri Mar 24 11:50:25 2000
@@ -0,0 +1,16 @@
+#!@-SHELL-@
+# build-guile-config.in
+case $1 in
+	--version)
+		echo "@-GUILE_VERSION-@"
+		exit 0
+		;;
+	compile)
+		echo "-I @-PREFIX-@/include/guile"
+		exit 0
+		;;
+	link)
+		echo "-L @-PREFIX-@/lib -lguile"
+		exit 0
+		;;
+esac


-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]