2 Helper to export gnulib-tool local-dir settings to Automake and distribute
6 m4_set_add([DX_GNULIB_LOCAL_DIST], [modules/gnulib-local])dnl
7 AC_REQUIRE([AC_PROG_AWK])dnl
8 m4_pushdef([gl_LOCAL_DIR],
9 [m4_define([_DX_GNULIB_LOCAL_DIR_], $][@)])m4_divert_push([KILL])
10 m4_include([m4/gnulib-cache.m4])
11 m4_popdef([gl_LOCAL_DIR])m4_divert_pop([KILL])dnl
12 AC_SUBST([DX_GNULIB_LOCAL_DIR], m4_defn([_DX_GNULIB_LOCAL_DIR_]))
14 AC_CONFIG_COMMANDS_PRE([AC_SUBST([DX_GNULIB_LOCAL_DIST],
15 ["m4_set_dump([DX_GNULIB_LOCAL_DIST], [ ])"])])
18 DX_GNULIB_LOCAL_DIRS_AWK = \
19 { for (i=1; i<=NF; i++) { sub(/\/[^\/]*$$/, "", $$i); dirs[$$i]=1; } } \
20 END { for (i in dirs) print outdir "/" i; }
22 dist-hook: dist-gnulib-local
25 IFS=:; set x $(DX_GNULIB_LOCAL_DIR); shift; \
27 outdir="$(top_distdir)/$$1"; \
28 dirs=`echo $(DX_GNULIB_LOCAL_DIST) \
29 | $(AWK) '$(DX_GNULIB_LOCAL_DIRS_AWK)' outdir="$$outdir"`; \
30 ( set -x; $(MKDIR_P) $$dirs && chmod u+w $$dirs ) || exit; \
31 for f in $(DX_GNULIB_LOCAL_DIST); do \
33 test -f "$(top_srcdir)/$$indir/$$f" || continue; \
34 ( set -x; cp -p "$(top_srcdir)/$$indir/$$f" "$$outdir/$$f" ) || exit; \
38 .PHONY: dist-gnulib-local