Don't call turn_on_atimers around `connect' (Bug#5723).
[bpt/emacs.git] / configure.in
index b365421..2a3ac32 100644 (file)
@@ -4,7 +4,7 @@ dnl     autoconf
 dnl in the directory containing this script.
 dnl
 dnl  Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003,
 dnl in the directory containing this script.
 dnl
 dnl  Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003,
-dnl    2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
+dnl    2004, 2005, 2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 dnl
 dnl  This file is part of GNU Emacs.
 dnl
 dnl
 dnl  This file is part of GNU Emacs.
 dnl
@@ -12,17 +12,17 @@ dnl  GNU Emacs is free software: you can redistribute it and/or modify
 dnl  it under the terms of the GNU General Public License as published by
 dnl  the Free Software Foundation, either version 3 of the License, or
 dnl  (at your option) any later version.
 dnl  it under the terms of the GNU General Public License as published by
 dnl  the Free Software Foundation, either version 3 of the License, or
 dnl  (at your option) any later version.
-dnl  
+dnl
 dnl  GNU Emacs is distributed in the hope that it will be useful,
 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 dnl  GNU General Public License for more details.
 dnl  GNU Emacs is distributed in the hope that it will be useful,
 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 dnl  GNU General Public License for more details.
-dnl  
+dnl
 dnl  You should have received a copy of the GNU General Public License
 dnl  along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 dnl  You should have received a copy of the GNU General Public License
 dnl  along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
-AC_PREREQ(2.61)
-AC_INIT(emacs, 23.0.90)
+AC_PREREQ(2.62)
+AC_INIT(emacs, 24.0.50)
 AC_CONFIG_HEADER(src/config.h:src/config.in)
 AC_CONFIG_SRCDIR(src/lisp.h)
 
 AC_CONFIG_HEADER(src/config.h:src/config.in)
 AC_CONFIG_SRCDIR(src/lisp.h)
 
@@ -91,10 +91,26 @@ if test "${with_kerberos5}" != no; then
 fi
 
 OPTION_DEFAULT_OFF([hesiod],[support Hesiod to get the POP server host])
 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
 
 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])
 OPTION_DEFAULT_ON([sound],[don't compile with sound support])
 
 OPTION_DEFAULT_ON([sync-input],[process async input synchronously])
@@ -107,7 +123,7 @@ dnl This should be the last --with option, because --with-x is
 dnl added later on when we find the path of X, and it's best to
 dnl keep them together visually.
 AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
 dnl added later on when we find the path of X, and it's best to
 dnl keep them together visually.
 AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
- [use an X toolkit (KIT one of: yes, lucid, athena, motif, gtk, no)])],
+ [use an X toolkit (KIT one of: yes or gtk, lucid or athena, motif, no)])],
 [        case "${withval}" in
            y | ye | yes )      val=gtk ;;
            n | no )            val=no  ;;
 [        case "${withval}" in
            y | ye | yes )      val=gtk ;;
            n | no )            val=no  ;;
@@ -133,7 +149,6 @@ OPTION_DEFAULT_ON([gif],[don't compile with GIF image support])
 OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
 OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])
 
 OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
 OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])
 
-OPTION_DEFAULT_ON([freetype],[don't use Freetype for local font support])
 OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts])
 OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support])
 OPTION_DEFAULT_ON([m17n-flt],[don't use m17n-flt for text shaping])
 OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts])
 OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support])
 OPTION_DEFAULT_ON([m17n-flt],[don't use m17n-flt for text shaping])
@@ -145,6 +160,7 @@ OPTION_DEFAULT_OFF([ns],[use nextstep (Cocoa or GNUstep) windowing system])
 
 OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
 OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
 
 OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
 OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
+OPTION_DEFAULT_ON([gconf],[don't compile with GConf support])
 
 ## For the times when you want to build Emacs but don't have
 ## a suitable makeinfo, and can live without the manuals.
 
 ## For the times when you want to build Emacs but don't have
 ## a suitable makeinfo, and can live without the manuals.
@@ -176,12 +192,6 @@ test "X${with_gnustep_conf}" != X && test "${with_gnustep_conf}" != yes && \
 test "X$GNUSTEP_CONFIG_FILE" = "X" && \
      GNUSTEP_CONFIG_FILE=/etc/GNUstep/GNUstep.conf
 
 test "X$GNUSTEP_CONFIG_FILE" = "X" && \
      GNUSTEP_CONFIG_FILE=/etc/GNUstep/GNUstep.conf
 
-AC_ARG_ENABLE(cocoa-experimental-ctrl-g,
-[AS_HELP_STRING([--enable-cocoa-experimental-ctrl-g],
-                [enable experimental improved ctrl-g recognition])],
-   EN_COCOA_EXPERIMENTAL_CTRL_G=$enableval,
-   EN_COCOA_EXPERIMENTAL_CTRL_G=no)
-
 AC_ARG_ENABLE(ns-self-contained,
 [AS_HELP_STRING([--disable-ns-self-contained],
                 [disable self contained build under NeXTstep])],
 AC_ARG_ENABLE(ns-self-contained,
 [AS_HELP_STRING([--disable-ns-self-contained],
                 [disable self contained build under NeXTstep])],
@@ -216,6 +226,90 @@ elif test "${enableval}" != "yes"; then
   locallisppath=${enableval}
 fi)
 
   locallisppath=${enableval}
 fi)
 
+AC_ARG_ENABLE(checking,
+[AS_HELP_STRING([--enable-checking@<:@=LIST@:>@],
+               [enable expensive run-time checks.  With LIST,
+                enable only specific categories of checks.
+                Categories are: all,yes,no.
+                Flags are: stringbytes, stringoverrun, stringfreelist,
+                xmallocoverrun, conslist])],
+[ac_checking_flags="${enableval}"],[])
+IFS="${IFS=    }"; ac_save_IFS="$IFS"; IFS="$IFS,"
+for check in $ac_checking_flags
+do
+       case $check in
+       # these set all the flags to specific states
+       yes)            ac_enable_checking=1 ;;
+       no)             ac_enable_checking= ;
+                       ac_gc_check_stringbytes= ;
+                       ac_gc_check_string_overrun= ;
+                       ac_gc_check_string_free_list= ;
+                       ac_xmalloc_overrun= ;
+                       ac_gc_check_cons_list= ;;
+       all)            ac_enable_checking=1 ;
+                       ac_gc_check_stringbytes=1 ;
+                       ac_gc_check_string_overrun=1 ;
+                       ac_gc_check_string_free_list=1 ;
+                       ac_xmalloc_overrun=1 ;
+                       ac_gc_check_cons_list=1 ;;
+       # these enable particular checks
+       stringbytes)    ac_gc_check_stringbytes=1 ;;
+       stringoverrun)  ac_gc_check_string_overrun=1 ;;
+       stringfreelist) ac_gc_check_string_free_list=1 ;;
+       xmallocoverrun) ac_xmalloc_overrun=1 ;;
+       conslist)       ac_gc_check_cons_list=1 ;;
+       *)      AC_MSG_ERROR(unknown check category $check) ;;
+       esac
+done
+IFS="$ac_save_IFS"
+
+if test x$ac_enable_checking != x ; then
+  AC_DEFINE(ENABLE_CHECKING, 1,
+[Enable expensive run-time checking of data types?])
+fi
+if test x$ac_gc_check_stringbytes != x ; then
+  AC_DEFINE(GC_CHECK_STRING_BYTES, 1,
+[Define this temporarily to hunt a bug.  If defined, the size of
+   strings is redundantly recorded in sdata structures so that it can
+   be compared to the sizes recorded in Lisp strings.])
+fi
+if test x$ac_gc_check_stringoverrun != x ; then
+  AC_DEFINE(GC_CHECK_STRING_OVERRUN, 1,
+[Define this to check for short string overrun.])
+fi
+if test x$ac_gc_check_string_free_list != x ; then
+  AC_DEFINE(GC_CHECK_STRING_FREE_LIST, 1,
+[Define this to check the string free list.])
+fi
+if test x$ac_xmalloc_overrun != x ; then
+  AC_DEFINE(XMALLOC_OVERRUN_CHECK, 1,
+[Define this to check for malloc buffer overrun.])
+fi
+if test x$ac_gc_check_cons_list != x ; then
+  AC_DEFINE(GC_CHECK_CONS_LIST, 1,
+[Define this to check for errors in cons list.])
+fi
+
+AC_ARG_ENABLE(profiling,
+[AS_HELP_STRING([--enable-profiling],
+               [build emacs with profiling support.
+                This might not work on all platforms])],
+[ac_enable_profiling="${enableval}"],[])
+if test x$ac_enable_profiling != x ; then
+   PROFILING_CFLAGS="-DPROFILING=1 -pg"
+   PROFILING_LDFLAGS="-pg"
+else
+   PROFILING_CFLAGS=
+   PROFILING_LDFLAGS=
+fi
+
+AC_ARG_ENABLE(autodepend,
+[AS_HELP_STRING([--enable-autodepend],
+               [automatically generate dependencies to .h-files.
+                Requires GNU Make and Gcc. Enabled if GNU Make and Gcc is
+                found])],
+[ac_enable_autodepend="${enableval}"],[ac_enable_autodepend=yes])
+
 #### Make srcdir absolute, if it isn't already.  It's important to
 #### avoid running the path through pwd unnecessarily, since pwd can
 #### give you automounter prefixes, which can go away.  We do all this
 #### Make srcdir absolute, if it isn't already.  It's important to
 #### avoid running the path through pwd unnecessarily, since pwd can
 #### give you automounter prefixes, which can go away.  We do all this
