Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save konsolebox/9c500cc693c5e22859dc79b2750068a8 to your computer and use it in GitHub Desktop.
Save konsolebox/9c500cc693c5e22859dc79b2750068a8 to your computer and use it in GitHub Desktop.
> git diff configure.ac config.h.in variables.c
diff --git a/config.h.in b/config.h.in
index 84113a8f..6647a490 100644
--- a/config.h.in
+++ b/config.h.in
@@ -121,6 +121,10 @@
to have by default */
#undef EXTGLOB_DEFAULT
+/* Define BASH_SOURCE_FULLPATH_DEFAULT to the value you'd like the
+ bash_source_fullpath shell option to have by default */
+#undef BASH_SOURCE_FULLPATH_DEFAULT
+
/* Define COND_COMMAND if you want the ksh-style [[...]] conditional
command. */
#undef COND_COMMAND
diff --git a/configure.ac b/configure.ac
index 40ca34cd..e207e7f1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -186,6 +186,7 @@ opt_function_import=yes
opt_dev_fd_stat_broken=no
opt_alt_array_impl=no
opt_translatable_strings=yes
+opt_bash_source_fullpath=no
dnl modified by alternate array implementation option
ARRAY_O=array.o
@@ -211,6 +212,7 @@ if test $opt_minimal_config = yes; then
opt_casemod_attrs=no opt_casemod_expansions=no opt_extglob_default=no
opt_translatable_strings=no
opt_globascii_default=yes
+ opt_bash_source_fullpath=no
fi
AC_ARG_ENABLE(alias, AS_HELP_STRING([--enable-alias], [enable shell aliases]), opt_alias=$enableval)
@@ -233,6 +235,7 @@ AC_ARG_ENABLE(disabled-builtins, AS_HELP_STRING([--enable-disabled-builtins], [a
AC_ARG_ENABLE(dparen-arithmetic, AS_HELP_STRING([--enable-dparen-arithmetic], [include ((...)) command]), opt_dparen_arith=$enableval)
AC_ARG_ENABLE(extended-glob, AS_HELP_STRING([--enable-extended-glob], [include ksh-style extended pattern matching]), opt_extended_glob=$enableval)
AC_ARG_ENABLE(extended-glob-default, AS_HELP_STRING([--enable-extended-glob-default], [force extended pattern matching to be enabled by default]), opt_extglob_default=$enableval)
+AC_ARG_ENABLE(bash-source-fullpath-default, AS_HELP_STRING([--enable-bash-source-fullpath-default], [force conversion of BASH_SOURCE values to fullpath to be enabled by default]), opt_bash_source_fullpath_default=$enableval)
AC_ARG_ENABLE(function-import, AS_HELP_STRING([--enable-function-import], [allow bash to import exported function definitions by default]), opt_function_import=$enableval)
AC_ARG_ENABLE(glob-asciiranges-default, AS_HELP_STRING([--enable-glob-asciiranges-default], [force bracket range expressions in pattern matching to use the C locale by default]), opt_globascii_default=$enableval)
AC_ARG_ENABLE(help-builtin, AS_HELP_STRING([--enable-help-builtin], [include the help builtin]), opt_help=$enableval)
@@ -371,6 +374,11 @@ fi
if test $opt_translatable_strings = yes; then
AC_DEFINE(TRANSLATABLE_STRINGS)
fi
+if test $opt_bash_source_fullpath_default = yes; then
+AC_DEFINE(BASH_SOURCE_FULLPATH_DEFAULT, 1)
+else
+AC_DEFINE(BASH_SOURCE_FULLPATH_DEFAULT, 0)
+fi
if test $opt_memscramble = yes; then
AC_DEFINE(MEMSCRAMBLE)
diff --git a/variables.c b/variables.c
index 6d717757..3c9e2907 100644
--- a/variables.c
+++ b/variables.c
@@ -171,7 +171,7 @@ int array_needs_making = 1;
int shell_level = 0;
/* If non-zero, each element of BASH_SOURCE contains a full pathnames */
-int bash_source_fullpath = 0;
+int bash_source_fullpath = BASH_SOURCE_FULLPATH_DEFAULT;
/* An array which is passed to commands as their environment. It is
manufactured from the union of the initial environment and the
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment