From ca69f7f89202a78a29d276a2ecfbc55642e5d780 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 21 Sep 2011 13:14:29 +0400 Subject: Fix configure for mingw-w64/32. (Apply commit ad82960) * configure.ac (PICFLAG, THREADDLLIBS): Define as empty for MinGW. * configure.ac (have_pthreads): New definition (set to true unless MinGW). * configure.ac (HAVE_PTHREAD_H): New AM conditional (based on have_pthreads value). * tests/Makefile.am (test_atomic_pthreads_SOURCES, test_atomic_pthreads_CPPFLAGS, test_atomic_pthreads_LDADD): Define only if HAVE_PTHREAD_H. * tests/Makefile.am (TESTS): Don't include test_atomic_pthreads unless HAVE_PTHREAD_H. * tests/Makefile.am (check_PROGRAMS): Define to TESTS value. --- configure.ac | 10 ++++++++-- tests/Makefile.am | 14 ++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index bfc5acd..6ab62b8 100644 --- a/configure.ac +++ b/configure.ac @@ -30,8 +30,8 @@ if test "$GCC" = yes; then # Workaround: at least GCC 3.4.6 does not define this macro. CFLAGS="$CFLAGS -D__PIC__=1" ;; - *-*-cygwin*) - # Cygwin does not need -fPIC. + *-*-cygwin* | *-*-mingw*) + # Cygwin and Mingw[-w32/64] do not need -fPIC. ;; *) AC_MSG_RESULT(-fPIC) @@ -68,6 +68,7 @@ AC_SUBST(DEFS) AH_TEMPLATE([_PTHREADS], [Indicates the use of pthreads (NetBSD).]) THREADDLLIBS= +have_pthreads=true ## Libraries needed to support threads. AC_CHECK_LIB(pthread, pthread_self, THREADDLLIBS="-lpthread",,) AC_DEFINE(_REENTRANT, 1, [Required define if using POSIX threads.]) @@ -81,9 +82,14 @@ case "$host" in *-*-cygwin* | *-*-darwin*) THREADDLLIBS= ;; + *-*-mingw*) + THREADDLLIBS= + have_pthreads=false + ;; esac AC_SUBST(THREADDLLIBS) +AM_CONDITIONAL(HAVE_PTHREAD_H, test x$have_pthreads = xtrue) AM_CONDITIONAL(NEED_ASM, test x$need_asm = xtrue) AC_CONFIG_FILES([Makefile src/Makefile src/atomic_ops/Makefile \ diff --git a/tests/Makefile.am b/tests/Makefile.am index f23a9b6..1753c9f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,18 +8,20 @@ CLEANFILES = list_atomic.i AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src +if HAVE_PTHREAD_H TESTS=test_atomic test_atomic_pthreads test_stack test_malloc +test_atomic_pthreads_SOURCES=$(test_atomic_SOURCES) +test_atomic_pthreads_CPPFLAGS=-DAO_USE_PTHREAD_DEFS $(AM_CPPFLAGS) +test_atomic_pthreads_LDADD=$(test_atomic_LDADD) +else +TESTS=test_atomic test_stack test_malloc +endif -#create the test_atomic test program -check_PROGRAMS=test_atomic test_atomic_pthreads test_stack test_malloc +check_PROGRAMS=$(TESTS) test_atomic_SOURCES=test_atomic.c test_atomic_LDADD=$(THREADDLLIBS) ../src/libatomic_ops.a -test_atomic_pthreads_SOURCES=test_atomic.c -test_atomic_pthreads_CPPFLAGS=-DAO_USE_PTHREAD_DEFS $(AM_CPPFLAGS) -test_atomic_pthreads_LDADD=$(THREADDLLIBS) ../src/libatomic_ops.a - test_stack_SOURCES=test_stack.c test_stack_LDADD=$(THREADDLLIBS) ../src/libatomic_ops_gpl.a \ ../src/libatomic_ops.a -- cgit v1.2.1