bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accommodate non-recursive Automake in a less hacky way


From: Bruno Haible
Subject: Accommodate non-recursive Automake in a less hacky way
Date: Wed, 15 Dec 2021 19:38:00 +0100

With the attached patches, 'gnulib-tool' gains the functionality to
generate a "non-recursive" Automake Makefile.am snippet, similar to
what the 'non-recursive-gnulib-prefix-hack' module does.

The new gnulib-tool option is called '--automake-subdir'.

Compared to the 'non-recursive-gnulib-prefix-hack' module approach:

  * It works together with the --with-tests option. (I don't think
    it's possible to make 'non-recursive-gnulib-prefix-hack' work
    with --with-tests, because the processing of *_H variables in
    m4/non-recursive-gnulib-prefix-hack.m4 cannot distinguish
    .h files generated in lib/ from .h files generated in tests/.)

  * It is documented.

  * The processing is more reliable, because it relies less on
    textual patterns.

  * It does not leave a backup file on disk, that conflicts with
    the backup files from gnulib-tool.

  * It does not print a line 'prefix=lib/' (which I found irritating).

  * An explicit invocation of 'build-aux/prefix-gnulib-mk' from
    autogen.sh (or bootstrap.conf) is not needed. gnulib-tool does
    it transparently.

The first patch makes use of the Automake special notation %reldir%;
thanks Marc for the pointer.

The second patch is necessary for the third one; it confirms that
file names are better stored in the module description, as opposed
to *.m4 files.


2021-12-15  Bruno Haible  <bruno@clisp.org>

        Accommodate non-recursive Automake in a less hacky way.
        * gnulib-tool: New option --automake-subdir.
        (automake_subdir): New variable.
        (func_emit_initmacro_end): Add a second argument. Use it to prefix each
        object file name in *_LIBOBJS and *_LTLIBOBJS.
        (func_emit_shellvars_init): New function.
        (func_import): Add support for --automake-subdir. Invoke
        prefix-gnulib-mk. Update calls to func_emit_initmacro_end. Call
        func_emit_shellvars_init.
        (func_create_testdir): Update calls to func_emit_initmacro_end. Call
        func_emit_shellvars_init.
        * m4/gnulib-tool.m4 (gl_AUTOMAKE_SUBDIR): New macro.
        * m4/gnulib-common.m4 (gl_CONDITIONAL_HEADER): Use the value of the
        gl_source_base_prefix variable.
        * build-aux/prefix-gnulib-mk: New options --from-gnulib-tool, --prefix.
        (contents_of_file): Renamed from contents.
        (contents_of_stdin): New function.
        (process): Inline and remove function.
        * doc/gnulib-tool.texi (Non-recursive make): New section.

