1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Add compiled guile-tools program

For systems that do not have a posix shell.

* configure.ac (GUILE_TOOLS_EXE): new conditional
* libguile/Makefile.am (guile-tools)[GUILE_TOOLS_EXE]: new binary target
* libguile/guile-tools.c: new file
* meta/Makefile.am (guile.scm): new data
  [!GUILE_TOOLS_EXE](install-exec-hook): don't alias guile-tools to guild
  (CLEANFILES): add guild.exe
This commit is contained in:
Michael Gran 2023-10-07 11:51:27 -07:00
parent 9ae3069437
commit 08e1876d71
4 changed files with 57 additions and 2 deletions

View file

@ -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

View file

@ -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.

25
libguile/guile-tools.c Normal file
View file

@ -0,0 +1,25 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <locale.h>
#include <stdio.h>
#include <libguile.h>
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;
}

View file

@ -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