From 27d3bb906b843a38c371e66372745095ccaceef6 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Thu, 28 Mar 2019 11:51:37 +0000 Subject: Configure script now has options With the options, it is now possible to run the configure script more easily after the initial run. The `--help' option provides a nice and complete introduction along with a listing of the input options and the `-j' option can be use to manually set the number of threads. --- .file-metadata | Bin 4158 -> 4141 bytes configure | 294 +++++++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 254 insertions(+), 40 deletions(-) diff --git a/.file-metadata b/.file-metadata index ac0a6cb..18e0cd8 100644 Binary files a/.file-metadata and b/.file-metadata differ diff --git a/configure b/configure index c34a68a..3e0a7f0 100755 --- a/configure +++ b/configure @@ -34,6 +34,199 @@ set -e +# Output of --help +# ---------------- +me=$0 # Executable file name. +help_print() { + + if [ x"$build_dir" = x ]; then + bdir_status="NOT SET" + else + bdir_status="$build_dir" + fi + + if [ x"$input_dir" = x ]; then + indir_status="NOT SET" + else + indir_status="$input_dir" + fi + + if [ x"$software_dir" = x ]; then + software_status="NOT SET" + else + software_status="$software_dir" + fi + + if [ $in_minmapsize = 0 ]; then + mm_status="NOT SET" + else + mm_status="$in_minmapsize" + fi + + if [ $jobs = "0" ]; then + jobs_status="NUMBER OF THREADS ON SYSTEM" + else + jobs_status=$jobs + fi + + if [ $existing_conf = 1 ]; then + ec_status="ACTIVATED" + else + ec_status="NOT SET" + fi + + # Print the output. + cat < /dev/null; then - bdir=$(absolute_dir $inbdir) + if [ -d $build_dir ]; then + if mkdir $build_dir/$junkname 2> /dev/null; then + bdir=$(absolute_dir $build_dir) echo " -- Build directory: '$bdir'" - rm -rf $inbdir/$junkname + rm -rf $build_dir/$junkname else - echo " -- Can't write in '$inbdir'" + echo " -- Can't write in '$build_dir'" fi else - if mkdir $inbdir 2> /dev/null; then - bdir=$(absolute_dir $inbdir) + if mkdir $build_dir 2> /dev/null; then + bdir=$(absolute_dir $build_dir) echo " -- Build directory set to (the newly created): '$bdir'" else - echo " -- Can't create '$inbdir'" + echo " -- Can't create '$build_dir'" fi fi + + # Reset `build_dir' to blank, so it continues asking when the + # previous value wasn't usable. + build_dir= done fi @@ -291,12 +480,16 @@ fi # Input directory # --------------- -indir=$optionaldir +if [ x"$input_dir" = x ]; then + indir=$optionaldir +else + indir=$input_dir +fi wfpc2name=$(awk '!/^#/ && $1=="WFPC2IMAGE" {print $3}' $pdir/INPUTS.mk) wfpc2md5=$(awk '!/^#/ && $1=="WFPC2MD5" {print $3}' $pdir/INPUTS.mk) wfpc2size=$(awk '!/^#/ && $1=="WFPC2SIZE" {print $3}' $pdir/INPUTS.mk) wfpc2url=$(awk '!/^#/ && $1=="WFPC2URL" {print $3}' $pdir/INPUTS.mk) -if [ $rewritepconfig = yes ]; then +if [ $rewritepconfig = yes ] && [ x"$input_dir" = x ]; then cat < /dev/null 2>/dev/null; then numthreads=$(nproc --all); -else numthreads=1; +# Since the system might not have GNU Make at this stage, and other Make +# implementations can't deal with parallel build properly, we'll just +# default to 1 thread. This is because some versions of Make complain about +# not having enough 'pipe' (memory) on some systems. After some searching, +# I found out its because of too many threads. GNU Make will be present on +# GNU systems (that have `nproc', part of GNU Coreutils). So to simplify +# the test for GNU Make, we'll just try running `nproc'. +if which nproc > /dev/null 2>/dev/null; then + if [ $jobs = 0 ]; then + numthreads=$(nproc --all); + else + numthreads=$jobs + fi +else + numthreads=1; fi make -f reproduce/src/make/dependencies-basic.mk \ rpath_command=$rpath_command \ -- cgit v1.2.1