Skip to content

Commit

Permalink
upd configure
Browse files Browse the repository at this point in the history
  • Loading branch information
nilason committed Sep 4, 2024
1 parent 46a58df commit 17c9c62
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 64 deletions.
1 change: 0 additions & 1 deletion .github/workflows/apt.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
bison
build-essential
flex
libblas-dev
libbz2-dev
libcairo-dev
libfftw3-dev
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_ubuntu-22.04.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export INSTALL_PREFIX=$1
--with-cxx \
--with-zstd \
--with-bzlib \
--with-blas=blas-netlib \
--with-blas=openblas \
--with-lapack \
--with-libsvm \
--with-readline \
Expand Down
56 changes: 28 additions & 28 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -13736,8 +13736,8 @@ fi # $USE_FFTW

# Enable BLAS option

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use BLAS" >&5
printf %s "checking whether to use BLAS... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use (C)BLAS" >&5
printf %s "checking whether to use (C)BLAS... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_blas" >&5
printf "%s\n" "$with_blas" >&6; }

Expand All @@ -13763,31 +13763,32 @@ if test -n "$USE_BLAS"; then
blas_ok=no

if ! ${PKG_CONFIG} --exists ${BLAS_PKG} ; then
as_fn_error $? "*** Unable to locate BLAS pkg-conf package \"${BLAS_PKG}\".
as_fn_error $? "*** Unable to locate (C)BLAS pkg-conf package \"${BLAS_PKG}\".
Perhaps you need to set PKG_CONFIG_PATH." "$LINENO" 5
fi

BLASLIB=$(${PKG_CONFIG} --libs ${BLAS_PKG})
BLASINC=$(${PKG_CONFIG} --cflags ${BLAS_PKG})

save_CFLAGS="$CFLAGS"; CFLAGS="$BLASINC"
save_LDFLAGS="$LDFLAGS"; LDFLAGS="$BLASLIB"
save_CFLAGS="$CFLAGS"; CFLAGS="$BLASINC $CFLAGS"
save_LIBS="$LIBS"; LIBS="$BLASLIB"

for ac_header in cblas.h
do :
ac_fn_c_check_header_compile "$LINENO" "cblas.h" "ac_cv_header_cblas_h" "$ac_includes_default"
if test "x$ac_cv_header_cblas_h" = xyes
then :
printf "%s\n" "#define HAVE_CBLAS_H 1" >>confdefs.h

else $as_nop
as_fn_error $? "*** Unable to find \"cblas.h\" with \"$CFLAGS\"." "$LINENO" 5
fi
ac_fn_c_check_header_compile "$LINENO" "cblas-atlas.h" "ac_cv_header_cblas_atlas_h" "$ac_includes_default"
if test "x$ac_cv_header_cblas_atlas_h" = xyes
then :
printf "%s\n" "#define HAVE_CBLAS_ATLAS_H 1" >>confdefs.h

fi

done

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linking to BLAS" >&5
printf %s "checking for linking to BLAS... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linking to (C)BLAS" >&5
printf %s "checking for linking to (C)BLAS... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
char cblas_dgemm();
Expand All @@ -13804,16 +13805,15 @@ then :
blas_ok=yes
else $as_nop

as_fn_error $? "*** Unable to link to BLAS library with \"$BLASLIB\"." "$LINENO" 5

as_fn_error $? "*** Unable to link to (C)BLAS library with \"$LIBS\"." "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $blas_ok" >&5
printf "%s\n" "$blas_ok" >&6; }

CFLAGS="$save_CFLAGS"
LDFLAGS="$save_LDFLAGS"
LIBS="$save_LIBS"


printf "%s\n" "#define HAVE_LIBBLAS 1" >>confdefs.h
Expand All @@ -13828,8 +13828,8 @@ fi # $USE_BLAS

# Enable LAPACK option

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use LAPACK" >&5
printf %s "checking whether to use LAPACK... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use LAPACK(E)" >&5
printf %s "checking whether to use LAPACK(E)... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_lapack" >&5
printf "%s\n" "$with_lapack" >&6; }

Expand All @@ -13856,15 +13856,15 @@ if test -n "$USE_BLAS" && test -n "$USE_LAPACK"; then
lapack_ok=no

if ! ${PKG_CONFIG} --exists ${LAPACK_PKG} ; then
as_fn_error $? "*** Unable to locate LAPACK pkg-conf package \"${LAPACK_PKG}\".
as_fn_error $? "*** Unable to locate LAPACK(E) pkg-conf package \"$LAPACK_PKG\".
Perhaps you need to set PKG_CONFIG_PATH." "$LINENO" 5
fi

