changeset 108125:13415f222ad9

Use $CRT_DIR in more places. * configure.in (--with-crt-dir): Doc fix (now valid for all platforms). (CRT_DIR): On (powerpc64|sparc64)-*-linux-gnu*, default to /usr/lib64. On hpux10-20, default to /lib. * src/m/amdx86-64.h (START_FILES, LIB_STANDARD): Change the logic around, since the defaults (set by the system file) are fine in most cases. [GNU_LINUX, __OpenBSD__, __NetBSD__, __APPLE__]: Remove sections. * src/m/ibms390x.h (START_FILES, LIB_STANDARD): * src/m/macppc.h (START_FILES, LIB_STANDARD) [GNU_LINUX]: * src/m/sparc.h (START_FILES, LIB_STANDARD) [__linux__]: Remove definitions, since they are set correctly in s/gnu-linux.h. * src/s/freebsd.h (START_FILES, LIB_STANDARD): * src/s/gnu-linux.h (START_FILES, LIB_STANDARD): * src/s/hpux10-20.h (START_FILES): * src/s/netbsd.h (START_FILES, LIB_STANDARD, START_FILES_1, END_FILES_1): Use $CRT_DIR in place of fixed /usr/lib, /lib directories. * src/Makefile.in: Comment.
author Glenn Morris <rgm@gnu.org>
date Mon, 26 Apr 2010 20:14:14 -0700
parents 8fead72884b2
children fa115392c7cd
files ChangeLog configure.in src/ChangeLog src/Makefile.in src/m/amdx86-64.h src/m/ibms390x.h src/m/macppc.h src/m/sparc.h src/s/freebsd.h src/s/gnu-linux.h src/s/hpux10-20.h src/s/netbsd.h
diffstat 12 files changed, 68 insertions(+), 80 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Apr 26 19:38:36 2010 -0700
+++ b/ChangeLog	Mon Apr 26 20:14:14 2010 -0700
@@ -1,5 +1,9 @@
 2010-04-27  Glenn Morris  <rgm@gnu.org>
 
+	* configure.in (--with-crt-dir): Doc fix (now valid for all platforms).
+	(CRT_DIR): On (powerpc64|sparc64)-*-linux-gnu*, default to /usr/lib64.
+	On hpux10-20, default to /lib.
+
 	* configure.in (LUCID_LIBW, LIBXP, WIDGET_OBJ): New output variables.
 
 2010-04-26  Dan Nicolaescu  <dann@ics.uci.edu>
--- a/configure.in	Mon Apr 26 19:38:36 2010 -0700
+++ b/configure.in	Mon Apr 26 20:14:14 2010 -0700
@@ -189,7 +189,7 @@
 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.])])
+The default is /usr/lib, or /usr/lib64 on some platforms.])])
 CRT_DIR="${with_crt_dir}"
 
 AC_ARG_WITH([gnustep-conf],dnl
@@ -983,29 +983,40 @@
 AC_SYS_LARGEFILE
 
 
-## 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* )
-
-   ## 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
+## If user specified a crt-dir, use that unconditionally.
+if test "X$CRT_DIR" = "X"; then
+
+  case "$canonical" in
+    x86_64-*-linux-gnu* | s390x-*-linux-gnu*)
+    ## 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).
+    ## FIXME better to test for binary compatibility somehow.
+    test -e /usr/lib64/crtn.o && CRT_DIR=/usr/lib64
+    ;;
+
+    powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*) CRT_DIR=/usr/lib64 ;;
+  esac
+
+  case "$opsys" in
+    hpux10-20) CRT_DIR=/lib ;;
+  esac
+
+  ## Default is /usr/lib.
+  test "X$CRT_DIR" = "X" && CRT_DIR=/usr/lib
+
+else
+
+  ## Some platforms don't use any of these files, so it is not
+  ## appropriate to put this test outside the if block.
+  test -e $CRT_DIR/crtn.o || test -e $CRT_DIR/crt0.o || \
+    AC_MSG_ERROR([crt*.o not found in specified location.])
+
+fi
+
 AC_SUBST(CRT_DIR)
 
 
--- a/src/ChangeLog	Mon Apr 26 19:38:36 2010 -0700
+++ b/src/ChangeLog	Mon Apr 26 20:14:14 2010 -0700
@@ -1,5 +1,18 @@
 2010-04-27  Glenn Morris  <rgm@gnu.org>
 
