Skip to content

Commit

Permalink
Commit #10
Browse files Browse the repository at this point in the history
  • Loading branch information
madmurphy committed Oct 3, 2019
1 parent 45ed1e5 commit 0b7615e
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 27 deletions.
20 changes: 16 additions & 4 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ Change Log
==========


0.7.0
-----

Changes:

* New macro `NA_HELP_STRINGS()` has been created in `not-autotools.m4`
* Code review (`NC_CONFIG_SHADOW_DIR()` in `not-extended-config.m4`)
* Macro † `NA_SET_GLOBALLY()` in `not-autotools.m4` has been renamed to
`NC_SET_GLOBALLY()`
* Documentation


0.6.0
-----

Expand All @@ -11,7 +23,7 @@ Changes:
`not-utf8.m4` have been created, containing the following new macros:
`NC_MSG_ERRORBOX()`, `NC_MSG_FAILUREBOX()`, `NC_MSG_NOTICEBOX()` and
`NC_MSG_WARNBOX()` (`not-ac-messages.m4`); `NC_CONFIG_SHADOW_DIR()`,
`NC_SHADOW_MAYBE_OUT`, `NC_THREATEN_BLINDLY` and `NC_THREATEN_FILES()`
`NC_SHADOW_MAYBE_OUTPUT`, `NC_THREATEN_BLINDLY` and `NC_THREATEN_FILES()`
(`not-extended-config.m4`); `n4_charcode()`, `n4_codeunit_at()`,
`n4_codepoint_to_ascii()`, `n4_escape_non_ascii()` and
`n4_escape_everything()` (`not-utf8.m4`);
Expand All @@ -34,7 +46,7 @@ Changes:

* New macro `n4_burn_out()` has been created in `not-m4sugar.m4`
* Code review (macro `NM_LOAD_ENVIRONMENT()` in `not-automake.m4`, macro
`NA_SET_GLOBALLY()` in `not-autotools.m4`)
`NA_SET_GLOBALLY()` in `not-autotools.m4`)
* Documentation


Expand All @@ -43,7 +55,7 @@ Changes:

Changes:

