check for iconveh values at configure-time
[bpt/guile.git] / libguile / Makefile.am
index 046ce21..4ec7ee5 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with Automake to create Makefile.in
 ##
-##     Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+##     Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 ##
 ##   This file is part of GUILE.
 ##
@@ -19,6 +19,8 @@
 ##   write to the Free Software Foundation, Inc., 51 Franklin Street,
 ##   Fifth Floor, Boston, MA 02110-1301 USA
 
+include $(top_srcdir)/am/snarf
+
 AUTOMAKE_OPTIONS = gnu
 
 ## Prevent automake from adding extra -I options
@@ -33,7 +35,7 @@ DEFAULT_INCLUDES =
 ## <libguile/MUMBLE.h> will find MUMBLE.h in this dir when we're
 ## building.  Also look for Gnulib headers in `lib'.
 AM_CPPFLAGS = -DBUILDING_LIBGUILE=1 -I$(top_srcdir) -I$(top_builddir) \
-             -I$(top_srcdir)/lib -I$(top_builddir)/lib
+             -I$(top_srcdir)/lib -I$(top_builddir)/lib $(LIBFFI_CFLAGS)
 
 AM_CFLAGS = $(GCC_CFLAGS) $(CFLAG_VISIBILITY)
 
@@ -43,8 +45,7 @@ gnulib_library = $(top_builddir)/lib/libgnu.la
 ETAGS_ARGS = --regex='/SCM_\(GLOBAL_\)?\(G?PROC\|G?PROC1\|SYMBOL\|VCELL\|CONST_LONG\).*\"\([^\"]\)*\"/\3/' \
    --regex='/[ \t]*SCM_[G]?DEFINE1?[ \t]*(\([^,]*\),[^,]*/\1/'
 
-lib_LTLIBRARIES = libguile.la                                          \
-                 libguile-i18n-v-@LIBGUILE_I18N_MAJOR@.la
+lib_LTLIBRARIES = libguile-@GUILE_EFFECTIVE_VERSION@.la
 bin_PROGRAMS = guile
 
 noinst_PROGRAMS = guile_filter_doc_snarfage gen-scmconfig
@@ -54,6 +55,7 @@ gen_scmconfig_SOURCES = gen-scmconfig.c
 ## Override default rule; this should be compiled for BUILD host.
 ## For some reason, OBJEXT does not include the dot
 gen-scmconfig.$(OBJEXT): gen-scmconfig.c
+       $(AM_V_GEN) \
        if [ "$(cross_compiling)" = "yes" ]; then \
                $(CC_FOR_BUILD) $(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) -c -o $@ $<; \
        else \
@@ -61,8 +63,9 @@ gen-scmconfig.$(OBJEXT): gen-scmconfig.c
        fi
 
 ## Override default rule; this should run on BUILD host.
-gen-scmconfig$(EXEEXT): $(gen_scmconfig_OBJECTS) $(gen_scmconfig_DEPENDENCIES) 
-       @rm -f gen-scmconfig$(EXEEXT)
+gen-scmconfig$(EXEEXT): $(gen_scmconfig_OBJECTS) $(gen_scmconfig_DEPENDENCIES)
+       $(AM_V_GEN) \
+       rm -f gen-scmconfig$(EXEEXT); \
        if [ "$(cross_compiling)" = "yes" ]; then \
                $(CCLD_FOR_BUILD) -o $@ $(gen_scmconfig_OBJECTS); \
        else \
@@ -70,27 +73,30 @@ gen-scmconfig$(EXEEXT): $(gen_scmconfig_OBJECTS) $(gen_scmconfig_DEPENDENCIES)
        fi
 
 scmconfig.h: ${top_builddir}/config.h gen-scmconfig$(EXEEXT)
-       rm -f scmconfig.h.tmp
-       cat $(srcdir)/scmconfig.h.top > scmconfig.h.tmp
-       ./gen-scmconfig$(EXEEXT) >> scmconfig.h.tmp
-       chmod 444 scmconfig.h.tmp
-       rm -f scmconfig.h
-       mv scmconfig.h.tmp scmconfig.h
+       $(AM_V_GEN)(rm -f scmconfig.h.tmp; \
+       cat $(srcdir)/scmconfig.h.top > scmconfig.h.tmp; \
+       ./gen-scmconfig$(EXEEXT) >> scmconfig.h.tmp; \
+       chmod 444 scmconfig.h.tmp; \
+       rm -f scmconfig.h; \
+       mv scmconfig.h.tmp scmconfig.h)
+
 
 guile_filter_doc_snarfage_SOURCES = c-tokenize.c
 
 ## Override default rule; this should be compiled for BUILD host.
 ## For some reason, OBJEXT does not include the dot
 c-tokenize.$(OBJEXT): c-tokenize.c
