From 754996bcf8e980648b63afa3e8bbaedcefdc22bc Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 3 Nov 2010 14:55:19 -0400 Subject: [PATCH] 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) --- ChangeLog | 6 ++++++ configure.in | 34 +++++++++++++++++++++++++--------- etc/NEWS | 5 +++++ src/ChangeLog | 6 ++++++ src/Makefile.in | 3 +++ src/m/amdx86-64.h | 17 ++++++----------- src/m/ibms390x.h | 12 ++---------- 7 files changed, 53 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c32435237a..11363c3e592 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-11-03 Glenn Morris + + * configure.in (CRT_DIR): New output variable. + (--with-crt-dir): New option. (Bug#5655) + (HAVE_LIB64_DIR): Remove. + 2010-10-12 Glenn Morris * BUGS, INSTALL.BZR, README: Updates. diff --git a/configure.in b/configure.in index 304f6ab2f91..539b910cd71 100644 --- a/configure.in +++ b/configure.in @@ -169,6 +169,12 @@ if test "X${with_pkg_config_prog}" != X; then 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 @@ AC_CONFIG_LIBOBJ_DIR(src) 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) diff --git a/etc/NEWS b/etc/NEWS index fd6d1b5a954..bde5219cb15 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -17,6 +17,11 @@ with a prefix argument or by typing C-u C-h C-n. * Installation Changes in Emacs 23.3 +--- +** New configure option --with-crt-dir specifies the location of your +crt*.o files, if they are in a non-standard location. This is only +used on x86-64 and s390x GNU/Linux architectures. + * Startup Changes in Emacs 23.3 * Changes in Emacs 23.3 diff --git a/src/ChangeLog b/src/ChangeLog index 33552c0ed57..a44fdbb7e42 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-11-03 Glenn Morris + + * Makefile.in (CRT_DIR): New variable, set by configure. + * m/amdx86-64.h, m/ibms390x.h (START_FILES, LIB_STANDARD): + Use $CRT_DIR rather than HAVE_LIB64_DIR. (Bug#5655) + 2010-11-01 Jan Djärv * process.c (kbd_is_on_hold): New variable. diff --git a/src/Makefile.in b/src/Makefile.in index 9caa01d9066..1b0fbdb8b63 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -67,6 +67,9 @@ bootstrap_exe = ../src/bootstrap-emacs${EXEEXT} OTHER_FILES = @OTHER_FILES@ +## Only used by amdx86-64 and ibms390x GNU/Linux. +CRT_DIR=@CRT_DIR@ + # ========================== start of cpp stuff ======================= /* From here on, comments must be done in C syntax. */ diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h index 4bea30d12de..0401b8bf90f 100644 --- a/src/m/amdx86-64.h +++ b/src/m/amdx86-64.h @@ -80,7 +80,7 @@ along with GNU Emacs. If not, see . */ a native binary of Emacs on FreeBSD/amd64 we can just point to /usr/lib. */ #undef START_FILES -#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o +#define START_FILES pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o /* The duplicate -lgcc is intentional in the definition of LIB_STANDARD. The reason is that some functions in libgcc.a call functions from libc.a, @@ -88,14 +88,14 @@ along with GNU Emacs. If not, see . */ versions of ld are one-pass linkers, we need to mention -lgcc twice, or else we risk getting unresolved externals. */ #undef LIB_STANDARD -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o +#define LIB_STANDARD -lgcc -lc -lgcc $(CRT_DIR)/crtn.o #elif defined(__OpenBSD__) #undef START_FILES -#define START_FILES pre-crt0.o /usr/lib/crt0.o /usr/lib/crtbegin.o +#define START_FILES pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o #undef LIB_STANDARD -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o +#define LIB_STANDARD -lgcc -lc -lgcc $(CRT_DIR)/crtend.o #elif defined(__NetBSD__) @@ -119,13 +119,8 @@ along with GNU Emacs. If not, see . */ or else we risk getting unresolved externals. */ #undef START_FILES #undef LIB_STANDARD -#ifdef HAVE_LIB64_DIR -#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o -#else -#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o -#endif +#define START_FILES pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o +#define LIB_STANDARD -lgcc -lc -lgcc $(CRT_DIR)/crtn.o #endif /* __FreeBSD__ */ #endif /* !i386 */ diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h index 9429e4282bf..ea0fa11ec3f 100644 --- a/src/m/ibms390x.h +++ b/src/m/ibms390x.h @@ -91,18 +91,10 @@ NOTE-END */ #define XPNTR(a) XUINT (a) #undef START_FILES -#ifdef HAVE_LIB64_DIR -#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o -#else -#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o -#endif +#define START_FILES pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o #undef LIB_STANDARD -#ifdef HAVE_LIB64_DIR -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o -#else -#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o -#endif +#define LIB_STANDARD -lgcc -lc -lgcc $(CRT_DIR)/crtn.o /* arch-tag: 4b87653c-6add-4663-8691-7d9dc17b5519 (do not change this comment) */ -- 2.11.4.GIT