+	* m/amdx86-64.h (START_FILES, LIB_STANDARD): Change the logic around,
+	since the defaults (set by the system file) are fine in most cases.
+	[GNU_LINUX, __OpenBSD__, __NetBSD__, __APPLE__]: Remove sections.
+	* m/ibms390x.h (START_FILES, LIB_STANDARD):
+	* m/macppc.h (START_FILES, LIB_STANDARD) [GNU_LINUX]:
+	* m/sparc.h (START_FILES, LIB_STANDARD) [__linux__]:
+	Remove definitions, since they are set correctly in s/gnu-linux.h.
+	* s/freebsd.h (START_FILES, LIB_STANDARD):
+	* s/gnu-linux.h (START_FILES, LIB_STANDARD):
+	* s/hpux10-20.h (START_FILES):
+	* s/netbsd.h (START_FILES, LIB_STANDARD, START_FILES_1, END_FILES_1):
+	Use $CRT_DIR in place of fixed /usr/lib, /lib directories.
+
 	* Makefile.in (LIBXP, LUCID_LIBW, WIDGET_OBJ): Set via configure.
 	(MOTIF_LIBW): Use $LIBXP.
 	(otherobj): Use $WIDGET_OBJ.
--- a/src/Makefile.in	Mon Apr 26 19:38:36 2010 -0700
+++ b/src/Makefile.in	Mon Apr 26 20:14:14 2010 -0700
@@ -68,7 +68,6 @@
 
 OTHER_FILES = @OTHER_FILES@
 
-## Only used by amdx86-64 and ibms390x GNU/Linux.
 CRT_DIR=@CRT_DIR@
 
 LIBTIFF=@LIBTIFF@
--- a/src/m/amdx86-64.h	Mon Apr 26 19:38:36 2010 -0700
+++ b/src/m/amdx86-64.h	Mon Apr 26 20:14:14 2010 -0700
@@ -67,34 +67,18 @@
 /* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
 #undef DATA_SEG_BITS
 
-#ifdef __OpenBSD__
 
-#undef START_FILES
-#define START_FILES pre-crt0.o /usr/lib/crt0.o /usr/lib/crtbegin.o
-#undef LIB_STANDARD
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o
-
-#elif defined(__NetBSD__)
-
-/* LIB_STANDARD and START_FILES set correctly in s/netbsd.h */
-
-#elif defined(SOLARIS2)
-
+/* For GNU_LINUX,  __OpenBSD__, __NetBSD__, __APPLE__, things are set
+   correctly in s/gnu-linux.h, netbsd.h, darwin.h.  */
+#ifdef SOLARIS2
 #undef START_FILES
 #undef LIB_STANDARD
-
-#elif defined(__APPLE__)
-
-/* LIB_STANDARD and START_FILES set correctly in s/darwin.h */
-
-#else /* !__OpenBSD__ && !__NetBSD__ && !SOLARIS2 && !__APPLE__ */
-/* CRT_DIR defaults to /usr/lib.  On GNU/Linux, it may be /usr/lib64.
-   On FreeBSD, the libraries for binaries native to the build host's
+#elif defined (__FreeBSD__) || (defined (DARWIN_OS) && !defined (__APPLE__))
+/* On FreeBSD, the libraries for binaries native to the build host's
    architecture are installed under /usr/lib, and the ones that need
    special paths are 32-bit compatibility libraries (installed under
    /usr/lib32).  So to build a native binary of Emacs on FreeBSD/amd64
-   we can just point to /usr/lib.
- */
+   we can just point to /usr/lib (the default $CRT_DIR).  */
 #undef START_FILES
 #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.
@@ -105,7 +89,7 @@
 #undef LIB_STANDARD
 #define LIB_STANDARD -lgcc -lc -lgcc $(CRT_DIR)/crtn.o
 
-#endif /* __OpenBSD__ */
+#endif /* SOLARIS2 */
 #endif /* !i386 */
 
 /* arch-tag: 8a5e001d-e12e-4692-a3a6-0b15ba271c6e
--- a/src/m/ibms390x.h	Mon Apr 26 19:38:36 2010 -0700
+++ b/src/m/ibms390x.h	Mon Apr 26 20:14:14 2010 -0700
@@ -85,11 +85,5 @@
 
 #define XPNTR(a) XUINT (a)
 
-#undef START_FILES
-#define START_FILES pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o
-
-#undef LIB_STANDARD
-#define LIB_STANDARD -lgcc -lc -lgcc $(CRT_DIR)/crtn.o
-
 /* arch-tag: 4b87653c-6add-4663-8691-7d9dc17b5519
    (do not change this comment) */
