From 035e44f3bfdd814c4b7d8240011672ed625aed8d Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi <mohammad@akhlaghi.org> Date: Fri, 16 Nov 2018 19:07:03 +0000 Subject: 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. --- configure | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 4 deletions(-) (limited to 'configure') 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 -- cgit v1.2.1