* Macro `NA_SET_GLOBALLY()` in `not-autotools.m4` has been made variadic
* Macro `NA_SET_GLOBALLY()` in `not-autotools.m4` has been made variadic
* Code review (macros `NA_GET_PROGS()`, `NA_REQ_PROGS()` and
`NA_SANITIZE_VARNAME()` in `not-autotools.m4`; macros `n4_case_in()`,
`n4_define_substrings_as()`, `n4_for_each_match()`, `n4_get_replacements()`,
Expand Down Expand Up @@ -82,7 +94,7 @@ Changes:
* 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
* 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
Expand Down
2 changes: 1 addition & 1 deletion m4/not-autoshell.m4
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ dnl Author: madmurphy
dnl
dnl **************************************************************************
AC_DEFUN([NS_UNSET],
[m4_ifblank([$1], [], [AS_UNSET([$1]);])m4_if([$#], [1], [], [NS_UNSET(m4_shift($@))])])
[m4_ifnblank([$1], [AS_UNSET([$1]);])m4_if([$#], [1], [], [NS_UNSET(m4_shift($@))])])



Expand Down
67 changes: 60 additions & 7 deletions m4/not-autotools.m4
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,60 @@ AC_DEFUN([NC_REQ_PROGS], [
])


dnl NA_SET_GLOBALLY(name1, [value1][, name2, [value2][, ... nameN, [valueN]]])
dnl NA_HELP_STRINGS(list1, help1[, list2, help2[, ... listN, helpN]])
dnl **************************************************************************
dnl
dnl Similar to `AS_HELP_STRING()`, but with support for multiple strings, each
dnl one associated with one or more options
dnl
dnl For example,
dnl
dnl AC_ARG_ENABLE([foo],
dnl [NA_HELP_STRINGS(
dnl [--disable-foo],
dnl [disable the `foo` feature; on some machines the package might not
dnl work properly without the `foo` feature enabled],
dnl [[--enable-foo], [--enable-foo=yes], [--enable-foo=enhanced]],
dnl [install this package with the `foo` feature enabled; if `foo` is
dnl enabled in `enhanced` mode Autoconf might get sentimental],
dnl [[--enable-foo=auto], [--enable-foo=check], [@<:@omitted@:>@]],
dnl [decide automatically whether it is opportune to enable the `foo`
dnl feature on this machine or not]
dnl )],
dnl [:],
dnl [AS_VAR_SET([enable_foo], ['check'])])
dnl
dnl will print, when the user launches `./configure --help`:
dnl
dnl --disable-foo disable the `foo` feature; on some machines the
dnl package might not work properly without the `foo`
dnl feature enabled
dnl --enable-foo,
dnl --enable-foo=yes,
dnl --enable-foo=enhanced install this package with the `foo` feature enabled;
dnl if `foo` is enabled in `enhanced` mode Autoconf
dnl might get sentimental
dnl --enable-foo=auto,
dnl --enable-foo=check,
dnl [omitted] decide automatically whether it is opportune to
dnl enable the `foo` feature on this machine or not
dnl
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_HELP_STRINGS],
[m4_if(m4_count($1), [1],
[m4_if([$#], [0], [], [$#], [1],
[m4_text_wrap($1, [ ])],
[AS_HELP_STRING($1, [$2])m4_if([$#], [2], [], [m4_newline()NA_HELP_STRINGS(m4_shift2($@))])])],
[m4_text_wrap(m4_argn(1, $1)[,], [ ])m4_newline()NA_HELP_STRINGS(m4_dquote(m4_shift($1))m4_if([$#], [1], [], [, m4_shift($@)]))])])


dnl NC_SET_GLOBALLY(name1, [value1][, name2, [value2][, ... nameN, [valueN]]])
dnl **************************************************************************
dnl
dnl For each `nameN`-`valueN` pair, creates a new argumentless macro named
Expand All @@ -132,12 +185,12 @@ dnl invoked
dnl
dnl For example:
dnl
dnl NA_SET_GLOBALLY(
dnl NC_SET_GLOBALLY(
dnl [PROJECT_DESCRIPTION], [Some description],
dnl [COPYLEFT], [GNU]
dnl [COPYLEFT], [madmurphy]
dnl )
dnl AC_MSG_NOTICE([Package copyleft: ]GL_COPYLEFT)
dnl AC_MSG_NOTICE([Package copyleft: ${COPYLEFT}])
dnl AC_MSG_NOTICE([package copyleft: ]GL_COPYLEFT)
dnl AC_MSG_NOTICE([package copyleft: ${COPYLEFT}])
dnl
dnl Each argument can safely contain any arbitrary character, however all the
dnl `nameN` arguments will be processed by `NA_SANITIZE_VARNAME()`, and all
Expand All @@ -150,10 +203,10 @@ dnl Requires: `NA_SANITIZE_VARNAME()`
dnl Author: madmurphy
dnl
dnl **************************************************************************
AC_DEFUN([NA_SET_GLOBALLY], [
AC_DEFUN([NC_SET_GLOBALLY], [
m4_define([GL_]NA_SANITIZE_VARNAME([$1]), m4_normalize([$2]))
AC_SUBST(NA_SANITIZE_VARNAME([$1]), ['m4_bpatsubst(m4_normalize([$2]), ['], ['\\''])'])
m4_if(m4_eval([$# > 2]), [1], [NA_SET_GLOBALLY(m4_shift2($@))])
m4_if(m4_eval([$# > 2]), [1], [NC_SET_GLOBALLY(m4_shift2($@))])
])


Expand Down
20 changes: 14 additions & 6 deletions m4/not-extended-config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ dnl latter is launched with an `--enable-extended-config` parameter.
dnl
dnl A good point of your `configure.ac` where to place `NC_THREATEN_FILES()`
dnl file is immediately after `AC_CONFIG_FILES()`. But you are free to place
dnl it anywere between `NC_CONFIG_SHADOW_DIR()` and `NC_SHADOW_MAYBE_OUT()`.
dnl it anywere between `NC_CONFIG_SHADOW_DIR()` and `NC_SHADOW_MAYBE_OUTPUT`.
dnl
dnl AC_CONFIG_FILES([
dnl Makefile
Expand Down Expand Up @@ -171,7 +171,7 @@ dnl - `NC_CONFNEW_DIR`: expands to the path of the sandbox directory
dnl (currently `confnew`)
dnl - `NC_SHADOW_DIR`: expands exactly to the argument passed to
dnl `NC_CONFIG_SHADOW_DIR()`
dnl - `NC_SHADOW_MAYBE_OUT`: finalizes the extended configuration mode
dnl - `NC_SHADOW_MAYBE_OUTPUT`: finalizes the extended configuration mode
dnl - `NC_THREATENED_LIST`: expands to the comma-separated list of the
dnl threatened files
dnl - `NC_THREATEN_BLINDLY`: recursively registers all the templates in
Expand Down Expand Up @@ -222,6 +222,7 @@ AC_DEFUN_ONCE([NC_CONFIG_SHADOW_DIR], [
AM_CONDITIONAL([HAVE_EXTENDED_CONFIG], [test "x${enable_extended_config}" != xno])
AM_CONDITIONAL([HAVE_UPDATES], [test "x${enable_extended_config}" = xsandbox])
AM_COND_IF([HAVE_EXTENDED_CONFIG], [AS_MKDIR_P(NC_CONFNEW_DIR)])
AC_DEFUN([NC_THREATEN_FILES], [
AM_COND_IF([HAVE_EXTENDED_CONFIG],
Expand All @@ -237,16 +238,23 @@ AC_DEFUN_ONCE([NC_CONFIG_SHADOW_DIR], [
]]])m4_if(m4_eval(][$][#][ > 1), [1],
[n4_anon(m4_shift(]m4_dquote(][$][@][)[))])])(][$][@][)[)
])
m4_ifdef([NC_SHADOW_REDEF], [m4_warn([syntax], [Redefined configure files ]m4_quote(NC_SHADOW_REDEF)[ - skip])])
m4_ifdef([NC_SHADOW_REDEF], [m4_warn([syntax], [redefined configure files ]m4_quote(NC_SHADOW_REDEF)[ - skip])])
])
AC_DEFUN_ONCE([NC_THREATEN_BLINDLY],
[NC_THREATEN_FILES(m4_shift(m4_bpatsubst(m4_quote(m4_esyscmd([find ']NC_SHADOW_DIR[' -type f -name '*.in' -printf ", [[%P{/@/}]]"])), [\.in{/@/}], [])))])
AC_DEFUN_ONCE([NC_SHADOW_MAYBE_OUTPUT], [
AM_COND_IF([HAVE_UPDATES],
[AC_MSG_NOTICE([Extended configuration has been saved in ./]NC_CONFNEW_DIR[.])],
[AM_COND_IF([HAVE_EXTENDED_CONFIG], [cp -rf ']NC_CONFNEW_DIR['/* ./ && rm -rf ']NC_CONFNEW_DIR['])])
m4_ifset([NC_THREATENED_LIST], [
AM_COND_IF([HAVE_UPDATES],
[AC_MSG_NOTICE([extended configuration has been saved in ./]NC_CONFNEW_DIR[.])],
[AM_COND_IF([HAVE_EXTENDED_CONFIG], [
cp -rf NC_CONFNEW_DIR/* ./ && rm -rf NC_CONFNEW_DIR
AC_MSG_NOTICE([extended configuration has been merged with the package tree.])
])])
], [
m4_warn([syntax], [NC_SHADOW_MAYBE_OUTPUT has been invoked but no files have been threatened.])
])
])
])
Expand Down
6 changes: 3 additions & 3 deletions m4/not-m4sugar.m4
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ dnl For example,
dnl
dnl n4_lambda([Hi there! Here it's $1!])([Rose])
dnl
dnl will print
dnl will expand to
dnl
dnl Hi there! Here it's Rose!
dnl
dnl Or, for instance, in the following code a lambda macro instead of a named
dnl one is passed to `m4_map()`:
dnl
dnl AC_DEFUN([MISSING_PROGRAMS], [[find], [xargs], [sed]])
dnl AC_MSG_ERROR([Install first m4_map([n4_lambda(["$1", ])], [MISSING_PROGRAMS])then proceed.])
dnl AC_MSG_ERROR([install first m4_map([n4_lambda(["$1", ])], [MISSING_PROGRAMS])then proceed.])
dnl
dnl The code above will print:
dnl
dnl Install first "find", "xargs", "sed", then proceed.
dnl install first "find", "xargs", "sed", then proceed.
dnl
dnl By using the `n4_anon` keyword, a lambda macro can invoke itself
dnl repeatedly (recursion). For example,
Expand Down
8 changes: 2 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Not Autotools",
"version": "0.6.0",
"version": "0.7.0",
"description": "A collection of awesome and self-documented M4-ish macros for GNU Autotools",
"homepage": "https://github.com/madmurphy/not-autotools",
"author": "[email protected]",
Expand All @@ -14,11 +14,7 @@
"autoconf": "*",
},
"src": [
"m4/not-automake.m4",
"m4/not-autoshell.m4",
"m4/not-autotools.m4",
"m4/not-m4sugar.m4",
"m4/not-misc.m4"
"m4/*.m4"
],
"bugs": {
"url": "https://github.com/madmurphy/not-autotools/issues",
Expand Down

0 comments on commit 0b7615e

Please sign in to comment.