This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cross compile and checking for C compiler default output file name


Hello,

In newlib-1.15.0, the following hunk had been added to
libgloss/m68k/configure.in

 @@ -81,7 +43,29 @@
  LD=${LD-ld}
  AC_SUBST(LD)
  AC_PROG_RANLIB
 +LIB_AM_PROG_AS
  
 +AC_MSG_CHECKING([target cpu family])
 +DO=m68k
 +dnl Temporarily modify LDFLAGS so that link tests will succeed without
 +dnl a C library.  Note that we may not have a C librabry yet and that
 +dnl autoconf automatically adds script to check whether we can create
 +dnl an executable or not.
 +dnl
 +saved_LDFLAGS="$LDFLAGS"
 +LDFLAGS="-nostdlib -e main"
 +AC_PREPROC_IFELSE([#ifndef __mcoldfire__
 +               #error we are not coldfire
 +               #endif],
 +              DO="cf",)
 +AC_PREPROC_IFELSE([#ifndef __mfido__
 +               #error we are not fido
 +               #endif],
 +              DO="fido",)
 +LDFLAGS=$saved_LDFLAGS
 +AC_MSG_RESULT($DO)
 +AC_SUBST(DO)
 +
  host_makefile_frag=${srcdir}/../config/default.mh
  target_makefile_frag=${srcdir}/../config/default.mt
  

This causes the configure script to fail when building newlib for a cross
compiler, since cross compiler do _not_ create executables. Here's the
error message:

 configure:2336: checking for C compiler default output file name
 configure:2339: m68k-coff-gcc -B/var/tmp/builds/crossgcc/build/newlib/m68k-coff/m68000/newlib/ -isystem /var/tmp/builds/crossgcc/build/newlib/m68k-coff/m68000/newlib/targ-include -isystem /var/tmp/builds/crossgcc/src/newlib-1.15.0/newlib/libc/include  -m68000 -nostdlib -e main conftest.c  >&5
 /tmp/ccWpP6Cn.o(.text+0x6):conftest.c: undefined reference to `__main'
 collect2: ld returned 1 exit status
 configure:2342: $? = 1
 configure: failed program was:
 | /* confdefs.h.  */
 |
 | #define PACKAGE_NAME ""
 | #define PACKAGE_TARNAME ""
 | #define PACKAGE_VERSION ""
 | #define PACKAGE_STRING ""
 | #define PACKAGE_BUGREPORT ""
 | /* end confdefs.h.  */
 |
 | int
 | main ()
 | {
 |
 |   ;
 |   return 0;
 | }
 configure:2381: error: C compiler cannot create executables
 See `config.log' for more details.

This is detected wrong, since my (cross-) compiler _can_ create working
executables, at least with newslib-1.14.0.

Any hints how to work around this problem?


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