Skip to content

Commit 3e62e02

Browse files
committed
Move -latomic check earlier in configure (autools)
We may need it to properly detect some libraries (e.g., tbb on various architectures).
1 parent 7608bb7 commit 3e62e02

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

M2/configure.ac

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,21 @@ done
596596
AC_SUBST(OPENMP_CXXFLAGS,"$OPENMP_CXXFLAGS")
597597
AC_SUBST(OPENMP_LIBS,"$OPENMP_LIBS")
598598

599+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358
600+
AC_MSG_CHECKING([whether we need to link with -latomic])
601+
AC_LANG([C++])
602+
AC_LINK_IFELSE([AC_LANG_PROGRAM([
603+
#include <atomic>
604+
], [std::atomic<int64_t> x; x++])],
605+
[AC_MSG_RESULT([no])],
606+
[LIBS="$LIBS -latomic"
607+
AC_LINK_IFELSE([AC_LANG_PROGRAM([
608+
#include <atomic>
609+
], [std::atomic<int64_t> x; x++])],
610+
[AC_MSG_RESULT([yes])],
611+
[AC_MSG_RESULT([error])
612+
AC_MSG_ERROR([unable to handle 64-bit atomics])])])
613+
599614
#############################################################################
600615
AC_SUBST(BUILTLIBS)
601616
# The list BUILTLIBS is the list of link options for the libraries we have decided to build,
@@ -1845,21 +1860,6 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([int main() {}])],
18451860
rm -f conftest.mapfile
18461861
LDFLAGS=$SAVE
18471862

1848-
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358
1849-
AC_MSG_CHECKING([whether we need to link with -latomic])
1850-
AC_LANG([C++])
1851-
AC_LINK_IFELSE([AC_LANG_PROGRAM([
1852-
#include <atomic>
1853-
], [std::atomic<int64_t> x; x++])],
1854-
[AC_MSG_RESULT([no])],
1855-
[LIBS="$LIBS -latomic"
1856-
AC_LINK_IFELSE([AC_LANG_PROGRAM([
1857-
#include <atomic>
1858-
], [std::atomic<int64_t> x; x++])],
1859-
[AC_MSG_RESULT([yes])],
1860-
[AC_MSG_RESULT([error])
1861-
AC_MSG_ERROR([unable to handle 64-bit atomics])])])
1862-
18631863
AC_SUBST(DUMPDATAFILE,Macaulay2-$ARCH-data)
18641864

18651865
test "$MEMDEBUG" = yes && M2_CPPFLAGS="$M2_CPPFLAGS -DMEMDEBUG"

0 commit comments

Comments
 (0)