From fa798cd44da4e1c28a42393463efb62e99ecbe86 Mon Sep 17 00:00:00 2001 From: Brady McDonough Date: Sun, 2 Feb 2025 22:20:20 -0700 Subject: [PATCH] Changed environment handling in automake --- .env.default | 4 ++++ configure | 26 +++++++++++++++++++++----- configure.in | 13 +++++++++---- 3 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 .env.default diff --git a/.env.default b/.env.default new file mode 100644 index 0000000..d56a8a6 --- /dev/null +++ b/.env.default @@ -0,0 +1,4 @@ +server_name=yacswa.home +public_dir=/srv/yacswa.home +nginx_dir=/etc/nginx +nginx_config=yacswa.home.conf \ No newline at end of file diff --git a/configure b/configure index b008fc7..190f454 100755 --- a/configure +++ b/configure @@ -665,7 +665,11 @@ enable_option_checking ' ac_precious_vars='build_alias host_alias -target_alias' +target_alias +server_name +public_dir +nginx_dir +nginx_config' # Initialize some variables set by options. @@ -1281,6 +1285,17 @@ if test -n "$ac_init_help"; then esac cat <<\_ACEOF +Some influential environment variables: + server_name The hostname of the target server + public_dir The directory where public html files should be installed + nginx_dir The nginx config directory containing sites_available and + sites_enabled + nginx_config + The name to give the nginx config file in sites_available + +Use these variables to override the choices made by 'configure' or to help +it to find libraries and programs with nonstandard names/locations. + Report bugs to . _ACEOF ac_status=$? @@ -1724,14 +1739,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Pull in environment variables -server_name=yacswa.home -public_dir=/srv/yacswa.home -nginx_dir=/etc/nginx/ -nginx_config=yacswa.home.conf +# Default values +test "$server_name" || server_name=yacswa.home +test "$public_dir" || public_dir=/srv/yacswa.home +test "$nginx_dir" || nginx_dir=/etc/nginx/ +test "$nginx_config" || nginx_config=yacswa.home.conf # Checks for programs. { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 diff --git a/configure.in b/configure.in index 4833579..f8772e6 100644 --- a/configure.in +++ b/configure.in @@ -5,10 +5,15 @@ AC_PREREQ([2.72]) AC_INIT([Yet Another Covid Statistics Web App], [1.0], [me@bradymcd.ca]) # Pull in environment variables -AC_SUBST([server_name], [yacswa.home]) -AC_SUBST([public_dir], [/srv/yacswa.home]) -AC_SUBST([nginx_dir], [/etc/nginx/]) -AC_SUBST([nginx_config], [yacswa.home.conf]) +AC_ARG_VAR([server_name], [The hostname of the target server]) +AC_ARG_VAR([public_dir], [The directory where public html files should be installed]) +AC_ARG_VAR([nginx_dir], [The nginx config directory containing sites_available and sites_enabled]) +AC_ARG_VAR([nginx_config], [The name to give the nginx config file in sites_available]) +# Default values +test "$server_name" || server_name=yacswa.home +test "$public_dir" || public_dir=/srv/yacswa.home +test "$nginx_dir" || nginx_dir=/etc/nginx/ +test "$nginx_config" || nginx_config=yacswa.home.conf # Checks for programs. AC_PROG_MAKE_SET