This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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 install fix for libf2c



libf2c was installing libg2c.a in $prefix/lib, which is wrong and
would trash any native f77 installation there.  I wouldn't have
noticed, but it was also not creating $prefix/lib, which caused 'make
install' to fail on cross targets in a completely empty directory
(this was caught by the regression tester).  There was also an
undefined macro in libU77/configure, it must have been out-of-date
somehow.  I also took out the notice about libf2c, since it's now
quite historical and won't be triggered under any reasonable
circumstances.

Tested with 'make install' on powerpc-eabisim and i686-linux.

-- 
Geoff Keating <geoffk@redhat.com>

===File ~/patches/gcc-libf2c-crossinstall.patch=============
2002-01-28  Geoffrey Keating  <geoffk@redhat.com>

	* aclocal.m4: Replace with version copied from libstdc++-v3.
	* configure.in: Update for changes to aclocal and Makefile.
	* configure: Regenerate.
	* Makefile.in: Correct install and uninstall for cross targets.
	* libU77/configure: Regenerate.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/libf2c/Makefile.in,v
retrieving revision 1.47
diff -p -u -p -r1.47 Makefile.in
--- Makefile.in	2002/01/20 19:58:42	1.47
+++ Makefile.in	2002/01/29 07:12:34
@@ -24,13 +24,18 @@ MAKEOVERRIDES=
 
 #### Start of system configuration section. ####
 
-srcdir = @srcdir@
-VPATH = @srcdir@
+srcdir = @glibcpp_srcdir@
+VPATH = @glibcpp_srcdir@
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 target_alias = @target_alias@
 gcc_version = @gcc_version@
 gcc_version_trigger = @gcc_version_trigger@
+top_srcdir = @top_srcdir@
+toplevel_srcdir = @toplevel_srcdir@
+toolexecdir = @glibcpp_toolexecdir@
+glibcpp_toolexecdir = @glibcpp_toolexecdir@
+glibcpp_toolexeclibdir = @glibcpp_toolexeclibdir@
 
 top_builddir = .
 
@@ -204,28 +209,21 @@ check:
 	cd libU77; $(MAKE) G77DIR=../../../gcc/ check
 
 install: all
-	$(LIBTOOL) --mode=install $(INSTALL) $(LIBG2C) $(libdir)$(MULTISUBDIR)
-	$(INSTALL_DATA) libfrtbegin.a $(libsubdir)$(MULTISUBDIR)
-	$(RANLIB) $(libsubdir)$(MULTISUBDIR)/libfrtbegin.a
+	$(SHELL) $(toplevel_srcdir)/mkinstalldirs $(glibcpp_toolexeclibdir)
+	$(LIBTOOL) --mode=install $(INSTALL) $(LIBG2C) $(glibcpp_toolexeclibdir)
+	$(INSTALL_DATA) libfrtbegin.a $(glibcpp_toolexeclibdir)
+	$(RANLIB) $(glibcpp_toolexeclibdir)/libfrtbegin.a
 	$(INSTALL_DATA) g2c.h $(libsubdir)/include/g2c.h
-	@if [ -f f2c-install-ok -o -f $(srcdir)/f2c-install-ok ]; then \
-	  echo ''; \
-	  echo 'Warning: g77 no longer installs libf2c.a or f2c.h.'; \
-	  echo '         You must do so yourself.  For more information,'; \
-	  echo '         read "Distributing Binaries" in the g77 docs.'; \
-	  echo '         (To turn off this warning, delete the file'; \
-	  echo '         f2c-install-ok in the source or build directory.)'; \
-	  echo ''; \
-	else true; fi
 	$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
-	@-$(LIBTOOL) --mode=finish $(prefix)/lib
+	@-$(LIBTOOL) --mode=finish $(glibcpp_toolexeclibdir)
 
 install-strip:
 	$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
 
 uninstall:
-	rm -f $(libsubdir)$(MULTISUBDIR)/include/g2c.h
-	$(LIBTOOL) --mode=uninstall rm -f $(libdir)$(MULTISUBDIR)/$(LIBG2C_BASE).la
+	rm -f $(libsubdir)/include/g2c.h
+	rm -f $(glibcpp_toolexeclibdir)/libfrtbegin.a
+	$(LIBTOOL) --mode=uninstall rm -f $(glibcpp_toolexeclibdir)$(LIBG2C_BASE).la
 	$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO="$@"
 
 mostlyclean:
