diff options
author | Mathieu Lirzin <mthl@gnu.org> | 2015-10-17 20:05:08 +0200 |
---|---|---|
committer | Mathieu Lirzin <mthl@gnu.org> | 2016-05-07 23:38:53 +0200 |
commit | 8952d2dc442913f0ecf1fa896d97c882a5daa664 (patch) | |
tree | 11492526f1a25cbdecd40f899f2ba19adfa90433 /mcron.c | |
parent | b59f2f5ea6f99681ca61f9342206c11f3a165b2c (diff) | |
download | mcron-8952d2dc442913f0ecf1fa896d97c882a5daa664.tar.gz mcron-8952d2dc442913f0ecf1fa896d97c882a5daa664.tar.bz2 mcron-8952d2dc442913f0ecf1fa896d97c882a5daa664.zip |
build: Support VPATH builds.
This allows using 'mcron' before it is installed without hardcoding the
local build environment in the executable.
* build-aux/pre-inst-env.in: New script.
* configure.ac (AC_CONFIG_FILES): Create it.
(AC_CONFIG_HEADER): Add 'config.h'.
(moduledir): New variable.
(PACKAGE_LOAD_PATH): new C preprocessor macro.
* mcron.c: Include "config.h".
(main): Don't overwrite Guile load paths.
(inner_main): Prepend Mcron modules load paths.
* Makefile.am (.scm.go, doc/mcron.1): Use 'pre-inst-env'.
(mcron_CFLAGS): Remove GUILE_LOAD_PATH macro.
(noinst_SCRIPTS): New variable.
* .gitignore: Update.
Diffstat (limited to 'mcron.c')
-rw-r--r-- | mcron.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -22,6 +22,7 @@ is needed because the crontab personality requires SUID which is not permitted for executable scripts. */ +#include "config.h" #include <libguile.h> #include <signal.h> #include <stdlib.h> @@ -35,7 +36,6 @@ static SCM set_cron_signals (void); int main (int argc, char **argv) { - setenv ("GUILE_LOAD_PATH", GUILE_LOAD_PATH, 1); scm_boot_guile (argc, argv, inner_main, 0); return EXIT_SUCCESS; @@ -45,6 +45,14 @@ main (int argc, char **argv) static void inner_main (void *closure, int argc, char **argv) { + /* Set Guile load paths to ensure that Mcron modules will be found. */ + if (getenv ("MCRON_UNINSTALLED") == NULL) + { + scm_c_eval_string ("(set! %load-path (cons \"" + PACKAGE_LOAD_PATH "\" %load-path))"); + scm_c_eval_string ("(set! %load-compiled-path (cons \"" + PACKAGE_LOAD_PATH "\" %load-compiled-path))"); + } scm_set_current_module (scm_c_resolve_module ("mcron main")); /* Register set_cron_signals to be called from Guile. */ scm_c_define_gsubr ("c-set-cron-signals", 0, 0, 0, set_cron_signals); |