summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--configure.ac11
-rw-r--r--src/Makefile.am7
3 files changed, 20 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 52fdb74..3d2e0fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-03-25  Gilles Chanteperdrix <gilles.chanteperdrix@laposte.net>
+
+	* Fixed support for cross-compilation.
+
 2005-03-03  Herbert Xu <herbert@gondor.apana.org.au>
 
 	* Removed qflag.
diff --git a/configure.ac b/configure.ac
index a986200..2441c63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 dnl $Id$
 AC_INIT(dash, 0.5.2)
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([foreign])
 AC_CONFIG_SRCDIR([src/main.c])
 
 AC_CONFIG_HEADERS(config.h)
@@ -10,6 +10,15 @@ AC_PROG_CC
 AC_GNU_SOURCE
 AC_PROG_YACC
 
+AC_MSG_CHECKING([for build system compiler])
+if test "$cross_compiling" = yes; then
+	CC_FOR_BUILD=${CC_FOR_BUILD-cc}
+else
+	CC_FOR_BUILD=${CC}
+fi
+AC_MSG_RESULT(${CC_FOR_BUILD})
+AC_SUBST(CC_FOR_BUILD)
+
 dnl Checks for libraries.
 
 dnl Checks for header files.
diff --git a/src/Makefile.am b/src/Makefile.am
index 35bdbcf..b0d909c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,7 @@
 AM_CPPFLAGS = -include $(top_builddir)/config.h
 AM_YFLAGS = -d
 
-CFLAGS = -g -O2 -Wall
+AM_CFLAGS = -g -O2 -Wall
 DEFS = \
 	-DBSD=1 -DSMALL -DSHELL \
 	-DGLOB_BROKEN -DFNMATCH_BROKEN -DIFS_BROKEN \
@@ -24,6 +24,8 @@ dash_SOURCES = \
 	show.h system.h trap.h var.h
 dash_LDADD = builtins.o init.o nodes.o signames.o syntax.o
 
+HELPERS = mkinit mksyntax mknodes mksignames
+
 BUILT_SOURCES = arith.h builtins.h nodes.h syntax.h token.h
 CLEANFILES = \
 	$(BUILT_SOURCES) $(patsubst %.o,%.c,$(dash_LDADD)) \
@@ -52,3 +54,6 @@ syntax.c syntax.h: mksyntax
 
 signames.c: mksignames
 	./$^
+
+$(HELPERS): %: %.c
+	$(CC_FOR_BUILD) -o $@ $<