changeset 2499:da67547eda51

* configure.in: When checking for X windows, search for an X11 subdirectory of ${x_includes}. * configure.in: Check for gettimeofday function, for getdate.y. Change `configure' to a mixture of custom code and autoconf stuff. autoconf can't derive all the information we need, but we'd really like to be able to take advantage of some of its tests, and its file-editing facilities. * configure.in: Renamed from configure. Quote the sections of shell script we want copied literally to the configure script. (compile): Initialize this to make the autoconf macros' code happy. Use AC_PROG_CC, AC_CONST, and AC_RETSIGTYPE instead of writing out code to do their jobs. Use autoconf to produce Makefile and src/config.h. Remove the Makefile-style comment that autoconf places at the top of src/config.h. (config_h_opts): Removed - no longer necessary. * Makefile.in (configname): Renamed to configuration. (CONFIG_CFLAGS): Renamed to DEFS. (CC, DEFS, C_SWITCH_SYSTEM, version, configuration): Adjusted to get values via autoload @cookies@. (libsrc_libs): Get this from autoconf. We used to do nothing about this. (${SUBDIR}): Pass DEFS to submakes instead of CONFIG_CFLAGS.
author Jim Blandy <jimb@redhat.com>
date Sat, 10 Apr 1993 06:02:36 +0000
parents 0126ca788e99
children 332457055981
files configure1.in
diffstat 1 files changed, 95 insertions(+), 202 deletions(-) [+]
line wrap: on
line diff
--- a/configure1.in	Sat Apr 10 06:01:49 1993 +0000
+++ b/configure1.in	Sat Apr 10 06:02:36 1993 +0000
@@ -1,4 +1,4 @@
-
+[
 ### The above line is deliberately left blank.  If it starts with a #,
 ### some CSH's will think this is a csh script.
 
@@ -21,8 +21,19 @@
 ### along with GNU Emacs; see the file COPYING.  If not, write to
 ### the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
-### Shell script to edit files and make symlinks in preparation for
-### compiling Emacs.
+
+### Since Emacs has configuration requirements that autoconf can't
+### meet, this file is an unholy marriage of custom-baked
+### configuration code and autoconf macros.  New versions of autoconf
+### could very well break this arrangement.
+###
+### We omit the invocation of autoconf's initialization function,
+### because it produces Bourne shell code to parse arguments, but we
+### need to parse our own arguments.
+###
+### We use the m4 quoting characters [ ] (as established by the
+### autoconf system) to include large sections of raw sewage - Oops, I
+### mean, shell code - in the final configuration script.
 ###
 ### Usage: configure config_name
 ###
@@ -92,14 +103,6 @@
 
 #### Option processing.
 
-### These are the names of CPP symbols we want to define or leave undefined
-### in src/config.h; their values are given by the shell variables of the same
-### names.
-config_h_opts=" \
-HAVE_X_WINDOWS HAVE_X11 HAVE_X_MENU \
-SIGTYPE GNU_MALLOC REL_ALLOC LISP_FLOAT_TYPE HAVE_CONST \
-LD_SWITCH_X_SITE C_SWITCH_X_SITE HAVE_XFREE386"
-
 ### Record all the arguments, so we can save them in config.status.
 arguments="$@"
 
@@ -768,6 +771,31 @@
 machfile="m/${machine}.h"
 opsysfile="s/${opsys}.h"
 
+#### Set some things up for the autoconf macros.
+trap 'rm -f conftest* core; exit 1' 1 3 15
+
+rm -f conftest*
+compile='${CC-cc} $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
+
+
+#### Choose a compiler.
+DEFS=-g
+case ${with_gcc} in
+  "yes" ) CC="gcc -O99" GCC=1 ;;
+  "no"  ) CC="cc"             ;;
+  * )
+]
+AC_PROG_CC
+[
+esac
+
+#### Some other nice autoconf tests.
+]
+AC_CONST
+AC_RETSIGTYPE
+AC_HAVE_FUNCS(gettimeofday)
+[
+
 
 #### Choose a window system.
 echo "Checking window system."
@@ -797,7 +825,8 @@
     window_system=none
     if [ -r /usr/lib/libX11.a \
 	 -o -d /usr/include/X11 \
-         -o -d /usr/X386/include ]; then
+         -o -d /usr/X386/include \
+	 -o -d ${x_includes}/X11 ]; then
       window_system=x11
     fi
   ;;
@@ -845,93 +874,6 @@
   ;;
 esac
 
-#### Choose a compiler.
-echo "Checking compilers."
-if [ "${with_gcc}" = "" ]; then
-  echo "  Searching load path for GCC."
-  temppath=`echo $PATH | sed 's/^:/.:/
-			      s/::/:.:/g
-			      s/:$/:./
-			      s/:/ /g'`
-  default_cc=`(
-    for dir in ${temppath}; do
-      if [ -f ${dir}/gcc ]; then echo gcc; exit 0; fi
-    done
-    echo cc
-  )`
-else
-  case ${with_gcc} in
-    "yes" ) default_cc="gcc" ;;
-    "no"  ) default_cc="cc"  ;;
-  esac
-fi
-
-case "${default_cc}" in
-  "gcc" )
-    echo "  Using GCC."
-    default_cflags='-g -O'
-  ;;
-  * )
-    echo "  Using the system's CC."
-    default_cflags='-g'
-  ;;
-esac
-
-
-#### Does this compiler support the `const' keyword?
-#### The code for this test was adapted from autoconf's test.
-echo "Checking if the compiler supports \`const'."
-rm -f conftest*
-compile='${default_cc} conftest.c -o conftest >/dev/null 2>&1'
-echo "
-main() { exit(0); } t() {
-/* Ultrix mips cc rejects this.  */
-typedef int charset[2]; const charset x;
-/* SunOS 4.1.1 cc rejects this. */
-char const *const *p;
-char **p2;
-/* AIX 3.2 cc rejects this.  */
-p += p ? p-p : 0;
-/* HPUX 7.0 cc rejects these. */
-++p;
-p2 = (char const* const*) p;
- }" > conftest.c
-if eval $compile; then
-  echo "  It seems to."
-  HAVE_CONST=yes
-else
-  echo "  It doesn't seem to."
-  HAVE_CONST=no
-fi
-rm -f conftest*
-
-#### What is the return type of a signal handler?
-
-### We run /usr/include/signal.h through cpp and grep for the
-### declaration of the signal function.  Yuck.
-echo "Looking for return type of signal handler functions."
-signal_h_file=''
-if [ -r /usr/include/signal.h ]; then
-  signal_h_file=/usr/include/signal.h
-elif [ -r /usr/include/sys/signal.h ]; then
-  signal_h_file=/usr/include/sys/signal.h
-fi
-SIGTYPE=void
-if [ "${signal_h_file}" ]; then
-  sigpattern='[ 	]*([ 	]*\*[ 	]*signal[ 	]*('
-
-  ## We make a copy whose name ends in .c, so the compiler
-  ## won't complain about having only been given a .h file.
-  tempcname="configure.tmp.$$.c"
-  cp ${signal_h_file}  ${tempcname}
-  if ${default_cc} -E ${tempcname} | grep "int${sigpattern}" > /dev/null; then
-    SIGTYPE=int
-  fi
-  rm -f ${tempcname}
-fi
-echo "  Guessing that signals return \`${SIGTYPE}'."
-
-
 #### Extract some information from the operating system and machine files.
 
 echo "Examining the machine- and system-dependent files to find out"
