aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2021-08-05 16:55:53 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2021-08-05 16:55:53 -0400
commitfc92f346a1e86c02f15896966428857b1de41f5f (patch)
treec2bf85c15d3fd2aec1ec1ac2f16014cea3f7f8cb
parentb58c466b3651d53718ac53edd77981ba67192c8a (diff)
downloadmoog-fc92f346a1e86c02f15896966428857b1de41f5f.tar.gz
Add help option to configure script
* Add FC compiler variable to makefile template
-rw-r--r--Makefile.in2
-rwxr-xr-xconfigure34
2 files changed, 28 insertions, 8 deletions
diff --git a/Makefile.in b/Makefile.in
index 6f7dc9a..fbf099f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -36,7 +36,7 @@ COMMON = Atmos.com Dummy.com Equivs.com Factor.com Kappa.com Linex.com \
X11LIB = @WITH_X11@
SMLIB = @WITH_SM@
-FC = gfortran
+FC = @FC@
FFLAGS = @FFLAGS@
LDFLAGS = -L$(X11LIB) -lX11 -ltcl -ltk -L$(SMLIB) -lplotsub -ldevices -lutils
diff --git a/configure b/configure
index eaa9884..ce1af78 100755
--- a/configure
+++ b/configure
@@ -1,11 +1,23 @@
#!/bin/bash
+CC=${CC:-gcc}
+FC=${FC:-gfortran}
with_x11="/usr/X11/lib"
with_sm="/usr/local/sm"
fflags=(-Wall -Wextra -ff2c -fdefault-double-8 -fdefault-real-8)
-
-gcc_version=$(gcc --version | head -n 1 | awk -F' ' '{ print $3 }')
+gcc_version=$($CC --version | head -n 1 | awk -F' ' '{ print $3 }')
gcc_major="${gcc_version%%\.*}"
+
+function do_help() {
+ printf "Options:
+ --help (-h) Display this message
+ --prefix Path to install MOOG
+ --bindir Path to install MOOG binaries (default: PREFIX/bin)
+ --datadir Path to install MOOG data files (default: PREFIX/share/moog)
+ --with-x11 Path to X11 library
+ --with-sm Path to SuperMongo libraries\n"
+}
+
if (( $gcc_major >= 10 )); then
fflags+=(--allow-argument-mismatch)
fi
@@ -18,7 +30,7 @@ for x in $@; do
argv+=($key)
argv+=($value)
else
- argv+=(x)
+ argv+=($x)
fi
done
@@ -29,6 +41,10 @@ while [[ $i < $nargs ]]; do
key="${argv[$i]}"
value="${argv[$i+1]}"
case "$key" in
+ --help|-h)
+ do_help
+ exit 0
+ ;;
--prefix)
prefix="$value"
(( i++ ))
@@ -57,23 +73,27 @@ done
[[ -z "${bindir}" ]] && bindir="${prefix}/bin"
[[ -z "${datadir}" ]] && datadir="${prefix}/share/moog"
fflags="${fflags[@]}"
+
sed "s|@PREFIX@|${prefix}|g;\
s|@BINDIR@|${bindir}|g;\
s|@DATADIR@|${datadir}|g;\
s|@FFLAGS@|${fflags}|g;\
s|@WITH_X11@|${with_x11}|g;\
s|@WITH_SM@|${with_sm}|g;\
+ s|@FC@|${FC}|g;\
" Makefile.in > Makefile
sed "s|@MOOGPATH_DEFAULT@|${datadir}/|" Moog.f.in > Moog.f
printf "
Configured with:
-Installation prefix ... %s
-X11 library ........... %s
-SuperMongo library .... %s
+GCC version ........... $gcc_version
+Fortran compiler ...... $FC
+Installation prefix ... $prefix
+X11 library ........... $with_x11
+SuperMongo library .... $with_sm
Run 'make' to compile
Run 'make install' to install
+"
-" $prefix $with_x11 $with_sm