LAPACKLIB=`${PKG_CONFIG} --libs ${LAPACK_PKG}`
LAPACKINC=`${PKG_CONFIG} --cflags ${LAPACK_PKG}`

save_CFLAGS="$CFLAGS"; CFLAGS="$LAPACKINC"
save_LDFLAGS="$LDFLAGS"; LDFLAGS="$LAPACKLIB"
save_CFLAGS="$CFLAGS"; CFLAGS="$LAPACKINC $CFLAGS"
save_LIBS="$LIBS"; LIBS="$LAPACKLIB"

for ac_header in lapacke.h
do :
Expand All @@ -13879,8 +13879,8 @@ fi

done

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linking to LAPACK" >&5
printf %s "checking for linking to LAPACK... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linking to LAPACK(E)" >&5
printf %s "checking for linking to LAPACK(E)... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
char LAPACKE_dgesv();
Expand All @@ -13897,16 +13897,16 @@ then :
lapack_ok=yes
else $as_nop

as_fn_error $? "*** Unable to link to LAPACKE library with \"$LAPACKLIB\"." "$LINENO" 5
as_fn_error $? "*** Unable to link to LAPACK(E) library with \"$LIBS\"." "$LINENO" 5

fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
printf "%s\n" "yes" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lapack_ok" >&5
printf "%s\n" "$lapack_ok" >&6; }

CFLAGS="$save_CFLAGS"
LDFLAGS="$save_LDFLAGS"
LIBS="$save_LIBS"


printf "%s\n" "#define HAVE_LIBLAPACK 1" >>confdefs.h
Expand Down
38 changes: 18 additions & 20 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@ AC_SUBST(FFTWLIB)

# Enable BLAS option

AC_MSG_CHECKING([whether to use BLAS])
AC_MSG_CHECKING([whether to use (C)BLAS])
AC_MSG_RESULT([$with_blas])

BLASLIB=
Expand All @@ -1607,29 +1607,27 @@ if test -n "$USE_BLAS"; then
blas_ok=no

if ! ${PKG_CONFIG} --exists ${BLAS_PKG} ; then
AC_MSG_ERROR([*** Unable to locate BLAS pkg-conf package "${BLAS_PKG}".
AC_MSG_ERROR([*** Unable to locate (C)BLAS pkg-conf package "${BLAS_PKG}".
Perhaps you need to set PKG_CONFIG_PATH.])
fi

BLASLIB=$(${PKG_CONFIG} --libs ${BLAS_PKG})
BLASINC=$(${PKG_CONFIG} --cflags ${BLAS_PKG})

save_CFLAGS="$CFLAGS"; CFLAGS="$BLASINC"
save_LDFLAGS="$LDFLAGS"; LDFLAGS="$BLASLIB"
save_CFLAGS="$CFLAGS"; CFLAGS="$BLASINC $CFLAGS"
save_LIBS="$LIBS"; LIBS="$BLASLIB"

AC_CHECK_HEADERS([cblas.h], [],
AC_MSG_ERROR([*** Unable to find "cblas.h" with "$CFLAGS".]))
AC_CHECK_HEADERS([cblas.h cblas-atlas.h])

AC_MSG_CHECKING([for linking to BLAS])
AC_MSG_CHECKING([for linking to (C)BLAS])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[char cblas_dgemm();]], [[return cblas_dgemm();]])],
[blas_ok=yes] , [
AC_MSG_ERROR([*** Unable to link to BLAS library with "$BLASLIB".])
])
AC_MSG_RESULT(yes)
AC_MSG_ERROR([*** Unable to link to (C)BLAS library with "$LIBS".])])
AC_MSG_RESULT([$blas_ok])

CFLAGS="$save_CFLAGS"
LDFLAGS="$save_LDFLAGS"
LIBS="$save_LIBS"

AC_DEFINE(HAVE_LIBBLAS, 1, [Define to 1 if BLAS exists.])

Expand All @@ -1642,7 +1640,7 @@ AC_SUBST(BLASINC)

# Enable LAPACK option

AC_MSG_CHECKING([whether to use LAPACK])
AC_MSG_CHECKING([whether to use LAPACK(E)])
AC_MSG_RESULT([$with_lapack])

LAPACKLIB=
Expand All @@ -1668,29 +1666,29 @@ if test -n "$USE_BLAS" && test -n "$USE_LAPACK"; then
lapack_ok=no

