Move LIBS_SYSTEM from cpp to configure.
authorGlenn Morris <rgm@gnu.org>
Mon, 10 May 2010 02:16:09 +0000 (19:16 -0700)
committerGlenn Morris <rgm@gnu.org>
Mon, 10 May 2010 02:16:09 +0000 (19:16 -0700)
* configure.in (LIBS_SYSTEM): New output variable, replacing cpp.

* lib-src/Makefile.in (LIBS_SYSTEM) [!MSDOS]: Set with configure, not cpp.
(LIBS_SYSTEM) [MSDOS]: Use MSDOS_LIBS_SYSTEM.
(NOT_C_CODE): Remove, no longer used.
(config.h) [!MSDOS]: No longer include.
(LOADLIBES): Use LIBS_SYSTEM as a variable.

* src/Makefile.in (LIBS_SYSTEM): Set using configure, not cpp.
(LIBS_SYSTEM) [MSDOS]: Reset with MSDOS_LIBS_SYSTEM.
(LIBES): Use LIBS_SYSTEM as a variable.
* src/s/msdos.h (LIBS_SYSTEM): Rename to MSDOS_LIBS_SYSTEM.  Always define.
* src/s/aix4-2.h (LIBS_SYSTEM):
* src/s/freebsd.h (LIBS_SYSTEM):
* src/s/hpux10-20.h (LIBS_SYSTEM):
* src/s/sol2-6.h (LIBS_SYSTEM):
* src/s/unixware.h (LIBS_SYSTEM):
Move to configure.

* msdos/sed1v2.inp, msdos/sed3v2.inp (LIBS_SYSTEM): Edit to empty.

15 files changed:
ChangeLog
configure.in
lib-src/ChangeLog
lib-src/Makefile.in
msdos/ChangeLog
msdos/sed1v2.inp
msdos/sed3v2.inp
src/ChangeLog
src/Makefile.in
src/s/aix4-2.h
src/s/freebsd.h
src/s/hpux10-20.h
src/s/msdos.h
src/s/sol2-6.h
src/s/unixware.h

index 355f21f..b6caa8b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2010-05-10  Glenn Morris  <rgm@gnu.org>
 
+       * configure.in (LIBS_SYSTEM): New output variable, replacing cpp.
+
        * configure.in (MAIL_USE_FLOCK, MAIL_USE_LOCKF): New AC_DEFINEs.
        (BLESSMAIL_TARGET): New output variable.
 
 
        * configure.in (REAL_CFLAGS, CFLAGS): Restore -g for gcc.
 
-2010-04-22  Miles Bader <miles@gnu.org>
+2010-04-22  Miles Bader  <miles@gnu.org>
 
        * configure.in: Get rid of "unix" pre-defined macro when
        preprocessing Makefile.  (Bug#5857)
index 383e80b..c99167f 100644 (file)
@@ -859,10 +859,6 @@ tempcname="conftest.c"
 echo '
 #include "'${srcdir}'/src/'${opsysfile}'"
 #include "'${srcdir}'/src/'${machfile}'"
-#ifndef LIBS_SYSTEM
-#define LIBS_SYSTEM
-#endif
-configure___ libsrc_libs=LIBS_SYSTEM
 
 configure___ LIBX=-lX11
 
@@ -1003,6 +999,23 @@ test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \
 AC_SUBST(C_SWITCH_SYSTEM)
 
 
+LIBS_SYSTEM=
+case "$opsys" in
+  ## IBM's X11R5 uses -lIM and -liconv in AIX 3.2.2.
+  aix4-2) LIBS_SYSTEM="-lrts -lIM -liconv" ;;
+
+  freebsd) LIBS_SYSTEM="-lutil" ;;
+
+  hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
+
+  sol2*) LIBS_SYSTEM="-lsocket -lnsl -lkstat" ;;
+
+  ## Motif needs -lgen.
+  unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
+esac
+AC_SUBST(LIBS_SYSTEM)
+
+
 ### Make sure subsequent tests use flags consistent with the build flags.
 
 if test x"${OVERRIDE_CPPFLAGS}" != x; then
