From: Nick Bowler Date: Sun, 7 Jan 2024 02:29:50 +0000 (-0500) Subject: Don't build locale/wcwidth junk if NLS is disabled. X-Git-Url: http://git.draconx.ca/gitweb/rrace.git/commitdiff_plain/b901702b893a6c7e0a964f2f5249a37fe0cf2805 Don't build locale/wcwidth junk if NLS is disabled. These functions are only used for NLS support, so it is silly to compile them if NLS is disabled for any reason. To do this, we create a local "dx-nls" gnulib module which can in turn use conditional dependencies to pull in all the (now optional) modules. --- diff --git a/.gitignore b/.gitignore index c3b122a..3c43afb 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,6 @@ /configure /depcomp /install-sh -/lib /libtool /ltmain.sh /missing diff --git a/Makefile.am b/Makefile.am index a48c500..ea546a8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -# Copyright © 2022-2023 Nick Bowler +# Copyright © 2022-2024 Nick Bowler # # License WTFPL2: Do What The Fuck You Want To Public License, version 2. # This is free software: you are free to do what the fuck you want to. @@ -7,6 +7,7 @@ ACLOCAL_AMFLAGS = -I m4 -I common/m4 EXTRA_DIST = +EXTRA_PROGRAMS = EXTRA_LIBRARIES = MAINTAINERCLEANFILES = MOSTLYCLEANFILES = diff --git a/common b/common index cf78d2a..aaaaceb 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit cf78d2aad652d3dd53a76e6651a08194a52afb6e +Subproject commit aaaacebf1f04c364803f308c3b3e9670e216da09 diff --git a/configure.ac b/configure.ac index ab932ce..0042b37 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -dnl Copyright © 2022-2023 Nick Bowler +dnl Copyright © 2022-2024 Nick Bowler dnl dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2. dnl This is free software: you are free to do what the fuck you want to. @@ -15,19 +15,15 @@ DX_AUTOMAKE_COMPAT AC_PROG_CC_C99 gl_EARLY -LT_INIT -gl_INIT AC_C_FLEXIBLE_ARRAY_MEMBER +AC_C_INLINE + +LT_INIT +gl_INIT AC_CACHE_SAVE m4_include([lib/gnulib.mk]) - -dnl We will provide our own makefile rules for gettext. Disable tracing of -dnl AM_GNU_GETTEXT to prevent autoreconf from running autopoint, and to -dnl prevent automake from growing gratuitous error conditions. -m4_traceoff([AM_GNU_GETTEXT]) -AM_GNU_GETTEXT([external]) AH_BOTTOM([#include ]) # Checks for curses @@ -114,8 +110,7 @@ On some platforms, or when statically linking lib]m4_defn([lib])[, leaving this undefined may reduce the executable size somewhat.])]) AC_CONFIG_TESTDIR([.], [t:.]) -DX_PROG_AUTOTEST -AM_CONDITIONAL([HAVE_AUTOTEST], [test x"$dx_cv_autotest_works" = x"yes"]) +DX_PROG_AUTOTEST_AM AC_CHECK_PROGS([XPMTOPPM], [xpmtoppm]) AC_CHECK_PROGS([PNMTOPNG], [pnmtopng]) diff --git a/lib/.gitignore b/lib/.gitignore new file mode 100644 index 0000000..baacf4f --- /dev/null +++ b/lib/.gitignore @@ -0,0 +1,3 @@ +/* +!/.gitignore +!/local diff --git a/lib/local/modules/dx-nls b/lib/local/modules/dx-nls new file mode 100644 index 0000000..9a1a6fb --- /dev/null +++ b/lib/local/modules/dx-nls @@ -0,0 +1,26 @@ +Description: +Conditionally pull in various gnulib modules for NLS support. + +Files: + +Depends-on: +gnulib-local +gettext-h [test x"$USE_NLS" = x"yes"] +localcharset [test x"$USE_NLS" = x"yes"] +mbswidth [test x"$USE_NLS" = x"yes"] + +configure.ac: +m4_set_add([DX_GNULIB_LOCAL_DIST], [modules/dx-nls])dnl +dnl We provide our own makefile rules for gettext. Avoid tracing of +dnl AM_GNU_GETTEXT to prevent autoreconf from running autopoint, and +dnl to prevent Automake from growing gratuitous error conditions. +m4_indir([AM_GNU_GETTEXT], [external]) +DX_LINGUAS + +Makefile.am: + +License: +WTFPL2 + +Maintainer: +Nick Bowler diff --git a/lib/local/modules/gnulib-local b/lib/local/modules/gnulib-local new file mode 100644 index 0000000..ed362f6 --- /dev/null +++ b/lib/local/modules/gnulib-local @@ -0,0 +1,38 @@ +Description: +Helper to export gnulib-tool local-dir settings to Automake and distribute +files automatically. + +configure.ac: +m4_set_add([DX_GNULIB_LOCAL_DIST], [modules/gnulib-local])dnl +AC_REQUIRE([AC_PROG_AWK])dnl +m4_pushdef([gl_LOCAL_DIR], + [m4_define([_DX_GNULIB_LOCAL_DIR_], $][@)])m4_divert_push([KILL]) +m4_include([m4/gnulib-cache.m4]) +m4_popdef([gl_LOCAL_DIR])m4_divert_pop([KILL])dnl +AC_SUBST([DX_GNULIB_LOCAL_DIR], m4_defn([_DX_GNULIB_LOCAL_DIR_])) + +AC_CONFIG_COMMANDS_PRE([AC_SUBST([DX_GNULIB_LOCAL_DIST], + ["m4_set_dump([DX_GNULIB_LOCAL_DIST], [ ])"])]) + +Makefile.am: +DX_GNULIB_LOCAL_DIRS_AWK = \ + { for (i=1; i<=NF; i++) { sub(/\/[^\/]*$$/, "", $$i); dirs[$$i]=1; } } \ + END { for (i in dirs) print outdir "/" i; } + +dist-hook: dist-gnulib-local +dist-gnulib-local: + save_IFS=$$IFS; \ + IFS=:; set x $(DX_GNULIB_LOCAL_DIR); shift; \ + IFS=$$save_IFS; \ + outdir="$(top_distdir)/$$1"; \ + dirs=`echo $(DX_GNULIB_LOCAL_DIST) \ + | $(AWK) '$(DX_GNULIB_LOCAL_DIRS_AWK)' outdir="$$outdir"`; \ + ( set -x; $(MKDIR_P) $$dirs && chmod u+w $$dirs ) || exit; \ + for f in $(DX_GNULIB_LOCAL_DIST); do \ + for indir; do \ + test -f "$(top_srcdir)/$$indir/$$f" || continue; \ + ( set -x; cp -p "$(top_srcdir)/$$indir/$$f" "$$outdir/$$f" ) || exit; \ + break; \ + done; \ + done +.PHONY: dist-gnulib-local diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 index d29c1da..6902641 100644 --- a/m4/gnulib-cache.m4 +++ b/m4/gnulib-cache.m4 @@ -27,7 +27,7 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import \ +# gnulib-tool --import --local-dir=lib/local \ # --lib=libgnu \ # --source-base=lib \ # --m4-base=m4 \ @@ -40,22 +40,18 @@ # --macro-prefix=gl \ # --no-vc-files \ # --avoid=std-gnu11 \ +# dx-nls \ # gethrxtime \ # getopt-gnu \ -# gettext-h \ -# inline \ -# localcharset \ -# mbswidth +# gettext-h # Specification in the form of a few gnulib-tool.m4 macro invocations: -gl_LOCAL_DIR([]) +gl_LOCAL_DIR([lib/local]) gl_MODULES([ + dx-nls gethrxtime getopt-gnu gettext-h - inline - localcharset - mbswidth ]) gl_AVOID([std-gnu11]) gl_SOURCE_BASE([lib])