summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog20
-rw-r--r--Makefile.in23
-rw-r--r--aclocal.m473
-rw-r--r--configure.in47
4 files changed, 154 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index f734bce..778ab13 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+Wed Apr 16 16:55:36 1997 Marcus G. Daniels <marcus@cathcart.sysc.pdx.edu>
+
+ * configure.in: Replace AC_PROG_CC with AC_PROG_CC_LOCAL.
+ If cross compiling do Lex/Yacc checks with BUILD_CC.
+ Check CC and BUILD_CC for libraries having the needed support,
+ and substitute discovery in installed_clib.
+
+ * aclocal.m4: New file. These replacement macros are to handle
+ the case where there is a cross compiler but no supporting files.
+
+ * Makefile.in (installed-clib): Don't hardwire a Hurd libcrt.a.
+ (cross_linkable): Only define cross-migcom variable when it will
+ be possible to build it.
+ (all, install): Use $(cross-migcom).
+ (install): Install cross-migcom only if was to be built.
+ (mkinstalldirs): Add $(bindir), $(includedir)/mach/exec
+ (cross-lexxer.o lexxer.o): lexxer.o needs cpu.h.
+ (./cross-migcom): Prevent dependency generation for cross-* MiG files
+ unless they can actually be built.
+
Thu Apr 17 15:55:40 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* kern/exception.c (exception_no_server): Comment out the suspend
diff --git a/Makefile.in b/Makefile.in
index 9be046c..c549d8e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -20,7 +20,7 @@ srcdir=@srcdir@
systype=@systype@
prefix=@prefix@
-installed-clib=$(prefix)/lib/libcrt.a
+installed-clib=@installed_clib@
exec_prefix=$(prefix)
bootdir=$(exec_prefix)/boot
@@ -31,6 +31,10 @@ bindir=$(exec_prefix)/bin
sysdep = $(srcdir)/$(systype)
cross_compiling=@cross_compiling@
+cross_linkable=@cross_linkable@
+ifeq ($(cross_linkable),yes)
+ cross-migcom = cross-migcom
+endif
# Programs found by configure.
AWK=@AWK@
@@ -275,7 +279,7 @@ CPPFLAGS += -nostdinc $(DEFINES) $(INCLUDES)
MIGFLAGS += $(CPPFLAGS)
-all: kernel cross-migcom cross-mig
+all: kernel $(cross-migcom) cross-mig
#
@@ -293,10 +297,10 @@ kernel: $(objfiles)
#
installed-headers-names = $(addprefix $(includedir)/,$(installed-headers))
installed-sysdep-headers-names = $(addprefix $(includedir)/,$($(systype)-installed-headers))
-install: mkinstalldirs kernel $(installed-headers-names) $(installed-sysdep-headers-names) cross-mig cross-migcom
+install: mkinstalldirs kernel $(installed-headers-names) $(installed-sysdep-headers-names) cross-mig $(cross-migcom)
$(INSTALL_PROGRAM) kernel $(bootdir)/gnumach
$(INSTALL_PROGRAM) cross-mig $(bindir)/mig
- $(INSTALL_PROGRAM) cross-migcom $(libexecdir)/mig
+ test -z "$(cross-migcom)" || $(INSTALL_PROGRAM) cross-migcom $(libexecdir)/mig
-ln -s $(systype) $(includedir)/mach/machine
$(installed-headers-names): $(includedir)/%: $(srcdir)/include/%
@@ -307,7 +311,8 @@ $(installed-sysdep-headers-names): $(includedir)/%: $(sysdep)/include/%
mkinstalldirs:
mkdir -p $(bootdir) $(includedir) $(includedir)/device \
- $(includedir)/mach $(includedir)/mach/$(systype) $(libexecdir)
+ $(includedir)/mach $(includedir)/mach/$(systype) \
+ $(libexecdir) $(includedir)/mach/exec $(bindir)
#
@@ -458,10 +463,13 @@ mig-othersrc = alloc.h boolean.h error.h global.h lexxer.h message.h \
mig_string.h routine.h statement.h type.h utils.h write.h \
lexxer.l parser.y mig.sh parser.h cpu.sym
+cross-lexxer.o lexxer.o: cpu.h
+
mig-files = $(mig-csrcfiles) $(mig-othersrc) ChangeLog
vpath cpu.sym $(srcdir)/mig
+ifeq ($(cross_linkable),yes)
# Don't use $(CPPFLAGS) here; MiG needs none of the Mach headers except
# what happens automagically to build cpu.h.
@@ -483,7 +491,12 @@ $(subst .o,.d,$(cross-mig-objfiles)): cross-%.d: $(srcdir)/mig/%.c
set -e; $(CC) $(CFLAGS) -M -MG -I. -I$(srcdir)/mig $< | \
sed > $@.new -e 's/$*\.o:/cross-$*.o $@:/'
mv -f $@.new $@
+endif
+./cross-mig: $(srcdir)/mig/mig.sh Makefile
+ sed -e 's,@MIGDIR@,$(libexecdir),g' \
+ -e 's,@CPP@,${CC} -x c-header -E,g' \
+ $< >$@.tmp && chmod +x $@.tmp && mv -f $@.tmp $@
ifeq ($(cross_compiling),yes)
# When cross compiling, we build two migcoms; one for our use and one to
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..3d04b82
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,73 @@
+dnl These modifications are to allow for an empty cross compiler tree.
+dnl In the situation that cross-linking is impossible, the variable
+dnl `cross_linkable' will be substituted with "yes".
+
+dnl
+AC_DEFUN(AC_PROG_CC_LOCAL,
+[AC_BEFORE([$0], [AC_PROG_CPP])dnl
+AC_CHECK_PROG(CC, gcc, gcc)
+if test -z "$CC"; then
+ AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
+ test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
+fi
+
+AC_PROG_CC_WORKS_LOCAL
+AC_PROG_CC_GNU
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+dnl Check whether -g works, even if CFLAGS is set, in case the package
+dnl plays around with CFLAGS (such as to build both debugging and
+dnl normal versions of a library), tasteless as that idea is.
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=
+dnl AC_PROG_CC_G
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+dnl # This doesn't work on Linux (libc-4.5.26): Because of differences between
+dnl # the shared and the static libraries there are less symbols available
+dnl # without -g than with -g. It is therefore better to run the configuration
+dnl # without -g and to add -g afterwards than the contrary. So don't add
+dnl # -g to the CFLAGS now.
+dnl elif test $ac_cv_prog_cc_g = yes; then
+dnl CFLAGS="-g -O"
+ else
+dnl CFLAGS="-O"
+ # Add "-O" to both the CC and CPP commands, to eliminate possible confusion
+ # that results from __OPTIMIZE__ being defined for CC but not CPP.
+changequote(, )dnl
+ if echo "$CC " | grep ' -O[1-9 ]' > /dev/null 2>&1; then
+changequote([, ])dnl
+ : # already optimizing
+ else
+ CC="$CC -O"
+ ac_cv_prog_CC="$CC"
+ fi
+ fi
+else
+ GCC=
+dnl # See above.
+dnl test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+])
+
+AC_DEFUN(AC_PROG_CC_WORKS_LOCAL,
+[AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) works])
+AC_LANG_SAVE
+AC_LANG_C
+AC_TRY_COMPILER([main(){return(0);}], ac_cv_prog_cc_works, ac_cv_prog_cc_cross)
+AC_LANG_RESTORE
+AC_MSG_RESULT($ac_cv_prog_cc_works)
+if test $ac_cv_prog_cc_works = no; then
+ cross_linkable=no
+ ac_cv_prog_cc_cross=yes
+ # AC_MSG_ERROR([installation or configuration problem: C compiler cannot create executables.])
+else
+ cross_linkable=yes
+fi
+AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler])
+AC_MSG_RESULT($ac_cv_prog_cc_cross)
+AC_SUBST(cross_linkable)
+cross_compiling=$ac_cv_prog_cc_cross
+])
diff --git a/configure.in b/configure.in
index 50aabe4..1683d3f 100644
--- a/configure.in
+++ b/configure.in
@@ -39,16 +39,55 @@ AC_PREFIX_DEFAULT()
#
# Programs
#
-AC_PROG_CC
+AC_PROG_CC_LOCAL
AC_PROG_AWK
AC_PROG_INSTALL
-AC_PROG_LEX
-AC_PROG_YACC
AC_CHECK_TOOL(MIG, mig, mig)
-if test $host != $build; then
+if test $cross_compiling = yes; then
AC_CHECK_PROG(BUILD_CC, gcc cc)
+ CC=$BUILD_CC
+fi
+
+AC_PROG_LEX
+AC_PROG_YACC
+
+if test $cross_compiling = yes ; then
+ CC=$ac_cv_prog_CC
+fi
+
+
+usable_libc='yes'
+needed_funcs='memcpy memset bcopy bzero htonl ntohl ntohs'
+AC_CHECK_FUNCS($needed_funcs, , usable_libc=no)
+if test $usable_libc = no ; then
+ echo "Support functions not found using $CC, trying $BUILD_CC."
+ CC="$BUILD_CC"
+ for i in $needed_funcs ; do
+ unset ac_cv_func_$i
+ done
+ usable_libc=yes
+ AC_CHECK_FUNCS($needed_funcs, , usable_libc=no)
+ if test $usable_libc = no ; then
+ echo "Configuration problem:" 1>&2
+ echo "Please set installed-clib in the toplevel Makefile so the functions:"
+ echo "$needed_funcs are available."
+ exit 1
+ else
+ changequote(,)
+ set -- `$BUILD_CC -v 2>&1 | sed -n 's/.*from \(.*\)\/lib\/gcc-lib\/\([^/][^/]*\).*/\1 \2/p'`
+ changequote([,])
+ if test -f "$1/$2/lib/libc.a" ; then
+ installed_clib=$1/$2/lib/libc.a
+ else
+ installed_clib=$1/lib/libc.a
+ fi
+ fi
+ CC=$ac_cv_prog_CC
+else
+ installed_clib=$prefix/lib/libcrt.a
fi
+AC_SUBST(installed_clib)
# Set up `machine' link in build directory for easier header file location.
AC_LINK_FILES(${systype}/${systype},machine)