+Fri Feb 16 10:50:38 2007 Ben Pfaff <blp@gnu.org>
+
+ Better support cross-compiling by using CC_FOR_BUILD and
+ EXEEXT_FOR_BUILD for q2c.
+
+ * Makefile.am: Add CC_FOR_BUILD, EXEEXT_FOR_BUILD variables. Use
+ in .q.c rule.
+
+ * acinclude.m4: Add PSPP_CC_FOR_BUILD macro.
+
+ * configure.ac: Call PSPP_CC_FOR_BUILD.
+
Mon Feb 12 16:39:18 2007 Ben Pfaff <blp@gnu.org>
* README: Note that iconv is required.
-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@
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
AM_CONDITIONAL(cc_is_gcc, test x"$GCC" = x"yes" )
-
+PSPP_CC_FOR_BUILD
PSPP_PERL
dnl Internationalization macros.
+Fri Feb 16 11:14:42 2007 Ben Pfaff <blp@gnu.org>
+
+ Better support cross-compiling by using CC_FOR_BUILD and
+ EXEEXT_FOR_BUILD for q2c.
+
+ * automake.mk: Use EXEEXT_FOR_BUILD and CC_FOR_BUILD to build and
+ clean q2c.
+
+ * q2c.c: Avoid external dependencies, besides the standard C
+ library.
+
Sun Feb 11 20:31:51 2007 Ben Pfaff <blp@gnu.org>
* q2c.c: Make q2c link under mingw32, by eliminating the
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)
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
-#include <config.h>
-
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#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
break;
default:
- NOT_REACHED ();
+ abort ();
}
}
}