From: Glenn Morris Date: Fri, 7 May 2010 02:55:47 +0000 (-0700) Subject: Move LD_SWITCH_SYSTEM from cpp to configure. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~250 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2f86b22b05324b3687dd470bbd85e65d4d8db1d7;p=emacs.git 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. --- diff --git a/ChangeLog b/ChangeLog index 2f6f8c8e855..06a8ad610b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-05-07 Glenn Morris + + * 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 Define START_FILES and LIB_STANDARD using autoconf. diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES index eee7a99d1a1..ab78d1b8c5f 100644 --- a/admin/CPP-DEFINES +++ b/admin/CPP-DEFINES @@ -215,7 +215,6 @@ IS_ANY_SEP IS_DIRECTORY_SEP KERNEL_FILE LDAV_SYMBOL -LD_SWITCH_SYSTEM LIBS_SYSTEM LIBS_TERMCAP LIBXMU diff --git a/configure.in b/configure.in index d670342723f..8b1bc60cc5f 100644 --- a/configure.in +++ b/configure.in @@ -892,12 +892,6 @@ configure___ use_mmap_for_buffers=no #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 @@ else 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 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 @@ esac 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. diff --git a/src/ChangeLog b/src/ChangeLog index 81fe7c07571..04d9d6b8266 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2010-05-07 Glenn Morris + + * 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 Define LIB_STANDARD and START_FILES using autoconf. diff --git a/src/Makefile.in b/src/Makefile.in index 70ec71f3fb6..5ea321df78c 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -73,13 +73,20 @@ C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ ## 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 @@ DEPFLAGS = -MMD -MF deps/$*.d #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 @@ LD=ld #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 @@ temacs${EXEEXT}: $(LOCALCPP) $(START_FILES) stamp-oldxmenu ${obj} ${otherobj} pr ${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 diff --git a/src/s/freebsd.h b/src/s/freebsd.h index 0b56f6b3c81..1e79e1d3581 100644 --- a/src/s/freebsd.h +++ b/src/s/freebsd.h @@ -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 @@ along with GNU Emacs. If not, see . */ #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 diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h index e5ac75ff0d4..f3a06990ed3 100644 --- a/src/s/gnu-linux.h +++ b/src/s/gnu-linux.h @@ -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 @@ along with GNU Emacs. If not, see . */ /* 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 diff --git a/src/s/netbsd.h b/src/s/netbsd.h index 987f5e68907..a92e8ce56ee 100644 --- a/src/s/netbsd.h +++ b/src/s/netbsd.h @@ -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 @@ along with GNU Emacs. If not, see . */ #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