aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2018-11-16 19:07:03 +0000
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2018-11-16 19:10:41 +0000
commit035e44f3bfdd814c4b7d8240011672ed625aed8d (patch)
tree612f3604fee775869462d3bc888ad88ce4a0eba1 /configure
parenta0ac5af0b21c79a65d8657f762ff5324bd2419ae (diff)
Configure script checks if static libraries will be built
The default Mac compiler has problems building static libraries. Since we are not yet building the GNU C Compiler as part of the pipeline, we'll have to rely on the host system's compiler. Therefore, a check is now added a the start of the configure script that will build a minimal program with the `-static' flag and if it fails, it will print a warning. Afterwards, none of the dependencies will be built with the `-static' flag.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure61
1 files changed, 57 insertions, 4 deletions
diff --git a/configure b/configure
index d60a34b..cc5bd88 100755
--- a/configure
+++ b/configure
@@ -406,8 +406,52 @@ ln -s $(pwd)/reproduce/config/gnuastro .gnuastro
-# Build basic dependencies
-# ------------------------
+# See if the C compiler can build static libraries
+# ------------------------------------------------
+oprog=$ddir/static-test
+cprog=$ddir/static-test.c
+echo "#include <stdio.h>" > $cprog
+echo "int main(void) {return 0;}" >> $cprog
+if [ x$CC = x ]; then CC=gcc; fi;
+if $CC $cprog -o$oprog -static -ljunk &> /dev/null; then
+ export static_build="yes"
+else
+ export static_build="no"
+fi
+rm -f $oprog $cprog
+if [ $static_build = "no" ]; then
+ cat <<EOF
+_________________________________________________________________________
+!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!
+
+Your system's C compiler ('$CC') doesn't support building static
+libraries. Therefore the dependencies will be built dynamically. This means
+that they will depend more strongly on changes/updates in the host
+system. For high-level applications (like most research projects in natural
+sciences), this shouldn't be a significant problem.
+
+But generally, for reproducibility, its better to build static libraries
+and programs. For more on their difference (and generally an introduction
+on linking), please see the link below:
+
+https://www.gnu.org/software/gnuastro/manual/html_node/Linking.html
+
+If you have other compilers on your system, you can select a different
+compiler by setting the 'CC' environment variable before running
+'./configure'.
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+EOF
+ sleep 5
+fi
+
+
+
+
+
+# Inform the user that the build process is starting
+# -------------------------------------------------
tsec=10
cat <<EOF
@@ -425,7 +469,15 @@ pipeline. They will be installed in:
EOF
sleep $tsec
-make -f reproduce/src/make/dependencies-basic.mk #-j2
+
+
+
+
+
+# Build Basic dependencies
+# ------------------------
+make -f reproduce/src/make/dependencies-basic.mk \
+ static_build=$static_build #-j2
@@ -438,7 +490,8 @@ make -f reproduce/src/make/dependencies-basic.mk #-j2
# Makefile. To make the job easier, we'll do it in a Makefile, not a
# script. Bash and Make were the tools we need to run Makefiles, so we had
# to build them in this script. But after this, we can rely on Makefiles.
-.local/bin/make -f reproduce/src/make/dependencies.mk #-j8
+./.local/bin/make -f reproduce/src/make/dependencies.mk \
+ static_build=$static_build #-j8