From dfab18fe4729e71f53d0056572e3f85a72467247 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 20 Oct 2015 08:31:29 -0600 Subject: [PATCH] configure: infer static linking of libwinpthread for MinGW Merge to v6.3 --- racket/src/configure | 46 ++++++++++++++++++++++++++++++++++ racket/src/racket/configure.ac | 5 ++++ 2 files changed, 51 insertions(+) diff --git a/racket/src/configure b/racket/src/configure index 87f48a7c2c..dbc52ea48d 100755 --- a/racket/src/configure +++ b/racket/src/configure @@ -4674,6 +4674,52 @@ $as_echo "#define HAVE_STDINT_H 1" >>confdefs.h if `which ${host}-dlltool > /dev/null` ; then DLLTOOL="${host}-dlltool" fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lwinpthread" >&5 +$as_echo_n "checking for pthread_create in -lwinpthread... " >&6; } +if ${ac_cv_lib_winpthread_pthread_create+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lwinpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (); +int +main () +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_winpthread_pthread_create=yes +else + ac_cv_lib_winpthread_pthread_create=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_winpthread_pthread_create" >&5 +$as_echo "$ac_cv_lib_winpthread_pthread_create" >&6; } +if test "x$ac_cv_lib_winpthread_pthread_create" = xyes; then : + has_winpthread=yes +else + has_winpthread=no +fi + + if test "${has_winpthread}" == "yes" ; then + LIBS="${LIBS} -Wl,-Bstatic -lwinpthread" + fi case "$build_os" in *cygwin*) PWD="cygpath -m \\\`pwd\\\`" diff --git a/racket/src/racket/configure.ac b/racket/src/racket/configure.ac index d778329f93..46b76c953f 100644 --- a/racket/src/racket/configure.ac +++ b/racket/src/racket/configure.ac @@ -796,6 +796,11 @@ case "$host_os" in if `which ${host}-dlltool > /dev/null` ; then DLLTOOL="${host}-dlltool" fi + + AC_CHECK_LIB(winpthread, pthread_create, has_winpthread=yes, has_winpthread=no) + if test "${has_winpthread}" == "yes" ; then + LIBS="${LIBS} -Wl,-Bstatic -lwinpthread" + fi case "$build_os" in *cygwin*) PWD="cygpath -m \\\`pwd\\\`"