+       $(AM_V_GEN) \
        if [ "$(cross_compiling)" = "yes" ]; then \
-               $(CC_FOR_BUILD) $(DEFS) $(AM_CPPFLAGS) -c -o $@ $<; \
+               $(CC_FOR_BUILD) -c -o $@ $<; \
        else \
-               $(filter-out -Werror,$(COMPILE)) -c -o $@ $<; \
+               $(COMPILE) -c -o $@ $<; \
        fi
 
 ## Override default rule; this should run on BUILD host.
-guile_filter_doc_snarfage$(EXEEXT): $(guile_filter_doc_snarfage_OBJECTS) $(guile_filter_doc_snarfage_DEPENDENCIES) 
-       @rm -f guile_filter_doc_snarfage$(EXEEXT)
+guile_filter_doc_snarfage$(EXEEXT): $(guile_filter_doc_snarfage_OBJECTS) $(guile_filter_doc_snarfage_DEPENDENCIES)
+       $(AM_V_GEN) \
+       rm -f guile_filter_doc_snarfage$(EXEEXT); \
        if [ "$(cross_compiling)" = "yes" ]; then \
                $(CCLD_FOR_BUILD) -o $@ $(guile_filter_doc_snarfage_OBJECTS); \
        else \
@@ -100,12 +106,12 @@ guile_filter_doc_snarfage$(EXEEXT): $(guile_filter_doc_snarfage_OBJECTS) $(guile
 
 guile_SOURCES = guile.c
 guile_CFLAGS = $(GUILE_CFLAGS) $(AM_CFLAGS)
-guile_LDADD = libguile.la
+guile_LDADD = libguile-@GUILE_EFFECTIVE_VERSION@.la
 guile_LDFLAGS = $(GUILE_CFLAGS)
 
-libguile_la_CFLAGS = $(GUILE_CFLAGS) $(AM_CFLAGS)
+libguile_@GUILE_EFFECTIVE_VERSION@_la_CFLAGS = $(GUILE_CFLAGS) $(AM_CFLAGS)
 
-libguile_la_SOURCES =                          \
+libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES =                                \
        alist.c                                 \
        arbiters.c                              \
        array-handle.c                          \
@@ -117,22 +123,24 @@ libguile_la_SOURCES =                             \
        bitvectors.c                            \
        bytevectors.c                           \
        chars.c                                 \
+       control.c                               \
        continuations.c                         \
        debug.c                                 \
        deprecated.c                            \
        deprecation.c                           \
-       discouraged.c                           \
        dynwind.c                               \
        eq.c                                    \
        error.c                                 \
        eval.c                                  \
        evalext.c                               \
+       expand.c                                \
        extensions.c                            \
        feature.c                               \
+       filesys.c                               \
        fluids.c                                \
+       foreign.c                               \
        fports.c                                \
        frames.c                                \
-       futures.c                               \
        gc-malloc.c                             \
        gc.c                                    \
        gdbint.c                                \
@@ -145,30 +153,31 @@ libguile_la_SOURCES =                             \
        hash.c                                  \
        hashtab.c                               \
        hooks.c                                 \
+       i18n.c                                  \
        init.c                                  \
        inline.c                                \
        instructions.c                          \
        ioext.c                                 \
        keywords.c                              \
-       lang.c                                  \
        list.c                                  \
        load.c                                  \
        macros.c                                \
        mallocs.c                               \
+       memoize.c                               \
        modules.c                               \
        null-threads.c                          \
        numbers.c                               \
        objcodes.c                              \
-       objects.c                               \
        objprop.c                               \
        options.c                               \
        pairs.c                                 \
+       poll.c                                  \
        ports.c                                 \
        print.c                                 \
        procprop.c                              \
        procs.c                                 \
        programs.c                              \
-       properties.c                            \
+       promises.c                              \
        r6rs-ports.c                            \
        random.c                                \
        rdelim.c                                \
@@ -181,9 +190,11 @@ libguile_la_SOURCES =                              \
        smob.c                                  \
        sort.c                                  \
        srcprop.c                               \
+       srfi-1.c                                \
+       srfi-4.c                                \
        srfi-13.c                               \
        srfi-14.c                               \
-       srfi-4.c                                \
+       srfi-60.c                               \
        stackchk.c                              \
        stacks.c                                \
        stime.c                                 \
@@ -194,6 +205,7 @@ libguile_la_SOURCES =                               \
        symbols.c                               \
        threads.c                               \
        throw.c                                 \
+       trees.c                                 \
        uniform.c                               \
        values.c                                \
        variable.c                              \
@@ -203,15 +215,6 @@ libguile_la_SOURCES =                              \
        vports.c                                \
        weaks.c
 
-libguile_i18n_v_@LIBGUILE_I18N_MAJOR@_la_SOURCES = i18n.c
-libguile_i18n_v_@LIBGUILE_I18N_MAJOR@_la_CFLAGS =      \
-   $(libguile_la_CFLAGS)
-libguile_i18n_v_@LIBGUILE_I18N_MAJOR@_la_LIBADD =      \
-   libguile.la $(gnulib_library)
-libguile_i18n_v_@LIBGUILE_I18N_MAJOR@_la_LDFLAGS =     \
-   -module -L$(builddir) -lguile                               \
-   -version-info @LIBGUILE_I18N_INTERFACE@
-
 DOT_X_FILES =                                  \
        alist.x                                 \
        arbiters.x                              \
@@ -224,22 +227,24 @@ DOT_X_FILES =                                     \
        bitvectors.x                            \
        bytevectors.x                           \
        chars.x                                 \
+       control.x                               \
        continuations.x                         \
        debug.x                                 \
        deprecated.x                            \
        deprecation.x                           \
-       discouraged.x                           \
        dynl.x                                  \
        dynwind.x                               \
        eq.x                                    \
        error.x                                 \
        eval.x                                  \
        evalext.x                               \
+       expand.x                                \
        extensions.x                            \
        feature.x                               \
+       filesys.x                               \
        fluids.x                                \
+       foreign.x                               \
        fports.x                                \
-       futures.x                               \
        gc-malloc.x                             \
        gc.x                                    \
        gettext.x                               \
@@ -255,14 +260,13 @@ DOT_X_FILES =                                     \
        init.x                                  \
        ioext.x                                 \
        keywords.x                              \
-       lang.x                                  \
        list.x                                  \
        load.x                                  \
        macros.x                                \
        mallocs.x                               \
+       memoize.x                               \
        modules.x                               \
        numbers.x                               \
-       objects.x                               \
        objprop.x                               \
        options.x                               \
        pairs.x                                 \
@@ -270,7 +274,7 @@ DOT_X_FILES =                                       \
        print.x                                 \
        procprop.x                              \
        procs.x                                 \
-       properties.x                            \
+       promises.x                              \
        r6rs-ports.x                            \
        random.x                                \
        rdelim.x                                \
@@ -283,9 +287,11 @@ DOT_X_FILES =                                      \
        smob.x                                  \
        sort.x                                  \
        srcprop.x                               \
+       srfi-1.x                                \
+       srfi-4.x                                \
        srfi-13.x                               \
        srfi-14.x                               \
-       srfi-4.x                                \
+       srfi-60.x                               \
        stackchk.x                              \
        stacks.x                                \
        stime.x                                 \
@@ -296,6 +302,7 @@ DOT_X_FILES =                                       \
        symbols.x                               \
        threads.x                               \
        throw.x                                 \
+       trees.x                                 \
        uniform.x                               \
        values.x                                \
        variable.x                              \
@@ -321,22 +328,24 @@ DOT_DOC_FILES =                           \
        bitvectors.doc                          \
        bytevectors.doc                         \
        chars.doc                               \
+       control.doc                             \
        continuations.doc                       \
        debug.doc                               \
        deprecated.doc                          \
        deprecation.doc                         \
-       discouraged.doc                         \
        dynl.doc                                \
        dynwind.doc                             \
        eq.doc                                  \
        error.doc                               \
        eval.doc                                \
        evalext.doc                             \
+       expand.doc                              \
        extensions.doc                          \
        feature.doc                             \
+       filesys.doc                             \
        fluids.doc                              \
+       foreign.doc                             \
        fports.doc                              \
-       futures.doc                             \
        gc-malloc.doc                           \
        gc.doc                                  \
        gettext.doc                             \
@@ -352,14 +361,13 @@ DOT_DOC_FILES =                           \
        init.doc                                \
        ioext.doc                               \
        keywords.doc                            \
-       lang.doc                                \
        list.doc                                \
        load.doc                                \
        macros.doc                              \
        mallocs.doc                             \
+       memoize.doc                             \
        modules.doc                             \
        numbers.doc                             \
-       objects.doc                             \
        objprop.doc                             \
        options.doc                             \
        pairs.doc                               \
@@ -367,7 +375,7 @@ DOT_DOC_FILES =                             \
        print.doc                               \
        procprop.doc                            \
        procs.doc                               \
-       properties.doc                          \
+       promises.doc                            \
        r6rs-ports.doc                          \
        random.doc                              \
        rdelim.doc                              \
@@ -380,9 +388,11 @@ DOT_DOC_FILES =                            \
        smob.doc                                \
        sort.doc                                \
        srcprop.doc                             \
+       srfi-1.doc                              \
+       srfi-4.doc                              \
        srfi-13.doc                             \
        srfi-14.doc                             \
-       srfi-4.doc                              \
+       srfi-60.doc                             \
        stackchk.doc                            \
        stacks.doc                              \
        stime.doc                               \
@@ -393,6 +403,7 @@ DOT_DOC_FILES =                             \
        symbols.doc                             \
        threads.doc                             \
        throw.doc                               \
+       trees.doc                               \
        uniform.doc                             \
        values.doc                              \
        variable.doc                            \
@@ -406,16 +417,16 @@ EXTRA_DOT_DOC_FILES = @EXTRA_DOT_DOC_FILES@
 DOT_I_FILES = vm-i-system.i vm-i-scheme.i vm-i-loader.i
 
 .c.i:
-       grep '^VM_DEFINE' $< > $@
+       $(AM_V_GEN)$(GREP) '^VM_DEFINE' $< > $@
 
-BUILT_SOURCES = cpp_err_symbols.c cpp_sig_symbols.c libpath.h \
-    version.h scmconfig.h \
+BUILT_SOURCES = cpp-E.c cpp-SIG.c libpath.h \
+    scmconfig.h \
     $(DOT_I_FILES) $(DOT_X_FILES) $(EXTRA_DOT_X_FILES)
 
-EXTRA_libguile_la_SOURCES = _scm.h             \
-    inet_aton.c memmove.c putenv.c strerror.c  \
+EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES = _scm.h           \
+    memmove.c strerror.c                       \
     dynl.c regex-posix.c                       \
-    filesys.c posix.c net_db.c socket.c                \
+    posix.c net_db.c socket.c                  \
     debug-malloc.c mkstemp.c                   \
     win32-uname.c win32-dirent.c win32-socket.c        \
     locale-categories.h
@@ -431,31 +442,59 @@ install-exec-hook:
 ## Perhaps we can deal with them normally once the merge seems to be
 ## working.
 noinst_HEADERS = conv-integer.i.c conv-uinteger.i.c            \
-                 eval.i.c ieee-754.h                           \
-                 srfi-4.i.c srfi-14.i.c                                \
+                 ieee-754.h                                    \
+                 srfi-14.i.c                                   \
                  quicksort.i.c                                  \
                  win32-uname.h win32-dirent.h win32-socket.h   \
-                private-gc.h private-options.h
+                private-gc.h private-options.h
 
 # vm instructions
 noinst_HEADERS += vm-engine.c vm-i-system.c vm-i-scheme.c vm-i-loader.c
 
-libguile_la_DEPENDENCIES = @LIBLOBJS@
-libguile_la_LIBADD = @LIBLOBJS@ $(gnulib_library) $(LTLIBGMP) $(LTLIBUNISTRING)
-libguile_la_LDFLAGS = @LTLIBINTL@ -version-info @LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@ -export-dynamic -no-undefined
+libguile_@GUILE_EFFECTIVE_VERSION@_la_DEPENDENCIES = @LIBLOBJS@
+
+libguile_@GUILE_EFFECTIVE_VERSION@_la_LIBADD =         \
+  @LIBLOBJS@ $(gnulib_library) $(LTLIBGMP) $(LTLIBLTDL)
+
+# Libtool version info.
+version_info = @LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@
+
+libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS =        \
+  $(BDW_GC_LIBS) $(LIBFFI_LIBS)                        \
+  $(CEIL_LIBM)                                 \
+  $(FLOOR_LIBM)                                        \
+  $(FREXP_LIBM)                                        \
+  $(GETADDRINFO_LIB)                           \
+  $(HOSTENT_LIB)                               \
+  $(INET_NTOP_LIB)                             \
+  $(INET_PTON_LIB)                             \
+  $(ISNAND_LIBM)                               \
+  $(ISNANF_LIBM)                               \
+  $(ISNANL_LIBM)                               \
+  $(LDEXP_LIBM)                                        \
+  $(LIBSOCKET)                                 \
+  $(LOG1P_LIBM)                                        \
+  $(LTLIBICONV)                                        \
+  $(LTLIBINTL)                                 \
+  $(LTLIBUNISTRING)                            \
+  $(SERVENT_LIB)                               \
+  $(TRUNC_LIBM)                                        \
+  -version-info $(version_info)                        \
+  -export-dynamic -no-undefined                        \
+  $(GNU_LD_FLAGS)
 
 if HAVE_LD_VERSION_SCRIPT
 
-libguile_la_LDFLAGS += -Wl,--version-script="$(srcdir)/libguile.map"
+libguile_@GUILE_EFFECTIVE_VERSION@_la_LDFLAGS += -Wl,--version-script="$(srcdir)/libguile.map"
 
 endif HAVE_LD_VERSION_SCRIPT
 
 
 # These are headers visible as <guile/mumble.h>
-pkginclude_HEADERS = 
+pkginclude_HEADERS =
 
 # These are headers visible as <libguile/mumble.h>.
-modincludedir = $(includedir)/libguile
+modincludedir = $(pkgincludedir)/$(GUILE_EFFECTIVE_VERSION)/libguile
 modinclude_HEADERS =                           \
        __scm.h                                 \
        alist.h                                 \
@@ -465,29 +504,31 @@ modinclude_HEADERS =                              \
        arrays.h                                \
        async.h                                 \
        backtrace.h                             \
+       bdw-gc.h                                \
        boolean.h                               \
        bitvectors.h                            \
        bytevectors.h                           \
        chars.h                                 \
+       control.h                               \
        continuations.h                         \
        debug-malloc.h                          \
        debug.h                                 \
        deprecated.h                            \
        deprecation.h                           \
-       discouraged.h                           \
        dynl.h                                  \
        dynwind.h                               \
        eq.h                                    \
        error.h                                 \
        eval.h                                  \
        evalext.h                               \
+       expand.h                                \
        extensions.h                            \
        feature.h                               \
        filesys.h                               \
        fluids.h                                \
+       foreign.h                               \
        fports.h                                \
        frames.h                                \
-       futures.h                               \
        gc.h                                    \
        gdb_interface.h                         \
        gdbint.h                                \
@@ -507,27 +548,27 @@ modinclude_HEADERS =                              \
        ioext.h                                 \
        iselect.h                               \
        keywords.h                              \
-       lang.h                                  \
        list.h                                  \
        load.h                                  \
        macros.h                                \
        mallocs.h                               \
+       memoize.h                               \
        modules.h                               \
        net_db.h                                \
        null-threads.h                          \
        numbers.h                               \
        objcodes.h                              \
-       objects.h                               \
        objprop.h                               \
        options.h                               \
        pairs.h                                 \
+       poll.h                                  \
        ports.h                                 \
        posix.h                                 \
        print.h                                 \
        procprop.h                              \
        procs.h                                 \
        programs.h                              \
-       properties.h                            \
+       promises.h                              \
        pthread-threads.h                       \
        r6rs-ports.h                            \
        random.h                                \
@@ -544,9 +585,11 @@ modinclude_HEADERS =                               \
        socket.h                                \
        sort.h                                  \
        srcprop.h                               \
+       srfi-1.h                                \
+       srfi-4.h                                \
        srfi-13.h                               \
        srfi-14.h                               \
-       srfi-4.h                                \
+       srfi-60.h                               \
        stackchk.h                              \
        stacks.h                                \
        stime.h                                 \
@@ -558,12 +601,12 @@ modinclude_HEADERS =                              \
        tags.h                                  \
        threads.h                               \
        throw.h                                 \
+       trees.h                                 \
        validate.h                              \
        uniform.h                               \
        values.h                                \
        variable.h                              \
        vectors.h                               \
-       vm-bootstrap.h                          \
        vm-engine.h                             \
        vm-expand.h                             \
        vm.h                                    \
@@ -576,35 +619,27 @@ bin_SCRIPTS = guile-snarf
 
 # We can re-enable install for some of these if/when they are documented
 # and people feel like maintaining them.  For now, this is not the case.
-noinst_SCRIPTS = guile-doc-snarf guile-snarf-docs guile-func-name-check
+noinst_SCRIPTS = guile-snarf-docs
 
 EXTRA_DIST = ChangeLog-scm ChangeLog-threads           \
-    ChangeLog-1996-1999 ChangeLog-2000 ChangeLog-2008 cpp_signal.c     \
-    cpp_errno.c cpp_err_symbols.in cpp_err_symbols.c                   \
-    cpp_sig_symbols.c cpp_sig_symbols.in cpp_cnvt.awk                  \
-    c-tokenize.lex version.h.in                                                \
+    ChangeLog-1996-1999 ChangeLog-2000 ChangeLog-2008  \
+    guile-func-name-check                              \
+    cpp-E.syms cpp-E.c cpp-SIG.syms cpp-SIG.c                  \
+    c-tokenize.lex                                             \
     scmconfig.h.top libgettext.h unidata_to_charset.pl libguile.map
 #    $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES) \
 #    guile-procedures.txt guile.texi
 
-## We use @-...-@ as the substitution brackets here, instead of the
-## usual @...@, so autoconf doesn't go and substitute the values
-## directly into the left-hand sides of the sed substitutions.  *sigh*
-version.h: version.h.in
-       sed < $(srcdir)/version.h.in > $@.tmp \
-         -e s:@-GUILE_MAJOR_VERSION-@:${GUILE_MAJOR_VERSION}: \
-         -e s:@-GUILE_MINOR_VERSION-@:${GUILE_MINOR_VERSION}: \
-         -e s:@-GUILE_MICRO_VERSION-@:${GUILE_MICRO_VERSION}:
-       mv $@.tmp $@
-
 ## FIXME: Consider using timestamp file, to avoid unnecessary rebuilds.
 libpath.h: $(srcdir)/Makefile.in  $(top_builddir)/config.status
-       @echo "Generating libpath.h..."
        @rm -f libpath.tmp
        @echo '/* generated by Makefile */' > libpath.tmp
        @echo '#define SCM_PKGDATA_DIR "$(pkgdatadir)"' >> libpath.tmp
        @echo '#define SCM_LIBRARY_DIR "$(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)"'>>libpath.tmp
-       @echo '#define SCM_SITE_DIR "$(pkgdatadir)/site"' >> libpath.tmp
+       @echo '#define SCM_SITE_DIR "$(sitedir)"' >> libpath.tmp
+       @echo '#define SCM_GLOBAL_SITE_DIR "$(pkgdatadir)/site"' >> libpath.tmp
+       @echo '#define SCM_LIB_DIR "$(libdir)"' >> libpath.tmp
+       @echo '#define SCM_EXTENSIONS_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/extensions"' >> libpath.tmp
        @echo '#define SCM_CCACHE_DIR "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/ccache"' >> libpath.tmp
        @echo '#define SCM_EFFECTIVE_VERSION "$(GUILE_EFFECTIVE_VERSION)"' >> libpath.tmp
        @echo '#define SCM_BUILD_INFO { \' >> libpath.tmp
@@ -624,36 +659,36 @@ libpath.h: $(srcdir)/Makefile.in  $(top_builddir)/config.status
        @echo ' { "infodir",       "@infodir@" }, \' >> libpath.tmp
        @echo ' { "mandir",        "@mandir@" }, \' >> libpath.tmp
        @echo ' { "includedir",    "@includedir@" }, \' >> libpath.tmp
-       @echo ' { "pkgdatadir",    "@pkgdatadir@" }, \' >> libpath.tmp
-       @echo ' { "pkglibdir",     "@pkglibdir@" }, \' >> libpath.tmp
-       @echo ' { "pkgincludedir", "@pkgincludedir@" }, \' \
+       @echo ' { "pkgdatadir",    "$(pkgdatadir)" }, \' >> libpath.tmp
+       @echo ' { "pkglibdir",     "$(pkglibdir)" }, \' >> libpath.tmp
+       @echo ' { "pkgincludedir", "$(pkgincludedir)" }, \' \
                >> libpath.tmp
+       @echo ' { "extensiondir", "$(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/extensions" }, \' >> libpath.tmp
        @echo ' { "guileversion", "@GUILE_VERSION@" }, \' >> libpath.tmp
        @echo ' { "libguileinterface", "@LIBGUILE_INTERFACE@" }, \' \
                >> libpath.tmp
        @echo ' { "LIBS",          "@GUILE_LIBS@" }, \' >> libpath.tmp
        @echo ' { "CFLAGS",        "@GUILE_CFLAGS@" }, \' >> libpath.tmp
-       @echo ' { "buildstamp",    "'"`date`"'" }, \' >> libpath.tmp
+       @echo ' { "buildstamp",    "'`date -u +'%Y-%m-%d %T'`'" }, \' >> libpath.tmp
        @echo '}' >> libpath.tmp
-       @mv libpath.tmp libpath.h
+       $(AM_V_GEN)mv libpath.tmp libpath.h
 
 
 snarfcppopts = $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)
 
 SUFFIXES = .x .doc
