aboutsummaryrefslogtreecommitdiffstats
path: root/conf/m4/plptools/AC_REMOVE_FORBIDDEN.m4
diff options
context:
space:
mode:
Diffstat (limited to 'conf/m4/plptools/AC_REMOVE_FORBIDDEN.m4')
-rw-r--r--conf/m4/plptools/AC_REMOVE_FORBIDDEN.m423
1 files changed, 23 insertions, 0 deletions
diff --git a/conf/m4/plptools/AC_REMOVE_FORBIDDEN.m4 b/conf/m4/plptools/AC_REMOVE_FORBIDDEN.m4
new file mode 100644
index 0000000..77f0dca
--- /dev/null
+++ b/conf/m4/plptools/AC_REMOVE_FORBIDDEN.m4
@@ -0,0 +1,23 @@
+dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables
+dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever])
+dnl it's all white-space separated
+AC_DEFUN(AC_REMOVE_FORBIDDEN,
+[ __val=$$1
+ __forbid=" $2 "
+ if test -n "$__val"; then
+ __new=""
+ ac_save_IFS=$IFS
+ IFS=" "
+ for i in $__val; do
+ case "$__forbid" in
+ *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;;
+ *) # Careful to not add spaces, where there were none, because otherwise
+ # libtool gets confused, if we change e.g. CXX
+ if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;;
+ esac
+ done
+ IFS=$ac_save_IFS
+ $1=$__new
+ fi
+])
+