Skip to content

Commit df68029

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 e07c5f3 commit df68029

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
@@ -604,6 +604,21 @@ done
604604
AC_SUBST(OPENMP_CXXFLAGS,"$OPENMP_CXXFLAGS")
605605
AC_SUBST(OPENMP_LIBS,"$OPENMP_LIBS")
606606

607+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358
608+
AC_MSG_CHECKING([whether we need to link with -latomic])
609+
AC_LANG([C++])
610+
AC_LINK_IFELSE([AC_LANG_PROGRAM([
611+
#include <atomic>
612+
], [std::atomic<int64_t> x; x++])],
613+
[AC_MSG_RESULT([no])],
614+
[LIBS="$LIBS -latomic"
615+
AC_LINK_IFELSE([AC_LANG_PROGRAM([
616+
#include <atomic>
617+
], [std::atomic<int64_t> x; x++])],
618+
[AC_MSG_RESULT([yes])],
619+
[AC_MSG_RESULT([error])
620+
AC_MSG_ERROR([unable to handle 64-bit atomics])])])
621+
607622
#############################################################################
608623
AC_SUBST(BUILTLIBS)
609624
# The list BUILTLIBS is the list of link options for the libraries we have decided to build,
@@ -1850,21 +1865,6 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([int main() {}])],
18501865
rm -f conftest.mapfile
18511866
LDFLAGS=$SAVE
18521867

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

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

0 commit comments

Comments
 (0)