#!/bin/sh set -e # Show the usage screen show_help(){ cat <> configure.mk ;; --disable-static) ;; *=*) printf '%s\n' "${arg?}" >> configure.mk printf 'set %s\n' "$arg" ;; *) show_help; exit 1 ;; esac done # Truncate the current configuration : > configure.mk # Platform information printf 'Running on ' case $(uname -s) in Linux*) echo 'Linux' ;; Darwin*) echo 'Mac' ;; CYGWIN*|MSYS*|MINGW*) echo 'Windows' ;; *) echo 'unknown OS' ;; esac os=$(uname -r) printf 'OS version %s\n' "$os" # Architecture information arch=$(uname -m) printf 'Processor architecture %s\n' "$arch" # Variables with a default printf '%s=%s\n' PREFIX "${PREFIX:-/usr/local}" >> configure.mk # Detect the Fortran compiler for FC in "$FC" ifort gfortran f77; do check "$FC" && break done # shellcheck disable=SC2181 if [ $? -ne 0 ]; then printf 'Fortran compiler not found: cannot proceed\n' exit 1 fi printf 'using %s as Fortran compiler\n' "$FC" printf '%s=%s\n' FC "$FC" >> configure.mk