Add --enable-openmp to configure

new-context
Salvatore Filippone 4 years ago
parent 1023ba9019
commit 7ba9ae18c8

@ -363,6 +363,45 @@ fi
] ]
) )
dnl @synopsis PAC_ARG_OPENMP
dnl
dnl Test for --enable-openmp
dnl
dnl
dnl
dnl Example use:
dnl
dnl
dnl @author Salvatore Filippone <salvatore.filippone@uniroma2.it>
dnl
AC_DEFUN([PAC_ARG_OPENMP],
[AC_MSG_CHECKING([whether we want openmp ])
AC_ARG_ENABLE(openmp,
AC_HELP_STRING([--enable-openmp],
[Specify whether to enable openmp. ]),
[
pac_cv_openmp="yes";
]
dnl ,
dnl [pac_cv_openmp="no";]
)
if test x"$pac_cv_openmp" == x"yes" ; then
AC_MSG_RESULT([yes.])
AC_LANG_PUSH([Fortran])
AC_OPENMP()
pac_cv_openmp_fcopt="$OPENMP_FCFLAGS";
AC_LANG_POP()
AC_LANG_PUSH([C])
AC_OPENMP()
pac_cv_openmp_ccopt="$OPENMP_CFLAGS";
AC_LANG_POP()
else
pac_cv_openmp="no";
AC_MSG_RESULT([no.])
fi
]
)
dnl @synopsis PAC_ARG_LONG_INTEGERS dnl @synopsis PAC_ARG_LONG_INTEGERS
dnl dnl
dnl Test for --enable-long-integers dnl Test for --enable-long-integers

185
configure vendored

