* Makefile.am (EXTRA_DIST): add errnos_cnvt.awk, errnos.default,
authorGary Houston <ghouston@arglist.com>
Mon, 13 Jan 1997 04:05:27 +0000 (04:05 +0000)
committerGary Houston <ghouston@arglist.com>
Mon, 13 Jan 1997 04:05:27 +0000 (04:05 +0000)
errnos_get.c.
Add a rule to generate errnos.c from errnos.
* error.c (scm_init_error): include errnos.c.
* errnos_cnvt.awk: new file, converts the list of errno codes to
C expressions.
* errnos_get.c: new file.
* errnos.default: new file, contains errnos to try if they can't
be extracted from errno.h.
* configure.in: if using GCC, try and extract errno codes from
errno.h.
Added AC_PROG_AWK.

libguile/ChangeLog
libguile/Makefile.am
libguile/Makefile.in
libguile/configure
libguile/configure.in
libguile/error.c

index ef8dce8..417f972 100644 (file)
@@ -1,3 +1,18 @@
+Mon Jan 13 03:47:04 1997  Gary Houston  <ghouston@actrix.gen.nz>
+
+       * Makefile.am (EXTRA_DIST): add errnos_cnvt.awk, errnos.default,
+       errnos_get.c.
+       Add a rule to generate errnos.c from errnos.
+       * error.c (scm_init_error): include errnos.c.
+       * errnos_cnvt.awk: new file, converts the list of errno codes to
+       C expressions.
+       * errnos_get.c: new file.
+       * errnos.default: new file, contains errnos to try if they can't
+       be extracted from errno.h.
+       * configure.in: if using GCC, try and extract errno codes from
+       errno.h.
+       Added AC_PROG_AWK.
+
 Sat Jan 11 14:47:00 1997  Marius Vollmer  <mvo@zagadka.ping.de>
 
        * configure.in: Replaced AC_PROG_RANLIB with AM_PROG_LIBTOOL.
@@ -58,7 +73,7 @@ Tue Jan  7 15:04:06 1997  Mikael Djurfeldt  <mdj@kenneth>
 Mon Jan  6 20:39:08 1997  Gary Houston  <ghouston@actrix.gen.nz>
 
        * socket.c (scm_recvfrom): allow buff_or_size to be a list containing
-       the buffer and start and end positions for SCSH networking
+       the buffer and start and end positions for scsh networking
        implementation.
 
 Sun Jan  5 13:53:53 1997  Jim Blandy  <jimb@floss.cyclic.com>
index e4252bb..f65f503 100644 (file)
@@ -44,7 +44,8 @@ modinclude_DATA = scmconfig.h
 bin_SCRIPTS = guile-snarf
 
 EXTRA_DIST = gscm.c gscm.h ChangeLog-scm dynl-dl.c dynl-dld.c dynl-shl.c \
-dynl-vms.c DYNAMIC-LINKING PLUGIN/REQ PLUGIN/guile.config PLUGIN/guile.libs.in
+dynl-vms.c DYNAMIC-LINKING PLUGIN/REQ PLUGIN/guile.config \
+PLUGIN/guile.libs.in errnos_cnvt.awk errnos.default errnos_get.c
 
 ## FIXME: shouldn't directly generate file; instead generate temp file
 ## and "mv".  Consider using timestamp file as well, to avoid
@@ -66,3 +67,9 @@ dynl.o dynl.lo: dynl.x
 
 ## Add -MG to make the .x magic work with auto-dep code.
 MKDEP = gcc -M -MG $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
+
+errnos.c: errnos.list
+       $(AWK) -f $(srcdir)/errnos_cnvt.awk < errnos.list > errnos.c
+
+CLEANFILES=errnos.c
+DISTCLEANFILES=errnos.list
index f158d37..5d6991b 100644 (file)
@@ -88,11 +88,15 @@ modinclude_DATA = scmconfig.h
 bin_SCRIPTS = guile-snarf
 
 EXTRA_DIST = gscm.c gscm.h ChangeLog-scm dynl-dl.c dynl-dld.c dynl-shl.c \