if ! ${PKG_CONFIG} --exists ${LAPACK_PKG} ; then
AC_MSG_ERROR([*** Unable to locate LAPACK pkg-conf package "${LAPACK_PKG}".
AC_MSG_ERROR([*** Unable to locate LAPACK(E) pkg-conf package "$LAPACK_PKG".
Perhaps you need to set PKG_CONFIG_PATH.])
fi

LAPACKLIB=`${PKG_CONFIG} --libs ${LAPACK_PKG}`
LAPACKINC=`${PKG_CONFIG} --cflags ${LAPACK_PKG}`

save_CFLAGS="$CFLAGS"; CFLAGS="$LAPACKINC"
save_LDFLAGS="$LDFLAGS"; LDFLAGS="$LAPACKLIB"
save_CFLAGS="$CFLAGS"; CFLAGS="$LAPACKINC $CFLAGS"
save_LIBS="$LIBS"; LIBS="$LAPACKLIB"

AC_CHECK_HEADERS([lapacke.h], [],
AC_MSG_ERROR([*** Unable to find "lapacke.h" with "$CFLAGS".]))

AC_MSG_CHECKING([for linking to LAPACK])
AC_MSG_CHECKING([for linking to LAPACK(E)])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[char LAPACKE_dgesv();]], [[return LAPACKE_dgesv(); ]])],
[lapack_ok=yes] , [
AC_MSG_ERROR([*** Unable to link to LAPACKE library with "$LAPACKLIB".])
])
AC_MSG_RESULT(yes)
AC_MSG_ERROR([*** Unable to link to LAPACK(E) library with "$LIBS".])]
)
AC_MSG_RESULT([$lapack_ok])

CFLAGS="$save_CFLAGS"
LDFLAGS="$save_LDFLAGS"
LIBS="$save_LIBS"

AC_DEFINE(HAVE_LIBLAPACK, 1, [Define to 1 if LAPACK exists.])

Expand Down
22 changes: 8 additions & 14 deletions include/grass/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,18 @@
/* Define to 1 if you have the `asprintf' function. */
#undef HAVE_ASPRINTF

/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY

/* Define to 1 if you have the <bzlib.h> header file. */
#undef HAVE_BZLIB_H

/* Define to 1 if you have the <cairo.h> header file. */
#undef HAVE_CAIRO_H

/* Define to 1 if you have the <cblas-atlas.h> header file. */
#undef HAVE_CBLAS_ATLAS_H

/* Define to 1 if you have the <cblas.h> header file. */
#undef HAVE_CBLAS_H

/* Define to 1 if you have the <clapack.h> header file. */
#undef HAVE_CLAPACK_H

/* Define to 1 if you have the <CL/cl.h> header file. */
#undef HAVE_CL_CL_H

Expand All @@ -38,9 +35,6 @@
/* Define to 1 if you have the `drand48' function. */
#undef HAVE_DRAND48

/* Define to 1 if you have the <f2c.h> header file. */
#undef HAVE_F2C_H

/* Define to 1 if you have the <fftw3.h> header file. */
#undef HAVE_FFTW3_H

Expand All @@ -56,9 +50,6 @@
/* Define to 1 if you have the `ftime' function. */
#undef HAVE_FTIME

/* Define to 1 if you have the <g2c.h> header file. */
#undef HAVE_G2C_H

/* Define to 1 if GDAL is to be used. */
#undef HAVE_GDAL

Expand Down Expand Up @@ -92,8 +83,8 @@
/* Define to 1 if you have the <langinfo.h> header file. */
#undef HAVE_LANGINFO_H

/* Define to 1 if ATLAS exists. */
#undef HAVE_LIBATLAS
/* Define to 1 if you have the <lapacke.h> header file. */
#undef HAVE_LAPACKE_H

/* Define to 1 if BLAS exists. */
#undef HAVE_LIBBLAS
Expand Down Expand Up @@ -239,6 +230,9 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H

/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY

/* Define to 1 if you have the <svm.h> header file. */
#undef HAVE_SVM_H

Expand Down
4 changes: 4 additions & 0 deletions lib/gmath/la.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@

#if defined(HAVE_LIBLAPACK) && defined(HAVE_LIBBLAS)
#include <lapacke.h>
#if defined(HAVE_CBLAS_ATLAS_H)
#include <cblas-atlas.h>
#else
#include <cblas.h>
#endif
#endif

#include <math.h>
#include <stdio.h>
Expand Down

0 comments on commit 17c9c62

Please sign in to comment.