-GNULIB_SRCDIR=/usr/local/src/gnu/gnulib
-[[ ! -d ${GNULIB_SRCDIR} ]] && GNULIB_SRCDIR=/usr/local/src/gnulib
-if [[ -d ${GNULIB_SRCDIR} ]] ; then
- export GNULIB_SRCDIR
-else
- unset GNULIB_SRCDIR
-fi
+gnu_var_setup() {
+ local var="${1^^}_SRCDIR"
+ local path="/usr/local/src/gnu/$1"
+ [[ ! -d ${path} ]] && path="/usr/local/src/$1"
+ [[ -d ${path} ]] && eval export ${var}=\""${path}"\"
+}
+gnu_var_setup gnulib
+gnu_var_setup paxutils
+unset gnu_var_setup