@@ -336,6 +430,9 @@ dnl see the `changequote' comment above.
     case "${canonical}" in
       alpha*-*-netbsd*)        machine=alpha ;;
       i[3456]86-*-netbsd*) machine=intel386 ;;
     case "${canonical}" in
       alpha*-*-netbsd*)        machine=alpha ;;
       i[3456]86-*-netbsd*) machine=intel386 ;;
+      mips-*-netbsd*)  machine=mips ;;
+      mipsel-*-netbsd*)        machine=mips ;;
+      mipseb-*-netbsd*)        machine=mips ;;
       powerpc-*-netbsd*) machine=macppc ;;
       sparc*-*-netbsd*)        machine=sparc ;;
       vax-*-netbsd*)   machine=vax ;;
       powerpc-*-netbsd*) machine=macppc ;;
       sparc*-*-netbsd*)        machine=sparc ;;
       vax-*-netbsd*)   machine=vax ;;
@@ -361,15 +458,6 @@ dnl see the `changequote' comment above.
     esac
   ;;
 
     esac
   ;;
 
-  ## LynxOS ports
-  *-*-lynxos* )
-    opsys=lynxos
-    case "${canonical}" in
-      i[3456]86-*-lynxos*) machine=intel386 ;;
-      powerpc-*-lynxos*) machine=powerpc ;;
-    esac
-  ;;
-
   alpha*-*-linux-gnu* )
     machine=alpha opsys=gnu-linux
   ;;
   alpha*-*-linux-gnu* )
     machine=alpha opsys=gnu-linux
   ;;
@@ -383,6 +471,7 @@ dnl see the `changequote' comment above.
     case "${canonical}" in
       i[3456]86-* )  machine=intel386 ;;
       powerpc-* )    machine=macppc ;;
     case "${canonical}" in
       i[3456]86-* )  machine=intel386 ;;
       powerpc-* )    machine=macppc ;;
+      x86_64-* )     machine=amdx86-64 ;;
       * )            unported=yes ;;
     esac
     opsys=darwin
       * )            unported=yes ;;
     esac
     opsys=darwin
@@ -425,7 +514,7 @@ dnl see the `changequote' comment above.
   rs6000-ibm-aix5* | powerpc-ibm-aix5*  )
     machine=ibmrs6000 opsys=aix4-2
   ;;
   rs6000-ibm-aix5* | powerpc-ibm-aix5*  )
     machine=ibmrs6000 opsys=aix4-2
   ;;
-  rs6000-ibm-aix5* | powerpc-ibm-aix6*  )
+  rs6000-ibm-aix6* | powerpc-ibm-aix6*  )
     machine=ibmrs6000 opsys=aix4-2
   ;;
 
     machine=ibmrs6000 opsys=aix4-2
   ;;
 
