build: Run tr only once in configure.ac.
authorAndre Noll <maan@systemlinux.org>
Sat, 19 Apr 2014 22:53:00 +0000 (22:53 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 26 Oct 2014 12:15:53 +0000 (13:15 +0100)
The configure script creates the subsystem error enums for config.h
from the list of object file names by turning the base name into
upper case and prepending "SS_". For the conversion to upper case we
currently execute the tr command once for each object.

This patch changes the corresponding shell code of configure.ac to
first build the full enum and then turn all words into upper case
in one go. This way tr is only executed once which should save us a
few cycles.

configure.ac

index 6f8878a3e09c5b8b30f4f42f4a43825000b3c7a9..e4010bdeb0800dbea6ac63e073264666ad0f249e 100644 (file)
@@ -1541,9 +1541,8 @@ done
 # use echo to replace newlines by space
 AC_SUBST(object_executable_matrix, $(echo $object_executable_matrix))
 
 # use echo to replace newlines by space
 AC_SUBST(object_executable_matrix, $(echo $object_executable_matrix))
 
-for obj in $all_errlist_objs; do
-       SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
-done
+SS=$(for obj in $all_errlist_objs; do
+       printf '%s' " SS_$obj,"; done | tr 'a-z' 'A-Z')
 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
        [enum {$SS NUM_SS}],
        [list of all objects that use the paraslash error facility]
 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
        [enum {$SS NUM_SS}],
        [list of all objects that use the paraslash error facility]