aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2019-07-07 22:27:20 +0100
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2019-07-07 22:27:20 +0100
commitdb322d5bfef46f3b7ad11d3c8b26f45f5ec1dc1a (patch)
treee94df37735cb8d733cd754f13eaf8832a640206a /configure
parent1643e10563fa8d68f1643fbc4e6df3ecfac57449 (diff)
Compiler checks added to the configure script
To build the software, we need a C/C++ compiler. But until now at configure time there was no check on this. As a result, when the system didn't have them, the user would only learn in a crash of the programs. With this commit, some checks have been added at configure time to do basic checks and inform the user if necessary.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure77
1 files changed, 77 insertions, 0 deletions
diff --git a/configure b/configure
index 5e089c1..61e8469 100755
--- a/configure
+++ b/configure
@@ -710,6 +710,45 @@ ln -s $topdir/reproduce/software/config/gnuastro .gnuastro
+# Check for C/C++ compilers
+# -------------------------
+#
+# To build the software, we'll need some basic tools (the compilers in
+# particular) to be present.
+hascc=0;
+if type cc > /dev/null 2>/dev/null; then
+ if type c++ > /dev/null 2>/dev/null; then hascc=1; fi
+else
+ if type gcc > /dev/null 2>/dev/null; then
+ if type g++ > /dev/null 2>/dev/null; then hascc=1; fi
+ else
+ if type clang > /dev/null 2>/dev/null; then
+ if type clang++ > /dev/null 2>/dev/null; then hascc=1; fi
+ fi
+ fi
+fi
+if [ $hascc = 0 ]; then
+ cat <<EOF
+______________________________________________________
+!!!!!!! C/C++ Compiler NOT FOUND !!!!!!!
+
+To build the project's software, the host system needs to have basic C and
+C++ compilers. The executables that were checked are 'cc', 'gcc' and
+'clang' for a C compiler, and 'c++', 'g++' and 'clang++' for a C++
+compiler. If you have a relevant compiler that is not checked, please get
+in touch with us (with the form below) so we add it:
+
+ https://savannah.nongnu.org/support/?func=additem&group=reproduce
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+EOF
+ exit 1
+fi
+
+
+
+
+
# See if the C compiler can build static libraries
# ------------------------------------------------
@@ -1004,6 +1043,44 @@ fi
+# Fortran compiler
+# ----------------
+#
+# If GCC is ultimately build within the project, the user won't need to
+# have a fortran compiler, we'll build it internally for high-level
+# programs. However, when the host C compiler is to be used, the user needs
+# to have a Fortran compiler available.
+if [ $host_cc = 1 ]; then
+ hasfc=0;
+ if type gfortran > /dev/null 2>/dev/null; then hasfc=1; fi
+
+ if [ $hasfc = 0 ]; then
+ cat <<EOF
+______________________________________________________
+!!!!!!! Fortran Compiler NOT FOUND !!!!!!!
+
+Because the project won't be building its own GCC (which includes a Fortran
+compiler), you need to have a Fortran compiler available. Fortran is
+commonly necessary for many lower-level scientific programs. Currently we
+search for 'gfortran'. If you have a Fortran compiler that is not checked,
+please get in touch with us (with the form below) so we add it:
+
+ https://savannah.nongnu.org/support/?func=additem&group=reproduce
+
+Note: GCC will not be built because you are either using the '--host-cc'
+option, or you are using an operating system that currently has bugs when
+building GCC.
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+EOF
+ exit 1
+ fi
+fi
+
+
+
+
+
# Number of threads for basic builds
# ----------------------------------
#