-dnl Care must be taken to avoid spurious expansions of things that look like
-dnl macros in the filename; this is made especially difficult since
-dnl m4_bpatsubst does not expand to a quoted string.
-m4_define([_DX_BASEDIR], m4_if([$1], [],
- [m4_bpatsubst(m4_dquote(m4_defn([_DX_BASE_FILE])),
- [/m4/[^/]*\.m4\(.\)$], [\1])],
- [[$1]]))
+dnl _DX_SET_BASEDIR([directory])
+dnl
+dnl Defines the macro _DX_BASEDIR to the dxcommon base directory. If the
+dnl argument is empty, the base directory will be determined automatically.
+dnl Otherwise, the base directory is set to the argument (which is not
+dnl subject to macro expansion).
+dnl
+dnl Quoting here is tricky as we must avoid macro expansion of _DX_BASE_FILE,
+dnl but m4_bpatsubst does not quote its result. The resulting _DX_BASEDIR
+dnl macro is a literal string, thus it should not be expanded directly; use
+dnl m4_defn([_DX_BASEDIR]) instead.
+m4_define([_DX_SET_BASEDIR], [m4_do(
+ [m4_define([_DX_BASEDIR], m4_ifval([$1], [[$1]],
+ [m4_bpatsubst(m4_dquote(m4_defn([_DX_BASE_FILE])),
+ [/m4/[^/]*\.m4\(.\)$], [\1])]))],
+ [_DX_STAMP])])