@ -663,6 +663,8 @@ BASEMODNAME
CDEFINES CDEFINES
FDEFINES FDEFINES
LAPACK_LIBS LAPACK_LIBS
OPENMP_CFLAGS
OPENMP_FCFLAGS
EGREP EGREP
GREP GREP
CPP CPP
@ -771,6 +773,7 @@ enable_dependency_tracking
enable_silent_rules enable_silent_rules
with_ipk with_ipk
with_lpk with_lpk
enable_openmp
with_blas with_blas
with_blasdir with_blasdir
with_lapack with_lapack
@ -1420,6 +1423,8 @@ Optional Features:
speeds up one-time build speeds up one-time build
--enable-silent-rules less verbose build output (undo: "make V=1") --enable-silent-rules less verbose build output (undo: "make V=1")
--disable-silent-rules verbose build output (undo: "make V=0") --disable-silent-rules verbose build output (undo: "make V=0")
--enable-openmp Specify whether to enable openmp.
--disable-openmp do not use OpenMP
Optional Packages: Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -6890,7 +6895,187 @@ FDEFINES="$psblas_cv_define_prepend-DIPK${pac_cv_ipk_size} $FDEFINES";
FDEFINES="$psblas_cv_define_prepend-DLPK${pac_cv_lpk_size} $FDEFINES"; FDEFINES="$psblas_cv_define_prepend-DLPK${pac_cv_lpk_size} $FDEFINES";
CDEFINES="-DIPK${pac_cv_ipk_size} -DLPK${pac_cv_lpk_size} $CDEFINES" CDEFINES="-DIPK${pac_cv_ipk_size} -DLPK${pac_cv_lpk_size} $CDEFINES"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we want openmp " >&5
$as_echo_n "checking whether we want openmp ... " >&6; }
# Check whether --enable-openmp was given.
if test "${enable_openmp+set}" = set; then :
enableval=$enable_openmp;
pac_cv_openmp="yes";
fi
if test x"$pac_cv_openmp" == x"yes" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes." >&5
$as_echo "yes." >&6; }
ac_ext=${ac_fc_srcext-f}
ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5'
ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_fc_compiler_gnu
OPENMP_FCFLAGS=
# Check whether --enable-openmp was given.
if test "${enable_openmp+set}" = set; then :
enableval=$enable_openmp;
fi
if test "$enable_openmp" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $FC option to support OpenMP" >&5
$as_echo_n "checking for $FC option to support OpenMP... " >&6; }
if ${ac_cv_prog_fc_openmp+:} false; then :
$as_echo_n "(cached) " >&6
else
cat > conftest.$ac_ext <<_ACEOF
program main
implicit none
!$ integer tid
tid = 42
call omp_set_num_threads(2)
end
_ACEOF
if ac_fn_fc_try_link "$LINENO"; then :
ac_cv_prog_fc_openmp='none needed'
else
ac_cv_prog_fc_openmp='unsupported'
for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \
-Popenmp --openmp; do
ac_save_FCFLAGS=$FCFLAGS
FCFLAGS="$FCFLAGS $ac_option"
cat > conftest.$ac_ext <<_ACEOF
program main
implicit none
!$ integer tid
tid = 42
call omp_set_num_threads(2)
end
_ACEOF
if ac_fn_fc_try_link "$LINENO"; then :
ac_cv_prog_fc_openmp=$ac_option
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
FCFLAGS=$ac_save_FCFLAGS
if test "$ac_cv_prog_fc_openmp" != unsupported; then
break
fi
done
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_fc_openmp" >&5
$as_echo "$ac_cv_prog_fc_openmp" >&6; }
case $ac_cv_prog_fc_openmp in #(
"none needed" | unsupported)
;; #(
*)
OPENMP_FCFLAGS=$ac_cv_prog_fc_openmp ;;
esac
fi
pac_cv_openmp_fcopt="$OPENMP_FCFLAGS";
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
OPENMP_CFLAGS=
# Check whether --enable-openmp was given.
if test "${enable_openmp+set}" = set; then :
enableval=$enable_openmp;
fi
if test "$enable_openmp" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to support OpenMP" >&5
$as_echo_n "checking for $CC option to support OpenMP... " >&6; }
if ${ac_cv_prog_c_openmp+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef _OPENMP
choke me
#endif
#include <omp.h>
int main () { return omp_get_num_threads (); }
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_prog_c_openmp='none needed'
else
ac_cv_prog_c_openmp='unsupported'
for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \
-Popenmp --openmp; do
ac_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $ac_option"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef _OPENMP
choke me
#endif
#include <omp.h>
int main () { return omp_get_num_threads (); }
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_prog_c_openmp=$ac_option
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CFLAGS=$ac_save_CFLAGS
if test "$ac_cv_prog_c_openmp" != unsupported; then
break
fi
done
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_c_openmp" >&5
$as_echo "$ac_cv_prog_c_openmp" >&6; }
case $ac_cv_prog_c_openmp in #(
"none needed" | unsupported)
;; #(
*)
OPENMP_CFLAGS=$ac_cv_prog_c_openmp ;;
esac
fi
pac_cv_openmp_ccopt="$OPENMP_CFLAGS";
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
else
pac_cv_openmp="no";
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no." >&5
$as_echo "no." >&6; }
fi
FCOPT="$FCOPT $pac_cv_openmp_fcopt";
CCOPT="$CCOPT $pac_cv_openmp_ccopt";
{ $as_echo "$as_me:${as_lineno-$LINENO}: \"FLAGS: $FCOPT $OPENMP_FFLAGS\"" >&5
$as_echo "$as_me: \"FLAGS: $FCOPT $OPENMP_FFLAGS\"" >&6;}
# #
# Tests for support of various Fortran features; some of them are critical, # Tests for support of various Fortran features; some of them are critical,
# some optional # some optional

@ -498,7 +498,10 @@ FDEFINES="$psblas_cv_define_prepend-DIPK${pac_cv_ipk_size} $FDEFINES";
FDEFINES="$psblas_cv_define_prepend-DLPK${pac_cv_lpk_size} $FDEFINES"; FDEFINES="$psblas_cv_define_prepend-DLPK${pac_cv_lpk_size} $FDEFINES";
CDEFINES="-DIPK${pac_cv_ipk_size} -DLPK${pac_cv_lpk_size} $CDEFINES" CDEFINES="-DIPK${pac_cv_ipk_size} -DLPK${pac_cv_lpk_size} $CDEFINES"
PAC_ARG_OPENMP()
FCOPT="$FCOPT $pac_cv_openmp_fcopt";
CCOPT="$CCOPT $pac_cv_openmp_ccopt";
AC_MSG_NOTICE(["FLAGS: $FCOPT $OPENMP_FFLAGS"])
# #
# Tests for support of various Fortran features; some of them are critical, # Tests for support of various Fortran features; some of them are critical,
# some optional # some optional

Loading…
Cancel
Save