unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH]: Cross building and Cygwin fixes.
@ 2002-07-03 16:25 Jan Nieuwenhuizen
  2002-07-07 20:35 ` Marius Vollmer
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Nieuwenhuizen @ 2002-07-03 16:25 UTC (permalink / raw)
  Cc: Han-Wen

Hi,

Today I spent making a fresh Guile patch to get it compiled for
Cygwin, and to fix cross building issues that were introduced during
Guile's 1.5 development cycle.

It's against latest 1.6 CVS, making use of autoconf, automake, and
libtool from CVS, that are supposed to have fresh fixes for Cygwin.

I still can't get the shared version to link:

    /bin/sh ../libtool --mode=link gcc -I/home/cygwin/cygwin-1.3.10/usr/include -L/home/cygwin/cygwin-1.3.10/usr/lib -L/home/cygwin/cygwin-1.3.10/usr/lib/w32api -L/home/cygwin/cygwin-1.3.10/usr/bin  -O2 -g -Wall -Wmissing-prototypes   -o guile.exe -dlpreopen force guile.o libguile.la -lm 
libtool: link: not configured to extract global symbols from dlpreopened files
    gcc -I/home/cygwin/cygwin-1.3.10/usr/include -O2 -g -Wall -Wmissing-prototypes -o guile.exe guile.o  -L/home/cygwin/cygwin-1.3.10/usr/lib -L/home/cygwin/cygwin-1.3.10/usr/lib/w32api -L/home/cygwin/cygwin-1.3.10/usr/bin ./.libs/libguile.a /home/fred/cvs/guile/cygwin/libltdl/.libs/libltdl.a
guile.o: In function `main':
    /home/fred/cvs/guile/cygwin/libguile/../../guile-core-1.6/libguile/guile.c:90: undefined reference to `lt_preloaded_symbols'

but the static version cross builds fine.  Of course, I'm enquiring at
Cygwin and will continue to look into this.

Please let me know what needs to be done to get this into CVS.

Greetings,
Jan.


Index: ChangeLog
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/ChangeLog,v
retrieving revision 1.281.2.72
diff -p -u -r1.281.2.72 ChangeLog
--- ChangeLog	6 May 2002 19:15:04 -0000	1.281.2.72
+++ ChangeLog	3 Jul 2002 15:40:16 -0000
@@ -1,3 +1,13 @@
+2002-07-03  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* autogen.sh: Only fix libltdl/configure.in if it exists.  Current
+	libtool CVS does not need this fix.
+
+	* configure.in (AC_LIBTOOL_WIN32_DLL): Add for shared Cygwin
+	build.
+	Add --with-cc-for-build option to re-enable cross building.
+	Add --with-guile-for-build option to re-enable cross building.
+
 2002-05-06  Marius Vollmer  <mvo@zagadka.ping.de>
 
 	* configure.in: Include <sys/types.h> before <netinet/in.h> when
Index: autogen.sh
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/autogen.sh,v
retrieving revision 1.11.2.10
diff -p -u -r1.11.2.10 autogen.sh
--- autogen.sh	1 May 2002 21:05:26 -0000	1.11.2.10
+++ autogen.sh	3 Jul 2002 15:40:16 -0000
@@ -47,11 +47,14 @@ $mscripts/render-bugs > BUGS
 rm -rf libltdl
 libtoolize --force --copy --automake --ltdl
 
+# Fix older versions of libtool.
 # Make sure we use a ./configure.in compatible autoconf in ./libltdl/
-mv libltdl/configure.in libltdl/configure.tmp
-echo 'AC_PREREQ(2.50)' > libltdl/configure.in
-cat libltdl/configure.tmp >> libltdl/configure.in
-rm libltdl/configure.tmp
+if [ -f libltdl/configure.in ]; then
+	mv libltdl/configure.in libltdl/configure.tmp
+	echo 'AC_PREREQ(2.50)' > libltdl/configure.in
+	cat libltdl/configure.tmp >> libltdl/configure.in
+	rm libltdl/configure.tmp
+fi
 ######################################################################
 
 autoheader
Index: configure.in
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/configure.in,v
retrieving revision 1.157.2.19
diff -p -u -r1.157.2.19 configure.in
--- configure.in	6 May 2002 19:11:00 -0000	1.157.2.19
+++ configure.in	3 Jul 2002 15:40:17 -0000
@@ -155,6 +155,9 @@ AC_ISC_POSIX
 AC_MINIX
 
 AM_PROG_CC_STDC
+
+## Needed for building DLLs on Cygwin, before AM_PROG_LIBTOOL
+AC_LIBTOOL_WIN32_DLL
 AM_PROG_LIBTOOL
 
 AC_CHECK_PROG(have_makeinfo, makeinfo, yes, no)
@@ -621,6 +624,54 @@ if test "${THREAD_PACKAGE}" != "" ; then
   fi
 fi
 
+## Cross building	
+if test "$cross_compiling" = "yes"; then
+  AC_MSG_CHECKING(cc for build)
+  ## /usr/bin/cc still uses wrong assembler
+  ## CC_FOR_BUILD="${CC_FOR_BUILD-/usr/bincc}"
+  CC_FOR_BUILD="${CC_FOR_BUILD-PATH=/usr/bin:$PATH cc}"
+else
+  CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
+fi   
+AC_ARG_WITH(cc-for-build,
+  [  --with-cc-for-build=CC  native C compiler, to be used during build])
+test -n "$with_cc_for_build" && CC_FOR_BUILD="$with_cc_for_build"
+     
+## AC_MSG_CHECKING("if we are cross compiling")
+## AC_MSG_RESULT($cross_compiling)
+if test "$cross_compiling" = "yes"; then
+   AC_MSG_RESULT($CC_FOR_BUILD)
+fi
+
+## No need as yet to be more elaborate
+CCLD_FOR_BUILD="$CC_FOR_BUILD"
+
+AC_SUBST(cross_compiling)
+AC_SUBST(CC_FOR_BUILD)
+AC_SUBST(CCLD_FOR_BUILD)
+	
+## libtool erroneously calls CC_FOR_BUILD HOST_CC;
+## --HOST is the platform that PACKAGE is compiled for.
+HOST_CC="$CC_FOR_BUILD"
+AC_SUBST(HOST_CC)
+
+if test "$cross_compiling" = "yes"; then
+  AC_MSG_CHECKING(guile for build)
+  GUILE_FOR_BUILD="${GUILE_FOR_BUILD-guile}"
+else
+  GUILE_FOR_BUILD='$(top_builddir_absolute)/pre-inst-guile'
+fi   
+AC_ARG_WITH(guile-for-build,
+  [  --with-guile-for-build=CC  native guile executable, to be used during build])
+test -n "$with_guile_for_build" && GUILE_FOR_BUILD="$with_cc_for_build"
+
+## AC_MSG_CHECKING("if we are cross compiling")
+## AC_MSG_RESULT($cross_compiling)
+if test "$cross_compiling" = "yes"; then
+   AC_MSG_RESULT($GUILE_FOR_BUILD)
+fi
+AC_SUBST(GUILE_FOR_BUILD)
+  			
 ## If we're using GCC, ask for aggressive warnings.
 case "$GCC" in
   yes )
Index: am/ChangeLog
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/am/ChangeLog,v
retrieving revision 1.1.2.4
diff -p -u -r1.1.2.4 ChangeLog
--- am/ChangeLog	1 Apr 2002 20:02:29 -0000	1.1.2.4
+++ am/ChangeLog	3 Jul 2002 15:40:17 -0000
@@ -1,3 +1,8 @@
+2002-07-03  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* pre-inst-guile (preinstguile): Initialize with
+	$(GUILE_FOR_BUILD) configure parameter.
+
 2002-04-01  Thien-Thi Nguyen  <ttn@giblet.glug.org>
 
 	* maintainer-dirs: Remove "if MAINTAINER_MODE" conditional.
Index: am/pre-inst-guile
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/am/pre-inst-guile,v
retrieving revision 1.1.2.1
diff -p -u -r1.1.2.1 pre-inst-guile
--- am/pre-inst-guile	26 Feb 2002 11:12:18 -0000	1.1.2.1
+++ am/pre-inst-guile	3 Jul 2002 15:40:17 -0000
@@ -28,7 +28,7 @@
 
 ## Code:
 
-preinstguile     = $(top_builddir_absolute)/pre-inst-guile
+preinstguile     = $(GUILE_FOR_BUILD)
 preinstguiletool = GUILE="$(preinstguile)" $(top_srcdir)/scripts
 
 ## am/pre-inst-guile ends here
Index: libguile/ChangeLog
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/ChangeLog,v
retrieving revision 1.1465.2.92
diff -p -u -r1.1465.2.92 ChangeLog
--- libguile/ChangeLog	17 Jun 2002 23:22:45 -0000	1.1465.2.92
+++ libguile/ChangeLog	3 Jul 2002 15:40:20 -0000
@@ -1,3 +1,14 @@
+2002-07-03  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* Makefile.am: Override default rule for c-tokenize.$(OBJECT);
+	this should be compiled for BUILD host.
+	Override default rule for
+	guile_filter_doc_snarfage$(EEXECT); this should run on BUILD host.
+	Add missing $(EXEEXT) to guile_filter_doc_snarfage invocation.
+
+	* guile.c, iselect.h, net_db.c, posix.c, socket.c: Cygwin compile
+	fixes. 
+
 2002-06-18  Marius Vollmer  <mvo@zagadka.ping.de>
 
 	* print.c (scm_simple_format): Print missing part of format before
Index: libguile/Makefile.am
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/Makefile.am,v
retrieving revision 1.138.2.21
diff -p -u -r1.138.2.21 Makefile.am
--- libguile/Makefile.am	9 Apr 2002 17:24:41 -0000	1.138.2.21
+++ libguile/Makefile.am	3 Jul 2002 15:40:20 -0000
@@ -33,14 +33,33 @@ ETAGS_ARGS = --regex='/SCM_\(GLOBAL_\)?\
 
 lib_LTLIBRARIES = libguile.la
 bin_PROGRAMS = guile
+
 noinst_PROGRAMS = guile_filter_doc_snarfage
+guile_filter_doc_snarfage_SOURCES = c-tokenize.c
+
+## Override default rule; this should be compiled for BUILD host.
+## For some reason, OBJEXT does not include the dot
+c-tokenize.$(OBJEXT): c-tokenize.c
+	if [ "$(cross_compiling)" = "yes" ]; then \
+		$(CC_FOR_BUILD) -c -o $@ $<; \
+	else \
+		$(COMPILE) -c -o $@ $<; \
+	fi
+
+## Override default rule; this should run on BUILD host.
+guile_filter_doc_snarfage$(EXEEXT): $(guile_filter_doc_snarfage_OBJECTS) $(guile_filter_doc_snarfage_DEPENDENCIES) 
+	@rm -f guile_filter_doc_snarfage$(EXEEXT)
+	if [ "$(cross_compiling)" = "yes" ]; then \
+		$(CCLD_FOR_BUILD) -o $@ $(guile_filter_doc_snarfage_OBJECTS); \
+	else \
+		$(LINK) $(guile_filter_doc_snarfage_OBJECTS) $(LDADD) $(LIBS); \
+	fi
+
 
 guile_SOURCES = guile.c
 guile_LDADD = libguile.la
 guile_LDFLAGS = @DLPREOPEN@
 
-guile_filter_doc_snarfage_SOURCES = c-tokenize.c
-
 libguile_la_SOURCES = alist.c arbiters.c async.c backtrace.c boolean.c	    \
     chars.c continuations.c debug.c deprecation.c dynl.c dynwind.c	    \
     environments.c eq.c error.c eval.c evalext.c extensions.c		    \
@@ -197,7 +216,7 @@ SUFFIXES = .x .doc
 .c.doc:
 	-(test -n "${AWK+set}" || AWK="@AWK@"; ${AWK} -f ./guile-func-name-check $<)
 	(./guile-snarf-docs $(snarfcppopts) $< | \
-	./guile_filter_doc_snarfage --filter-snarfage) > $@ || { rm $@; false; }
+	./guile_filter_doc_snarfage$(EXEEXT) --filter-snarfage) > $@ || { rm $@; false; }
 
 $(DOT_X_FILES) $(EXTRA_DOT_DOC_FILES): snarf.h guile-snarf.in
 
Index: libguile/guile.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/guile.c,v
retrieving revision 1.8
diff -p -u -r1.8 guile.c
--- libguile/guile.c	26 Jun 2001 17:53:09 -0000	1.8
+++ libguile/guile.c	3 Jul 2002 15:40:21 -0000
@@ -55,7 +55,8 @@
 #include <libltdl/ltdl.h>
 #endif
 
-#ifdef HAVE_WINSOCK2_H
+#if defined (HAVE_WINSOCK2_H) \
+  && !(defined (__CYGWIN32__) || defined (__CYGWIN__))
 #include <winsock2.h>
 #endif
 
Index: libguile/iselect.h
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/iselect.h,v
retrieving revision 1.9.2.1
diff -p -u -r1.9.2.1 iselect.h
--- libguile/iselect.h	19 Jul 2001 21:28:54 -0000	1.9.2.1
+++ libguile/iselect.h	3 Jul 2002 15:40:21 -0000
@@ -67,7 +67,8 @@
 #include <sys/select.h>
 #endif
 
-#ifdef HAVE_WINSOCK2_H
+#if defined (HAVE_WINSOCK2_H) \
+  && !(defined (__CYGWIN32__) || defined (__CYGWIN__))
 #include <winsock2.h>
 #endif
 
Index: libguile/net_db.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/net_db.c,v
retrieving revision 1.62.2.3
diff -p -u -r1.62.2.3 net_db.c
--- libguile/net_db.c	15 Mar 2002 09:23:19 -0000	1.62.2.3
+++ libguile/net_db.c	3 Jul 2002 15:40:21 -0000
@@ -65,7 +65,8 @@
 
 #include <sys/types.h>
 
-#ifdef HAVE_WINSOCK2_H
+#if defined (HAVE_WINSOCK2_H) \
+  && !(defined (__CYGWIN32__) || defined (__CYGWIN__))
 #include <winsock2.h>
 #else
 #include <sys/socket.h>
Index: libguile/posix.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/posix.c,v
retrieving revision 1.92.2.5
diff -p -u -r1.92.2.5 posix.c
--- libguile/posix.c	15 Mar 2002 10:33:37 -0000	1.92.2.5
+++ libguile/posix.c	3 Jul 2002 15:40:22 -0000
@@ -95,7 +95,8 @@ extern char *ttyname();
 #ifdef HAVE_IO_H
 #include <io.h>
 #endif
-#ifdef HAVE_WINSOCK2_H
+#if defined (HAVE_WINSOCK2_H) \
+  && !(defined (__CYGWIN32__) || defined (__CYGWIN__))
 #include <winsock2.h>
 #endif
 
Index: libguile/socket.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/socket.c,v
retrieving revision 1.80.2.3
diff -p -u -r1.80.2.3 socket.c
--- libguile/socket.c	15 Mar 2002 09:23:19 -0000	1.80.2.3
+++ libguile/socket.c	3 Jul 2002 15:40:22 -0000
@@ -61,7 +61,8 @@
 #include <unistd.h>
 #endif
 #include <sys/types.h>
-#ifdef HAVE_WINSOCK2_H
+#if defined (HAVE_WINSOCK2_H) \
+  && !(defined (__CYGWIN32__) || defined (__CYGWIN__))
 #include <winsock2.h>
 #else
 #include <sys/socket.h>


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


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: [PATCH]: Cross building and Cygwin fixes.
@ 2002-07-03 17:06 Jan Nieuwenhuizen
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Nieuwenhuizen @ 2002-07-03 17:06 UTC (permalink / raw)
  Cc: Han-Wen


Hi,

This didn't make it into the patch, obviously.  I was not familiar
with the workbook symlinks.

Jan.

Index: INSTALL
===================================================================
RCS file: /cvsroot/guile/guile/workbook/build/dist-files/INSTALL,v
retrieving revision 1.1
diff -p -u -r1.1 INSTALL
--- INSTALL	31 Mar 2002 21:45:53 -0000	1.1
+++ INSTALL	3 Jul 2002 17:02:51 -0000
@@ -199,6 +199,29 @@ switches specific to Guile you may find 
 --disable-regex       ---  omit regular expression interfaces
 
 
+Cross building Guile  =====================================================
+
+As of guile-1.5.x, the build process uses compiled C files for
+snarfing, and (indirectly, through libtool) for linking, and uses the
+guile executable for generating documentation.
+
+When cross building guile, you first need to configure, build and
+install guile for your build host.
+
+Then, you may configure guile for cross building, eg:
+
+    ./configure --host=i686-pc-cygwin --disable-shared
+
+Two special options for cross building are available:
+
+--with-cc-for-build      --- native C compiler, to be used during build
+                             defaults to: `PATH=/usr/bin:$PATH cc'
+
+--with-guile-for-build   --- native C compiler, to be used during build
+                             defaults to: `guile', assuming you just
+                             installed this guile natively.
+
+
 Using Guile Without Installing It =========================================
 
 If you want to run Guile without installing it, set the environment

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


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2002-07-10 20:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-03 16:25 [PATCH]: Cross building and Cygwin fixes Jan Nieuwenhuizen
2002-07-07 20:35 ` Marius Vollmer
2002-07-08  9:04   ` Han-Wen Nienhuys
2002-07-08 18:12     ` Marius Vollmer
2002-07-08  9:52   ` Jan Nieuwenhuizen
2002-07-09 18:08     ` Marius Vollmer
2002-07-10  0:37       ` Jan Nieuwenhuizen
2002-07-10 19:34         ` Marius Vollmer
2002-07-10 19:52           ` Marius Vollmer
2002-07-10 20:02             ` Jan Nieuwenhuizen
  -- strict thread matches above, loose matches on Subject: below --
2002-07-03 17:06 Jan Nieuwenhuizen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).