changeset 107407:975563054751

Replace some cpp with autoconf. * configure.in (--with-mmdf, --with-mail-unlink): New options, off by default. (--with-mailhost): New option to set default POP host. (LIBXPM, LIBJPEG, LIBPNG, LIBTIFF, LIBGIF, LIBGPM, LIBS_MAIL) (LIBHESIOD, LIBRESOLV, COM_ERRLIB, CRYPTOLIB, KRB5LIB, DESLIB, KRB4LIB): New variables, substituted in Makefiles. (try_libungif, ac_gif_lib_name): Replace with HAVE_GIF=maybe, LIBGIF. (LIBGIF): Use AC_SUBST rather than AC_DEFINE. (HAVE_LIBMAIL, HAVE_LIBLOCKFILE, HAVE_LIBCOM_ERR, HAVE_LIBCRYPTO) (HAVE_LIBK5CRYPTO, HAVE_LIBKRB5, HAVE_LIBDES425, HAVE_LIBDES) (HAVE_LIBKRB4, HAVE_LIBKRB): New AC_DEFINEs. * lib-src/Makefile.in (KRB4LIB, DESLIB, KRB5LIB, CRYPTOLIB, COM_ERRLIB) (HESIODLIB, LIBS_MAIL): Set using autoconf rather than cpp. (BASE_CFLAGS): Remove (identical to CPP_CFLAGS). * src/Makefile.in (XFT_LIBS, LIBXPM, LIBJPEG, LIBPNG, LIBTIFF, LIBGIF) (LIBGPM, LIBRESOLV): Set using autoconf rather than cpp.
author Glenn Morris <rgm@gnu.org>
date Wed, 17 Mar 2010 22:49:31 -0700
parents 1de48da1419b
children eba6eb70e988
files ChangeLog configure.in etc/NEWS lib-src/ChangeLog lib-src/Makefile.in src/ChangeLog src/Makefile.in
diffstat 7 files changed, 186 insertions(+), 167 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Mar 17 22:25:13 2010 -0700
+++ b/ChangeLog	Wed Mar 17 22:49:31 2010 -0700
@@ -1,3 +1,17 @@
+2010-03-18  Glenn Morris  <rgm@gnu.org>
+
+	* configure.in (--with-mmdf, --with-mail-unlink):
+	New options, off by default.
+	(--with-mailhost): New option to set default POP host.
+	(LIBXPM, LIBJPEG, LIBPNG, LIBTIFF, LIBGIF, LIBGPM, LIBS_MAIL)
+	(LIBHESIOD, LIBRESOLV, COM_ERRLIB, CRYPTOLIB, KRB5LIB, DESLIB, KRB4LIB):
+	New variables, substituted in Makefiles.
+	(try_libungif, ac_gif_lib_name): Replace with HAVE_GIF=maybe, LIBGIF.
+	(LIBGIF): Use AC_SUBST rather than AC_DEFINE.
+	(HAVE_LIBMAIL, HAVE_LIBLOCKFILE, HAVE_LIBCOM_ERR, HAVE_LIBCRYPTO)
+	(HAVE_LIBK5CRYPTO, HAVE_LIBKRB5, HAVE_LIBDES425, HAVE_LIBDES)
+	(HAVE_LIBKRB4, HAVE_LIBKRB): New AC_DEFINEs.
+
 2010-03-18  Tetsurou Okazaki  <okazaki@be.to>  (tiny change)
 
 	* Makefile.in (uninstall): Handle the case where archlibdir does not
--- a/configure.in	Wed Mar 17 22:25:13 2010 -0700
+++ b/configure.in	Wed Mar 17 22:49:31 2010 -0700
@@ -91,10 +91,26 @@
 fi
 
 OPTION_DEFAULT_OFF([hesiod],[support Hesiod to get the POP server host])
+dnl FIXME hesiod support may not be present, so it seems like an error
+dnl to define, or at least use, this unconditionally.
 if test "$with_hesiod" != no; then
   AC_DEFINE(HESIOD, 1, [Define to support using a Hesiod database to find the POP server.])
 fi
 
