changeset 108278:9c003610b6fc

Move LD_SWITCH_SYSTEM from cpp to configure. * configure.in (LD_SWITCH_SYSTEM): Set with configure, not cpp. Merges logic from src/s/* and src/Makefile.in. (LD_SWITCH_SYSTEM_TEMACS): New output variable. * src/Makefile.in (LD_SWITCH_SYSTEM): Set with configure, not cpp. (LD_SWITCH_SYSTEM_EXTRA): New variable, set by configure. (TEMACS_LDFLAGS): Use $LD_SWITCH_SYSTEM and $LD_SWITCH_SYSTEM_EXTRA, move out of cpp section. * src/s/freebsd.h (LD_SWITCH_SYSTEM): * src/s/gnu-linux.h (LD_SWITCH_SYSTEM): * src/s/netbsd.h (LD_SWITCH_SYSTEM): * admin/CPP-DEFINES: Remove LD_SWITCH_SYSTEM.
author Glenn Morris <rgm@gnu.org>
date Thu, 06 May 2010 19:55:47 -0700
parents 77714da1307b
children af063227abbf
files ChangeLog admin/CPP-DEFINES configure.in src/ChangeLog src/Makefile.in src/s/freebsd.h src/s/gnu-linux.h src/s/netbsd.h
diffstat 8 files changed, 95 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri May 07 02:50:26 2010 +0200
+++ b/ChangeLog	Thu May 06 19:55:47 2010 -0700
@@ -1,3 +1,9 @@
+2010-05-07  Glenn Morris  <rgm@gnu.org>
+
+	* configure.in (LD_SWITCH_SYSTEM): Set with configure, not cpp.
+	Merges logic from src/s/* and src/Makefile.in.
+	(LD_SWITCH_SYSTEM_TEMACS): New output variable.
+
 2010-05-07  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	Define START_FILES and LIB_STANDARD using autoconf.
--- a/admin/CPP-DEFINES	Fri May 07 02:50:26 2010 +0200
+++ b/admin/CPP-DEFINES	Thu May 06 19:55:47 2010 -0700
@@ -215,7 +215,6 @@
 IS_DIRECTORY_SEP
 KERNEL_FILE
 LDAV_SYMBOL
-LD_SWITCH_SYSTEM
 LIBS_SYSTEM
 LIBS_TERMCAP
 LIBXMU
--- a/configure.in	Fri May 07 02:50:26 2010 +0200
+++ b/configure.in	Thu May 06 19:55:47 2010 -0700
@@ -892,12 +892,6 @@
 #define C_WARNINGS_SWITCH ${C_WARNINGS_SWITCH}
 #endif
 
-#ifndef LD_SWITCH_SYSTEM
-#define LD_SWITCH_SYSTEM
-#endif
-
-configure___ ld_switch_system=LD_SWITCH_SYSTEM
-
 #ifdef THIS_IS_CONFIGURE
 
 /* Get the CFLAGS for tests in configure.  */
@@ -934,7 +928,49 @@
 fi]
 rm ${tempcname}
 
-ac_link="$ac_link $ld_switch_system"
+
+LD_SWITCH_SYSTEM=
+case "$opsys" in
+  freebsd)
+   ## Let `ld' find image libs and similar things in /usr/local/lib.
+   ## The system compiler, GCC, has apparently been modified to not
+   ## look there, contrary to what a stock GCC would do.
+   LD_SWITCH_SYSTEM=-L/usr/local/lib
+   ;;
+
+  gnu-linux)
+   ## cpp test was "ifdef __mips__", but presumably this is equivalent...
+   test "$machine" = "mips" && LD_SWITCH_SYSTEM="-G 0"
+   ;;
+
+  netbsd)
+   LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib"
+   ;;
+
+  openbsd)
+   ## Han Boetes <han@mijncomputer.nl> says this is necessary,
+   ## otherwise Emacs dumps core on elf systems.
+   LD_SWITCH_SYSTEM="-Z"
+   ;;
+esac
+AC_SUBST(LD_SWITCH_SYSTEM)
+
+ac_link="$ac_link $LD_SWITCH_SYSTEM"
+
+## This is fun.  Some settings of LD_SWITCH_SYSTEM reference
+## LD_SWITCH_X_SITE_AUX, which has not been defined yet.  When using
+## cpp, it was expanded to null.  Thus LD_SWITCH_SYSTEM had different
+## values in configure and the Makefiles.  How helpful.
+## FIXME why not use LD_SWITCH_SYSTEM_TEMACS (or somesuch) instead?
+case "$opsys" in
+  gnu-linux)
+   ## LD_SWITCH_X_SITE_AUX is a -R option saying where to find X at run-time.
+   LD_SWITCH_SYSTEM="$LD_SWITCH_SYSTEM \$(LD_SWITCH_X_SITE_AUX)" ;;
+
+  netbsd|openbsd)
+   ## _AUX_RPATH is like _AUX, but uses -rpath instead of -R.
+   LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_AUX_RPATH) $LD_SWITCH_SYSTEM" ;;
+esac
 
 
 C_SWITCH_MACHINE=
