Index: Makefile.am
===================================================================
RCS file: /cvsroot/pspp/pspp/Makefile.am,v
retrieving revision 1.19
diff -u -p -r1.19 Makefile.am
--- Makefile.am	12 Feb 2007 02:10:55 -0000	1.19
+++ Makefile.am	16 Feb 2007 05:46:45 -0000
@@ -16,11 +16,13 @@ AM_CFLAGS+=-Wall -W -Wwrite-strings -Wst
 -Wpointer-arith -Wno-sign-compare -Wmissing-prototypes
 endif
 
+CC_FOR_BUILD = @CC_FOR_BUILD@
+EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
 .q.c:
 	@$(top_srcdir)/mkinstalldirs  `dirname $@`
-	./src/language/lexer/q2c $< $@
+	./src/language/lexer/q2c$(EXEEXT_FOR_BUILD) $< $@
 
-$(all_q_sources:.q=.c): src/language/lexer/q2c$(EXEEXT)
+$(all_q_sources:.q=.c): src/language/lexer/q2c$(EXEEXT_FOR_BUILD)
 all_q_sources =
 
 pkgsysconfdir = $(sysconfdir)/@PACKAGE@
Index: acinclude.m4
===================================================================
RCS file: /cvsroot/pspp/pspp/acinclude.m4,v
retrieving revision 1.9
diff -u -p -r1.9 acinclude.m4
--- acinclude.m4	15 Dec 2006 00:16:01 -0000	1.9
+++ acinclude.m4	16 Feb 2007 05:46:45 -0000
@@ -150,4 +150,39 @@ AC_DEFUN([PSPP_READLINE],
   AC_SUBST(LTLIBREADLINE)
 ])
 
+dnl Check for build tools.  Adapted from bfd library.
+
+AC_DEFUN([PSPP_CC_FOR_BUILD],
+[# Put a plausible default for CC_FOR_BUILD in Makefile.
+if test -z "$CC_FOR_BUILD"; then
+  if test "x$cross_compiling" = "xno"; then
+    CC_FOR_BUILD='$(CC)'
+  else
+    CC_FOR_BUILD=cc
+  fi
+fi
+AC_SUBST(CC_FOR_BUILD)
+# Also set EXEEXT_FOR_BUILD.
+if test "x$cross_compiling" = "xno"; then
+  EXEEXT_FOR_BUILD='$(EXEEXT)'
+else
+  AC_CACHE_CHECK([for build system executable suffix], pspp_cv_build_exeext,
+    [rm -f conftest*
+     echo 'int main () { return 0; }' > conftest.c
+     pspp_cv_build_exeext=
+     ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
+     for file in conftest.*; do
+       case $file in # (
+       *.c | *.o | *.obj | *.ilk | *.pdb) ;; # (
+       *) pspp_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
+       esac
+     done
+     rm -f conftest*
+     test x"${pspp_cv_build_exeext}" = x && pspp_cv_build_exeext=no])
+  EXEEXT_FOR_BUILD=""
+  test x"${pspp_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${pspp_cv_build_exeex
+t}
+fi
+AC_SUBST(EXEEXT_FOR_BUILD)])
+
 dnl aclocal.m4 ends here
Index: configure.ac
===================================================================
RCS file: /cvsroot/pspp/pspp/configure.ac,v
retrieving revision 1.53
diff -u -p -r1.53 configure.ac
--- configure.ac	13 Feb 2007 00:39:49 -0000	1.53
+++ configure.ac	16 Feb 2007 05:46:45 -0000
@@ -18,7 +18,7 @@ PSPP_ENABLE_WARNING(-Wdeclaration-after-
 
 AM_CONDITIONAL(cc_is_gcc, test x"$GCC" = x"yes" )
 
-
+PSPP_CC_FOR_BUILD
 PSPP_PERL
 
 dnl Internationalization macros.
Index: src/language/lexer/automake.mk
===================================================================
RCS file: /cvsroot/pspp/pspp/src/language/lexer/automake.mk,v
retrieving revision 1.6
diff -u -p -r1.6 automake.mk
--- src/language/lexer/automake.mk	14 Dec 2006 10:45:19 -0000	1.6
+++ src/language/lexer/automake.mk	16 Feb 2007 05:46:45 -0000
@@ -15,9 +15,9 @@ language_lexer_sources = \
 EXTRA_DIST += src/language/lexer/q2c.c
 
 
-src/language/lexer/q2c$(EXEEXT): $(top_srcdir)/src/language/lexer/q2c.c 
+src/language/lexer/q2c$(EXEEXT_FOR_BUILD): $(top_srcdir)/src/language/lexer/q2c.c 
 	@$(top_srcdir)/mkinstalldirs `dirname $@`
-	$(CC) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(top_srcdir)/src/language/lexer/q2c.c -o $@
+	$(CC_FOR_BUILD) $(top_srcdir)/src/language/lexer/q2c.c -o $(top_builddir)/src/language/lexer/q2c
 
 
-CLEANFILES += src/language/lexer/q2c$(EXEEXT)
+CLEANFILES += src/language/lexer/q2c$(EXEEXT_FOR_BUILD)
Index: src/language/lexer/q2c.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/language/lexer/q2c.c,v
retrieving revision 1.20
diff -u -p -r1.20 q2c.c
--- src/language/lexer/q2c.c	13 Feb 2007 00:28:52 -0000	1.20
+++ src/language/lexer/q2c.c	16 Feb 2007 05:46:46 -0000
@@ -16,8 +16,6 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA. */
 
-#include <config.h>
-
 #include <assert.h>
 #include <ctype.h>
 #include <stdio.h>
@@ -28,11 +26,26 @@
 #include <errno.h>
 #include <unistd.h>
 
-#include <libpspp/assertion.h>
-#include <libpspp/compiler.h>
+/* GNU C allows the programmer to declare that certain functions take
+   printf-like arguments, never return, etc.  Conditionalize these
+   declarations on whether gcc is in use. */
+#if __GNUC__ > 1
+#define ATTRIBUTE(X) __attribute__ (X)
+#else
+#define ATTRIBUTE(X)
+#endif
+
+/* Marks a function argument as possibly not used. */
+#define UNUSED ATTRIBUTE ((unused))
+
+/* Marks a function that will never return. */
+#define NO_RETURN ATTRIBUTE ((noreturn))
+
+/* Mark a function as taking a printf- or scanf-like format
+   string as its FMT'th argument and that the FIRST'th argument
+   is the first one to be checked against the format string. */
+#define PRINTF_FORMAT(FMT, FIRST) ATTRIBUTE ((format (__printf__, FMT, FIRST)))
 
-#include "exit.h"
-     
 /* Max length of an input line. */
 #define MAX_LINE_LEN 1024
 
@@ -1322,7 +1335,7 @@ dump_vars_init (int persistent)
 		break;
 
 	      default:
-		NOT_REACHED ();
+		abort ();
 	      }
 	  }
       }