+OPTION_DEFAULT_OFF([mmdf],[support MMDF mailboxes])
+if test "$with_mmdf" != no; then
+   AC_DEFINE(MAIL_USE_MMDF, 1, [Define to support MMDF mailboxes in movemail.])
+fi
+
+OPTION_DEFAULT_OFF([mail-unlink],[unlink, rather than empty, mail spool after reading])
+if test "$with_mail_unlink" != no; then
+   AC_DEFINE(MAIL_UNLINK_SPOOL, 1, [Define to unlink, rather than empty, mail spool after reading.])
+fi
+
+AC_ARG_WITH([mailhost],[AS_HELP_STRING([--with-mailhost=HOSTNAME],
+    [string giving default POP mail host])],
+    AC_DEFINE_UNQUOTED(MAILHOST, ["$withval"], [String giving fallback POP mail host.]))
+
 OPTION_DEFAULT_ON([sound],[don't compile with sound support])
 
 OPTION_DEFAULT_ON([sync-input],[process async input synchronously])
@@ -2078,6 +2094,7 @@
 
 ### Use -lXpm if available, unless `--with-xpm=no'.
 HAVE_XPM=no
+LIBXPM=
 if test "${HAVE_X11}" = "yes"; then
   if test "${with_xpm}" != "no"; then
     AC_CHECK_HEADER(X11/xpm.h,
@@ -2101,11 +2118,14 @@
 
   if test "${HAVE_XPM}" = "yes"; then
     AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm libary (-lXpm).])
+    LIBXPM=-lXpm
   fi
 fi
+AC_SUBST(LIBXPM)
 
 ### Use -ljpeg if available, unless `--with-jpeg=no'.
 HAVE_JPEG=no
+LIBJPEG=
 if test "${HAVE_X11}" = "yes"; then
   if test "${with_jpeg}" != "no"; then
     dnl Checking for jpeglib.h can lose because of a redefinition of
@@ -2125,10 +2145,15 @@
         [AC_MSG_WARN([libjpeg found, but not version 6b or later])
         HAVE_JPEG=no])
   fi
+  if test "${HAVE_JPEG}" = "yes"; then
+    LIBJPEG=-ljpeg
+  fi
 fi
+AC_SUBST(LIBJPEG)
 
 ### Use -lpng if available, unless `--with-png=no'.
 HAVE_PNG=no
+LIBPNG=
 if test "${HAVE_X11}" = "yes"; then
   if test "${with_png}" != "no"; then
     # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
@@ -2141,11 +2166,14 @@
 
   if test "${HAVE_PNG}" = "yes"; then
     AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).])
+    LIBPNG="-lpng -lz -lm"
   fi
 fi
+AC_SUBST(LIBPNG)
 
 ### Use -ltiff if available, unless `--with-tiff=no'.
 HAVE_TIFF=no
+LIBTIFF=
 if test "${HAVE_X11}" = "yes"; then
   if test "${with_tiff}" != "no"; then
     AC_CHECK_HEADER(tiffio.h,
@@ -2157,35 +2185,34 @@
 
   if test "${HAVE_TIFF}" = "yes"; then
     AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
+    dnl FIXME -lz -lm, as per libpng?
+    LIBTIFF=-ltiff
   fi
 fi
+AC_SUBST(LIBTIFF)
 
 ### Use -lgif or -lungif if available, unless `--with-gif=no'.
 HAVE_GIF=no
+LIBGIF=
 if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no"; then
   AC_CHECK_HEADER(gif_lib.h,
 # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
 # Earlier versions can crash Emacs.
-    [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, try_libungif=yes)])
+    [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=maybe)])
 
   if test "$HAVE_GIF" = yes; then
-      ac_gif_lib_name="-lgif"
-  fi
-
+    LIBGIF=-lgif
+  elif test "$HAVE_GIF" = maybe; then
 # If gif_lib.h but no libgif, try libungif.
-  if test x"$try_libungif" = xyes; then
-    AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes)
-
-    if test "$HAVE_GIF" = yes; then
-      AC_DEFINE(LIBGIF, -lungif, [Compiler option to link with the gif library (if not -lgif).])
-      ac_gif_lib_name="-lungif"
-    fi
+    AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=no)
+    test "$HAVE_GIF" = yes && LIBGIF=-lungif
   fi
 
   if test "${HAVE_GIF}" = "yes"; then
-    AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif library (default -lgif; otherwise specify with LIBGIF).])
+    AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif (or ungif) library.])
   fi
 fi
+AC_SUBST(LIBGIF)
 
 dnl Check for required libraries.
 if test "${HAVE_X11}" = "yes"; then
