aboutsummaryrefslogtreecommitdiff
path: root/gold/configure.ac
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@gmail.com>2018-06-19 18:57:28 -0700
committerCary Coutant <ccoutant@gmail.com>2018-06-19 18:57:28 -0700
commitc8dc28bcc04532f3074a827dc940c033be4be4e7 (patch)
tree1b66812e19ad306c2676a5985f2d30800f693d9f /gold/configure.ac
parent27ab04240bb40e052f288b2960fb99210b6f67b1 (diff)
downloadgdb-c8dc28bcc04532f3074a827dc940c033be4be4e7.zip
gdb-c8dc28bcc04532f3074a827dc940c033be4be4e7.tar.gz
gdb-c8dc28bcc04532f3074a827dc940c033be4be4e7.tar.bz2
Replace thread config with automatic config using ax_pthread.m4.
The autotools library macro (AX_PTHREAD) is now used to detect if pthreads is present and multi-threaded linking in gold is automatically enabled if it is found. This enables multi-threaded gold on platforms where pthreads is enabled via other methods than just -lpthread (e.g., MinGW). 2018-06-19 Joshua Watt <jpewhacker@gmail.com> Cary Coutant <ccoutant@gmail.com> gold/ * configure.ac: Replace manual thread configuration with AX_PTHREAD. Add --enable-threads=auto. * Makefile.am (THREADFLAGS, THREADLIBS): New defines. (AM_CFLAGS, AM_CXXFLAGS): Add $(THREADFLAGS. (THREADSLIB): Remove; change all references to THREADLIBS. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * config.in: Regenerate. * configure: Regenerate. * testsuite/Makefile.am (THREADSLIB): Replace with... (THREADFLAGS, THREADLIBS): ... these. (LDADD): Remove; add as individual defines for... (object_unittest, binary_unittest, leb128_unittest) (overflow_unittest): ... these tests. (tls_test, tls_pic_test, tls_pie_test, tls_pie_pic_test) (tls_shared_test, tls_shared_ie_test, tls_shared_gd_to_ie_test) (tls_shared_gnu2_gd_to_ie_test, tls_shared_gnu2_test_LDFLAGS) (tls_shared_nonpic_test_LDFLAGS): Add $(THREADFLAGS) and ($THREADLIBS). * testsuite/Makefile.in: Regenerate.
Diffstat (limited to 'gold/configure.ac')
-rw-r--r--gold/configure.ac37
1 files changed, 22 insertions, 15 deletions
diff --git a/gold/configure.ac b/gold/configure.ac
index 7a0b371..d9a1869 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -85,21 +85,6 @@ AC_ARG_ENABLE(gold,
AC_SUBST(install_as_default)
AC_SUBST(installed_linker)
-dnl For now threads are a configure time option.
-AC_ARG_ENABLE([threads],
-[ --enable-threads multi-threaded linking],
-[case "${enableval}" in
- yes | "") threads=yes ;;
- no) threads=no ;;
- *) threads=yes ;;
- esac],
-[threads=no])
-if test "$threads" = "yes"; then
- AC_DEFINE(ENABLE_THREADS, 1,
- [Define to do multi-threaded linking])
-fi
-AM_CONDITIONAL(THREADS, test "$threads" = "yes")
-
AC_PLUGINS
if test "$plugins" = "yes"; then
AC_DEFINE(ENABLE_PLUGINS, 1,
@@ -563,6 +548,28 @@ fi
# Link in zlib if we can. This allows us to write compressed sections.
AM_ZLIB
+AC_ARG_ENABLE([threads],
+[[ --enable-threads[=ARG] multi-threaded linking [ARG={auto,yes,no}]]],
+[case "${enableval}" in
+ yes | "") threads=yes ;;
+ no) threads=no ;;
+ auto) threads=auto ;;
+ *) threads=yes ;;
+ esac],
+[threads=auto])
+
+if test "$threads" = "yes"; then
+ AX_PTHREAD([threads=yes], AC_MSG_ERROR([pthread not found]))
+elif test "$threads" = "auto"; then
+ AX_PTHREAD([threads=yes], [threads=no])
+fi
+
+if test "$threads" = "yes"; then
+ AC_DEFINE(ENABLE_THREADS, 1,
+ [Define to do multi-threaded linking])
+fi
+AM_CONDITIONAL(THREADS, test "$threads" = "yes")
+
dnl We have to check these in C, not C++, because autoconf generates
dnl tests which have no type information, and current glibc provides
dnl multiple declarations of functions like basename when compiling