@@ -1586,7 +1599,7 @@ if test $use_mmap_for_buffers = yes; then
   REL_ALLOC=no
 fi
 
-LIBS="$libsrc_libs $LIBS"
+LIBS="$LIBS_SYSTEM $LIBS"
 
 dnl If found, this defines HAVE_LIBDNET, which m/pmax.h checks,
 dnl and also adds -ldnet to LIBS, which Autoconf uses for checks.
@@ -1600,6 +1613,18 @@ AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
 
 AC_CHECK_LIB(pthreads, cma_open)
 
+## Note: when using cpp in s/aix4.2.h, this definition depended on
+## HAVE_LIBPTHREADS.  That was not defined earlier in configure when
+## the system file was sourced.  Hence the value of LIBS_SYSTEM
+## added to LIBS in configure would never contain the pthreads part,
+## but the value used in Makefiles might.  FIXME?
+##
+## -lpthreads seems to be necessary for Xlib in X11R6, and should
+## be harmless on older versions of X where it happens to exist.
+test "$opsys" = "aix4-2" && \
+  test $ac_cv_lib_pthreads_cma_open = yes && \
+  LIBS_SYSTEM="$LIBS_SYSTEM -lpthreads"
+
 dnl Check for need for bigtoc support on IBM AIX
 
 case ${host_os} in
index c2a7b6f..608d5c6 100644 (file)
@@ -1,5 +1,11 @@
 2010-05-10  Glenn Morris  <rgm@gnu.org>
 
+       * Makefile.in (LIBS_SYSTEM): Set with configure, not cpp.
+       (LIBS_SYSTEM) [MSDOS]: Reset with MSDOS_LIBS_SYSTEM.
+       (NOT_C_CODE): Remove, no longer used.
+       (config.h) [!MSDOS]: No longer include.
+       (LOADLIBES): Use LIBS_SYSTEM as a variable.
+
        * Makefile.in (BLESSMAIL_TARGET): Set with configure, not cpp.
 
 2010-05-08  Christoph  <cschol2112@googlemail.com>  (tiny change)
index cde26a5..5f0fb6e 100644 (file)
@@ -154,6 +154,9 @@ LIBS_MAIL=@LIBS_MAIL@
 ## Extra libraries to use when linking movemail.
 LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV)
 
+## Some systems define this to request special libraries.
+LIBS_SYSTEM = @LIBS_SYSTEM@
+
 # Those files shared with other GNU utilities need HAVE_CONFIG_H
 # defined before they know they can take advantage of the information
 # in ../src/config.h.
@@ -164,14 +167,12 @@ CPP_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H -I. -I../src
 # ========================== start of cpp stuff =======================
 /* From here on, comments must be done in C syntax.  */
 
-#define NOT_C_CODE
+#ifdef MSDOS
 #include "../src/config.h"
-
-/* Some s/SYSTEM.h files define this to request special libraries.  */
-#ifndef LIBS_SYSTEM
-#define LIBS_SYSTEM
+LIBS_SYSTEM = MSDOS_LIBS_SYSTEM
 #endif
-LOADLIBES=LIBS_SYSTEM
+
+LOADLIBES=$(LIBS_SYSTEM)
 
 \f
 .SUFFIXES: .m
index 996b9c0..6922c6f 100644 (file)
@@ -1,5 +1,7 @@
 2010-05-10  Glenn Morris  <rgm@gnu.org>
 
+       * sed1v2.inp, sed3v2.inp (LIBS_SYSTEM): Edit to empty.
+
        * sed3v2.inp (BLESSMAIL_TARGET): Edit to need-blessmail.
 
 2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
index a3ad070..db6944e 100644 (file)
@@ -50,6 +50,7 @@ s/@LIB_MATH@/-lm/
 /^LD_SWITCH_X_SITE_AUX_RPATH *=/s/@LD_SWITCH_X_SITE_AUX_RPATH@//
 /^LD_SWITCH_SYSTEM *=/s/@LD_SWITCH_SYSTEM@//
 /^LD_SWITCH_SYSTEM_EXTRA *=/s/@LD_SWITCH_SYSTEM_EXTRA@//
