]> git.draconx.ca Git - rrace.git/commitdiff
Don't build locale/wcwidth junk if NLS is disabled.
authorNick Bowler <nbowler@draconx.ca>
Sun, 7 Jan 2024 02:29:50 +0000 (21:29 -0500)
committerNick Bowler <nbowler@draconx.ca>
Sun, 7 Jan 2024 03:09:18 +0000 (22:09 -0500)
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.

.gitignore
Makefile.am
common
configure.ac
lib/.gitignore [new file with mode: 0644]
lib/local/modules/dx-nls [new file with mode: 0644]
lib/local/modules/gnulib-local [new file with mode: 0644]
m4/gnulib-cache.m4

index c3b122aaf938a5ff62ea6203b6f7020047a571b4..3c43afb9db1914d8d7340fbe5d53d448f5b99a49 100644 (file)
@@ -13,7 +13,6 @@
 /configure
 /depcomp
 /install-sh
-/lib
 /libtool
 /ltmain.sh
 /missing
index a48c500fe8061bd824c362264897a542c783d9f9..ea546a8ca328270671df072c520045080e0b4326 100644 (file)
@@ -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 cf78d2aad652d3dd53a76e6651a08194a52afb6e..aaaacebf1f04c364803f308c3b3e9670e216da09 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit cf78d2aad652d3dd53a76e6651a08194a52afb6e
+Subproject commit aaaacebf1f04c364803f308c3b3e9670e216da09
index ab932ce2a5f696e6bb2b9a47b7cf3cb38f0fbb64..0042b3715b8d39b9ef4361fb7e6fbb2e9bdd6b57 100644 (file)
@@ -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 <conf_post.h>])
 
 # 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 (file)
index 0000000..baacf4f
--- /dev/null
@@ -0,0 +1,3 @@
+/*
+!/.gitignore
+!/local
diff --git a/lib/local/modules/dx-nls b/lib/local/modules/dx-nls
new file mode 100644 (file)
index 0000000..9a1a6fb
--- /dev/null
@@ -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 (file)
index 0000000..ed362f6
--- /dev/null
@@ -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
index d29c1daf08f54c286a79de7b37967cd91f1f5e78..690264178cc848a211d8b3b46c52326be456ea78 100644 (file)
@@ -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 \
 #  --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])