@@ -452,30 +541,14 @@ dnl see the `changequote' comment above.
 
   *-sun-solaris* \
     | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* \
 
   *-sun-solaris* \
     | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* \
-    | x86_64-*-solaris2*    | x86_64-*-sunos5*    \
-    | powerpc*-*-solaris2*  | rs6000-*-solaris2*)
+    | x86_64-*-solaris2*    | x86_64-*-sunos5*)
     case "${canonical}" in
       i[3456]86-*-* )     machine=intel386 ;;
       amd64-*-*|x86_64-*-*)    machine=amdx86-64 ;;
     case "${canonical}" in
       i[3456]86-*-* )     machine=intel386 ;;
       amd64-*-*|x86_64-*-*)    machine=amdx86-64 ;;
-      powerpc* | rs6000* )  machine=ibmrs6000 ;;
       sparc* )         machine=sparc ;;
       * )              unported=yes ;;
     esac
     case "${canonical}" in
       sparc* )         machine=sparc ;;
       * )              unported=yes ;;
     esac
     case "${canonical}" in
-      *-sunos5.3* | *-solaris2.3* )
-               opsys=sol2-3
-               NON_GNU_CPP=/usr/ccs/lib/cpp
-               ;;
-      *-sunos5.4* | *-solaris2.4* )
-               opsys=sol2-4
-               NON_GNU_CPP=/usr/ccs/lib/cpp
-               RANLIB="ar -ts"
-               ;;
-      *-sunos5.5* | *-solaris2.5* )
-               opsys=sol2-5
-               NON_GNU_CPP=/usr/ccs/lib/cpp
-               RANLIB="ar -ts"
-               ;;
       *-sunos5.6* | *-solaris2.6* )
                opsys=sol2-6
                NON_GNU_CPP=/usr/ccs/lib/cpp
       *-sunos5.6* | *-solaris2.6* )
                opsys=sol2-6
                NON_GNU_CPP=/usr/ccs/lib/cpp
@@ -505,15 +578,6 @@ dnl see the `changequote' comment above.
     esac
   ;;
 
     esac
   ;;
 
-  ## Vaxen.
-  vax-dec-* )
-    machine=vax
-    case "${canonical}" in
-      *-vms* )                                                 opsys=vms ;;
-      * )                                              unported=yes
-    esac
-  ;;
-
   ## IA-64
   ia64*-*-linux* )
     machine=ia64 opsys=gnu-linux
   ## IA-64
   ia64*-*-linux* )
     machine=ia64 opsys=gnu-linux
@@ -575,22 +639,6 @@ esac
 if test x"${opsys}" = x; then
   case "${canonical}" in
     *-gnu* )                           opsys=gnu ;;
 if test x"${opsys}" = x; then
   case "${canonical}" in
     *-gnu* )                           opsys=gnu ;;
-    *-sysv4.2uw* )                     opsys=unixware ;;
-    *-sysv5uw* )                       opsys=unixware ;;
-    *-sysv5OpenUNIX* )                 opsys=unixware ;;
-    *-sysv4.1* | *-sysvr4.1* )
-       NON_GNU_CPP=/usr/lib/cpp
-       opsys=usg5-4 ;;
-    *-sysv4.[2-9]* | *-sysvr4.[2-9]* )
-       if [ x$NON_GNU_CPP = x ]; then
-         if [ -f /usr/ccs/lib/cpp ]; then
-           NON_GNU_CPP=/usr/ccs/lib/cpp
-         else
-           NON_GNU_CPP=/lib/cpp
-         fi
-       fi
-       opsys=usg5-4-2 ;;
-    *-sysv4* | *-sysvr4* )             opsys=usg5-4 ;;
     * )
       unported=yes
     ;;
     * )
       unported=yes
     ;;
@@ -684,6 +732,19 @@ CFLAGS="$SAVE_CFLAGS"
 unset has_option
 unset SAVE_CFLAGS
 
 unset has_option
 unset SAVE_CFLAGS
 
+### Use -Wdeclaration-after-statement if the compiler supports it
+AC_MSG_CHECKING([whether gcc understands -Wdeclaration-after-statement])
+SAVE_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wdeclaration-after-statement"
+AC_TRY_COMPILE([], [], has_option=yes, has_option=no,)
+if test $has_option = yes; then
+   C_WARNINGS_SWITCH="-Wdeclaration-after-statement $C_WARNINGS_SWITCH"
+fi
+AC_MSG_RESULT($has_option)
+CFLAGS="$SAVE_CFLAGS"
+unset has_option
+unset SAVE_CFLAGS
+
 #### Some other nice autoconf tests.
 
 dnl checks for programs
 #### Some other nice autoconf tests.
 
 dnl checks for programs
@@ -713,11 +774,11 @@ fi
 ## pre-built, and not deleted by the normal clean rules.  makeinfo is
 ## therefore in the category of "special tools" not normally required, which
 ## configure does not have to check for (eg autoconf itself).
 ## pre-built, and not deleted by the normal clean rules.  makeinfo is
 ## therefore in the category of "special tools" not normally required, which
 ## configure does not have to check for (eg autoconf itself).
-## In a CVS checkout on the other hand, the manuals are not included.
-## So makeinfo is a requirement to build from CVS, and configure
+## In a Bazaar checkout on the other hand, the manuals are not included.
+## So makeinfo is a requirement to build from Bazaar, and configure
 ## should test for it as it does for any other build requirement.
 ## We use the presence of $srcdir/info/emacs to distinguish a release,
 ## should test for it as it does for any other build requirement.
 ## We use the presence of $srcdir/info/emacs to distinguish a release,
-## with pre-built manuals, from a CVS checkout.
+## with pre-built manuals, from a Bazaar checkout.
 if test "$MAKEINFO" = "no"; then
   if test "x${with_makeinfo}" = "xno"; then
     MAKEINFO=off
 if test "$MAKEINFO" = "no"; then
   if test "x${with_makeinfo}" = "xno"; then
     MAKEINFO=off
@@ -871,7 +932,7 @@ configure___ CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
 
 /* Get the CFLAGS for real compilation.  */
 #ifdef __GNUC__
 
 /* Get the CFLAGS for real compilation.  */
 #ifdef __GNUC__
-configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH '${SPECIFIED_CFLAGS}'
+configure___ REAL_CFLAGS=C_DEBUG_SWITCH C_OPTIMIZE_SWITCH C_WARNINGS_SWITCH ${PROFILING_CFLAGS} '${SPECIFIED_CFLAGS}'
 #else
 configure___ REAL_CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
 #endif
 #else
 configure___ REAL_CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
 #endif
@@ -879,6 +940,8 @@ configure___ REAL_CFLAGS=C_DEBUG_SWITCH '${SPECIFIED_CFLAGS}'
 #endif /* not THIS_IS_CONFIGURE */
 ' > ${tempcname}
 
 #endif /* not THIS_IS_CONFIGURE */
 ' > ${tempcname}
 
+LDFLAGS="${LDFLAGS} ${PROFILING_LDFLAGS}"
+
 # The value of CPP is a quoted variable reference, so we need to do this
 # to get its actual value...
 CPP=`eval "echo $CPP"`
 # The value of CPP is a quoted variable reference, so we need to do this
 # to get its actual value...
 CPP=`eval "echo $CPP"`
