Skip to content

Commit

Permalink
Commit #4
Browse files Browse the repository at this point in the history
  • Loading branch information
madmurphy committed Sep 10, 2019
1 parent 5f2e9f6 commit 38115d1
Show file tree
Hide file tree
Showing 10 changed files with 981 additions and 347 deletions.
828 changes: 669 additions & 159 deletions COPYING

Large diffs are not rendered by default.

29 changes: 27 additions & 2 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@ Change Log
==========


0.3.0
-----

Changes:

* Macro † `nm4_unlambda` has been removed from `not-m4sugar.m4` -- lambda macros
are now safely created without polluting the global scope
* M4sugar clones † `nm4_switch()` and † `nm4_case()` have been removed from
`not-m4sugar.m4` (they were clones of `m4_case()` and `m4_bmatch()`
respectively)
* Reduntant macros `nm4_in()` and `nm4_in_args()` have been removed from
`not-m4sugar.m4`
* The _Not M4sugar_ prefix `nm4_` has been changed to `n4_`
* Macros `n4_case_in()` and `n4_list_index()` have been created in
`not-m4sugar.m4`
* Macros `n4_get_replacements()` and `n4_for_each_match()` in `not-m4sugar.m4`
(formerly † `n4_get_replacements()` and † `n4_for_each_match()`) no longer
depend on `n4_repeat()`, but on GNU `m4_for()` instead
* Macro `n4_define_substrings_as()` in `not-m4sugar.m4` (formerly
`nm4_define_substrings_as()`) has been re-implemented using a more efficient
algorithm (removed recursion, removed multiple calls to `m4_bregexp()`)
* Code review
* Examples


0.2.0
-----

Expand All @@ -23,8 +48,8 @@ Changes:
`not-m4sugar.m4` have been renamed to `nm4_get_replacements()`,
`nm4_define_substrings_as()`, `nm4_for_each_match()`, `nm4_redepth()`, and
`nm4_repeat()`
* Code review
* Examples
* Code review
* Examples



Expand Down
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
Not Autotools
=============

A collection of useful and self-documented *M4-ish* macros for GNU Autotools
A collection of awesome and self-documented *M4-ish* macros for GNU Autotools


Overview
--------

This collection is still very small. The macros are organized by topic and each topic has its own file. Most of the macros are independent from each other, so you can just copy and paste what you need. The few cases where a macro depends on a helper macro from the same file are documented.

Feel free to contribute. For any question, [drop me a message][1].


Free software
-------------

This library is free software. You can redistribute it and/or modify it under the terms of the GPL3 license. See [COPYING][2] for details.


[1]: https://github.com/madmurphy/not-autotools/issues
[2]: https://github.com/madmurphy/not-autotools/blob/master/COPYING

1 change: 0 additions & 1 deletion VERSION

This file was deleted.

33 changes: 22 additions & 11 deletions m4/not-automake.m4
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dnl \_| \_/\___/ \__| \_| |_/\__,_|\__\___/ \__\___/ \___/|_|___/
dnl
dnl A collection of useful m4-ish macros for GNU Autotools
dnl
dnl -- Released under GNU LGPL3 --
dnl -- Released under GNU GPL3 --
dnl
dnl https://github.com/madmurphy/not-autotools
dnl ***************************************************************************
Expand Down Expand Up @@ -37,6 +37,7 @@ dnl This macro can be invoked before `AC_INIT()`.
dnl
dnl Expansion type: literal
dnl Requires: nothing
dnl Author: madmurphy
dnl
dnl ***************************************************************************
AC_DEFUN([NM_GET_AM_VAR], [m4_esyscmd_s([echo ${$1}])])
Expand All @@ -50,11 +51,12 @@ dnl and returns a comma-separated list of their names
dnl
dnl Example:
dnl
dnl AC_MSG_NOTICE([This package has been distributed by ]m4_if(nm4_in([USER], [NM_ENVIRONMENT_KEYS]), [1],
dnl [NM_GET_AM_VAR([USER])],
dnl [unknown]))
dnl AC_MSG_NOTICE([This package has been distributed by n4_case_in([USER],
dnl [NM_ENVIRONMENT_KEYS],
dnl [NM_GET_AM_VAR([USER])],
dnl [unknown])])
dnl
dnl For the `nm4_in()` macro, see `not-m4sugar.m4`.
dnl For the `n4_case_in()` macro, see `not-m4sugar.m4`.
dnl
dnl Note that `automake` runs at a different time (and often even on a
dnl different computer) than the `configure` script.
Expand All @@ -69,14 +71,25 @@ dnl
dnl See:
dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Looping-constructs.html
dnl
dnl This macro makes a system call the first time it is invoked, then
dnl overwrites itself with the literal list of the environment keys received,
dnl so that any further access to the list will rely on a cache and not anymore
dnl on system calls. If you want to force further system calls after the first
dnl access you can use:
dnl
dnl m4_popdef([NM_ENVIRONMENT_KEYS])
dnl NM_ENVIRONMENT_KEYS
dnl
dnl This macro can be invoked before `AC_INIT()`.
dnl
dnl Expansion type: literal
dnl Requires: nothing
dnl Author: madmurphy
dnl
dnl ***************************************************************************
AC_DEFUN([NM_ENVIRONMENT_KEYS],
[m4_esyscmd([printenv | sed 's/^\([^=]\+\)=.*$/[\1],/g' | tr '\n' ' ' | sed 's/,\s$//'])])
[m4_pushdef([NM_ENVIRONMENT_KEYS],
m4_quote(m4_esyscmd([printenv | sed 's/^\([^=]\+\)=.*$/[\1],/g' | tr '\n' ' ' | sed 's/,\s*$//'])))[]NM_ENVIRONMENT_KEYS])