+/^LIBS_SYSTEM *=/s/@LIBS_SYSTEM@//
 /^LIBTIFF *=/s/@LIBTIFF@//
 /^LIBJPEG *=/s/@LIBJPEG@//
 /^LIBPNG *=/s/@LIBPNG@//
index b0182a7..d5a4a33 100644 (file)
@@ -35,6 +35,7 @@
 /^LIBHESIOD *=/s/@[^@\n]*@//g
 /^LIBRESOLV *=/s/@[^@\n]*@//g
 /^LIBS_MAIL *=/s/@[^@\n]*@//g
+/^LIBS_SYSTEM *=/s/@[^@\n]*@//g
 /^CFLAGS *=/s!=.*$!=-O2 -g!
 /^C_SWITCH_SYSTEM *=/s!=.*$!=-DMSDOS!
 /^C_SWITCH_MACHINE *=/s/@C_SWITCH_MACHINE@//
index c0a264d..c0e37f7 100644 (file)
@@ -1,5 +1,16 @@
 2010-05-10  Glenn Morris  <rgm@gnu.org>
 
+       * Makefile.in (LIBS_SYSTEM): Set using configure, not cpp.
+       (LIBS_SYSTEM) [MSDOS]: Reset with MSDOS_LIBS_SYSTEM.
+       (LIBES): Use LIBS_SYSTEM as a variable.
+       * s/msdos.h (LIBS_SYSTEM): Rename to MSDOS_LIBS_SYSTEM.  Always define.
+       * s/aix4-2.h (LIBS_SYSTEM):
+       * s/freebsd.h (LIBS_SYSTEM):
+       * s/hpux10-20.h (LIBS_SYSTEM):
+       * s/sol2-6.h (LIBS_SYSTEM):
+       * s/unixware.h (LIBS_SYSTEM):
+       Move to configure.
+
        * s/aix4-2.h (MAIL_USE_LOCKF):
        * s/bsd-common.h (MAIL_USE_FLOCK):
        * s/darwin.h (MAIL_USE_FLOCK):
index f956d03..69e37fb 100644 (file)
@@ -88,6 +88,9 @@ 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)
 
+## Some systems define this to request special libraries.
+LIBS_SYSTEM=@LIBS_SYSTEM@
+
 LIBTIFF=@LIBTIFF@
 LIBJPEG=@LIBJPEG@
 LIBPNG=@LIBPNG@
@@ -195,11 +198,6 @@ DEPFLAGS = -MMD -MF deps/$*.d
    do not let it interfere with this file.  */
 #undef register
 
-/* Some s/SYSTEM.h files define this to request special libraries.  */
-#ifndef LIBS_SYSTEM
-#define LIBS_SYSTEM
-#endif
-
 /* This macro is for switches specifically related to X Windows.  */
 #ifndef LD_SWITCH_X_SITE
 #define LD_SWITCH_X_SITE
@@ -324,9 +322,9 @@ LD=ld
 #endif
 
 #ifdef MSDOS
+LIBS_SYSTEM = MSDOS_LIBS_SYSTEM
 #ifdef HAVE_X_WINDOWS
 MSDOS_OBJ = dosfns.o msdos.o
-#define LIBS_SYSTEM -lxext -lsys
 #else
 MSDOS_OBJ = dosfns.o msdos.o w16select.o termcap.o
 #endif
@@ -656,8 +654,8 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \
    with GCC, we might need gnulib again after them.  */
 
 LIBES = $(LOADLIBES) $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
