pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp src/language/lexer/q2c.c src/language/lexe...


From: Ben Pfaff
Subject: [Pspp-cvs] pspp src/language/lexer/q2c.c src/language/lexe...
Date: Fri, 16 Feb 2007 19:24:25 +0000

CVSROOT:        /cvsroot/pspp
Module name:    pspp
Changes by:     Ben Pfaff <blp> 07/02/16 19:24:25

Modified files:
        src/language/lexer: q2c.c automake.mk ChangeLog 
        .              : configure.ac acinclude.m4 Makefile.am ChangeLog 

Log message:
        Better support cross-compiling.  Patch #19003.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/lexer/q2c.c?cvsroot=pspp&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/lexer/automake.mk?cvsroot=pspp&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/lexer/ChangeLog?cvsroot=pspp&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/pspp/configure.ac?cvsroot=pspp&r1=1.53&r2=1.54
http://cvs.savannah.gnu.org/viewcvs/pspp/acinclude.m4?cvsroot=pspp&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pspp/Makefile.am?cvsroot=pspp&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/pspp/ChangeLog?cvsroot=pspp&r1=1.68&r2=1.69

Patches:
Index: src/language/lexer/q2c.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/language/lexer/q2c.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- src/language/lexer/q2c.c    13 Feb 2007 00:28:52 -0000      1.20
+++ src/language/lexer/q2c.c    16 Feb 2007 19:24:25 -0000      1.21
@@ -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,10 +26,25 @@
 #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))
 
-#include "exit.h"
+/* 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)))
      
 /* Max length of an input line. */
 #define MAX_LINE_LEN 1024
@@ -1322,7 +1335,7 @@
                break;
 
              default:
-               NOT_REACHED ();
+               abort ();
              }
          }
       }

Index: src/language/lexer/automake.mk
===================================================================
RCS file: /cvsroot/pspp/pspp/src/language/lexer/automake.mk,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- src/language/lexer/automake.mk      14 Dec 2006 10:45:19 -0000      1.6
+++ src/language/lexer/automake.mk      16 Feb 2007 19:24:25 -0000      1.7
@@ -15,9 +15,9 @@
 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 address@hidden
-       $(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/ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/language/lexer/ChangeLog,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- src/language/lexer/ChangeLog        13 Feb 2007 00:28:52 -0000      1.22
+++ src/language/lexer/ChangeLog        16 Feb 2007 19:24:25 -0000      1.23
@@ -1,3 +1,14 @@
+Fri Feb 16 11:14:42 2007  Ben Pfaff  <address@hidden>
+
+       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  <address@hidden>
 
        * q2c.c: Make q2c link under mingw32, by eliminating the

Index: configure.ac
===================================================================
RCS file: /cvsroot/pspp/pspp/configure.ac,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- configure.ac        13 Feb 2007 00:39:49 -0000      1.53
+++ configure.ac        16 Feb 2007 19:24:25 -0000      1.54
@@ -18,7 +18,7 @@
 
 AM_CONDITIONAL(cc_is_gcc, test x"$GCC" = x"yes" )
 
-
+PSPP_CC_FOR_BUILD
 PSPP_PERL
 
 dnl Internationalization macros.

Index: acinclude.m4
===================================================================
RCS file: /cvsroot/pspp/pspp/acinclude.m4,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- acinclude.m4        15 Dec 2006 00:16:01 -0000      1.9
+++ acinclude.m4        16 Feb 2007 19:24:25 -0000      1.10
@@ -150,4 +150,39 @@
   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: Makefile.am
===================================================================
RCS file: /cvsroot/pspp/pspp/Makefile.am,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- Makefile.am 12 Feb 2007 02:10:55 -0000      1.19
+++ Makefile.am 16 Feb 2007 19:24:25 -0000      1.20
@@ -16,11 +16,13 @@
 -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 address@hidden
-       ./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: ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/ChangeLog,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- ChangeLog   13 Feb 2007 00:39:49 -0000      1.68
+++ ChangeLog   16 Feb 2007 19:24:25 -0000      1.69
@@ -1,3 +1,15 @@
+Fri Feb 16 10:50:38 2007  Ben Pfaff  <address@hidden>
+
+       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  <address@hidden>
 
        * README: Note that iconv is required.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]