Index: aclocal.m4
===================================================================
RCS file: /cvs/gcc/gcc/libf2c/aclocal.m4,v
retrieving revision 1.1
diff -p -u -p -r1.1 aclocal.m4
--- aclocal.m4	2001/09/30 22:06:22	1.1
+++ aclocal.m4	2002/01/29 07:12:34
@@ -1,7 +1,224 @@
+dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+dnl
+dnl Initialize configure bits.
+dnl
+dnl GLIBCPP_CONFIGURE
+AC_DEFUN(GLIBCPP_CONFIGURE, [
+  dnl Default to --enable-multilib
+  AC_ARG_ENABLE(multilib,
+  [  --enable-multilib       build hella library versions (default)],
+  [case "${enableval}" in
+    yes) multilib=yes ;;
+    no)  multilib=no ;;
+    *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
+   esac], [multilib=yes])dnl
+
+# When building with srcdir == objdir, links to the source files will
+# be created in directories within the target_subdir.  We have to
+# adjust toplevel_srcdir accordingly, so that configure finds
+# install-sh and other auxiliary files that live in the top-level
+# source directory.
+if test "${srcdir}" = "."; then
+  if test -z "${with_target_subdir}"; then
+    toprel=".."
+  else
+    if test "${with_target_subdir}" != "."; then
+      toprel="${with_multisrctop}../.."
+    else
+      toprel="${with_multisrctop}.."
+    fi
+  fi
+else
+  toprel=".."
+fi
+AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
+toplevel_srcdir=\${top_srcdir}/$toprel
+AC_SUBST(toplevel_srcdir)
+
+# Export build and source directories.
+# These need to be absolute paths, yet at the same time need to
+# canonicalize only relative paths, because then amd will not unmount
+# drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
+glibcpp_builddir=`pwd`
+case $srcdir in
+[\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
+*) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
+esac
+AC_SUBST(glibcpp_builddir)
+AC_SUBST(glibcpp_srcdir)
+
+dnl This is here just to satisfy automake.
+ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)])
+
+# Will set LN_S to either 'ln -s' or 'ln'.  With autoconf 2.50+, can also
+# be 'cp -p' if linking isn't available.
+#ac_cv_prog_LN_S='cp -p'
+AC_PROG_LN_S
+
+# We use these options to decide which functions to include.
+AC_ARG_WITH(target-subdir,
+[  --with-target-subdir=SUBDIR
+                           configuring in a subdirectory])
+AC_ARG_WITH(cross-host,
+[  --with-cross-host=HOST  configuring with a cross compiler])
+
+  # Never versions of autoconf add an underscore to these functions.
+  # Prevent future problems ...
+  ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
+  ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
+  ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
+  ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
+
+#  AC_PROG_CC
+
+# 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
+dnl Fool anybody using AC_PROG_CC.
+AC_PROVIDE([AC_PROG_CC])
+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
+])
+
+LIB_AC_PROG_CC
+
+  AC_CHECK_TOOL(AS, as)
+  AC_CHECK_TOOL(AR, ar)
+  AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
+  AC_PROG_INSTALL
+
+  # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
+  # at least currently, we never actually build a program, so we never
+  # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
+  # fails, because we are probably configuring with a cross compiler
+  # which can't create executables.  So we include AC_EXEEXT to keep
+  # automake happy, but we don't execute it, since we don't care about
+  # the result.
+  if false; then
+    # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
+    # to nothing, so nothing would remain between `then' and `fi' if it
+    # were not for the `:' below.
+    :
+    AC_EXEEXT
+  fi
+])
+
+
+dnl
+dnl  GLIBCPP_EXPORT_INSTALL_INFO
+dnl  calculates gxx_install_dir
+dnl  exports glibcpp_toolexecdir
+dnl  exports glibcpp_toolexeclibdir
+dnl  exports glibcpp_prefixdir
+dnl
+dnl Assumes cross_compiling bits already done, and with_cross_host in
+dnl particular
+dnl
+dnl GLIBCPP_EXPORT_INSTALL_INFO
+AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
+# Assumes glibcpp_builddir, glibcpp_srcdir are alreay set up and
+# exported correctly in GLIBCPP_CONFIGURE.
+glibcpp_toolexecdir=no
+glibcpp_toolexeclibdir=no
+glibcpp_prefixdir=${prefix}
+
+AC_MSG_CHECKING([for interface version number])
+libstdcxx_interface=$INTERFACE
+AC_MSG_RESULT($libstdcxx_interface)
+
+# Process the option "--enable-version-specific-runtime-libs"
+AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
+AC_ARG_ENABLE(version-specific-runtime-libs,
+[  --enable-version-specific-runtime-libs    Specify that runtime libraries should be installed in a compiler-specific directory ],
+[case "$enableval" in
+ yes) version_specific_libs=yes ;;
+ no)  version_specific_libs=no ;;
+ *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
+ esac],
+version_specific_libs=no)dnl
+# Option set, now we can test it.
+AC_MSG_RESULT($version_specific_libs)
+
+gcc_version_trigger=${srcdir}/../gcc/version.c
+gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'`
+gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
+AC_SUBST(gcc_version)
+AC_SUBST(gcc_version_trigger)
+
+if test $version_specific_libs = yes; then
+  # Need the gcc compiler version to know where to install libraries
+  # and header files if --enable-version-specific-runtime-libs option
+  # is selected.
+  changequote(,)dnl
+  glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+  glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
+  changequote([,])dnl
+fi
+
+# Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
+# Install a library built with a cross compiler in tooldir, not libdir.
+if test x"$glibcpp_toolexecdir" = x"no"; then 
+  if test -n "$with_cross_host" &&
+     test x"$with_cross_host" != x"no"; then
+    glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
+    glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)'
+  else
+    glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
+    glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)'
+  fi
+fi
+
+AC_SUBST(glibcpp_prefixdir)
+AC_SUBST(glibcpp_toolexecdir)
+AC_SUBST(glibcpp_toolexeclibdir)
+])
+
 sinclude(../libtool.m4)
 dnl The lines below arrange for aclocal not to bring an installed
 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
 dnl add a definition of LIBTOOL to Makefile.in.
 ifelse(,,,[AC_SUBST(LIBTOOL)
 AC_DEFUN([AM_PROG_LIBTOOL])
+AC_DEFUN([AC_LIBTOOL_DLOPEN])
+AC_DEFUN([AC_PROG_LD])
 ])
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libf2c/configure.in,v
retrieving revision 1.30
diff -p -u -p -r1.30 configure.in
--- configure.in	2001/10/20 17:05:52	1.30
+++ configure.in	2002/01/29 07:12:34
@@ -22,18 +22,12 @@
 AC_PREREQ(2.13)
 AC_INIT(libF77/Version.c)
 