@@ -1016,9 +1079,9 @@ fi
 dnl checks for header files
 AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
   linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
 dnl checks for header files
 AC_CHECK_HEADERS(sys/select.h sys/timeb.h sys/time.h unistd.h utime.h \
   linux/version.h sys/systeminfo.h termios.h limits.h string.h stdlib.h \
-  termcap.h stdio_ext.h fcntl.h strings.h coff.h pty.h sys/mman.h \
+  stdio_ext.h fcntl.h strings.h coff.h pty.h sys/mman.h \
   sys/param.h sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
   sys/param.h sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
-  sys/utsname.h pwd.h)
+  sys/utsname.h pwd.h utmp.h)
 
 AC_MSG_CHECKING(if personality LINUX32 can be set)
 AC_TRY_COMPILE([#include <sys/personality.h>], [personality (PER_LINUX32)],
 
 AC_MSG_CHECKING(if personality LINUX32 can be set)
 AC_TRY_COMPILE([#include <sys/personality.h>], [personality (PER_LINUX32)],
@@ -1162,6 +1225,32 @@ dnl AC_C_BIGENDIAN
 dnl check for Make feature
 AC_PROG_MAKE_SET
 
 dnl check for Make feature
 AC_PROG_MAKE_SET
 
+dnl check for GNU Make if we have GCC and autodepend is on.
+if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
+   AC_MSG_CHECKING([whether we are using GNU Make])
+   HAVE_GNU_MAKE=no
+   testval=`make --version 2>/dev/null | grep 'GNU Make'`
+   if test "x$testval" != x; then
+      HAVE_GNU_MAKE=yes
+   else
+      ac_enable_autodepend=no
+   fi
+   AC_MSG_RESULT([$HAVE_GNU_MAKE])
+   if test $HAVE_GNU_MAKE = yes; then
+      AC_MSG_CHECKING([whether gcc understands -MMD -MF])
+      SAVE_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -MMD -MF deps.d"
+      AC_TRY_COMPILE([], [], , ac_enable_autodepend=no)
+      CFLAGS="$SAVE_CFLAGS"
+      test -f deps.d || ac_enable_autodepend=no
+      rm -rf deps.d
+      AC_MSG_RESULT([$ac_enable_autodepend])
+   fi
+   if test $ac_enable_autodepend = yes; then
+      AC_DEFINE(AUTO_DEPEND, 1, [Generate dependencies with gcc.])
+   fi
+fi
+
 dnl checks for operating system services
 AC_SYS_LONG_FILE_NAMES
 
 dnl checks for operating system services
 AC_SYS_LONG_FILE_NAMES
 
@@ -1179,7 +1268,7 @@ fi
 ## No need to do anything special for these standard directories.
 ## This is an experiment, take it out if it causes problems.
 if test -n "${x_libraries}" && test x"${x_libraries}" != xNONE; then
 ## No need to do anything special for these standard directories.
 ## This is an experiment, take it out if it causes problems.
 if test -n "${x_libraries}" && test x"${x_libraries}" != xNONE; then
-   
+
    x_libraries=`echo :${x_libraries}: | sed -e 's|:/usr/lib64:|:|g' -e 's|:/lib64:|:|g' -e 's|^:||' -e 's|:$||'`
 
 fi
    x_libraries=`echo :${x_libraries}: | sed -e 's|:/usr/lib64:|:|g' -e 's|:/lib64:|:|g' -e 's|^:||' -e 's|:$||'`
 
 fi
@@ -1276,7 +1365,6 @@ fi
 if test "${HAVE_NS}" = yes; then
   window_system=nextstep
   with_xft=no
 if test "${HAVE_NS}" = yes; then
   window_system=nextstep
   with_xft=no
-  with_freetype=no
   # set up packaging dirs
   exec_prefix=${ns_appbindir}
   libexecdir=${ns_appbindir}/libexec
   # set up packaging dirs
   exec_prefix=${ns_appbindir}
   libexecdir=${ns_appbindir}/libexec
@@ -1497,9 +1585,9 @@ fi
 
 ### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
 HAVE_RSVG=no
 
 ### Use -lrsvg-2 if available, unless `--with-rsvg=no' is specified.
 HAVE_RSVG=no
-if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes"; then
+if test "${HAVE_X11}" = "yes" || test "${NS_IMPL_GNUSTEP}" = "yes"; then
   if test "${with_rsvg}" != "no"; then
   if test "${with_rsvg}" != "no"; then
-    RSVG_REQUIRED=2.0.0
+    RSVG_REQUIRED=2.11.0
     RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
 
     PKG_CHECK_MODULES(RSVG, $RSVG_MODULE, :, :)
     RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
 
     PKG_CHECK_MODULES(RSVG, $RSVG_MODULE, :, :)
@@ -1579,15 +1667,28 @@ if test "${HAVE_GTK}" = "yes"; then
               [Define to 1 if GTK can handle more than one display.])
   fi
 
               [Define to 1 if GTK can handle more than one display.])
   fi
 
-  dnl  Check if we have the old file selection dialog.
-  dnl  If gdk_display_open exists, assume all others are there also.
+  dnl  Check if we have the old file selection dialog declared and
+  dnl  in the link library.  In 2.x it may be in the library,
+  dnl  but not declared if deprecated featured has been selected out.
+  dnl  AC_CHECK_DECL checks for a macro, so check for GTK_TYPE_FILE_SELECTION.
   HAVE_GTK_FILE_SELECTION=no
   HAVE_GTK_FILE_SELECTION=no
-  AC_CHECK_FUNCS(gtk_file_selection_new, HAVE_GTK_FILE_SELECTION=yes)
+  AC_CHECK_DECL(GTK_TYPE_FILE_SELECTION, HAVE_GTK_FILE_SELECTION=yes,
+                   HAVE_GTK_FILE_SELECTION=no, [AC_INCLUDES_DEFAULT
+#include <gtk/gtk.h>])
+  if test "$HAVE_GTK_FILE_SELECTION" = yes; then
+    AC_CHECK_FUNCS(gtk_file_selection_new, HAVE_GTK_FILE_SELECTION=yes,
+                   HAVE_GTK_FILE_SELECTION=no)
+  fi
 
   dnl  Check if we have the new file chooser dialog
 
   dnl  Check if we have the new file chooser dialog
-  dnl  If gdk_display_open exists, assume all others are there also.
   HAVE_GTK_FILE_CHOOSER=no
   HAVE_GTK_FILE_CHOOSER=no
-  AC_CHECK_FUNCS(gtk_file_chooser_dialog_new, HAVE_GTK_FILE_CHOOSER=yes)
+  AC_CHECK_DECL(GTK_TYPE_FILE_CHOOSER, HAVE_GTK_FILE_CHOOSER=yes,
+                HAVE_GTK_FILE_CHOOSER=no, [AC_INCLUDES_DEFAULT
+#include <gtk/gtk.h>])
+  if test "$HAVE_GTK_FILE_CHOOSER" = yes; then
+    AC_CHECK_FUNCS(gtk_file_chooser_dialog_new, HAVE_GTK_FILE_CHOOSER=yes,
+                   HAVE_GTK_FILE_CHOOSER=no)
+  fi
 
   if test "$HAVE_GTK_FILE_SELECTION" = yes \
      && test "$HAVE_GTK_FILE_CHOOSER" = yes;  then
 
   if test "$HAVE_GTK_FILE_SELECTION" = yes \
      && test "$HAVE_GTK_FILE_CHOOSER" = yes;  then
@@ -1621,7 +1722,19 @@ HAVE_DBUS=no
 if test "${with_dbus}" = "yes"; then
    PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, HAVE_DBUS=yes, HAVE_DBUS=no)
    if test "$HAVE_DBUS" = yes; then
 if test "${with_dbus}" = "yes"; then
    PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0, HAVE_DBUS=yes, HAVE_DBUS=no)
    if test "$HAVE_DBUS" = yes; then
-      AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.])
+     LIBS="$LIBS $DBUS_LIBS"
+     AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.])
+     AC_CHECK_FUNCS([dbus_watch_get_unix_fd])
+   fi
+fi
+
+dnl GConf has been tested under GNU/Linux only.
+dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6.
+HAVE_GCONF=no
+if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then
+   PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.13, HAVE_GCONF=yes, HAVE_GCONF=no)
+   if test "$HAVE_GCONF" = yes; then
+      AC_DEFINE(HAVE_GCONF, 1, [Define to 1 if using GConf.])
    fi
 fi
 
    fi
 fi
 
