Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added automatic detection of quadmath library to configure.ac, while … #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rm -f */*.o
rm -f */*.so
34 changes: 34 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -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.])],
Expand Down Expand Up @@ -33,6 +34,39 @@ 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],
[],
[AC_MSG_ERROR([unable to find the quadmath libary!])]
)
fi

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

# 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

AC_OUTPUT()

5 changes: 0 additions & 5 deletions src/Makevars

This file was deleted.