aboutsummaryrefslogtreecommitdiff
path: root/ax_add_guile_pre_inst_env.m4
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2023-12-09 10:45:35 +0100
committerWojtek Kosior <koszko@koszko.org>2023-12-12 19:28:20 +0100
commitd2048b6c0c81b9b944354f6f66c353d65ee469a8 (patch)
treeb0409e35b984493b152abf9ac796e2e0efa45d98 /ax_add_guile_pre_inst_env.m4
downloadlawrence-boilerplate-d2048b6c0c81b9b944354f6f66c353d65ee469a8.tar.gz
lawrence-boilerplate-d2048b6c0c81b9b944354f6f66c353d65ee469a8.zip
Initial commit.
Diffstat (limited to 'ax_add_guile_pre_inst_env.m4')
-rw-r--r--ax_add_guile_pre_inst_env.m441
1 files changed, 41 insertions, 0 deletions
diff --git a/ax_add_guile_pre_inst_env.m4 b/ax_add_guile_pre_inst_env.m4
new file mode 100644
index 0000000..e5612d6
--- /dev/null
+++ b/ax_add_guile_pre_inst_env.m4
@@ -0,0 +1,41 @@
+dnl SPDX-License-Identifier: CC0-1.0
+dnl
+dnl Copyright (C) 2023 Wojtek Kosior <koszko@koszko.org>
+dnl
+dnl This file proviced an autoconf macro that generates a pre-inst-env script
+dnl suitable for use in Guile projects.
+dnl
+# AX_ADD_GUILE_PRE_INST_ENV([FILENAME = pre-inst-env],
+# [SCM_ROOT_PATH = src/guile],
+# [GO_ROOT_PATH = src/guile]
+# [SCRIPTS_PATH = scripts])
+# ------------------------------------------------------------------------------
+AC_DEFUN([AX_ADD_GUILE_PRE_INST_ENV], [
+printf '%s' '
+set -eu
+
+SOURCE_DIR='"$(cd "$srcdir" && pwd -P)"'
+BUILD_DIR="$(cd "$(dirname "[$]0")" && pwd -P)"
+
+export G''UILE_LOAD_PATH="$SOURCE_DIR/m4_default([$2], [src/guile])[]dnl
+${G''UILE_LOAD_PATH:+:}${G''UILE_LOAD_PATH:-}"
+
+export G''UILE_LOAD_COMPILED_PATH="$BUILD_DIR/m4_default([$3], [src/guile])[]dnl
+${G''UILE_LOAD_COMPILED_PATH:+:}${G''UILE_LOAD_COMPILED_PATH:-}"
+
+export G''UILE_AUTO_COMPILE=0
+
+export PATH="$SOURCE_DIR/m4_default([$3], [scripts])${PATH:+:}${PATH:-}"
+
+if test 0 = "[$]#"
+then :
+ "${SHELL:-/bin/sh}"
+else :
+ PROGRAM="[$]1"
+ shift
+ "$PROGRAM" "[$]@"
+fi
+' > m4_default([$1], [pre-inst-env])
+
+chmod 755 pre-inst-env
+])dnl AX_ADD_GUILE_PRE_INST_ENV