@@ -1830,90 +1943,104 @@ either XPointer or XPointer*.])dnl
   CFLAGS=$late_CFLAGS
 fi
 
   CFLAGS=$late_CFLAGS
 fi
 
-### Start of font-backend section.
-PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2.0, HAVE_FC=yes, HAVE_FC=no)
-test "${HAVE_FC}" = "no" && with_freetype=no
+### Start of font-backend (under any platform) section.
+# (nothing here yet -- this is a placeholder)
+### End of font-backend (under any platform) section.
 
 
-## Use -lXft if available, unless `--with-freetype=no' nor `--with-xft=no'.
-HAVE_XFT=maybe
-if test "x${with_freetype}" = "xno" || test "x${with_x}" = "xno"; then
-  with_xft="no";
-fi
-if test "x${with_xft}" != "xno"; then
+### Start of font-backend (under X11) section.
+if test "${HAVE_X11}" = "yes"; then
+   PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2.0, HAVE_FC=yes, HAVE_FC=no)
+
+   ## Use -lXft if available, unless `--with-xft=no'.
+   HAVE_XFT=maybe
+    if test "${HAVE_FC}" = "no" || test "x${with_x}" = "xno"; then
+      with_xft="no";
+    fi
+    if test "x${with_xft}" != "xno"; then
+
+      PKG_CHECK_MODULES(XFT, xft >= 0.13.0, , HAVE_XFT=no)
+      ## Because xftfont.c uses XRenderQueryExtension, we also
+      ## need to link to -lXrender.
+      HAVE_XRENDER=no
+      AC_CHECK_LIB(Xrender, XRenderQueryExtension, HAVE_XRENDER=yes)
+      if test "$HAVE_XFT" != no && test "$HAVE_XRENDER" != no; then
+       OLD_CPPFLAGS="$CPPFLAGS"
+       OLD_CFLAGS="$CFLAGS"
+       OLD_LIBS="$LIBS"
+       CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
+       CFLAGS="$CFLAGS $XFT_CFLAGS"
+       XFT_LIBS="-lXrender $XFT_LIBS"
+       LIBS="$XFT_LIBS $LIBS"
+       AC_CHECK_HEADER(X11/Xft/Xft.h,
+         AC_CHECK_LIB(Xft, XftFontOpen, HAVE_XFT=yes, , $XFT_LIBS))
+
+       if test "${HAVE_XFT}" = "yes"; then
+         AC_DEFINE(HAVE_XFT, 1, [Define to 1 if you have the Xft library.])
+           AC_SUBST(XFT_LIBS)
+         C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS"
+       else
+         CPPFLAGS="$OLD_CPPFLAGS"
+         CFLAGS="$OLD_CFLAGS"
+         LIBS="$OLD_LIBS"
+       fi                        # "${HAVE_XFT}" = "yes"
+      fi                          # "$HAVE_XFT" != no
+    fi                            # "x${with_xft}" != "xno"
+
+    dnl For the "Does Emacs use" message at the end.
+    if test "$HAVE_XFT" != "yes"; then
+       HAVE_XFT=no
+    fi
 
 
-  PKG_CHECK_MODULES(XFT, xft >= 0.13.0, , HAVE_XFT=no)
-  if test "$HAVE_XFT" != no; then
-    OLD_CPPFLAGS="$CPPFLAGS"
-    OLD_CFLAGS="$CFLAGS"
-    OLD_LIBS="$LIBS"
-    CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
-    CFLAGS="$CFLAGS $XFT_CFLAGS"
-    LIBS="$XFT_LIBS $LIBS"
-    AC_CHECK_HEADER(X11/Xft/Xft.h,
-      AC_CHECK_LIB(Xft, XftFontOpen, HAVE_XFT=yes, , $XFT_LIBS))
 
 
+    HAVE_FREETYPE=no
+    ## We used to allow building with FreeType and without Xft.
+    ## However, the ftx font backend driver is not in good shape.
     if test "${HAVE_XFT}" = "yes"; then
     if test "${HAVE_XFT}" = "yes"; then
