m32r-elf libgloss problem in newlib 1.9.0
J. Johnston
jjohnstn@cygnus.com
Mon Jul 30 15:12:00 GMT 2001
Joel Sherrill wrote:
>
> I think this is in spirit the fix but the configure in libgloss
> now fails with this:
>
> configure: error: installation or configuration problem: C compiler
> cannot creat
> e executables.
> configure: error: ../../../../../gcc-30-cvs/libgloss/m32r/configure
> failed for m
> 32r
>
> The i386, i960 and other targets have their own version of AC_PROG_CC
> in their configure.in with this comment:
>
> # FIXME: We temporarily define our own version of AC_PROG_CC. This is
> # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
> # are probably using a cross compiler, which will not be able to fully
> # link an executable. This should really be fixed in autoconf
> # itself.
>
> I think the rationale applies in this case as well. Is the right thing
> a cut and paste or is there a better autoconf macro?
>
The LIB_AC_PROG_CC should be used in this case. Try refreshing the file and applying
the new patch I have attached (has both the gdb stub stuff and the LIB_AC_PROG_CC).
-- Jeff J.
>
> "J. Johnston" wrote:
> >
> > Joel Sherrill wrote:
> > >
> > > The build fails with...
> > >
> > > /usr3/ftp_archive/gnu/gcc/ss/b3/b-m32r-elf/gcc/xgcc
> > > -B/usr3/ftp_archive/gnu/gcc/
> > > ss/b3/b-m32r-elf/gcc/ -nostdinc
> > > -B/usr3/ftp_archive/gnu/gcc/ss/b3/b-m32r-elf/m32
> > > r-elf/newlib/ -isystem
> > > /usr3/ftp_archive/gnu/gcc/ss/b3/b-m32r-elf/m32r-elf/newli
> > > b/targ-include -isystem
> > > /usr3/ftp_archive/gnu/gcc/ss/b3/gcc-30-cvs/newlib/libc/i
> > > nclude -B/opt/gnucross/m32r-elf/bin/ -B/opt/gnucross/m32r-elf/lib/ -isystem
> > > /opt
> > > /gnucross/m32r-elf/include -O2 -g -I.
> > > -I../../../../gcc-30-cvs/libgloss/m32r/..
> > > `if [ -d ./../../newlib ]; then echo -I./../../newlib/targ-include
> > > -I../../../.
> > > ./gcc-30-cvs/libgloss/m32r/../../newlib/libc/include; fi` -O2 -I.
> > > -I../../../../
> > > gcc-30-cvs/libgloss/m32r/.. -c -g -Os
> > > ../../../../gcc-30-cvs/libgloss/m32r/m32r-
> > > lib.c
> > > make[2]: *** No rule to make target
> > > `../../../../gcc-30-cvs/libgloss/m32r/../../
> > > gdb/m32r-stub.c', needed by `m32r-stub.o'. Stop.
> > > make[2]: Leaving directory
> > > `/usr3/ftp_archive/gnu/gcc/ss/b3/b-m32r-elf/m32r-elf/
> > > libgloss/m32r'
> > >
> > > It looks like that the libgloss included with newlib 1.9.0 has never been
> > > built outside a one-source tree with gdb. I just checked CVS and the
> > > Makefile.in still reaches up and over into gdb. How should this be fixed?
> > >
> > > --
> >
> > Try the attached patch which checks at configuration time if the file is in the source tree.
> >
> > -- Jeff J.
> >
Index: libgloss/m32r/Makefile.in
===================================================================
RCS file: /cvs/src/src/libgloss/m32r/Makefile.in,v
retrieving revision 1.1
diff -u -r1.1 Makefile.in
--- libgloss/m32r/Makefile.in 2000/03/17 22:48:50 1.1
+++ libgloss/m32r/Makefile.in 2001/07/30 22:06:35
@@ -64,7 +64,7 @@
CRT0 = crt0.o
GDBLIB = m32r-lib.o
-GDBSTUB = m32r-stub.o
+GDBSTUB = @GDBSTUB@
EVASCRIPT = eva.ld
STUBSCRIPT = eva-stub.ld
Index: libgloss/m32r/configure
===================================================================
RCS file: /cvs/src/src/libgloss/m32r/configure,v
retrieving revision 1.2
diff -u -r1.2 configure
--- libgloss/m32r/configure 2001/07/18 21:26:59 1.2
+++ libgloss/m32r/configure 2001/07/30 22:06:36
@@ -566,6 +566,13 @@
ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+if test -f "${srcdir}/${with_multisrctop}../../gdb/m32r-stub.c"; then
+ GDBSTUB=${srcdir}/${with_multisrctop}../../gdb/m32r-stub.c
+else
+ GDBSTUB=
+fi
+
+
# Do some error checking and defaulting for the host and target type.
# The inputs are:
@@ -594,7 +601,7 @@
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:598: checking host system type" >&5
+echo "configure:605: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -615,7 +622,7 @@
echo "$ac_t""$host" 1>&6
echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:619: checking target system type" >&5
+echo "configure:626: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@@ -633,7 +640,7 @@
echo "$ac_t""$target" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:637: checking build system type" >&5
+echo "configure:644: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -687,7 +694,7 @@
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:691: checking for a BSD compatible install" >&5
+echo "configure:698: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -740,10 +747,18 @@
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+# FIXME: We temporarily define our own version of AC_PROG_CC. This is
+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
+# are probably using a cross compiler, which will not be able to fully
+# link an executable. This should really be fixed in autoconf
+# itself.
+
+
+
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:747: checking for $ac_word" >&5
+echo "configure:762: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -773,7 +788,7 @@
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:777: checking for $ac_word" >&5
+echo "configure:792: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -818,92 +833,11 @@
echo "$ac_t""no" 1>&6
fi
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:828: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
- ;;
- esac
- fi
test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:860: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 871 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:902: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:907: checking whether we are using GNU C" >&5
+echo "configure:841: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -912,7 +846,7 @@
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:916: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:850: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -923,15 +857,11 @@
if test $ac_cv_prog_gcc = yes; then
GCC=yes
-else
- GCC=
-fi
-
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:935: checking whether ${CC-cc} accepts -g" >&5
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=
+ echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:865: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -946,20 +876,16 @@
fi
echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ elif test $ac_cv_prog_cc_g = yes; then
CFLAGS="-g -O2"
else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
CFLAGS="-O2"
- else
- CFLAGS=
fi
+else
+ GCC=
+ test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
AS=${AS-as}
@@ -971,7 +897,7 @@
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:975: checking for $ac_word" >&5
+echo "configure:901: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1150,6 +1076,7 @@
s%@oldincludedir@%$oldincludedir%g
s%@infodir@%$infodir%g
s%@mandir@%$mandir%g
+s%@GDBSTUB@%$GDBSTUB%g
s%@host@%$host%g
s%@host_alias@%$host_alias%g
s%@host_cpu@%$host_cpu%g
Index: libgloss/m32r/configure.in
===================================================================
RCS file: /cvs/src/src/libgloss/m32r/configure.in,v
retrieving revision 1.1
diff -u -r1.1 configure.in
--- libgloss/m32r/configure.in 2000/03/17 22:48:50 1.1
+++ libgloss/m32r/configure.in 2001/07/30 22:06:36
@@ -17,12 +17,57 @@
fi
AC_CONFIG_AUX_DIR($libgloss_topdir)
+if test -f "${srcdir}/${with_multisrctop}../../gdb/m32r-stub.c"; then
+ GDBSTUB=${srcdir}/${with_multisrctop}../../gdb/m32r-stub.c
+else
+ GDBSTUB=
+fi
+AC_SUBST(GDBSTUB)
+
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
AC_PROG_INSTALL
+
+# FIXME: We temporarily define our own version of AC_PROG_CC. This is
+# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
+# are probably using a cross compiler, which will not be able to fully
+# link an executable. This should really be fixed in autoconf
+# itself.
+
+AC_DEFUN(LIB_AC_PROG_CC,
+[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_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=
+ AC_PROG_CC_G
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ elif test $ac_cv_prog_cc_g = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-O2"
+ fi
+else
+ GCC=
+ test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+])
-AC_PROG_CC
+LIB_AC_PROG_CC
AS=${AS-as}
AC_SUBST(AS)
AR=${AR-ar}
More information about the Newlib
mailing list