]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
configure: simplify config-host.h & config-host.mak generation
authorJeremy Kerr <jk@codeconstruct.com.au>
Tue, 12 Oct 2021 06:52:03 +0000 (14:52 +0800)
committerJeremy Kerr <jk@codeconstruct.com.au>
Tue, 12 Oct 2021 06:52:03 +0000 (14:52 +0800)
Create the configuration files using a here-string, rather than separate
commands.

While we're at it, fix the configure-command-line formatting in the .h
header.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
configure

index 91a56d0546fc69f9c8ca7eb6f1e4a8cd1145ffe4..feb39caa4ce9756a3189924df8495dbfc7de70f5 100755 (executable)
--- a/configure
+++ b/configure
@@ -98,18 +98,21 @@ print_config() {
 CFLAGS="-D_GNU_SOURCE -include config-host.h"
 BUILD_CFLAGS=""
 
+cmdstr=$(printf " '%s'" "$0" "$@")
 # Print configure header at the top of $config_host_h
-echo "/*" > $config_host_h
-echo " * Automatically generated by configure - do not modify" >> $config_host_h
-printf " * Configured with:" >> $config_host_h
-printf " * '%s'" "$0" "$@" >> $config_host_h
-echo "" >> $config_host_h
-echo " */" >> $config_host_h
-
-echo "# Automatically generated by configure - do not modify" > $config_host_mak
-printf "# Configured with:" >> $config_host_mak
-printf " '%s'" "$0" "$@" >> $config_host_mak
-echo >> $config_host_mak
+cat > $config_host_h <<EOF
+/*
+ * Automatically generated by configure - do not modify
+ * Configured with:
+ * $cmdstr
+ */
+EOF
+
+cat > $config_host_mak <<EOF
+# Automatically generated by configure - do not modify
+# Configured with:
+# $cmdstr
+EOF
 
 do_cc() {
     # Run the compiler, capturing its output to the log.