-if test "${srcdir}" = "."  ; then
-  if test "${with_target_subdir}" != "." ; then
-    topsrcdir=${with_multisrctop}../..
-  else
-    topsrcdir=${with_multisrctop}..
-  fi
-else
-  topsrcdir=${srcdir}/..
-fi
-dnl This is needed for a multilibbed build in the source tree so
-dnl that install-sh and config.sub get found.
-AC_CONFIG_AUX_DIR($topsrcdir)
+AC_CANONICAL_SYSTEM
+target_alias=${target_alias-$target}
+AC_SUBST(target_alias)
+
+GLIBCPP_CONFIGURE(.)
+GLIBCPP_EXPORT_INSTALL_INFO
 
 # If the language specific compiler does not exist, but the "gcc" directory 
 # does, we do not build anything. Note, $r is set by the top-level Makefile.
@@ -65,29 +59,6 @@ fi
 
 dnl Checks for programs.
 
-dnl FIXME AC_PROG_CC wants CC to be able to link things, but it may
-dnl not be able to.
-define([AC_PROG_CC_WORKS],[])
-
-# We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
-# at least currently, we never actually build a program, so we never
-# need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
-# fails, because we are probably configuring with a cross compiler
-# which cant create executables.  So we include AC_EXEEXT to keep
-# automake happy, but we dont execute it, since we dont care about
-# the result.
-if false; then
-  # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
-  # to nothing, so nothing would remain between `then' and `fi' if it
-  # were not for the `:' below.
-  :
-  AC_EXEEXT
-fi
-
-# For g77 we'll set CC to point at the built gcc, but this will get it into
-# the makefiles
-
-AC_PROG_CC
 AM_PROG_LIBTOOL
 
 dnl These should be inherited in the recursive make, but ensure they are
@@ -135,19 +106,6 @@ test -f libF77/makefile && mv libF77/mak
 test -f libI77/makefile && mv libI77/makefile  libI77/makefile.ori
 test -f libU77/makefile && mv libU77/makefile  libU77/makefile.ori
 
-# Get the version trigger filename from the toplevel
-if [[ "${with_gcc_version_trigger+set}" = set ]]; then
-	gcc_version_trigger=$with_gcc_version_trigger
-	gcc_version=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([[^ \"]]*\)[[ \"]].*/\1/'`
-else
-	gcc_version_trigger=
-	gcc_version=UNKNOWN
-fi
-
-AC_SUBST(gcc_version)
-AC_SUBST(gcc_version_trigger)
-AC_CANONICAL_SYSTEM
-AC_SUBST(target_alias)
 AC_CONFIG_SUBDIRS(libU77 libI77 libF77)
 # Do Makefile first since g2c.h depends on it and shouldn't get an
 # earlier timestamp.  Of course, it does when the multilib gunk below
@@ -158,7 +116,7 @@ if test -n "$CONFIG_FILES"; then
   if test -n "${with_target_subdir}"; then
     # FIXME: We shouldn't need to set ac_file
     ac_file=Makefile
-    . ${topsrcdir}/config-ml.in
+    . ${toplevel_srcdir}/config-ml.in
     touch g2c.h   # to keep it more recent than Makefile
   fi
 fi],
@@ -168,8 +126,8 @@ target=${target}
 with_target_subdir=${with_target_subdir}
 with_multisubdir=${with_multisubdir}
 ac_configure_args="--enable-multilib ${ac_configure_args}"
+toplevel_srcdir=${toplevel_srcdir}
 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-topsrcdir=${topsrcdir}
 )
 
 
============================================================


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