+
 .c.x:
-       ./guile-snarf -o $@ $< $(snarfcppopts)
+       $(AM_V_SNARF)$(GUILE_SNARF) -o $@ $< $(snarfcppopts)
 .c.doc:
-       -$(AWK) -f ./guile-func-name-check $<
-       (./guile-snarf-docs $(snarfcppopts) $< | \
-       ./guile_filter_doc_snarfage$(EXEEXT) --filter-snarfage) > $@ || { rm $@; false; }
+       $(AM_V_SNARF)./guile-snarf-docs -o $@ $< -- $(snarfcppopts)
 
-$(DOT_X_FILES) $(EXTRA_DOT_X_FILES): scmconfig.h snarf.h guile-snarf.in
+$(DOT_X_FILES) $(EXTRA_DOT_X_FILES): scmconfig.h snarf.h guile-snarf.in version.h
 
 $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES): scmconfig.h snarf.h guile-snarf-docs.in guile_filter_doc_snarfage$(EXEEXT)
 
-error.x: cpp_err_symbols.c
-posix.x: cpp_sig_symbols.c
+error.x: cpp-E.c
+posix.x: cpp-SIG.c
 load.x: libpath.h
 
 alldotdocfiles    = $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES)
@@ -664,7 +699,7 @@ guile.texi: $(alldotdocfiles) guile$(EXEEXT)
        $(dotdoc2texi) --manual > $@ || { rm $@; false; }
 
 guile-procedures.texi: $(alldotdocfiles) guile$(EXEEXT)