-      AC_DEFINE(HAVE_XFT, 1, [Define to 1 if you have the Xft library.])
-       AC_SUBST(XFT_LIBS)
-      C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS"
-    else
-      CPPFLAGS="$OLD_CPPFLAGS"
-      CFLAGS="$OLD_CFLAGS"
-      LIBS="$OLD_LIBS"
-    fi                        # "${HAVE_XFT}" = "yes"
-  fi                          # "$HAVE_XFT" != no
-fi                            # "x${with_xft}" != "xno"
-
-dnl For the "Does Emacs use" message at the end.
-if test "$HAVE_XFT" != "yes"; then
-   HAVE_XFT=no
-fi
-
-
-HAVE_FREETYPE=no
-### Use -lfreetype if available, unless `--with-freetype=no'.
-if test "${HAVE_XFT}" = "yes"; then
-  dnl As we use Xft, we anyway use freetype.
-  dnl In this case, there's no need of additional CFLAGS and LIBS.
-  HAVE_FREETYPE=yes
-  FONTCONFIG_CFLAGS=
-  FONTCONFIG_LIBS=
-elif test "x${with_freetype}" != "xno" && test "x${with_x}" != "xno"; then
-
-  PKG_CHECK_MODULES(FREETYPE, freetype2, HAVE_FREETYPE=yes, HAVE_FREETYPE=no)
-fi
-
-HAVE_LIBOTF=no
-if test "${HAVE_FREETYPE}" = "yes"; then
-  AC_DEFINE(HAVE_FREETYPE, 1,
-            [Define to 1 if using the freetype and fontconfig libraries.])
-  if test "${with_libotf}" != "no"; then
-    PKG_CHECK_MODULES(LIBOTF, libotf, HAVE_LIBOTF=yes, 
-                      HAVE_LIBOTF=no)
-    if test "$HAVE_LIBOTF" = "yes"; then
-      AC_DEFINE(HAVE_LIBOTF, 1, [Define to 1 if using libotf.])
-      AC_CHECK_LIB(otf, OTF_get_variation_glyphs,
-                  HAVE_OTF_GET_VARIATION_GLYPHS=yes,
-                  HAVE_OTF_GET_VARIATION_GLYPHS=no)
-      if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
-        AC_DEFINE(HAVE_OTF_GET_VARIATION_GLYPHS, 1,
-                 [Define to 1 if libotf has OTF_get_variation_glyphs.])
+      dnl As we use Xft, we anyway use freetype.
+      dnl There's no need for additional CFLAGS and LIBS.
+      HAVE_FREETYPE=yes
+      FONTCONFIG_CFLAGS=
+      FONTCONFIG_LIBS=
+    fi
+
+    HAVE_LIBOTF=no
+    if test "${HAVE_FREETYPE}" = "yes"; then
+      AC_DEFINE(HAVE_FREETYPE, 1,
+               [Define to 1 if using the freetype and fontconfig libraries.])
+      if test "${with_libotf}" != "no"; then
+       PKG_CHECK_MODULES(LIBOTF, libotf, HAVE_LIBOTF=yes,
+                         HAVE_LIBOTF=no)
+       if test "$HAVE_LIBOTF" = "yes"; then
+         AC_DEFINE(HAVE_LIBOTF, 1, [Define to 1 if using libotf.])
+         AC_CHECK_LIB(otf, OTF_get_variation_glyphs,
+                      HAVE_OTF_GET_VARIATION_GLYPHS=yes,
+                      HAVE_OTF_GET_VARIATION_GLYPHS=no)
+         if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
+           AC_DEFINE(HAVE_OTF_GET_VARIATION_GLYPHS, 1,
+                     [Define to 1 if libotf has OTF_get_variation_glyphs.])
+         fi
+       fi
       fi
       fi
+    dnl FIXME should there be an error if HAVE_FREETYPE != yes?
+    dnl Does the new font backend require it, or can it work without it?
     fi
     fi
-  fi
-dnl FIXME should there be an error if HAVE_FREETYPE != yes?
-dnl Does the new font backend require it, or can it work without it?
-fi
 
 
-HAVE_M17N_FLT=no
-if test "${HAVE_LIBOTF}" = yes; then
-  if test "${with_m17n_flt}" != "no"; then
-    PKG_CHECK_MODULES(M17N_FLT, m17n-flt, HAVE_M17N_FLT=yes, HAVE_M17N_FLT=no)
-    if test "$HAVE_M17N_FLT" = "yes"; then
-      AC_DEFINE(HAVE_M17N_FLT, 1, [Define to 1 if using libm17n-flt.])
+    HAVE_M17N_FLT=no
+    if test "${HAVE_LIBOTF}" = yes; then
+      if test "${with_m17n_flt}" != "no"; then
+       PKG_CHECK_MODULES(M17N_FLT, m17n-flt, HAVE_M17N_FLT=yes, HAVE_M17N_FLT=no)
+       if test "$HAVE_M17N_FLT" = "yes"; then
+         AC_DEFINE(HAVE_M17N_FLT, 1, [Define to 1 if using libm17n-flt.])
+       fi
+      fi
     fi
     fi
-  fi
+else
+    HAVE_XFT=no
+    HAVE_FREETYPE=no
+    HAVE_LIBOTF=no
+    HAVE_M17N_FLT=no
 fi
 fi
+### End of font-backend (under X11) section.
 
 AC_SUBST(FREETYPE_CFLAGS)
 AC_SUBST(FREETYPE_LIBS)
 
 AC_SUBST(FREETYPE_CFLAGS)
 AC_SUBST(FREETYPE_LIBS)
@@ -1924,10 +2051,9 @@ AC_SUBST(LIBOTF_LIBS)
 AC_SUBST(M17N_FLT_CFLAGS)
 AC_SUBST(M17N_FLT_LIBS)
 
 AC_SUBST(M17N_FLT_CFLAGS)
 AC_SUBST(M17N_FLT_LIBS)
 
-### End of font-backend section.
-
 ### Use -lXpm if available, unless `--with-xpm=no'.
 HAVE_XPM=no
 ### 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,
 if test "${HAVE_X11}" = "yes"; then
   if test "${with_xpm}" != "no"; then
     AC_CHECK_HEADER(X11/xpm.h,
@@ -1951,11 +2077,14 @@ no_return_alloc_pixels
 
   if test "${HAVE_XPM}" = "yes"; then
     AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm libary (-lXpm).])
 
   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
   fi
 fi
+AC_SUBST(LIBXPM)
 
 ### Use -ljpeg if available, unless `--with-jpeg=no'.
 HAVE_JPEG=no
 
 ### 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
 if test "${HAVE_X11}" = "yes"; then
   if test "${with_jpeg}" != "no"; then
     dnl Checking for jpeglib.h can lose because of a redefinition of
@@ -1975,10 +2104,15 @@ if test "${HAVE_X11}" = "yes"; then
         [AC_MSG_WARN([libjpeg found, but not version 6b or later])
         HAVE_JPEG=no])
   fi
         [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
 fi
+AC_SUBST(LIBJPEG)
 
 ### Use -lpng if available, unless `--with-png=no'.
 HAVE_PNG=no
 
 ### 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
 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
@@ -1991,11 +2125,14 @@ if test "${HAVE_X11}" = "yes"; then
 
   if test "${HAVE_PNG}" = "yes"; then
     AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).])
 
   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
   fi
 fi
