diff configure.in @ 111354:7df8e74a1096

Fix for Bug#5655, backported from trunk. * configure.in (CRT_DIR): New output variable. (--with-crt-dir): New option. (Bug#5655) (HAVE_LIB64_DIR): Remove. * src/Makefile.in (CRT_DIR): New variable, set by configure. * src/m/amdx86-64.h, m/ibms390x.h (START_FILES, LIB_STANDARD): Use $CRT_DIR rather than HAVE_LIB64_DIR. (Bug#5655)
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 03 Nov 2010 14:55:19 -0400
parents 4d25cedac124
children 57927f4ca500
line wrap: on
line diff
--- a/configure.in	Mon Nov 01 12:30:33 2010 +0100
+++ b/configure.in	Wed Nov 03 14:55:19 2010 -0400
@@ -169,6 +169,12 @@
    fi
 fi
 
+CRT_DIR=
+AC_ARG_WITH([crt-dir],dnl
+[AS_HELP_STRING([--with-crt-dir=DIR],[directory containing crtn.o etc.
+This option is only used on x86-64 and s390x GNU/Linux architectures.])])
+CRT_DIR="${with_crt_dir}"
+
 AC_ARG_WITH([gnustep-conf],dnl
 [AS_HELP_STRING([--with-gnustep-conf=PATH],[path to GNUstep.conf; default $GNUSTEP_CONFIG_FILE, or /etc/GNUstep/GNUstep.conf])])
 test "X${with_gnustep_conf}" != X && test "${with_gnustep_conf}" != yes && \
@@ -996,18 +1002,28 @@
 dnl Do this early because it can frob feature test macros for Unix-98 &c.
 AC_SYS_LARGEFILE
 
-
-### The standard library on x86-64 and s390x GNU/Linux distributions can
-### be located in either /usr/lib64 or /usr/lib.
-### In some rare cases, /usr/lib64 exists but does not contain the
-### relevant files (bug#1287).  Hence test for crtn.o.
+## Note: at present CRT_DIR is only used for amdx86-64 and ibms390x.
+## Other machine types hard-code the location in src/[ms]/*.h.
 case "${canonical}" in
   x86_64-*-linux-gnu* | s390x-*-linux-gnu* )
-    if test -e /usr/lib64/crtn.o; then
-      AC_DEFINE(HAVE_LIB64_DIR, 1,
-        [Define to 1 if the directory /usr/lib64 exists.])
-fi
+   ## On x86-64 and s390x GNU/Linux distributions, the standard library
+   ## can be in a variety of places.  We only try /usr/lib64 and /usr/lib.
+   ## For anything else (eg /usr/lib32), it is up the user to specify
+   ## the location (bug#5655).
+   ## Test for crtn.o, not just the directory, because sometimes the
+   ## directory exists but does not have the relevant files (bug#1287).
+   ## If user specified a crt-dir, use that unconditionally.
+   if test "X$CRT_DIR" = "X"; then
+     CRT_DIR=/usr/lib
+     test -e /usr/lib64/crtn.o && CRT_DIR=/usr/lib64
+   fi
+
+   test -e $CRT_DIR/crtn.o || test -e $CRT_DIR/crt0.o || \
+     AC_MSG_ERROR([crt*.o not found.  Use --with-crt-dir to specify the location.])
+   ;;
 esac
+test "X$CRT_DIR" = "X" && CRT_DIR=/usr/lib
+AC_SUBST(CRT_DIR)
 
 dnl This function defintion taken from Gnome 2.0
 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)