@@ -958,11 +900,12 @@
 @configure@ system_malloc=no
 #endif
 ' > ${tempcname}
-eval `${default_cc} -E ${tempcname} \
+eval `${CC} -E ${tempcname} \
        | grep '@configure@' \
        | sed -e 's/^@configure@ \([^=]*=\)\(.*\)$/\1"\2"/'`
 rm ${tempcname}
 
+
 # Do the opsystem or machine files prohibit the use of the GNU malloc?
 # Assume not, until told otherwise.
 GNU_MALLOC=yes
@@ -989,118 +932,68 @@
 fi
 
 
-#### Make the proper settings in `src/config.h'.
-rm -f config.status
-set -e
-
-echo "Making \`./src/config.h' from \`${srcdir}/src/config.h.in'."
-sed_flags="-e 's:@machine@:${machfile}:' -e 's:@opsystem@:${opsysfile}:'"
-
-for flag in ${config_h_opts}; do
-  val=`eval echo '$'${flag}`
-  case ${val} in
-    no | "")
-      f="-e 's:.*#define ${flag}.*:/\\* #define ${flag} \\*/:'"
-    ;;
-    yes)
-      f="-e 's:.*#define ${flag}.*:#define ${flag}:'"
-    ;;
-    *)
-      f="-e 's:.*#define ${flag}.*:#define ${flag} ${val}:'"
-    ;;
-  esac
-  sed_flags="${sed_flags} ${f}"
-done
-
-rm -f ./src/config.h.tmp
-(echo "/* This file is generated by \`${progname}' from"
- echo "   \`${srcdir}/src/config.h.in'."
- echo "   If you are thinking about editing it, you should seriously consider"
- echo "   running \`${progname} instead, or editing"
- echo "   \`${srcdir}/src/config.h.in' itself." 
- eval '/bin/sed '${sed_flags}' < "${srcdir}/src/config.h.in"'
-) > src/config.h.tmp
-${srcdir}/move-if-change src/config.h.tmp src/config.h
-### Remind people not to edit this.
-chmod -w src/config.h
+#### Specify what sort of things we'll be editing into our Makefiles.
+]
+AC_SUBST(configuration)
+AC_SUBST(version)
+AC_SUBST(srcdir)
+AC_SUBST(c_switch_system)
+AC_SUBST(libsrc_libs)
+AC_SUBST(machfile)
+AC_SUBST(opsysfile)
+AC_SUBST(LD_SWITCH_X_SITE)
+AC_SUBST(C_SWITCH_X_SITE)
+[
+if [ "${HAVE_X_WINDOWS}" = "yes" ] ; then
+  ] AC_DEFINE(HAVE_X_WINDOWS) [
+fi
+if [ "${HAVE_X11}" = "yes" ] ; then
+  ] AC_DEFINE(HAVE_X11) [
+fi
+if [ "${HAVE_XFREE386}" = "yes" ] ; then
+  ] AC_DEFINE(HAVE_XFREE386) [
+fi
+if [ "${HAVE_X_MENU}" = "yes" ] ; then
+  ] AC_DEFINE(HAVE_X_MENU) [
+fi
+if [ "${GNU_MALLOC}" = "yes" ] ; then
+  ] AC_DEFINE(GNU_MALLOC) [
+fi
+if [ "${REL_ALLOC}" = "yes" ] ; then
+  ] AC_DEFINE(REL_ALLOC) [
+fi
+if [ "${LISP_FLOAT_TYPE}" = "yes" ] ; then
+  ] AC_DEFINE(LISP_FLOAT_TYPE) [
+fi
 
 
-#### Modify the parameters in the top-level Makefile.
-echo "Producing \`Makefile' from \`${srcdir}/Makefile.in'."
-rm -f Makefile.tmp
-(echo "\
-# This file is generated by \`${progname}' from
-# \`${srcdir}/Makefile.in'.
-# If you are thinking about editing it, you should seriously consider
-# running \`${progname}' instead, or editing
-# \`${srcdir}/Makefile.in' itself."
- /bin/sed < ${srcdir}/Makefile.in					\
- -e 's|^configname *=.*$|configname='"${configuration}"'|'		\
- -e 's|^version *=.*$|version='"${version}"'|' 				\
- -e 's|^srcdir *=.*$|srcdir='"${srcdir}"'|' 				\
- -e 's|^CC *=.*$|CC='"${default_cc}"'|'					\
- -e 's|^CONFIG_CFLAGS *=.*$|CONFIG_CFLAGS='"${default_cflags}"'|'	\
- -e 's|^C_SWITCH_SYSTEM *=.*$|C_SWITCH_SYSTEM='"${c_switch_system}"'|'	\
- -e 's|^LOADLIBES *=.*$|LOADLIBES='"${libsrc_libs}"'|'			\
- -e '/^# DIST: /d') > Makefile.tmp
-${srcdir}/move-if-change Makefile.tmp Makefile
-
-### I'm commenting out this section until I bring the `build-install' script
-### into line with the rest of the configuration stuff.
+#### Report on what we decided to do.
+echo "
 
-### # Modify the parameters in the `build-install' script.
-### echo "Producing \`./build-install' from \`${srcdir}/build-install.in'."
-### rm -f ./build-install.tmp
-### (echo "\
-### # This file is generated by \`${progname}' from \`${srcdir}/build-install.in'.
-### # If you are thinking about editing it, you should seriously consider
-### # editing \`./build-install.in' itself, or running \`${progname}' instead."
-###  /bin/sed < ${srcdir}/build-install.in			\
-###  -e 's;^\(prefix=\).*$;\1'"${prefix};"			\
-###  -e 's;^\(bindir=\).*$;\1'"${bindir};"			\
-###  -e 's;^\(lisppath=\).*$;\1'"${lisppath};"		\
-###  -e 's;^\(datadir=\).*$;\1'"${datadir};"		\
-###  -e 's;^\(lockdir=\).*$;\1'"${lockdir};"		\
-###  -e 's;^\(libdir=\).*$;\1'"${libdir};") > ./build-install.tmp
-### ${srcdir}/move-if-change build-install.tmp build-install
-### # Remind people not to edit this.
-### chmod -w build-install
-### chmod +x build-install
-
-
-#### Describe the results.
-
-### Create a verbal description of what we have done.
-
-message="Configured for \`${configuration}'.
+Configured for \`${configuration}'.
 
   What operating system and machine description files should Emacs use?
         \`${opsysfile}' and \`${machfile}'
+  What compiler should emacs be built with?               ${CC} -g
   Should Emacs use the GNU version of malloc?             ${GNU_MALLOC}${GNU_MALLOC_reason}
   Should Emacs use the relocating allocator for buffers?  ${REL_ALLOC}
-  What window system should Emacs use?                    ${window_system}
-  What compiler should emacs be built with?               ${default_cc}
-  Should the compilation use \`-g' and/or \`-O'?            ${default_cflags-neither}${x_includes+
+  What window system should Emacs use?                    ${window_system}${x_includes+
   Where do we find X Windows header files?                }${x_includes}${x_libraries+
-  Where do we find X Windows libraries?                   }${x_libraries}"
+  Where do we find X Windows libraries?                   }${x_libraries}
 
-### Write config.status, documenting the damage we have done.
+"
 
-(echo "\
-#!/bin/sh
-### This file is generated by \`${progname}.'
-### If you are thinking about editing it, you should seriously consider
-### running \`${progname}' instead.
-"
- echo "${message}" | sed -e 's/^/# /'
- echo "exec '${progname}' ${arguments} "'$@') > config.status
+### Restore the arguments to this script, so autoconf can record them
+### in the config.status file.
+set - ${arguments}
+]
+AC_OUTPUT(Makefile src/config.h)
+[
 
-### Remind people not to edit this.
-chmod -w config.status
-chmod +x config.status
+### Autoconf likes to add a Makefile comment to the top of
+### src/config.h.  Do you have a better idea?
+(cd src
+ sed < config.h > conftemp.$$ '1d'
+ mv conftemp.$$ config.h)
 
-### Print the description.
-echo
-echo "${message}"
-
-exit 0
+]