-   $(RSVG_LIBS) $(DBUS_LIBS) @LIBGPM@ @LIBRESOLV@ LIBS_SYSTEM $(LIBS_TERMCAP) \
-   $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \
+   $(RSVG_LIBS) $(DBUS_LIBS) @LIBGPM@ @LIBRESOLV@ $(LIBS_SYSTEM) \
+   $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \
    @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ @M17N_FLT_LIBS@ \
    $(GNULIB_VAR) @LIB_MATH@ @LIB_STANDARD@ $(GNULIB_VAR)
 
index dc6ba71..8f506cb 100644 (file)
@@ -87,15 +87,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define LINKER cc
 #endif
 
-/* -lpthreads seems to be necessary for Xlib in X11R6, and should be harmless
-   on older versions of X where it happens to exist.  */
-#ifdef HAVE_LIBPTHREADS
-#define LIBS_SYSTEM -lrts -lIM -liconv -lpthreads
-#else
-/* IBM's X11R5 use -lIM and -liconv in AIX 3.2.2.  */
-#define LIBS_SYSTEM -lrts -lIM -liconv
-#endif
-
 /* The following definition seems to be needed in AIX version 3.1.6.8.
    It may not have been needed in certain earlier versions.  */
 #define HAVE_TCATTR
index 50fdf65..78c7dfd 100644 (file)
@@ -30,8 +30,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
 
-#define LIBS_SYSTEM -lutil
-
 #undef LIB_GCC
 #define LIB_GCC
 
index 8dc2f4d..0dc8276 100644 (file)
@@ -1,6 +1,7 @@
 /* System description file for hpux version 10.20.
-   Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-     2008, 2009, 2010  Free Software Foundation, Inc.
+
+Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+  2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -126,13 +127,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* AlainF 20-Jul-1996 says this is right.  */
 #define KERNEL_FILE "/stand/vmunix"
 
-#define LIBS_SYSTEM -l:libdld.sl
-
 
 /* Rainer Malzbender <rainer@displaytech.com> says definining
    HAVE_XRMSETDATABASE allows Emacs to compile on HP-UX 10.20
    using GCC.  */
-
 #ifndef HAVE_XRMSETDATABASE
 #define HAVE_XRMSETDATABASE
 #endif
index 5199799..a594bb8 100644 (file)
@@ -1,7 +1,7 @@
 /* System description file for MS-DOS
 
-   Copyright (C) 1993, 1996, 1997, 2001, 2002, 2003, 2004, 2005, 2006,
-                 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright (C) 1993, 1996, 1997, 2001, 2002, 2003, 2004, 2005, 2006,
+  2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -140,8 +140,9 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
    commentary below, in the non-X branch.  The 140KB number was
    measured on GNU/Linux and on MS-WIndows.  */
 #define SYSTEM_PURESIZE_EXTRA (-170000+140000)
-#define LIBS_SYSTEM -lxext -lsys
+#define MSDOS_LIBS_SYSTEM -lxext -lsys
 #else
+#define MSDOS_LIBS_SYSTEM
 /* We need a little extra space, see ../../lisp/loadup.el.
    As of 20091024, DOS-specific files use up 62KB of pure space.  But
    overall, we end up wasting 130KB of pure space, because
index 78d2bfb..f9a4c44 100644 (file)
@@ -27,8 +27,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define POSIX
 
-#define LIBS_SYSTEM -lsocket -lnsl -lkstat
-
 /* Prefer kstat over kvm in getloadavg.c, kstat doesn't require root.
    ghazi@caip.rutgers.edu, 7/21/97.  Don't redefine if already defined
    (e.g., by config.h). */
index 6e42a0d..31d7b25 100644 (file)
@@ -1,7 +1,7 @@
 /* s/ file for Unixware.
 
-   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-                 2008, 2009, 2010  Free Software Foundation, Inc.
+Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+  2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -28,9 +28,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #undef HAVE_SYSV_SIGPAUSE
 
-/* Motif needs -lgen.  */
-#define LIBS_SYSTEM -lsocket -lnsl -lelf -lgen
-
 /* This is the same definition as in usg5-4.h, but with sigblock/sigunblock
    rather than sighold/sigrelse, which appear to be BSD4.1 specific.
    It may also be appropriate for SVR4.x