+AC_SUBST(LIBPNG)
 
 ### Use -ltiff if available, unless `--with-tiff=no'.
 HAVE_TIFF=no
 
 ### 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,
 if test "${HAVE_X11}" = "yes"; then
   if test "${with_tiff}" != "no"; then
     AC_CHECK_HEADER(tiffio.h,
@@ -2007,35 +2144,34 @@ if test "${HAVE_X11}" = "yes"; then
 
   if test "${HAVE_TIFF}" = "yes"; then
     AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
 
   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
   fi
 fi
+AC_SUBST(LIBTIFF)
 
 ### Use -lgif or -lungif if available, unless `--with-gif=no'.
 HAVE_GIF=no
 
 ### 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.
 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
 
   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 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
   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
   fi
 fi
+AC_SUBST(LIBGIF)
 
 dnl Check for required libraries.
 if test "${HAVE_X11}" = "yes"; then
 
 dnl Check for required libraries.
 if test "${HAVE_X11}" = "yes"; then
@@ -2064,14 +2200,17 @@ fi
 
 ### Use -lgpm if available, unless `--with-gpm=no'.
 HAVE_GPM=no
 
 ### 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 "${with_gpm}" != "no"; then
   AC_CHECK_HEADER(gpm.h,
     [AC_CHECK_LIB(gpm, Gpm_Open, HAVE_GPM=yes)])
-fi
 
 
-if test "${HAVE_GPM}" = "yes"; then
-  AC_DEFINE(HAVE_GPM, 1, [Define to 1 if you have the gpm library (-lgpm).])
+  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
 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.])])
 
 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.])])
@@ -2082,10 +2221,6 @@ if test "${HAVE_NS}" = "yes"; then
   if test "${NS_IMPL_COCOA}" = "yes"; then
     AC_DEFINE(NS_IMPL_COCOA, 1, [Define to 1 if you are using NS windowing under MacOS X.])
     GNU_OBJC_CFLAGS=
   if test "${NS_IMPL_COCOA}" = "yes"; then
     AC_DEFINE(NS_IMPL_COCOA, 1, [Define to 1 if you are using NS windowing under MacOS X.])
     GNU_OBJC_CFLAGS=
-    LIB_SRC_EXTRA_INSTALLABLES=mac-fix-env
-  fi
-  if test "${EN_COCOA_EXPERIMENTAL_CTRL_G}" = "yes"; then
-    AC_DEFINE(COCOA_EXPERIMENTAL_CTRL_G, 1, [Define to 1 if you are trying experimental enhanced Ctrl-g support using NS windowing under MacOS X.])
   fi
   if test "${NS_IMPL_GNUSTEP}" = "yes"; then
     AC_DEFINE(NS_IMPL_GNUSTEP, 1, [Define to 1 if you are using NS windowing under GNUstep.])
   fi
   if test "${NS_IMPL_GNUSTEP}" = "yes"; then
     AC_DEFINE(NS_IMPL_GNUSTEP, 1, [Define to 1 if you are using NS windowing under GNUstep.])
@@ -2096,6 +2231,7 @@ if test "${HAVE_NS}" = "yes"; then
   fi
   # We also have mouse menus.
   HAVE_MENUS=yes
   fi
   # We also have mouse menus.
   HAVE_MENUS=yes
+  OTHER_FILES=ns-app
 fi
 
 
 fi
 
 
@@ -2139,13 +2275,24 @@ AC_CHECK_LIB(m, sqrt)
 
 # Check for mail-locking functions in a "mail" library.  Probably this should
 # have the same check as for liblockfile below.
 
 # 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:
 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 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,
   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,