dnl NM_LOAD_ENVIRONMENT
Expand All @@ -103,13 +116,11 @@ dnl This macro can be invoked before `AC_INIT()`.
dnl
dnl Expansion type: literal (void)
dnl Requires: nothing
dnl Author: madmurphy
dnl
dnl ***************************************************************************
AC_DEFUN_ONCE([NM_LOAD_ENVIRONMENT], [
m4_changequote([{{<<], [>>}}])
m4_esyscmd(printenv | sed 's/^\([^=]\+\)=\(.*\)$/{{<<m4_define({{<<AME_\1>>}}, {{<<\2>>}})d][n][l>>}}/g')
m4_changequote({{<<[>>}}, {{<<]>>}})
])
AC_DEFUN_ONCE([NA_LOAD_AM_ENVIRONMENT],
[m4_esyscmd_s([echo "m4_changequote([{{<<], [>>}}]){{<<>>}}$(printenv | sed 's/^\([^=]\+\)=\(.*\)$/m4_define({{<<AME_\1>>}}, {{<<\2>>}})/g'){{<<>>}}m4_changequote({{<<[>>}}, {{<<]>>}})"])])


dnl ***************************************************************************
Expand Down
5 changes: 4 additions & 1 deletion m4/not-autoshell.m4
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dnl \_| \_/\___/ \__| \_| |_/\__,_|\__\___/ \__\___/ \___/|_|___/
dnl
dnl A collection of useful m4-ish macros for GNU Autotools
dnl
dnl -- Released under GNU LGPL3 --
dnl -- Released under GNU GPL3 --
dnl
dnl https://github.com/madmurphy/not-autotools
dnl ***************************************************************************
Expand Down Expand Up @@ -37,6 +37,7 @@ dnl This macro can be invoked only after having invoked `AC_INIT()`
dnl
dnl Expansion type: shell code
dnl Requires: nothing
dnl Author: madmurphy
dnl
dnl ***************************************************************************
AC_DEFUN([NS_SETVAR], [$1=$2])
Expand All @@ -58,6 +59,7 @@ dnl This macro can be invoked only after having invoked `AC_INIT()`
dnl
dnl Expansion type: shell code
dnl Requires: nothing
dnl Author: madmurphy
dnl
dnl ***************************************************************************
AC_DEFUN([NS_GETVAR], [@S|@{$1}])
Expand All @@ -83,6 +85,7 @@ dnl This macro can be invoked only after having invoked `AC_INIT()`
dnl
dnl Expansion type: shell code
dnl Requires: nothing
dnl Author: madmurphy
dnl
dnl ***************************************************************************
AC_DEFUN([NS_GETOUT], [@S|@@{:@$1@:}@])
Expand Down
6 changes: 5 additions & 1 deletion m4/not-autotools.m4
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dnl \_| \_/\___/ \__| \_| |_/\__,_|\__\___/ \__\___/ \___/|_|___/
dnl
dnl A collection of useful m4-ish macros for GNU Autotools
dnl
dnl -- Released under GNU LGPL3 --
dnl -- Released under GNU GPL3 --
dnl
dnl https://github.com/madmurphy/not-autotools
dnl ***************************************************************************
Expand Down Expand Up @@ -38,6 +38,7 @@ dnl This macro can be invoked before `AC_INIT()`.
dnl
dnl Expansion type: literal
dnl Requires: nothing
dnl Author: madmurphy
dnl
dnl ***************************************************************************
m4_define([NA_UP_WORDS_ONLY],
Expand All @@ -63,6 +64,7 @@ dnl This macro can be invoked only after having invoked `AC_INIT()`
dnl
dnl Expansion type: shell code
dnl Requires: nothing
dnl Author: madmurphy
dnl
dnl ***************************************************************************
AC_DEFUN([NA_SET_GLOBALLY], [
Expand All @@ -88,6 +90,7 @@ dnl This macro can be invoked only after having invoked `AC_INIT()`
dnl
dnl Expansion type: shell code
dnl Requires: `NA_UP_WORDS_ONLY()`
dnl Author: madmurphy
dnl
dnl ***************************************************************************
AC_DEFUN([NA_GET_PROGS], [
Expand Down Expand Up @@ -125,6 +128,7 @@ dnl This macro can be invoked only after having invoked `AC_INIT()`
dnl
dnl Expansion type: shell code
dnl Requires: `NA_UP_WORDS_ONLY()`
dnl Author: madmurphy
dnl
dnl ***************************************************************************
AC_DEFUN([NA_REQ_PROGS], [
Expand Down
Loading

0 comments on commit 38115d1

Please sign in to comment.