2021-12-15  Bruno Haible  <bruno@clisp.org>

        Move .h file names out of the *.m4 files.
        This is useful because Autoconf macros defined in *.m4 files can be
        AC_REQUIREd. In the configure file, they are then expanded before
        gl_INIT, i.e. at a place where it is not known whether they are required
        for the lib/ or for the tests/ directory (or both).
        * m4/gnulib-common.m4 (gl_CONDITIONAL_HEADER): New macro.
        * m4/alloca.m4 (gl_FUNC_ALLOCA): Set GL_GENERATE_ALLOCA_H instead of
        ALLOCA_H. Drop AC_SUBST and AM_CONDITIONAL invocations.
        * modules/alloca-opt (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/argz.m4 (gl_FUNC_ARGZ): Set GL_GENERATE_ARGZ_H instead of ARGZ_H.
        Drop AC_SUBST and AM_CONDITIONAL invocations.
        * modules/argz (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/assert_h.m4 (gl_ASSERT_H): Set GL_GENERATE_ASSERT_H instead of
        ASSERT_H. Drop AC_SUBST and AM_CONDITIONAL invocations.
        * modules/assert-h (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/byteswap.m4 (gl_BYTESWAP): Set GL_GENERATE_BYTESWAP_H instead of
        BYTESWAP_H. Drop AC_SUBST and AM_CONDITIONAL invocations.
        * modules/byteswap (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/errno_h.m4 (gl_HEADER_ERRNO_H): Set GL_GENERATE_ERRNO_H instead of
        ERRNO_H. Drop AC_SUBST and AM_CONDITIONAL invocations.
        (gl_REPLACE_ERRNO_VALUE): Update.
        * m4/perror.m4 (gl_FUNC_PERROR): Update.
        * m4/strerror.m4 (gl_FUNC_STRERROR): Update.
        * m4/strerror_r.m4 (gl_FUNC_STRERROR_R, gl_FUNC_STRERROR_R_WORKS):
        Update.
        * modules/errno (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/execinfo.m4 (gl_EXECINFO_H): Set GL_GENERATE_EXECINFO_H instead of
        EXECINFO_H. Drop AC_SUBST and AM_CONDITIONAL invocations. Drop AC_LIBOBJ
        invocation.
        * modules/execinfo (configure.ac): Invoke gl_CONDITIONAL_HEADER and
        AC_LIBOBJ.
        * m4/float_h.m4 (gl_FLOAT_H): Set GL_GENERATE_FLOAT_H instead of
        FLOAT_H. Drop AC_SUBST and AM_CONDITIONAL invocations.
        * modules/float (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/fnmatch_h.m4 (gl_FNMATCH_H, gl_REPLACE_FNMATCH_H): Set
        GL_GENERATE_FNMATCH_H instead of FNMATCH_H. Drop AC_SUBST and
        AM_CONDITIONAL invocations.
        * modules/fnmatch-h (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * modules/fnmatch (configure.ac): Likewise.
        * m4/getopt.m4 (gl_FUNC_GETOPT_POSIX, gl_GETOPT_SUBSTITUTE_HEADER): Set
        GL_GENERATE_GETOPT_H instead of GETOPT_H. Set GL_GENERATE_GETOPT_CDEFS_H
        instead of GETOPT_CDEFS_H. Drop AC_SUBST invocations.
        * modules/getopt-posix (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/glob_h.m4 (gl_GLOB_H, gl_REPLACE_GLOB_H): Set GL_GENERATE_GLOB_H
        instead of GLOB_H. Drop AC_SUBST and AM_CONDITIONAL invocations.
        * modules/glob-h (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * modules/glob (configure.ac): Likewise.
        * m4/iconv_h.m4 (gl_ICONV_H_DEFAULTS, gl_REPLACE_ICONV_H): Set
        GL_GENERATE_ICONV_H instead of ICONV_H. Drop AC_SUBST and AM_CONDITIONAL
        invocations.
        (gl_ICONV_H): Update.
        * modules/iconv-h (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * modules/iconv_open (configure.ac): Likewise.
        * m4/ieee754-h.m4 (gl_IEEE754_H): Set GL_GENERATE_IEEE754_H instead of
        IEEE754_H. Drop AC_SUBST and AM_CONDITIONAL invocations.
        * modules/ieee754-h (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/libgmp.m4 (gl_LIBGMP): Set GL_GENERATE_GMP_H instead of GMP_H. Drop
        AC_SUBST invocation.
        * modules/libgmp (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        (Makefile.am): Use GL_GENERATE_GMP_H.
        * m4/libtextstyle-optional.m4 (gl_LIBTEXTSTYLE_OPTIONAL): Set
        GL_GENERATE_TEXTSTYLE_H instead of TEXTSTYLE_H. Drop AC_SUBST and
        AM_CONDITIONAL invocations.
        * modules/libtextstyle-optional (configure.ac): Invoke
        gl_CONDITIONAL_HEADER.
        * m4/limits-h.m4 (gl_LIMITS_H, gl_REPLACE_LIMITS_H): Set
        GL_GENERATE_LIMITS_H instead of LIMITS_H. Drop AC_SUBST and
        AM_CONDITIONAL invocations.
        * modules/limits-h (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/monetary_h.m4 (gl_MONETARY_H): Set GL_GENERATE_MONETARY_H instead
        of MONETARY_H. Drop AC_SUBST and AM_CONDITIONAL invocations.
        * modules/monetary (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/net_if_h.m4 (gl_HEADER_NET_IF): Set GL_GENERATE_NET_IF_H instead of
        NET_IF_H. Drop AC_SUBST and AM_CONDITIONAL invocations.
        * modules/net_if (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/netinet_in_h.m4 (gl_HEADER_NETINET_IN): Set
        GL_GENERATE_NETINET_IN_H instead of NETINET_IN_H. Drop AC_SUBST and
        AM_CONDITIONAL invocations.
        * modules/netinet_in (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/selinux-context-h.m4 (gl_HEADERS_SELINUX_CONTEXT_H): Set
        GL_GENERATE_SELINUX_CONTEXT_H instead of SELINUX_CONTEXT_H. Drop
        AC_SUBST and AM_CONDITIONAL invocations.
        * m4/selinux-label-h.m4 (gl_HEADERS_SELINUX_LABEL_H): Set
        GL_GENERATE_SELINUX_LABEL_H instead of SELINUX_LABEL_H. Drop AC_SUBST
        and AM_CONDITIONAL invocations.
        * modules/selinux-h (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/stdalign.m4 (gl_STDALIGN_H): Set GL_GENERATE_STDALIGN_H instead of
        STDALIGN_H. Drop AC_SUBST and AM_CONDITIONAL invocations.
        * modules/stdalign (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/stdarg.m4 (gl_STDARG_H): Set GL_GENERATE_STDARG_H instead of
        STDARG_H. Drop AC_SUBST and AM_CONDITIONAL invocations.
        * modules/stdarg (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/stdbool.m4 (gl_STDBOOL_H): Renamed from AM_STDBOOL_H. Set
        GL_GENERATE_STDBOOL_H instead of STDBOOL_H. Drop AC_SUBST and
        AM_CONDITIONAL invocations.
        * m4/parse-datetime.m4 (gl_PARSE_DATETIME): Don't require AM_STDBOOL_H.
        * modules/stdbool (configure.ac): Invoke gl_STDBOOL_H instead of
        AM_STDBOOL_H. Invoke gl_CONDITIONAL_HEADER.
        * m4/stddef_h.m4 (gl_STDDEF_H): Set GL_GENERATE_STDDEF_H instead of
        STDDEF_H. Drop AC_SUBST and AM_CONDITIONAL invocations.
        * modules/stddef (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/stdint.m4 (gl_STDINT_H): Set GL_GENERATE_STDINT_H instead of
        STDINT_H. Drop AC_SUBST and AM_CONDITIONAL invocations.
        * m4/inttypes.m4 (gl_INTTYPES_PRI_SCN): Update.
        * modules/stdint (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/stdnoreturn.m4 (gl_STDNORETURN_H): Set GL_GENERATE_STDNORETURN_H
        instead of STDNORETURN_H. Drop AC_SUBST and AM_CONDITIONAL invocations.
        * modules/stdnoreturn (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * m4/sys_socket_h.m4 (gl_SYS_SOCKET_H): Set GL_GENERATE_SYS_SOCKET_H
        instead of SYS_SOCKET_H.
        * m4/sysexits.m4 (gl_SYSEXITS): Set GL_GENERATE_SYSEXITS_H instead of
        SYSEXITS_H. Drop AC_SUBST and AM_CONDITIONAL invocations.
        * modules/sysexits (configure.ac): Invoke gl_CONDITIONAL_HEADER.
        * modules/sigsegv (configure.ac): Set GL_GENERATE_SIGSEGV_H instead of
        SIGSEGV_H. Drop AC_SUBST and AM_CONDITIONAL invocations. Invoke
        gl_CONDITIONAL_HEADER.

2021-12-15  Bruno Haible  <bruno@clisp.org>

        Fix creation of build directories with non-recursive-gnulib-prefix-hack.
        This is necessary for executing "make" in a VPATH build of a package
        that uses prefix-gnulib-mk and a module such as alloca-opt.
        * modules/alloca-opt (Makefile.am): Before generating the .h-t file,
        ensure that the directory in which we want to create it exists.
        (configure.ac): Invoke AC_PROG_MKDIR_P.
        * modules/argz: Likewise.
        * modules/arpa_inet: Likewise.
        * modules/assert-h: Likewise.
        * modules/byteswap: Likewise.
        * modules/configmake: Likewise.
        * modules/ctype: Likewise.
        * modules/dirent: Likewise.
        * modules/dynarray: Likewise.
        * modules/errno: Likewise.
        * modules/execinfo: Likewise.
        * modules/fcntl-h: Likewise.
        * modules/float: Likewise.
        * modules/fnmatch-h: Likewise.
        * modules/getopt-posix: Likewise.
        * modules/glob-h: Likewise.
        * modules/iconv-h: Likewise.
        * modules/ieee754-h: Likewise.
        * modules/inttypes-incomplete: Likewise.
        * modules/langinfo: Likewise.
        * modules/libgmp: Likewise.
        * modules/libtextstyle-optional: Likewise.
        * modules/limits-h: Likewise.
        * modules/locale: Likewise.
        * modules/malloc-h: Likewise.
        * modules/math: Likewise.
        * modules/monetary: Likewise.
        * modules/net_if: Likewise.
        * modules/netdb: Likewise.
        * modules/netinet_in: Likewise.
        * modules/openmp-init: Likewise.
        * modules/poll-h: Likewise.
        * modules/posix-shell: Likewise.
        * modules/pthread-h: Likewise.
        * modules/pty: Likewise.
        * modules/sched: Likewise.
        * modules/scratch_buffer: Likewise.
        * modules/search: Likewise.
        * modules/selinux-h: Likewise.
        * modules/signal-h: Likewise.
        * modules/sigsegv: Likewise.
        * modules/snippet/link-warning: Likewise.
        * modules/spawn: Likewise.
        * modules/stdalign: Likewise.
        * modules/stdarg: Likewise.
        * modules/stdbool: Likewise.
        * modules/stddef: Likewise.
        * modules/stdint: Likewise.
        * modules/stdio: Likewise.
        * modules/stdlib: Likewise.
        * modules/stdnoreturn: Likewise.
        * modules/string: Likewise.
        * modules/strings: Likewise.
        * modules/sys_file: Likewise.
        * modules/sys_ioctl: Likewise.
        * modules/sys_random: Likewise.
        * modules/sys_resource: Likewise.
        * modules/sys_select: Likewise.
        * modules/sys_socket: Likewise.
        * modules/sys_stat: Likewise.
        * modules/sys_time: Likewise.
        * modules/sys_times: Likewise.
        * modules/sys_types: Likewise.
        * modules/sys_uio: Likewise.
        * modules/sys_utsname: Likewise.
        * modules/sys_wait: Likewise.
        * modules/sysexits: Likewise.
        * modules/termios: Likewise.
        * modules/threads-h: Likewise.
        * modules/time: Likewise.
        * modules/uchar: Likewise.
        * modules/unicase/base: Likewise.
        * modules/unicase/special-casing: Likewise.
        * modules/uniconv/base: Likewise.
        * modules/unictype/base: Likewise.
        * modules/unigbrk/base: Likewise.
        * modules/unilbrk/base: Likewise.
        * modules/uniname/base: Likewise.
        * modules/uninorm/base: Likewise.
        * modules/unistd: Likewise.
        * modules/unistdio/base: Likewise.
        * modules/unistr/base: Likewise.
        * modules/unitypes: Likewise.
        * modules/uniwbrk/base: Likewise.
        * modules/uniwidth/base: Likewise.
        * modules/utime-h: Likewise.
        * modules/wchar: Likewise.
        * modules/wctype-h: Likewise.
        * gnulib-tool (func_emit_lib_Makefile_am): When producing output for
        GNU make, eliminate %reldir% tokens.

Attachment: 0001-Fix-creation-of-build-directories-with-non-recursive.patch
Description: Text Data

Attachment: 0002-Move-.h-file-names-out-of-the-.m4-files.patch
Description: Text Data

Attachment: 0003-Accommodate-non-recursive-Automake-in-a-less-hacky-w.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]