@@ -3033,6 +3069,23 @@
 AC_SUBST(LD_SWITCH_SYSTEM_TEMACS)
 
 
+## This exists because src/Makefile.in did some extra fiddling around
+## with LD_SWITCH_SYSTEM.  The cpp logic was:
+##   #ifndef LD_SWITCH_SYSTEM
+##   #if !defined (__GNUC__) && ((defined (BSD_SYSTEM) && !defined (COFF)))
+## Since all the *bsds define LD_SWITCH_SYSTEM, this simplifies to:
+## not using gcc, darwin system not on an alpha (ie darwin, since
+## darwin + alpha does not occur).
+## Note that unlike L_S_S, this is not used in ac_link.
+if test "x$LD_SWITCH_SYSTEM" = "x" && test "x$GCC" != "xyes" && \
+   test "$opsys" = "darwin"; then
+  LD_SWITCH_SYSTEM_EXTRA="-X"
+else
+  LD_SWITCH_SYSTEM_EXTRA=
+fi
+AC_SUBST(LD_SWITCH_SYSTEM_EXTRA)
+
+
 AH_TOP([/* GNU Emacs site configuration template file.
    Copyright (C) 1988, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2005,
      2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
--- a/src/ChangeLog	Fri May 07 02:50:26 2010 +0200
+++ b/src/ChangeLog	Thu May 06 19:55:47 2010 -0700
@@ -1,3 +1,14 @@
+2010-05-07  Glenn Morris  <rgm@gnu.org>
+
+	* Makefile.in (LD_SWITCH_SYSTEM): Set with configure, not cpp.
+	(LD_SWITCH_SYSTEM_EXTRA): New variable, set by configure.
+	(TEMACS_LDFLAGS): Use $LD_SWITCH_SYSTEM and $LD_SWITCH_SYSTEM_EXTRA,
+	move out of cpp section.
+	* s/freebsd.h (LD_SWITCH_SYSTEM):
+	* s/gnu-linux.h (LD_SWITCH_SYSTEM):
+	* s/netbsd.h (LD_SWITCH_SYSTEM):
+	* s/openbsd.h (LD_SWITCH_SYSTEM): Move to configure.in.
+
 2010-05-07  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	Define LIB_STANDARD and START_FILES using autoconf.
--- a/src/Makefile.in	Fri May 07 02:50:26 2010 +0200
+++ b/src/Makefile.in	Thu May 06 19:55:47 2010 -0700
@@ -73,13 +73,20 @@
 ## System-specific CFLAGS.
 C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
 ## This holds any special options for linking temacs only (ie, not
-## used by configure).
+## used by configure).  Not used elsewhere because it sometimes
+## contains options that have to do with using Emacs's crt0, 
+## which are only good with temacs.
 LD_SWITCH_SYSTEM_TEMACS=@LD_SWITCH_SYSTEM_TEMACS@
 ## Next two must come before LD_SWITCH_SYSTEM.
 ## If needed, a -R option that says where to find X windows at run time.
 LD_SWITCH_X_SITE_AUX=@LD_SWITCH_X_SITE_AUX@
 ## As above, but using -rpath instead.
 LD_SWITCH_X_SITE_AUX_RPATH=@LD_SWITCH_X_SITE_AUX_RPATH@
+## System-specific LDFLAGS.
+LD_SWITCH_SYSTEM=@LD_SWITCH_SYSTEM@
+LD_SWITCH_SYSTEM_EXTRA=@LD_SWITCH_SYSTEM_EXTRA@
+## Flags to pass to ld only for temacs.
+TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(LD_SWITCH_SYSTEM_EXTRA) $(LD_SWITCH_SYSTEM_TEMACS)
 
 LIBTIFF=@LIBTIFF@
 LIBJPEG=@LIBJPEG@
@@ -189,16 +196,7 @@
 #define LIBS_SYSTEM
 #endif
 
-/* Some s/SYSTEM.h files define this to request special switches in ld.  */
-#ifndef LD_SWITCH_SYSTEM
-#if !defined (__GNUC__) && ((defined (BSD_SYSTEM) && !defined (COFF)))
-#define LD_SWITCH_SYSTEM -X
-#else /* (defined (BSD_SYSTEM) && !defined (COFF)) */
-#define LD_SWITCH_SYSTEM
-#endif /* (defined (BSD_SYSTEM) && !defined (COFF)) */
-#endif /* LD_SWITCH_SYSTEM */
-
-/* These macros are for switches specifically related to X Windows.  */
+/* This macro is for switches specifically related to X Windows.  */
 #ifndef LD_SWITCH_X_SITE
 #define LD_SWITCH_X_SITE
 #endif
@@ -312,11 +310,6 @@
 #endif /* not LINKER */
 #endif /* not ORDINARY_LINK */
 
-/* Flags to pass to LD only for temacs.  */
-/* Do not split this line with a backslash.  That can cause trouble with
-   some cpps.  */
-TEMACS_LDFLAGS = LD_SWITCH_SYSTEM $(LD_SWITCH_SYSTEM_TEMACS)
-
 /* A macro which other sections of Makefile can redefine to munge the
    flags before they are passed to LD.  This is helpful if you have
    redefined LD to something odd, like "gcc".
@@ -730,9 +723,6 @@
     ${LIBES}
 #endif
 
-/* We do not use ALL_LDFLAGS because LD_SWITCH_SYSTEM
-   often contains options that have to do with using Emacs''s crt0,
-   which are only good with temacs.  */
 prefix-args${EXEEXT}: prefix-args.o $(config_h)
 	$(CC) $(LDFLAGS) prefix-args.o -o prefix-args
 
--- a/src/s/freebsd.h	Fri May 07 02:50:26 2010 +0200
+++ b/src/s/freebsd.h	Thu May 06 19:55:47 2010 -0700
@@ -1,9 +1,8 @@
 /* System description header for FreeBSD systems.
-   This file describes the parameters that system description files
-   should define or not.
-   Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-                 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-                 Free Software Foundation, Inc.
+
+Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+  2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+  Free Software Foundation, Inc.
 
 Author: Shawn M. Carey
 (according to authors.el)
@@ -41,11 +40,6 @@
 #define LIBS_TERMCAP -lncurses
 #endif
 
-/* Let `ld' find image libs and similar things in /usr/local/lib.  The
-   system compiler, GCC, has apparently been modified to not look
-   there, contrary to what a stock GCC would do.  */
-
-#define LD_SWITCH_SYSTEM  -L/usr/local/lib
 #undef LIB_GCC
 #define LIB_GCC
 
--- a/src/s/gnu-linux.h	Fri May 07 02:50:26 2010 +0200
+++ b/src/s/gnu-linux.h	Thu May 06 19:55:47 2010 -0700
@@ -1,7 +1,7 @@
 /* This file is the configuration file for Linux-based GNU systems
-   Copyright (C) 1985, 1986, 1992, 1994, 1996, 1999, 2001, 2002, 2003, 2004,
-                 2005, 2006, 2007, 2008, 2009, 2010
-                 Free Software Foundation, Inc.
+
+Copyright (C) 1985, 1986, 1992, 1994, 1996, 1999, 2001, 2002, 2003, 2004,
+  2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -169,15 +169,6 @@
 /* Ask GCC where to find libgcc.a.  */
 #define LIB_GCC `$(CC) $(C_SWITCH_X_SITE) -print-libgcc-file-name`
 
-/* Here is how to find X Windows.  LD_SWITCH_X_SITE_AUX gives an -R option
-   that says where to find X windows at run time.  */
-
-#ifdef __mips__
-#define LD_SWITCH_SYSTEM -G 0 $(LD_SWITCH_X_SITE_AUX)
-#else
-#define LD_SWITCH_SYSTEM $(LD_SWITCH_X_SITE_AUX)
-#endif /* __mips__ */
-
 #ifdef emacs
 #define INTERRUPT_INPUT
 #endif
--- a/src/s/netbsd.h	Fri May 07 02:50:26 2010 +0200
+++ b/src/s/netbsd.h	Thu May 06 19:55:47 2010 -0700
@@ -1,7 +1,7 @@
 /* s/ file for netbsd system.
 
-   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
+Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
+  2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -33,10 +33,6 @@
 
 #define AMPERSAND_FULL_NAME
 
-/* LD_SWITCH_X_SITE_AUX_RPATH gives a -rpath option (which is what
-   OSF1 uses) that says where to find X windows at run time.  */
-#define LD_SWITCH_SYSTEM $(LD_SWITCH_X_SITE_AUX_RPATH) -Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib
-
 /* On post 1.3 releases of NetBSD, gcc -nostdlib also clears
    the library search parth, i.e. it won't search /usr/lib
    for libc and friends. Using -nostartfiles instead avoids