From d5edbb905cd1cdb656706e54e6dc32ca9e6770a0 Mon Sep 17 00:00:00 2001 From: Bartosz Kostrzewa Date: Wed, 27 Jun 2018 10:48:19 +0200 Subject: [PATCH 1/4] Added automatic detection of quadmath library to configure.ac, while preserving the custom setting of paths via install.src, if desired. When gsl and quadmath are installed in default paths, sourcing of install.src is not required to insteall rzeta --- configure.ac | 26 ++++++++++++++++++++++++++ src/Makevars | 5 ----- 2 files changed, 26 insertions(+), 5 deletions(-) delete mode 100644 src/Makevars diff --git a/configure.ac b/configure.ac index e50e71f..3f35e1e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,7 @@ AC_INIT([src/qzeta_function.c]) AC_PROG_CXX + AC_CHECK_LIB(gsl, gsl_sf_airy_Ai_e, [LIBS="${LIBS} -lgsl -lgslcblas"], [AC_MSG_ERROR([Cannot find Gnu Scientific Library.])], @@ -33,6 +34,31 @@ else AC_MSG_RESULT([yes]) fi +AC_SEARCH_LIBS([expq], + [quadmath], + [], + [AC_MSG_ERROR([unable to find the quadmath libary!])] + ) + +gsl_custom_lib="" +gsl_custom_include="" +if test -n "${GSL_DIR}"; then + gsl_custom_lib="-L${GSL_DIR}/lib -lgsl -lgslcblas" + gsl_custom_include="-I${GSL_DIR}/include" +fi + +quadmath_custom_lib="" +quadmath_custom_include="" +if test -n "${QUADMATH_LIB_DIR}"; then + quadmath_custom_lib="-L${QUADMATH_LIB_DIR}/ -lquadmath" +fi +if test -n "${QUADMATH_INCLUDE_DIR}"; then + quadmath_custom_include="-I${QUADMATH_INCLUDE_DIR}/" +fi + +echo "PKG_LIBS=-lm ${LIBS} ${quadmath_custom_lib} ${gsl_custom_lib}" > src/Makevars +echo "PKG_CFLAGS=-march=native -mtune=native -O3 -Wall ${quadmath_custom_include} ${gsl_custom_include}" >> src/Makevars +echo "PKG_LDFLAGS=-lm ${LIBS} ${gsl_custom_lib} ${quadmath_custom_lib}" >> src/Makevars AC_OUTPUT() diff --git a/src/Makevars b/src/Makevars deleted file mode 100644 index 8887bf3..0000000 --- a/src/Makevars +++ /dev/null @@ -1,5 +0,0 @@ -# So 19. Nov 15:42:30 CET 2017 - -PKG_LIBS=-L${GSL_DIR}/lib -lgsl -lgslcblas -L${QUADMATH_LIB_DIR}/ -lquadmath -lm -PKG_CFLAGS=-I${GSL_DIR}/include -I${QUADMATH_INCLUDE_DIR}/ -O3 -Wall -PKG_LDFLAGS=-L${GSL_DIR}/lib/ -lgsl -lgslcblas -L${QUADMATH_LIB_DIR}/ -lquadmath -lm From 5f13b51a6d9615640be2cd0ee9d8aca058496f00 Mon Sep 17 00:00:00 2001 From: Bartosz Kostrzewa Date: Wed, 27 Jun 2018 12:15:06 +0200 Subject: [PATCH 2/4] enable quadmath library detection in configure only if no custom path has been specified --- configure.ac | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 3f35e1e..ef7a0cc 100644 --- a/configure.ac +++ b/configure.ac @@ -34,11 +34,13 @@ else AC_MSG_RESULT([yes]) fi -AC_SEARCH_LIBS([expq], - [quadmath], - [], - [AC_MSG_ERROR([unable to find the quadmath libary!])] - ) +if test -z "${QUADMATH_LIB_DIR}"; then + AC_SEARCH_LIBS([expq], + [quadmath], + [], + [AC_MSG_ERROR([unable to find the quadmath libary!])] + ) +fi gsl_custom_lib="" gsl_custom_include="" From b16920d8a06f0d8f2d990ec88d9cf6bcab5d50f0 Mon Sep 17 00:00:00 2001 From: Bartosz Kostrzewa Date: Thu, 28 Jun 2018 16:44:13 +0200 Subject: [PATCH 3/4] add some comments to configure.ac --- configure.ac | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/configure.ac b/configure.ac index ef7a0cc..00790e6 100644 --- a/configure.ac +++ b/configure.ac @@ -34,6 +34,11 @@ else AC_MSG_RESULT([yes]) fi +# if the user has not specified a library path for the quadmath library +# we try to auto-detect it +# currenty, if we fail to find it, we abort compilation +# in the future one could disable the quad precision +# implementation in this case if test -z "${QUADMATH_LIB_DIR}"; then AC_SEARCH_LIBS([expq], [quadmath], @@ -58,6 +63,7 @@ if test -n "${QUADMATH_INCLUDE_DIR}"; then quadmath_custom_include="-I${QUADMATH_INCLUDE_DIR}/" fi +# construct src/Makevars with the manually or automatically detected library paths and flags echo "PKG_LIBS=-lm ${LIBS} ${quadmath_custom_lib} ${gsl_custom_lib}" > src/Makevars echo "PKG_CFLAGS=-march=native -mtune=native -O3 -Wall ${quadmath_custom_include} ${gsl_custom_include}" >> src/Makevars echo "PKG_LDFLAGS=-lm ${LIBS} ${gsl_custom_lib} ${quadmath_custom_lib}" >> src/Makevars From 64798f2cccdc70a495144a0fcb06eee7c84668c2 Mon Sep 17 00:00:00 2001 From: Bartosz Kostrzewa Date: Thu, 28 Jun 2018 16:45:10 +0200 Subject: [PATCH 4/4] add script to clean the build directory, such that rebuilding works properly --- clean.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 clean.sh diff --git a/clean.sh b/clean.sh new file mode 100755 index 0000000..41e1170 --- /dev/null +++ b/clean.sh @@ -0,0 +1,2 @@ +rm -f */*.o +rm -f */*.so