-       $(dotdoc2texi)          > $@ || { rm $@; false; }
+       $(AM_V_GEN)$(dotdoc2texi)          > $@ || { rm $@; false; }
 
 if HAVE_MAKEINFO
 
@@ -688,51 +723,63 @@ schemelib_DATA = guile-procedures.txt
 ## Add -MG to make the .x magic work with auto-dep code.
 MKDEP = gcc -M -MG $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS)
 
-cpp_err_symbols.c: cpp_err_symbols.in cpp_cnvt.awk
-       $(AWK) -f $(srcdir)/cpp_cnvt.awk < $(srcdir)/cpp_err_symbols.in > \
-               cpp_err_symbols.tmp
-       mv cpp_err_symbols.tmp cpp_err_symbols.c
-
-cpp_sig_symbols.c: cpp_sig_symbols.in cpp_cnvt.awk
-       $(AWK) -f $(srcdir)/cpp_cnvt.awk < $(srcdir)/cpp_sig_symbols.in > \
-               cpp_sig_symbols.tmp
-       mv cpp_sig_symbols.tmp cpp_sig_symbols.c
-
-## Create a new version of the cpp_sig_symbols.in file, including all SIGXXX
-## macros defined on this platform.
-check_signals:
-       gcc -undef -dM -E $(srcdir)/cpp_signal.c | egrep ' SIG[A-Z]+' \
-         | cut -f2 -d' ' | sort > cpp_sig_symbols_here
-       diff -u $(srcdir)/cpp_sig_symbols.in cpp_sig_symbols_here \
-          | egrep '^\+S' \
-         | cut -c2- > cpp_sig_symbols_diff
-       if test -s cpp_sig_symbols_diff ; then \
-         cat $(srcdir)/cpp_sig_symbols.in cpp_sig_symbols_diff \
-           | sort > cpp_sig_symbols_new ;\
-         echo "cpp_sig_symbols_new has the following additions:" ;\
-         cat cpp_sig_symbols_diff ;\
-       else echo "No new symbols found."; \
-       fi
-
-## Likewise for cpp_err_symbols.in.
-check_errnos:
-       gcc -undef -dM -E $(srcdir)/cpp_errno.c | egrep ' E.+' \
-         | cut -f2 -d' ' | sort > cpp_err_symbols_here
-       diff -u $(srcdir)/cpp_err_symbols.in cpp_err_symbols_here \
-          | egrep '^\+E' \
-         | cut -c2- > cpp_err_symbols_diff
-       if test -s cpp_err_symbols_diff ; then \
-         cat $(srcdir)/cpp_err_symbols.in cpp_err_symbols_diff \
-           | sort > cpp_err_symbols_new ;\
-         echo "cpp_err_symbols_new has the following additions:" ;\
-         cat cpp_err_symbols_diff ;\
-       else echo "No new symbols found."; \
-       fi
+\f
+# This page is for maintenance of the lists of CPP symbols that are eventually
+# included in error.c (‘errno’ values: E*) and posix.c (signal names: SIG*),
+# in the funcs scm_init_{error,posix}, respectively.
+#
+# The lists (files cpp-{E,SIG}.syms) are not included verbatim, but processed
+# (via pattern rule ‘.syms.c’ below) so that each CPP symbol is transformed to
+# fragment of #ifdef'd C code that defines a Scheme variable of the same name.
+# The resulting files, cpp-{E,SIG}.c, are the ones #include:d.
+#
+# To maintain the (source) lists of symbols, we use a GCC-specific feature
+# to list all symbols #define:d when expanding <{errno,signal}.h>, grep
+# the output for {E,SIG}*, massage the result into a usable form, and
+# construct a union of the current and new symbols.  This is written to
+# files cpp-{E,SIG}.syms.NEW for review.  If things look ok, you can then
+# "mv foo.NEW foo" and commit.  Generating the foo.NEW files and showing
+# an informative message is the job of targets chknew-{E,SIG}.
+
+# For each line in foo.syms, transform:
+#      SYMBOL
+# to:
+#      #ifdef SYMBOL
+#      scm_c_define ("SYMBOL", scm_from_int (SYMBOL));
+#      #endif
+# writing output to foo.c.  We use a while-read loop instead of a
+# one-line sed script because some seds (e.g., FreeBSD) don't read
+# '\n' as a newline (like GNU sed does).  Sad, but true.
+.syms.c:
+       $(AM_V_GEN)                                                     \
+       cat $< | while read sym ; do                                    \
+         echo "#ifdef $$sym" ;                                         \
+         echo "scm_c_define (\"$$sym\", scm_from_int ($$sym));" ;      \
+         echo "#endif" ;                                               \
+       done > $@T
+       @mv $@T $@
+
+# Write $(srcdir)/cpp-{E,SIG}.syms.NEW if there are any not-yet-seen
+# ("new" to us) E* or SIG* symbols in <errno.h> or <signal.h>, respectively.
+chknew-E chknew-SIG:                                           \
+       @bit=`echo $@ | sed s/^chknew-//` ;                     \
+       old="$(srcdir)/cpp-$$bit.syms" ;                        \
+       echo "#include <$${bit}.h>"                             \
+        | sed 's/E/errno/;s/SIG/signal/'                       \
+        | gcc -dM -E -                                         \
+        | sed 's/^#define //;/^'$$bit'[A-Z][A-Z]*/!d;s/ .*//'  \
+        | sort | diff -u $$old - | sed '1,2d;/^+/!d;s/^.//'    \
+        > TMP ;                                                \
+       if [ -s TMP ] ; then new="$$old.NEW" ;                  \
+         cat $$old TMP | sort > $$new ;                        \
+         echo "$$new: `sed -n '$$=' TMP` new symbol(s)." ;     \
+         sed 's/^/  /' TMP ;                                   \
+       else echo "No new symbols found." ;                     \
+       fi ; rm TMP
+
+\f
 
 MOSTLYCLEANFILES = \
-       cpp_err_symbols_here cpp_err_symbols_diff cpp_err_symbols_new \
-       cpp_sig_symbols_here cpp_sig_symbols_diff cpp_sig_symbols_new \
-       version.h version.h.tmp \
        scmconfig.h scmconfig.h.tmp
 
 CLEANFILES = libpath.h *.x *.doc guile-procedures.txt guile-procedures.texi guile.texi \