@@ -2154,11 +2301,11 @@ if test "$ac_cv_lib_lockfile_maillock" = no; then
     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.])
     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)
   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 \
 
 AC_CHECK_FUNCS(gethostname getdomainname dup2 \
 rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
@@ -2205,7 +2352,17 @@ AC_CHECK_FUNCS(getpt)
 # That is because we have not set up to link ncurses in lib-src.
 # It's better to believe a function is not available
 # than to expect to find it in ncurses.
 # That is because we have not set up to link ncurses in lib-src.
 # It's better to believe a function is not available
 # than to expect to find it in ncurses.
-AC_CHECK_LIB(ncurses, tparm)
+# Also we need tputs and frieds to be able to build at all.
+have_tputs_et_al=true
+AC_SEARCH_LIBS(tputs, [ncurses terminfo termcap], , have_tputs_et_al=false)
+if test "$have_tputs_et_al" != true; then
+  AC_MSG_ERROR([I couldn't find termcap functions (tputs and friends).
+Maybe some development libraries/packages are missing?  Try installing
+libncurses-dev(el), libterminfo-dev(el) or similar.])
+fi
+# Must define this when any termcap library is found.
+AC_DEFINE(HAVE_LIBNCURSES, 1,
+          [Define to 1 if you have the `ncurses' library (-lncurses).])
 
 # Do we have res_init, for detecting changes in /etc/resolv.conf?
 
 
 # Do we have res_init, for detecting changes in /etc/resolv.conf?
 
@@ -2236,8 +2393,9 @@ if test "$have_res_init" = yes; then
 fi
 
 # Do we need the Hesiod library to provide the support routines?
 fi
 
 # Do we need the Hesiod library to provide the support routines?
+LIBHESIOD=
 if test "$with_hesiod" != no ; then
 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)])])])
   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)])])])
@@ -2247,28 +2405,86 @@ if test "$with_hesiod" != no ; then
     RESOLVLIB=
   fi
   AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost,
     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
 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).])
 
 # 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
 fi
+AC_SUBST(LIBRESOLV)
 
 # These tell us which Kerberos-related libraries to use.
 
 # These tell us which Kerberos-related libraries to use.
+COM_ERRLIB=
+CRYPTOLIB=
+KRB5LIB=
+DESLIB=
+KRB4LIB=
+
 if test "${with_kerberos}" != no; then
 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
   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
   fi
 
   if test "${with_kerberos5}" != no; then
@@ -2286,6 +2502,12 @@ if test "${with_kerberos}" != no; then
   AC_CHECK_HEADERS(com_err.h)
 fi
 
   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)
 # Solaris requires -lintl if you want strerror (which calls dgettext)
 # to return localized messages.
 AC_CHECK_LIB(intl, dgettext)
@@ -2459,6 +2681,9 @@ CPPFLAGS="$REAL_CPPFLAGS"
 if test x"${version}" = x; then
   AC_MSG_ERROR([can't find current emacs version in `${srcdir}/lisp/version.el'.])
 fi
 if test x"${version}" = x; then
   AC_MSG_ERROR([can't find current emacs version in `${srcdir}/lisp/version.el'.])
 fi
+if test x"${version}" != x"$PACKAGE_VERSION"; then
+  AC_MSG_WARN([version mismatch between `${srcdir}/configure.in' and `${srcdir}/lisp/version.el'.])
+fi
 
 ### Specify what sort of things we'll be editing into Makefile and config.h.
 ### Use configuration here uncanonicalized to avoid exceeding size limits.
 
 ### Specify what sort of things we'll be editing into Makefile and config.h.
 ### Use configuration here uncanonicalized to avoid exceeding size limits.
@@ -2503,6 +2728,7 @@ AC_SUBST(GNUSTEP_SYSTEM_HEADERS)
 AC_SUBST(GNUSTEP_SYSTEM_LIBRARIES)
 AC_SUBST(GNU_OBJC_CFLAGS)
 AC_SUBST(LIB_SRC_EXTRA_INSTALLABLES)
 AC_SUBST(GNUSTEP_SYSTEM_LIBRARIES)
 AC_SUBST(GNU_OBJC_CFLAGS)
 AC_SUBST(LIB_SRC_EXTRA_INSTALLABLES)
+AC_SUBST(OTHER_FILES)
 
 AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION,  "${canonical}",
                   [Define to the canonical Emacs configuration name.])
 
 AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION,  "${canonical}",
                   [Define to the canonical Emacs configuration name.])
@@ -2566,7 +2792,7 @@ fi
 
 AH_TOP([/* GNU Emacs site configuration template file.
    Copyright (C) 1988, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2005,
 
 AH_TOP([/* GNU Emacs site configuration template file.
    Copyright (C) 1988, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 2005,
-     2006, 2007, 2008, 2009  Free Software Foundation, Inc.
+     2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 
 This file is part of GNU Emacs.
 
@@ -2598,11 +2824,6 @@ AH_BOTTOM([
 #define HAVE_MOUSE
 #endif
 
 #define HAVE_MOUSE
 #endif
 
-/* Sadly for now, GNUstep dump does not work.  */
-#ifdef NS_IMPL_GNUSTEP
-#define CANNOT_DUMP
-#endif
-
 /* Define AMPERSAND_FULL_NAME if you use the convention
    that & in the full name stands for the login id.  */
 /* Turned on June 1996 supposing nobody will mind it.  */
 /* Define AMPERSAND_FULL_NAME if you use the convention
    that & in the full name stands for the login id.  */
 /* Turned on June 1996 supposing nobody will mind it.  */
@@ -2654,7 +2875,6 @@ AH_BOTTOM([
    side does this in s/darwin.h and we cannot
    parallel this exactly since GNUstep is multi-OS. */
 #ifdef HAVE_NS
    side does this in s/darwin.h and we cannot
    parallel this exactly since GNUstep is multi-OS. */
 #ifdef HAVE_NS
-#define OTHER_FILES ns-app
 # ifdef NS_IMPL_GNUSTEP
 /* See also .m.o rule in Makefile.in */
 /* FIXME: are all these flags really needed?  Document here why.  */
 # ifdef NS_IMPL_GNUSTEP
 /* See also .m.o rule in Makefile.in */
 /* FIXME: are all these flags really needed?  Document here why.  */
@@ -2786,9 +3006,6 @@ typedef unsigned size_t;
 #define HAVE_X11R6_XIM
 #endif
 
 #define HAVE_X11R6_XIM
 #endif
 
-/* Should we enable expensive run-time checking of data types?  */
-#undef ENABLE_CHECKING
-
 #if defined __GNUC__ && (__GNUC__ > 2 \
                          || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
 #define NO_RETURN      __attribute__ ((__noreturn__))
 #if defined __GNUC__ && (__GNUC__ > 2 \
                          || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
 #define NO_RETURN      __attribute__ ((__noreturn__))
@@ -2867,11 +3084,12 @@ echo "  Does Emacs use -lXaw3d?                                 ${HAVE_XAW3D}"
 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 -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}"
 echo "  Does Emacs use -ldbus?                                  ${HAVE_DBUS}"
 echo "  Does Emacs use -lpng?                                   ${HAVE_PNG}"
 echo "  Does Emacs use -lrsvg-2?                                ${HAVE_RSVG}"
 echo "  Does Emacs use -lgpm?                                   ${HAVE_GPM}"
 echo "  Does Emacs use -ldbus?                                  ${HAVE_DBUS}"
+echo "  Does Emacs use -lgconf?                                 ${HAVE_GCONF}"
 
 echo "  Does Emacs use -lfreetype?                              ${HAVE_FREETYPE}"
 echo "  Does Emacs use -lm17n-flt?                              ${HAVE_M17N_FLT}"
 
 echo "  Does Emacs use -lfreetype?                              ${HAVE_FREETYPE}"
 echo "  Does Emacs use -lm17n-flt?                              ${HAVE_M17N_FLT}"
@@ -2888,16 +3106,6 @@ fi
 
 echo
 
 
 echo
 
-if test "$USE_X_TOOLKIT" = GTK; then
-  case "$canonical" in
-  *cygwin*)
-    echo "There are known problems with Emacs and Gtk+ on cygwin, so you
-  will probably get a crash on startup.  If this happens, please use another
-  toolkit for Emacs.  See etc/PROBLEMS for more information."
-  ;;
-  esac
-fi
-
 if test "$HAVE_NS" = "yes"; then
    echo
    echo "You must run \"make install\" in order to test the built application.
 if test "$HAVE_NS" = "yes"; then
    echo
    echo "You must run \"make install\" in order to test the built application.
@@ -2977,7 +3185,7 @@ echo creating lib-src/Makefile
   sed -e '1,/start of cpp stuff/d'\
       -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
       < Makefile.c > junk.c
   sed -e '1,/start of cpp stuff/d'\
       -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
       < Makefile.c > junk.c
-  $CPP $cpp_undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
+  $CPP -P $cpp_undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
       sed -e 's/^ /    /' -e '/^#/d' -e '/^[   \f]*$/d' > junk2.c
   cat junk1.c junk2.c > Makefile.new
   rm -f junk.c junk1.c junk2.c
       sed -e 's/^ /    /' -e '/^#/d' -e '/^[   \f]*$/d' > junk2.c
   cat junk1.c junk2.c > Makefile.new
   rm -f junk.c junk1.c junk2.c
@@ -2993,7 +3201,7 @@ echo creating src/Makefile
   sed -e '1,/start of cpp stuff/d'\
       -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
       < Makefile.c > junk.c
   sed -e '1,/start of cpp stuff/d'\
       -e 's,/\*\*/#\(.*\)$,/* \1 */,' \
       < Makefile.c > junk.c
-  $CPP $cpp_undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
+  $CPP -P $cpp_undefs -I. -I$srcdir/src $CPPFLAGS junk.c | \
       sed -e 's/^ /    /' -e '/^#/d' -e '/^[   \f]*$/d' > junk2.c
   cat junk1.c junk2.c > Makefile.new
   rm -f junk.c junk1.c junk2.c
       sed -e 's/^ /    /' -e '/^#/d' -e '/^[   \f]*$/d' > junk2.c
   cat junk1.c junk2.c > Makefile.new
   rm -f junk.c junk1.c junk2.c