@@ -2214,14 +2241,17 @@
 
 ### Use -lgpm if available, unless `--with-gpm=no'.
 HAVE_GPM=no
+LIBGPM=
 if test "${with_gpm}" != "no"; then
   AC_CHECK_HEADER(gpm.h,
     [AC_CHECK_LIB(gpm, Gpm_Open, HAVE_GPM=yes)])
+
+  if test "${HAVE_GPM}" = "yes"; then
+    AC_DEFINE(HAVE_GPM, 1, [Define to 1 if you have the gpm library (-lgpm).])
+    LIBGPM=-lgpm
+  fi
 fi
-
-if test "${HAVE_GPM}" = "yes"; then
-  AC_DEFINE(HAVE_GPM, 1, [Define to 1 if you have the gpm library (-lgpm).])
-fi
+AC_SUBST(LIBGPM)
 
 dnl Check for malloc/malloc.h on darwin
 AC_CHECK_HEADER(malloc/malloc.h, [AC_DEFINE(HAVE_MALLOC_MALLOC_H, 1, [Define to 1 if you have the <malloc/malloc.h> header file.])])
@@ -2286,13 +2316,24 @@
 
 # Check for mail-locking functions in a "mail" library.  Probably this should
 # have the same check as for liblockfile below.
-AC_CHECK_LIB(mail, maillock)
+AC_CHECK_LIB(mail, maillock, have_mail=yes, have_mail=no)
+if test $have_mail = yes; then
+  LIBS_MAIL=-lmail
+  LIBS="$LIBS_MAIL $LIBS"
+  AC_DEFINE(HAVE_LIBMAIL, 1, [Define to 1 if you have the `mail' library (-lmail).])
+else
+  LIBS_MAIL=
+fi
 dnl Debian, at least:
-AC_CHECK_LIB(lockfile, maillock)
+AC_CHECK_LIB(lockfile, maillock, have_lockfile=yes, have_lockfile=no)
+if test $have_lockfile = yes; then
+   LIBS_MAIL=-llockfile
+   LIBS="$LIBS_MAIL $LIBS"
+   AC_DEFINE(HAVE_LIBLOCKFILE, 1, [Define to 1 if you have the `lockfile' library (-llockfile).])
+else
 # If we have the shared liblockfile, assume we must use it for mail
 # locking (e.g. Debian).  If we couldn't link against liblockfile
 # (no liblockfile.a installed), ensure that we don't need to.
-if test "$ac_cv_lib_lockfile_maillock" = no; then
   dnl This works for files generally, not just executables.
   dnl Should we look elsewhere for it?  Maybe examine /etc/ld.so.conf?
   AC_CHECK_PROG(liblockfile, liblockfile.so, yes, no,
@@ -2301,11 +2342,11 @@
     AC_MSG_ERROR([Shared liblockfile found but can't link against it.
 This probably means that movemail could lose mail.
 There may be a `development' package to install containing liblockfile.])
-  else :
   fi
 fi
 AC_CHECK_FUNCS(touchlock)
 AC_CHECK_HEADERS(maillock.h)
+AC_SUBST(LIBS_MAIL)
 
 AC_CHECK_FUNCS(gethostname getdomainname dup2 \
 rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
@@ -2383,8 +2424,9 @@
 fi
 
 # Do we need the Hesiod library to provide the support routines?
+LIBHESIOD=
 if test "$with_hesiod" != no ; then
-  # Don't set $LIBS here -- see comments above.
+  # Don't set $LIBS here -- see comments above.  FIXME which comments?
   AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, ,
      [AC_CHECK_LIB(resolv, res_send, resolv=yes,
 		  [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])])
@@ -2394,28 +2436,86 @@
     RESOLVLIB=
   fi
   AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost,
-	[AC_DEFINE(HAVE_LIBHESIOD, 1,
-		  [Define to 1 if you have the hesiod library (-lhesiod).])],
-	:, $RESOLVLIB)])
+	hesiod=yes, :, $RESOLVLIB)])
+
+  if test x"$hesiod" = xyes; then
+    AC_DEFINE(HAVE_LIBHESIOD, 1,
+              [Define to 1 if you have the hesiod library (-lhesiod).])
+    LIBHESIOD=-lhesiod
+  fi
 fi
+AC_SUBST(LIBHESIOD)
 
 # Do we need libresolv (due to res_init or Hesiod)?
 if test "$resolv" = yes ; then
   AC_DEFINE(HAVE_LIBRESOLV, 1,
             [Define to 1 if you have the resolv library (-lresolv).])
+  LIBRESOLV=-lresolv
+else
+  LIBRESOLV=
 fi
+AC_SUBST(LIBRESOLV)
 
 # These tell us which Kerberos-related libraries to use.
+COM_ERRLIB=
+CRYPTOLIB=
+KRB5LIB=
+DESLIB=
+KRB4LIB=
+
 if test "${with_kerberos}" != no; then
-  AC_CHECK_LIB(com_err, com_err)
-  AC_CHECK_LIB(k5crypto, mit_des_cbc_encrypt)
-  AC_CHECK_LIB(crypto, mit_des_cbc_encrypt)
-  AC_CHECK_LIB(krb5, krb5_init_context)
+  AC_CHECK_LIB(com_err, com_err, have_com_err=yes, have_com_err=no)
+  if test $have_com_err = yes; then
+    COM_ERRLIB=-lcom_err
+    LIBS="$COM_ERRLIB $LIBS"
+    AC_DEFINE(HAVE_LIBCOM_ERR, 1, [Define to 1 if you have the `com_err' library (-lcom_err).])
+  fi
+  AC_CHECK_LIB(crypto, mit_des_cbc_encrypt, have_crypto=yes, have_crypto=no)
+  if test $have_crypto = yes; then
+    CRYPTOLIB=-lcrypto
+    LIBS="$CRYPTOLIB $LIBS"
+    AC_DEFINE(HAVE_LIBCRYPTO, 1, [Define to 1 if you have the `crypto' library (-lcrypto).])
+  fi
+  AC_CHECK_LIB(k5crypto, mit_des_cbc_encrypt, have_k5crypto=yes, have_k5crypto=no)
+  if test $have_k5crypto = yes; then
+    CRYPTOLIB=-lk5crypto
+    LIBS="$CRYPTOLIB $LIBS"
+    AC_DEFINE(HAVE_LIBK5CRYPTO, 1, [Define to 1 if you have the `k5crypto' library (-lk5crypto).])
+  fi
+  AC_CHECK_LIB(krb5, krb5_init_context, have_krb5=yes, have_krb5=no)
+  if test $have_krb5=yes; then
+    KRB5LIB=-lkrb5
+    LIBS="$KRB5LIB $LIBS"
+    AC_DEFINE(HAVE_LIBKRB5, 1, [Define to 1 if you have the `krb5' library (-lkrb5).])
+  fi
+  dnl FIXME Simplify.  Does not match 22 logic, thanks to default_off?
   if test "${with_kerberos5}" = no; then
-    AC_CHECK_LIB(des425, des_cbc_encrypt,,
-		 [AC_CHECK_LIB(des, des_cbc_encrypt)])
-    AC_CHECK_LIB(krb4, krb_get_cred,,
-		 [AC_CHECK_LIB(krb, krb_get_cred)])
+    AC_CHECK_LIB(des425, des_cbc_encrypt, have_des425=yes, have_des425=no )
+    if test $have_des425 = yes; then
+      DESLIB=-ldes425
+      LIBS="$DESLIB $LIBS"
+      AC_DEFINE(HAVE_LIBDES425, 1, [Define to 1 if you have the `des425' library (-ldes425).])
+    else
+      AC_CHECK_LIB(des, des_cbc_encrypt, have_des=yes, have_des=no)
+      if test $have_des = yes; then
+        DESLIB=-ldes
+        LIBS="$DESLIB $LIBS"
+        AC_DEFINE(HAVE_LIBDES, 1, [Define to 1 if you have the `des' library (-ldes).])
+      fi
+    fi
+    AC_CHECK_LIB(krb4, krb_get_cred, have_krb4=yes, have_krb4=no)
+    if test $have_krb4 = yes; then
+      KRB4LIB=-lkrb4
+      LIBS="$KRB4LIB $LIBS"
+      AC_DEFINE(HAVE_LIBKRB4, 1, [Define to 1 if you have the `krb4' library (-lkrb4).])
+    else
+      AC_CHECK_LIB(krb, krb_get_cred, have_krb=yes, have_krb=no)
+      if test $have_krb = yes; then
+        KRB4LIB=-lkrb
+        LIBS="$KRB4LIB $LIBS"
+        AC_DEFINE(HAVE_LIBKRB, 1, [Define to 1 if you have the `krb' library (-lkrb).])
+      fi
+    fi
   fi
 
   if test "${with_kerberos5}" != no; then
@@ -2433,6 +2533,12 @@
   AC_CHECK_HEADERS(com_err.h)
 fi
 
+AC_SUBST(COM_ERRLIB)
+AC_SUBST(CRYPTOLIB)
+AC_SUBST(KRB5LIB)
+AC_SUBST(DESLIB)
+AC_SUBST(KRB4LIB)
+
 # Solaris requires -lintl if you want strerror (which calls dgettext)
 # to return localized messages.
 AC_CHECK_LIB(intl, dgettext)
@@ -3009,7 +3115,7 @@
 echo "  Does Emacs use -lXpm?                                   ${HAVE_XPM}"
 echo "  Does Emacs use -ljpeg?                                  ${HAVE_JPEG}"
 echo "  Does Emacs use -ltiff?                                  ${HAVE_TIFF}"
-echo "  Does Emacs use a gif library?                           ${HAVE_GIF} $ac_gif_lib_name"
+echo "  Does Emacs use a gif library?                           ${HAVE_GIF} $LIBGIF"
 echo "  Does Emacs use -lpng?                                   ${HAVE_PNG}"
 echo "  Does Emacs use -lrsvg-2?                                ${HAVE_RSVG}"
 echo "  Does Emacs use -lgpm?                                   ${HAVE_GPM}"
--- a/etc/NEWS	Wed Mar 17 22:25:13 2010 -0700
+++ b/etc/NEWS	Wed Mar 17 22:49:31 2010 -0700
@@ -24,6 +24,12 @@
 
 * Installation Changes in Emacs 24.1
 
+---
+** There are new configure options:
+--with-mmdf, --with-mail-unlink, --with-mailhost.
+These provide no new functionality, they just remove the need to edit
+lib-src/Makefile by hand in order to use the associated features.
+
 
 * Startup Changes in Emacs 24.1
 
--- a/lib-src/ChangeLog	Wed Mar 17 22:25:13 2010 -0700
+++ b/lib-src/ChangeLog	Wed Mar 17 22:49:31 2010 -0700
@@ -1,3 +1,9 @@
+2010-03-18  Glenn Morris  <rgm@gnu.org>
+
+	* Makefile.in (KRB4LIB, DESLIB, KRB5LIB, CRYPTOLIB, COM_ERRLIB)
+	(HESIODLIB, LIBS_MAIL): Set using autoconf rather than cpp.
+	(BASE_CFLAGS): Remove (identical to CPP_CFLAGS).
+
 2010-03-18  Tetsurou Okazaki  <okazaki@be.to>  (tiny change)
 
 	* Makefile.in (uninstall): Handle the case where archlibdir does not
--- a/lib-src/Makefile.in	Wed Mar 17 22:25:13 2010 -0700
+++ b/lib-src/Makefile.in	Wed Mar 17 22:49:31 2010 -0700
@@ -1,6 +1,7 @@
 # Makefile for lib-src subdirectory in GNU Emacs.
 # Copyright (C) 1985, 1987, 1988, 1993, 1994, 2001, 2002, 2003, 2004,
-#               2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+#               2005, 2006, 2007, 2008, 2009, 2010
+#               Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -122,20 +123,11 @@
 
 EXECUTABLES= ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
 
-# Additional -D flags for movemail (add to MOVE_FLAGS if desired):
-# MAIL_USE_POP		Support mail retrieval from a POP mailbox.
-# MAIL_USE_MMDF		Support MMDF mailboxes.
-# MAIL_USE_FLOCK	Use flock for file locking (see the comments
-#			about locking in movemail.c)
-# MAIL_UNLINK_SPOOL	Unlink the user's spool mailbox after reading
-#			it (instead of just emptying it).
-# KERBEROS		Support Kerberized POP.
-# KRB5			Support Kerberos Version 5 pop instead of
-#			Version 4 (define this in addition to
-#			KERBEROS).
-# HESIOD		Support Hesiod lookups of user mailboxes.
-# MAILHOST		A string, the host name of the default POP
-#			mail host for the site.
+# Specify additional -D flags for movemail. Options:
+# -DMAIL_USE_FLOCK or -DMAIL_USE_LOCKF (use flock or lockf for file locking).
+# See the comments about locking in movemail.c.  Normally the values
+# in ../src/[ms]/*.h should be correct and you should not need to do anything.
+# If neither flag is set, blessmail is used.
 MOVE_FLAGS=
 
 # ========================== start of cpp stuff =======================
@@ -176,72 +168,21 @@
 #define BLESSMAIL
 #endif
 
-#ifdef KERBEROS
-# ifdef HAVE_LIBKRB
-    KRB4LIB = -lkrb
-# else
-#  ifdef HAVE_LIBKRB4
-     KRB4LIB = -lkrb4
-#  endif
-# endif
-# ifdef HAVE_LIBDES
-    DESLIB = -ldes
-# else
-#  ifdef HAVE_LIBDES425
-    DESLIB = -ldes425
-#  endif
-# endif
-# ifdef HAVE_LIBKRB5
-    KRB5LIB = -lkrb5
-# endif
-# ifdef HAVE_LIBK5CRYPTO
-    CRYPTOLIB = -lk5crypto
-# else
-#  ifdef HAVE_LIBCRYPTO
-    CRYPTOLIB = -lcrypto
-#  endif
-# endif
-# ifdef HAVE_LIBCOM_ERR
-    COM_ERRLIB = -lcom_err
-# endif
-#endif /* KERBEROS */
+LIBS_MOVE=@KRB4LIB@ @DESLIB@ @KRB5LIB@ @CRYPTOLIB@ @COM_ERRLIB@ @LIBHESIOD@ @LIBRESOLV@
 
-/* If HESIOD is defined, set this to "-lhesiod". */
-#ifdef HAVE_LIBHESIOD
-# ifdef HAVE_LIBRESOLV
-    HESIODLIB= -lhesiod -lresolv
-# else
-    HESIODLIB= -lhesiod
-# endif
-#endif
-
-LIBS_MOVE=$(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) $(COM_ERRLIB) $(HESIODLIB)
-
-#ifdef HAVE_LIBLOCKFILE
-LIBS_MAIL=-llockfile
-#else
-#ifdef HAVE_LIBMAIL
-LIBS_MAIL=-lmail
-#endif
-#endif
+LIBS_MAIL=@LIBS_MAIL@
 
 LOADLIBES=LIBS_SYSTEM LIBS_MACHINE
 
-/* We need to #define emacs to get the right versions of some files.
-   Some other files - those shared with other GNU utilities - need
-   HAVE_CONFIG_H #defined before they know they can take advantage of
-   the information in ../src/config.h.  */
+/* 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.  */
 ALL_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
    -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
 LINK_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
    -I. -I../src -I${srcdir} -I${srcdir}/../src ${LDFLAGS} ${CFLAGS}
 CPP_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
    -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
-/* This was all of CPP_CFLAGS except -Demacs.
-   Now that -Demacs has been deleted from CPP_CFLAGS,
-   this is actually the same as CPP_CFLAGS, but let\'s not delete it yet.  */
-BASE_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \
-   -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS}
 
 .SUFFIXES: .m
 
@@ -394,7 +335,7 @@
 REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h
 
 regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h
-	${CC} -c ${BASE_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c
+	${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c
 
 etags${EXEEXT}: ${srcdir}/etags.c $(GETOPTDEPS) $(REGEXPDEPS) ../src/config.h
 	$(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" -DVERSION="\"${version}\"" ${srcdir}/etags.c $(GETOPTOBJS) $(REGEXPOBJ) $(LOADLIBES) -o etags
@@ -426,6 +367,7 @@
 movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS)
 	$(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MAIL) $(LIBS_MOVE) -o movemail
 
+/*  We need to define emacs to get the right version of something (what?).  */
 movemail.o: ${srcdir}/movemail.c ../src/config.h $(GETOPT_H)
 	$(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c
 
--- a/src/ChangeLog	Wed Mar 17 22:25:13 2010 -0700
+++ b/src/ChangeLog	Wed Mar 17 22:49:31 2010 -0700
@@ -1,3 +1,8 @@
+2010-03-18  Glenn Morris  <rgm@gnu.org>
+
+	* Makefile.in (XFT_LIBS, LIBXPM, LIBJPEG, LIBPNG, LIBTIFF, LIBGIF)
+	(LIBGPM, LIBRESOLV): Set using autoconf rather than cpp.
+
 2010-03-15  Chong Yidong  <cyd@stupidchicken.com>
 
 	* xfns.c (Fx_create_frame):
--- a/src/Makefile.in	Wed Mar 17 22:25:13 2010 -0700
+++ b/src/Makefile.in	Wed Mar 17 22:49:31 2010 -0700
@@ -369,76 +369,16 @@
 #endif
 #endif /* not USE_X_TOOLKIT */
 
-#if HAVE_XFT
-XFT_LIBS=@XFT_LIBS@
-#endif /* HAVE_XFT */
-
-#if HAVE_XPM
-#ifndef LIBXPM
-#define LIBXPM -lXpm
-#endif /* not defined LIBXPM */
-#else /* not HAVE_XPM */
-#define LIBXPM
-#endif /* not HAVE_XPM */
-
-#if HAVE_JPEG
-#ifndef LIBJPEG
-#define LIBJPEG -ljpeg
-#endif /* not defined LIBJPEG */
-#else /* not HAVE_JPEG */
-#define LIBJPEG
-#endif /* not HAVE_JPEG */
-
-#if HAVE_PNG
-#ifndef LIBPNG
-#define LIBPNG -lpng -lz -lm
-#endif /* not defined LIBPNG */
-#else /* not HAVE_PNG */
-#define LIBPNG
-#endif /* not HAVE_PNG */
-
-#if HAVE_TIFF
-#ifndef LIBTIFF
-#define LIBTIFF -ltiff
-#endif /* not defined LIBTIFF */
-#else /* not HAVE_TIFF */
-#define LIBTIFF
-#endif /* not HAVE_TIFF */
-
-#if HAVE_GIF
-#ifndef LIBGIF
-#define LIBGIF -lgif
-#endif /* not defined LIBGIF */
-#else /* not HAVE_GIF */
-#define LIBGIF
-#endif /* not HAVE_GIF */
-
 #ifdef HAVE_X11
 /* LD_SWITCH_X_DEFAULT comes after everything else that specifies
    options for where to find X libraries, but before those libraries.  */
 X11_LDFLAGS = LD_SWITCH_X_SITE LD_SWITCH_X_DEFAULT
-LIBX= $(LIBXMENU) $(X11_LDFLAGS) $(LIBXT) LIBTIFF LIBJPEG LIBPNG LIBGIF LIBXPM LIB_X11_LIB LIBX11_SYSTEM $(XFT_LIBS)
+LIBX= $(LIBXMENU) $(X11_LDFLAGS) $(LIBXT) @LIBTIFF@ @LIBJPEG@ @LIBPNG@ @LIBGIF@ @LIBXPM@ LIB_X11_LIB LIBX11_SYSTEM @XFT_LIBS@
 #else /* not HAVE_X11 */
 LIBX= $(LIBXMENU) LD_SWITCH_X_SITE
 #endif /* not HAVE_X11 */
 #endif /* not HAVE_X_WINDOWS */
 
-#if HAVE_GPM
-#ifndef LIBGPM
-#define LIBGPM -lgpm
-#endif /* not defined LIBGPM */
-#else /* not HAVE_GPM */
-#define LIBGPM
-#endif /* not HAVE_GPM */
-
-#if HAVE_LIBRESOLV
-#ifndef LIBRESOLV
-#define LIBRESOLV -lresolv
-#endif /* not defined LIBRESOLV */
-#else /* not HAVE_LIBRESOLV */
-#define LIBRESOLV
-#endif /* not HAVE_LIBRESOLV */
-
 LIBSOUND= @LIBSOUND@
 CFLAGS_SOUND= @CFLAGS_SOUND@
 
@@ -908,7 +848,7 @@
    with GCC, we might need gnulib again after them.  */
 
 LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) $(RSVG_LIBS) $(DBUS_LIBS) \
-   LIBGPM LIBRESOLV LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \
+   @LIBGPM@ @LIBRESOLV@ LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \
    LIBS_DEBUG $(GETLOADAVG_LIBS) ${GCONF_LIBS} \
    @FREETYPE_LIBS@ @FONTCONFIG_LIBS@ @LIBOTF_LIBS@ @M17N_FLT_LIBS@ \
    $(GNULIB_VAR) LIB_MATH LIB_STANDARD $(GNULIB_VAR)