From 004f2a63b4d2ab414be436a950876361618099f9 Mon Sep 17 00:00:00 2001 From: ayekat Date: Mon, 24 Apr 2017 08:46:35 +0200 Subject: Make mk/configure fully POSIX-compliant POSIX only states that file descriptors between 0 and 9 must be guaranteed to work correctly. Numbers above 9 may not work on all shells (most notably on ksh and dash, latter used as /bin/sh on some Linux systems). This patch changes the used file descriptor numbers from 10, 20 and 30 to 3, 4 and 5. --- mk/configure | 194 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 97 insertions(+), 97 deletions(-) (limited to 'mk/configure') diff --git a/mk/configure b/mk/configure index 4b6e61a..c9cc45e 100644 --- a/mk/configure +++ b/mk/configure @@ -23,10 +23,10 @@ # Store command for rebuilding Makefile to config.status. -exec 10>config.status +exec 3>config.status # Store configurations to .config.mk. -exec 20>.config.mk +exec 4>.config.mk # Print a quoted (if necessary) version of a string @@ -233,14 +233,14 @@ for option; do # feature tweaking (--with-*) feature="WITH_${feature}" - echo "${feature}" = yes >&20 + echo "${feature}" = yes >&4 export "${feature}"=yes option="${option}=x" ;; (--without-*) feature="WITHOUT_${feature}" - echo "${feature}" = yes >&20 + echo "${feature}" = yes >&4 export "${feature}"=yes option="${option}=x" ;; @@ -254,20 +254,20 @@ for option; do feature="DISABLE_${feature}" param=yes fi - echo "${feature}" = "${param}" >&20 + echo "${feature}" = "${param}" >&4 export "${feature}"="${param}" ;; (--enable-*) feature="DISABLE_${feature}" - echo "${feature}" = yes >&20 + echo "${feature}" = yes >&4 export "${feature}"=yes option="${option}=x" ;; (--disable-*) feature="DISABLE_${feature}" - echo "${feature}" = yes >&20 + echo "${feature}" = yes >&4 export "${feature}"=yes option="${option}=x" ;; @@ -287,7 +287,7 @@ for option; do printf "\e[01;31m%s: warning: ignoring because of bad format: %s\e[00m\n" "${0}" "${option}" >&2 sleep 1 fi - echo "${var}" = "${val}" >&20 + echo "${var}" = "${val}" >&4 ;; # unrecognised @@ -538,26 +538,26 @@ fi # Add shebang and "generated"-comment to config.status. -echo '#!/bin/sh' >&10 -echo >&10 -echo '# This file was generated by ./configure, its purpose is two-fold:' >&10 -echo '# 1) It lets you rebuild Makefile with the same configurations you' >&10 -echo '# used last time you run ./configure.' >&10 -echo '# 2) It lets Makefile rebuild itself transparently when out of date.' >&10 -echo >&10 +echo '#!/bin/sh' >&3 +echo >&3 +echo '# This file was generated by ./configure, its purpose is two-fold:' >&3 +echo '# 1) It lets you rebuild Makefile with the same configurations you' >&3 +echo '# used last time you run ./configure.' >&3 +echo '# 2) It lets Makefile rebuild itself transparently when out of date.' >&3 +echo >&3 # config.status should adjust CWD. -echo 'cd "$(dirname "${0}")"' >&10 +echo 'cd "$(dirname "${0}")"' >&3 # config.status calls ./configure with all arguments you called ./configure. -printf "exec %s" "${0}" >&10 +printf "exec %s" "${0}" >&3 for option; do - printf " %s" "$(quote "${option}")" >&10 + printf " %s" "$(quote "${option}")" >&3 done -echo >&10 +echo >&3 # Close config.status. -exec 10>&- +exec 3>&- # Store environment (with restrictions). @@ -577,99 +577,99 @@ env | while read line; do # We do not want to propagate these. ;; (*) - echo "${var}" = "${val}" >&20 + echo "${var}" = "${val}" >&4 ;; esac done # Store directories and filenames. if test -n "${destdir}"; then - echo DESTDIR = "${destdir}" >&20 + echo DESTDIR = "${destdir}" >&4 fi -echo PREFIX = "${prefix}" >&20 -echo SYSCONFDIR = "${sysconfdir}" >&20 -echo COMDIR = "${sharedstatedir}" >&20 -echo VARDIR = "${localstatedir}" >&20 -echo RUNDIR = "${runstatedir}" >&20 -echo TMPDIR = "${tmpdir}" >&20 -echo DEVDIR = "${devdir}" >&20 -echo SYSDIR = "${sysdir}" >&20 -echo PROCDIR = "${procdir}" >&20 -echo EXEC_PREFIX = "${exec_prefix}" >&20 -echo BINDIR = "${bindir}" >&20 -echo SBINDIR = "${sbindir}" >&20 -echo LIBEXECDIR = "${libexecdir}" >&20 -echo LIBDIR = "${libdir}" >&20 -echo INCLUDEDIR = "${includedir}" >&20 -echo OLDINCLUDEDIR = "${oldincludedir}" >&20 -echo DATADIR = "${datarootdir}" >&20 -echo RESDIR = "${datadir}" >&20 -echo SYSDEPDATADIR = "${libdatarootdir}" >&20 -echo SYSDEPRESDIR = "${libdatadir}" >&20 -echo LISPDIR = "${lispdir}" >&20 -echo LOCALEDIR = "${localedir}" >&20 -echo LICENSEDIR = "${licensedir}" >&20 -echo CACHEDIR = "${cachedir}" >&20 -echo SPOOLDIR = "${spooldir}" >&20 -echo EMPTYDIR = "${emptydir}" >&20 -echo LOGDIR = "${logdir}" >&20 -echo STATEDIR = "${statedir}" >&20 -echo GAMEDIR = "${gamedir}" >&20 -echo COMCACHEDIR = "${sharedcachedir}" >&20 -echo COMPOOLDIR = "${sharedpooldir}" >&20 -echo COMLOGDIR = "${sharedlogdir}" >&20 -echo COMSTATEDIR = "${sharedstatedir}" >&20 -echo COMGAMEDIR = "${sharedgamedir}" >&20 -echo LOCALTMPDIR = "${localtmpdir}" >&20 -echo SHAREDTMPDIR = "${sharedtmpdir}" >&20 -echo LOCKDIR = "${lockdir}" >&20 -echo SKELDIR = "${skeldir}" >&20 -echo SELFPROCDIR = "${selfprocdir}" >&20 -echo DOCDIR = "${docdir}" >&20 -echo INFODIR = "${infodir}" >&20 -echo DVIDIR = "${dvidir}" >&20 -echo PDFDIR = "${pdfdir}" >&20 -echo PSDIR = "${psdir}" >&20 -echo HTMLDIR = "${htmldir}" >&20 -echo MANDIR = "${mandir}" >&20 -echo MAN0 = "${man0}" >&20 -echo MAN1 = "${man1}" >&20 -echo MAN2 = "${man2}" >&20 -echo MAN3 = "${man3}" >&20 -echo MAN4 = "${man4}" >&20 -echo MAN5 = "${man5}" >&20 -echo MAN6 = "${man6}" >&20 -echo MAN7 = "${man7}" >&20 -echo MAN8 = "${man8}" >&20 -echo MAN9 = "${man9}" >&20 -echo MAN0EXT = "${man0ext}" >&20 -echo MAN1EXT = "${man1ext}" >&20 -echo MAN2EXT = "${man2ext}" >&20 -echo MAN3EXT = "${man3ext}" >&20 -echo MAN4EXT = "${man4ext}" >&20 -echo MAN5EXT = "${man5ext}" >&20 -echo MAN6EXT = "${man6ext}" >&20 -echo MAN7EXT = "${man7ext}" >&20 -echo MAN8EXT = "${man8ext}" >&20 -echo MAN9EXT = "${man9ext}" >&20 +echo PREFIX = "${prefix}" >&4 +echo SYSCONFDIR = "${sysconfdir}" >&4 +echo COMDIR = "${sharedstatedir}" >&4 +echo VARDIR = "${localstatedir}" >&4 +echo RUNDIR = "${runstatedir}" >&4 +echo TMPDIR = "${tmpdir}" >&4 +echo DEVDIR = "${devdir}" >&4 +echo SYSDIR = "${sysdir}" >&4 +echo PROCDIR = "${procdir}" >&4 +echo EXEC_PREFIX = "${exec_prefix}" >&4 +echo BINDIR = "${bindir}" >&4 +echo SBINDIR = "${sbindir}" >&4 +echo LIBEXECDIR = "${libexecdir}" >&4 +echo LIBDIR = "${libdir}" >&4 +echo INCLUDEDIR = "${includedir}" >&4 +echo OLDINCLUDEDIR = "${oldincludedir}" >&4 +echo DATADIR = "${datarootdir}" >&4 +echo RESDIR = "${datadir}" >&4 +echo SYSDEPDATADIR = "${libdatarootdir}" >&4 +echo SYSDEPRESDIR = "${libdatadir}" >&4 +echo LISPDIR = "${lispdir}" >&4 +echo LOCALEDIR = "${localedir}" >&4 +echo LICENSEDIR = "${licensedir}" >&4 +echo CACHEDIR = "${cachedir}" >&4 +echo SPOOLDIR = "${spooldir}" >&4 +echo EMPTYDIR = "${emptydir}" >&4 +echo LOGDIR = "${logdir}" >&4 +echo STATEDIR = "${statedir}" >&4 +echo GAMEDIR = "${gamedir}" >&4 +echo COMCACHEDIR = "${sharedcachedir}" >&4 +echo COMPOOLDIR = "${sharedpooldir}" >&4 +echo COMLOGDIR = "${sharedlogdir}" >&4 +echo COMSTATEDIR = "${sharedstatedir}" >&4 +echo COMGAMEDIR = "${sharedgamedir}" >&4 +echo LOCALTMPDIR = "${localtmpdir}" >&4 +echo SHAREDTMPDIR = "${sharedtmpdir}" >&4 +echo LOCKDIR = "${lockdir}" >&4 +echo SKELDIR = "${skeldir}" >&4 +echo SELFPROCDIR = "${selfprocdir}" >&4 +echo DOCDIR = "${docdir}" >&4 +echo INFODIR = "${infodir}" >&4 +echo DVIDIR = "${dvidir}" >&4 +echo PDFDIR = "${pdfdir}" >&4 +echo PSDIR = "${psdir}" >&4 +echo HTMLDIR = "${htmldir}" >&4 +echo MANDIR = "${mandir}" >&4 +echo MAN0 = "${man0}" >&4 +echo MAN1 = "${man1}" >&4 +echo MAN2 = "${man2}" >&4 +echo MAN3 = "${man3}" >&4 +echo MAN4 = "${man4}" >&4 +echo MAN5 = "${man5}" >&4 +echo MAN6 = "${man6}" >&4 +echo MAN7 = "${man7}" >&4 +echo MAN8 = "${man8}" >&4 +echo MAN9 = "${man9}" >&4 +echo MAN0EXT = "${man0ext}" >&4 +echo MAN1EXT = "${man1ext}" >&4 +echo MAN2EXT = "${man2ext}" >&4 +echo MAN3EXT = "${man3ext}" >&4 +echo MAN4EXT = "${man4ext}" >&4 +echo MAN5EXT = "${man5ext}" >&4 +echo MAN6EXT = "${man6ext}" >&4 +echo MAN7EXT = "${man7ext}" >&4 +echo MAN8EXT = "${man8ext}" >&4 +echo MAN9EXT = "${man9ext}" >&4 # Close .config.mk. -exec 20>&- +exec 4>&- # Now, make Makefile available. if test -f Makefile; then chmod u+w Makefile # This scripts makes it read-only. fi -exec 30>Makefile -echo "# ----------------------------------------------------- #" >&30 -echo "# This file was created by ./configure from Makefile.in #" >&30 -echo "# ----------------------------------------------------- #" >&30 -echo >&30 +exec 5>Makefile +echo "# ----------------------------------------------------- #" >&5 +echo "# This file was created by ./configure from Makefile.in #" >&5 +echo "# ----------------------------------------------------- #" >&5 +echo >&5 if test -n "${srcdir}"; then - echo v = "${srcdir}" >&30 + echo v = "${srcdir}" >&5 fi -cat "${srcdir_proper}"Makefile.in >&30 -exec 30>&- +cat "${srcdir_proper}"Makefile.in >&5 +exec 5>&- # config.status should be executable. -- cgit v1.2.3-70-g09d2