aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2018-12-03 04:51:45 +0000
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2018-12-03 05:27:32 +0000
commitcbd448bb7412e147fc1c22406c458c71954535cb (patch)
treef8e3178f16e98ba1a3fc694c3efc582ae33516f6 /configure
parent952cdacb25ac690a3206e48673168ed8de4a4056 (diff)
Preference for shared library linking
Some high-level programs like Wget and cURL need to be built in shared mode because they also include dynamic loading of libraries. Therefore, if we only build the lower-level libraries in static mode, our own build will be ignored and they will go and find the system's shared libraries to link with. Because of this, for now, we have manually set the `static_build' variable in the configure script to `no'. Also, if the downloader fails, we'll delete the output (an empty file in the case of Wget) because it interefers with a target definition.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure92
1 files changed, 51 insertions, 41 deletions
diff --git a/configure b/configure
index fc2adc7..5fddc73 100755
--- a/configure
+++ b/configure
@@ -502,43 +502,56 @@ ln -s $(pwd)/reproduce/config/gnuastro .gnuastro
# See if the C compiler can build static libraries
# ------------------------------------------------
-oprog=$depdir/static-test
-cprog=$depdir/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 &> /dev/null; then
- export static_build="yes"
-else
- export static_build="no"
-fi
-rm -f $oprog $cprog
-if [ $printnotice = yes ] && [ $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
+# We are manually only working with shared libraries: because some
+# high-level programs like Wget and cURL need dynamic linking and if we
+# build the libraries statically, our own builds will be ignored and these
+# programs will go and find their necessary libraries on the host system.
+#
+# Another good advantage of shared libraries is that we can actually use
+# the shared library tool of the system (`ldd' with GNU C Library) and see
+# exactly where each linked library comes from. But in static building,
+# unless you follow the build closely, its not easy to see if the source of
+# the library came from the system or our build.
+static_build=no
+
+#oprog=$depdir/static-test
+#cprog=$depdir/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 &> /dev/null; then
+# export static_build="yes"
+#else
+# export static_build="no"
+#fi
+#rm -f $oprog $cprog
+#if [ $printnotice = yes ] && [ $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
@@ -628,13 +641,10 @@ fi
if which nproc > /dev/null 2>/dev/null; then numthreads=$(nproc --all);
else numthreads=2;
fi
-#######################################
-#static_build=no
-#######################################
make -f reproduce/src/make/dependencies-basic.mk \
static_build=$static_build \
needs_ldl=$needs_ldl \
- #-j$numthreads
+ -j$numthreads
@@ -651,7 +661,7 @@ numthreads=$($instdir/bin/nproc)
./.local/bin/make -f reproduce/src/make/dependencies.mk \
static_build=$static_build \
rpath_command=$rpath_command \
- #-j$numthreads
+ -j$numthreads