diff --git a/configure.ac b/configure.ac index 9d5ac89d6..c1e350e26 100644 --- a/configure.ac +++ b/configure.ac @@ -515,6 +515,7 @@ dnl Check for Winsock and other functionality on Win32 (*not* CygWin) dnl EXTRA_DEFS="" mingw_libpath=false +guile_tools_exe=false case $host in *-*-mingw*) AC_CHECK_HEADER(winsock2.h, [AC_DEFINE([HAVE_WINSOCK2_H], 1, @@ -527,10 +528,12 @@ case $host in [Define if you need additional CPP macros on Win32 platforms.]) fi mingw_libpath=true + guile_tools_exe=true ;; esac AC_SUBST(EXTRA_DEFS) AM_CONDITIONAL([MINGW_LIBPATH], [test x$mingw_libpath = xtrue]) +AM_CONDITIONAL([GUILE_TOOLS_EXE], [test x$guile_tools_exe = xtrue]) # Reasons for testing: # crt_externs.h - Darwin specific diff --git a/libguile/Makefile.am b/libguile/Makefile.am index 089a8f5dd..2ca98f8a9 100644 --- a/libguile/Makefile.am +++ b/libguile/Makefile.am @@ -55,6 +55,10 @@ ETAGS_ARGS = --regex='/SCM_\(GLOBAL_\)?\(G?PROC\|G?PROC1\|SYMBOL\|VCELL\|CONST_L lib_LTLIBRARIES = libguile-@GUILE_EFFECTIVE_VERSION@.la bin_PROGRAMS = guile +if GUILE_TOOLS_EXE +bin_PROGRAMS += guile-tools$(EXEEXT) +endif + noinst_PROGRAMS = guile_filter_doc_snarfage gen-scmconfig gen_scmconfig_SOURCES = gen-scmconfig.c @@ -477,6 +481,13 @@ EXTRA_libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES = \ locale-categories.h \ mini-gmp.h +if GUILE_TOOLS_EXE +guile_tools_SOURCES = guile-tools.c +guile_tools_CFLAGS = $(GUILE_CFLAGS) $(AM_CFLAGS) +guile_tools_LDADD = libguile-@GUILE_EFFECTIVE_VERSION@.la $(gnulib_library) +guile_tools_LDFLAGS = $(GUILE_CFLAGS) +endif + ## delete guile-snarf.awk from the installation bindir, in case it's ## lingering there due to an earlier guile version not having been ## wiped out. diff --git a/libguile/guile-tools.c b/libguile/guile-tools.c new file mode 100644 index 000000000..755dd4405 --- /dev/null +++ b/libguile/guile-tools.c @@ -0,0 +1,25 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include + +static void +inner_main (void *closure SCM_UNUSED, int argc, char **argv) +{ + SCM mainproc; + + scm_c_use_module ("guild"); + mainproc = scm_c_private_ref("guild", "main"); + scm_call_1 (mainproc, scm_program_arguments()); +} + +int main(int argc, char **argv) +{ + setlocale (LC_ALL, ""); + scm_boot_guile (argc, argv, inner_main, 0); + return 0; +} diff --git a/meta/Makefile.am b/meta/Makefile.am index 0525b0493..66b957b6d 100644 --- a/meta/Makefile.am +++ b/meta/Makefile.am @@ -28,7 +28,21 @@ EXTRA_DIST= \ guile-$(GUILE_EFFECTIVE_VERSION)-uninstalled.pc.in \ guild.in guile-config.in -# What we now call `guild' used to be known as `guile-tools'. +# guild is a Guile shell script. For the benefit of systems without a +# posix shell, we also save guild as a regular scheme module, so that it +# can be called by guile. +guild.scm: guild + cp guild guild.scm + +moddir = $(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION) +nobase_mod_DATA = guild.scm + + +# What we now call `guild' used to be known as `guile-tools'. For posix +# shell systems no harm in installing guile-tools as an alias for guild. +# For systems without posix shell, we reserve guile-tools for the +# non-shell version of guild. +if !GUILE_TOOLS_EXE install-exec-hook: guild="`echo $(ECHO_N) guild \ | $(SED) -e '$(program_transform_name)'`" ; \ @@ -36,6 +50,8 @@ install-exec-hook: | $(SED) -e '$(program_transform_name)'`" ; \ cd $(DESTDIR)$(bindir) && rm -f "$$guile_tools" && \ $(LN_S) "$$guild" "$$guile_tools" +endif + pkgconfig_DATA = guile-$(GUILE_EFFECTIVE_VERSION).pc @@ -114,5 +130,5 @@ guild: $(srcdir)/guild.in $(top_builddir)/config.status mv "$@.out" "$@" CLEANFILES = \ - guile-config guild \ + guile-config guild guild.scm \ guile-$(GUILE_EFFECTIVE_VERSION).pc guile-$(GUILE_EFFECTIVE_VERSION)-uninstalled.pc