Patchwork libgfortran build failure targeting spu-elf

login
register
mail settings
Submitter Matthias Klose
Date Nov. 11, 2008, 9:13 a.m.
Message ID <18713.19651.796143.540970@gargle.gargle.HOWL>
Download mbox | patch
Permalink /patch/8096/
State New
Headers show

Comments

Matthias Klose - Nov. 11, 2008, 9:13 a.m.
libgfortran fails to build on the trunk when building a cross compiler
targeting spu-elf. Fixing the first two build failures and seeing more.

This is a regression compared to 4.3, but I'm wondering if this is
already fixed on some branch, and was forgotten to check in on the
trunk?

  Matthias

Patch

Index: configure.ac
===================================================================
--- configure.ac	(revision 141763)
+++ configure.ac	(working copy)
@@ -135,18 +135,20 @@ 
 AC_SUBST(AM_CFLAGS)
 AC_SUBST(CFLAGS)
 
-# Check for symbol versioning (copied from libssp).
-AC_MSG_CHECKING([whether symbol versioning is supported])
-cat > conftest.map <<EOF
+if test "x$enable_shared" = "xyes"; then
+  # Check for symbol versioning (copied from libssp).
+  AC_MSG_CHECKING([whether symbol versioning is supported])
+  cat > conftest.map <<EOF
 FOO_1.0 {
   global: *foo*; bar; local: *;
 };
 EOF
-save_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
-AC_TRY_LINK([int foo;],[],[gfortran_use_symver=yes],[gfortran_use_symver=no])
-LDFLAGS="$save_LDFLAGS"
-AC_MSG_RESULT($gfortran_use_symver)
+  save_LDFLAGS="$LDFLAGS"
+  LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
+  AC_TRY_LINK([int foo;],[],[gfortran_use_symver=yes],[gfortran_use_symver=no])
+  LDFLAGS="$save_LDFLAGS"
+  AC_MSG_RESULT($gfortran_use_symver)
+fi
 AM_CONDITIONAL(LIBGFOR_USE_SYMVER, [test "x$gfortran_use_symver" = xyes])
 
 # Find other programs we need.
@@ -158,7 +160,9 @@ 
 
 # Configure libtool
 #AC_MSG_NOTICE([====== Starting libtool configuration])
-AC_LIBTOOL_DLOPEN
+if test "x${with_newlib}" != "xyes"; then
+  AC_LIBTOOL_DLOPEN
+fi
 AM_PROG_LIBTOOL
 AC_SUBST(enable_shared)
 AC_SUBST(enable_static)
@@ -200,15 +204,26 @@ 
 AC_CHECK_MEMBERS([struct stat.st_rdev])
 
 # Check for library functions.
-AC_CHECK_FUNCS(getrusage times mkstemp strtof strtold snprintf ftruncate chsize)
-AC_CHECK_FUNCS(chdir strerror getlogin gethostname kill link symlink perror)
-AC_CHECK_FUNCS(sleep time ttyname signal alarm ctime clock access fork execl)
-AC_CHECK_FUNCS(wait setmode execvp pipe dup2 close fdopen strcasestr getrlimit)
-AC_CHECK_FUNCS(gettimeofday stat fstat lstat getpwuid vsnprintf dup getcwd)
+if test "x${with_newlib}" = "xyes"; then
+   # We are being configured with a cross compiler.  AC_REPLACE_FUNCS
+   # may not work correctly, because the compiler may not be able to
+   # link executables.
 
-# Check for glibc backtrace functions
-AC_CHECK_FUNCS(backtrace backtrace_symbols)
+   # We assume newlib.  This lets us hard-code the functions we know
+   # we'll have.
+   # FIXME ... define for every function in newlib
+   #AC_DEFINE(HAVE_XXX, 1, [Define if you have xxx.])
+else
+  AC_CHECK_FUNCS(getrusage times mkstemp strtof strtold snprintf ftruncate chsize)
+  AC_CHECK_FUNCS(chdir strerror getlogin gethostname kill link symlink perror)
+  AC_CHECK_FUNCS(sleep time ttyname signal alarm ctime clock access fork execl)
+  AC_CHECK_FUNCS(wait setmode execvp pipe dup2 close fdopen strcasestr getrlimit)
+  AC_CHECK_FUNCS(gettimeofday stat fstat lstat getpwuid vsnprintf dup getcwd)
 
+  # Check for glibc backtrace functions
+  AC_CHECK_FUNCS(backtrace backtrace_symbols)
+fi
+
 # Check for types
 AC_CHECK_TYPES([intptr_t])
 AC_CHECK_TYPES([uintptr_t])