-dynl-vms.c DYNAMIC-LINKING PLUGIN/REQ PLUGIN/guile.config PLUGIN/guile.libs.in
+dynl-vms.c DYNAMIC-LINKING PLUGIN/REQ PLUGIN/guile.config \
+PLUGIN/guile.libs.in errnos_cnvt.awk errnos.default errnos_get.c
 
 SUFFIXES = .x
 
 MKDEP = gcc -M -MG $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
+
+CLEANFILES=errnos.c
+DISTCLEANFILES=errnos.list
 ACLOCAL = $(top_srcdir)/aclocal.m4
 CONFIG_HEADER_IN = scmconfig.h.in
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
@@ -489,6 +493,9 @@ libpath.h: Makefile
 
 dynl.o dynl.lo: dynl.x
 
+errnos.c: errnos.list
+       $(AWK) -f $(srcdir)/errnos_cnvt.awk < errnos.list > errnos.c
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
index f200d57..5c6512b 100755 (executable)
@@ -2748,6 +2748,53 @@ case "$GCC" in
   yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
 esac
 
+for ac_prog in mawk gawk nawk awk
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2757: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_AWK="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+AWK="$ac_cv_prog_AWK"
+if test -n "$AWK"; then
+  echo "$ac_t""$AWK" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+test -n "$AWK" && break
+done
+
+echo $ac_n "checking whether errno codes can be extracted from errno.h""... $ac_c" 1>&6
+echo "configure:2786: checking whether errno codes can be extracted from errno.h" >&5
+goterrnos=0
+if test "$GCC" = yes ; then
+  ${CC-cc} -undef -dM -E $srcdir/errnos_get.c | egrep ' E.+' | cut -f2 -d' ' > errnos.list
+  egrep '^E.+' errnos.list > /dev/null 2>&1 && goterrnos=1
+fi
+if test $goterrnos = 1 ; then
+  echo "$ac_t""yes" 1>&6
+else
+  cp $srcdir/errnos.default errnos.list
+  echo "$ac_t""no, using default" 1>&6
+fi
+
 cat >> confdefs.h <<EOF
 #define GUILE_MAJOR_VERSION "$GUILE_MAJOR_VERSION"
 EOF
@@ -2911,6 +2958,7 @@ s%@RANLIB@%$RANLIB%g
 s%@LIBTOOL@%$LIBTOOL%g
 s%@LIBOBJS@%$LIBOBJS%g
 s%@xtra_PLUGIN_guile_libs@%$xtra_PLUGIN_guile_libs%g
+s%@AWK@%$AWK%g
 s%@FD_SETTER@%$FD_SETTER%g
 
 CEOF
index e314526..706a9b7 100644 (file)
@@ -221,6 +221,20 @@ case "$GCC" in
   yes ) CFLAGS="$CFLAGS -Wall -Wpointer-arith" ;;
 esac
 
+AC_PROG_AWK
+AC_MSG_CHECKING(whether errno codes can be extracted from errno.h)
+goterrnos=0
+if test "$GCC" = yes ; then
+  ${CC-cc} -undef -dM -E $srcdir/errnos_get.c | egrep ' E.+' | cut -f2 -d' ' > errnos.list
+  egrep '^E.+' errnos.list > /dev/null 2>&1 && goterrnos=1
+fi
+if test $goterrnos = 1 ; then
+  AC_MSG_RESULT(yes)
+else
+  cp $srcdir/errnos.default errnos.list
+  AC_MSG_RESULT([no, using default])
+fi
+
 AC_DEFINE_UNQUOTED(GUILE_MAJOR_VERSION, "$GUILE_MAJOR_VERSION")
 AC_DEFINE_UNQUOTED(GUILE_MINOR_VERSION, "$GUILE_MINOR_VERSION")
 AC_DEFINE_UNQUOTED(GUILE_VERSION, "$GUILE_VERSION")
index 68f24a9..93ec9de 100644 (file)
@@ -323,6 +323,7 @@ scm_wta (arg, pos, s_subr)
 void
 scm_init_error ()
 {
+#include "errnos.c"
 #include "error.x"
 }