--- a/src/m/macppc.h	Mon Apr 26 19:38:36 2010 -0700
+++ b/src/m/macppc.h	Mon Apr 26 20:14:14 2010 -0700
@@ -39,12 +39,6 @@
 
 #ifdef GNU_LINUX
 #define LINKER $(CC) -nostdlib
-#ifdef _ARCH_PPC64
-#undef START_FILES
-#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o
-#undef LIB_STANDARD
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o
-#endif
 #endif
 
 #ifdef _ARCH_PPC64
--- a/src/m/sparc.h	Mon Apr 26 19:38:36 2010 -0700
+++ b/src/m/sparc.h	Mon Apr 26 20:14:14 2010 -0700
@@ -52,17 +52,6 @@
 
 #ifdef __arch64__		/* GCC, 64-bit ABI.  */
 #define BITS_PER_LONG 64
-#ifdef __linux__
-#undef START_FILES
-#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/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,
-   and some libc.a functions need functions from libgcc.a.  Since most
-   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/lib64/crtn.o
 #endif
 
 #ifndef _LP64
--- a/src/s/freebsd.h	Mon Apr 26 19:38:36 2010 -0700
+++ b/src/s/freebsd.h	Mon Apr 26 20:14:14 2010 -0700
@@ -46,8 +46,8 @@
    there, contrary to what a stock GCC would do.  */
 
 #define LD_SWITCH_SYSTEM  -L/usr/local/lib
-#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o
+#define START_FILES pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o
+#define LIB_STANDARD -lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o
 #undef LIB_GCC
 #define LIB_GCC
 
--- a/src/s/gnu-linux.h	Mon Apr 26 19:38:36 2010 -0700
+++ b/src/s/gnu-linux.h	Mon Apr 26 20:14:14 2010 -0700
@@ -168,7 +168,7 @@
 /* Ask GCC where to find libgcc.a.  */
 #define LIB_GCC `$(CC) $(C_SWITCH_X_SITE) -print-libgcc-file-name`
 
-#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
 
 /* Here is how to find X Windows.  LD_SWITCH_X_SITE_AUX gives an -R option
    says where to find X windows at run time.  */
@@ -190,7 +190,7 @@
 
 #undef LIB_GCC
 #define LIB_GCC
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
+#define LIB_STANDARD -lgcc -lc -lgcc $(CRT_DIR)/crtn.o
 
 /* _BSD_SOURCE is redundant, at least in glibc2, since we define
    _GNU_SOURCE.  Left in in case it's relevant to libc5 systems and
--- a/src/s/hpux10-20.h	Mon Apr 26 19:38:36 2010 -0700
+++ b/src/s/hpux10-20.h	Mon Apr 26 20:14:14 2010 -0700
@@ -170,7 +170,7 @@
 
 #define NO_REMAP
 
-#define START_FILES pre-crt0.o /lib/crt0.o
+#define START_FILES pre-crt0.o $(CRT_DIR)/crt0.o
 
 /* Define VIRT_ADDR_VARIES if the virtual addresses of
    pure and impure space as loaded can vary, and even their
--- a/src/s/netbsd.h	Mon Apr 26 19:38:36 2010 -0700
+++ b/src/s/netbsd.h	Mon Apr 26 20:14:14 2010 -0700
@@ -28,14 +28,14 @@
 
 #define LIBS_TERMCAP -ltermcap
 
-#define START_FILES pre-crt0.o /usr/lib/crt0.o START_FILES_1 /usr/lib/crtbegin.o
-#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtend.o END_FILES_1
+#define START_FILES pre-crt0.o $(CRT_DIR)/crt0.o START_FILES_1 $(CRT_DIR)/crtbegin.o
+#define LIB_STANDARD -lgcc -lc -lgcc $(CRT_DIR)/crtend.o END_FILES_1
 #undef LIB_GCC
 #define LIB_GCC
 
 #ifdef HAVE_CRTIN
-#define START_FILES_1 /usr/lib/crti.o 
-#define END_FILES_1 /usr/lib/crtn.o
+#define START_FILES_1 $(CRT_DIR)/crti.o 
+#define END_FILES_1 $(CRT_DIR)/crtn.o
 #else
 #define START_FILES_1
 #define END_FILES_1