2006-02-21 10:42:00 +03:00
|
|
|
dnl -*- shell-script -*-
|
|
|
|
dnl
|
2007-06-17 08:58:33 +04:00
|
|
|
dnl Copyright (c) 2004-2007 The University of Tennessee and The University
|
2006-02-21 10:42:00 +03:00
|
|
|
dnl of Tennessee Research Foundation. All rights
|
|
|
|
dnl reserved.
|
|
|
|
dnl $COPYRIGHT$
|
|
|
|
dnl
|
|
|
|
dnl Additional copyrights may follow
|
|
|
|
dnl
|
|
|
|
dnl $HEADER$
|
|
|
|
dnl
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
#
|
|
|
|
# OMPI_MICROSOFT_COMPILER
|
|
|
|
#
|
|
|
|
# Keep all the Windows checks in one place.
|
|
|
|
#
|
|
|
|
# USAGE:
|
|
|
|
# OMPI_MICROSOFT_COMPILER()
|
|
|
|
#
|
|
|
|
######################################################################
|
|
|
|
AC_DEFUN([OMPI_MICROSOFT_COMPILER],[
|
|
|
|
|
|
|
|
# If we are using one of the Microsoft compilers check that we are
|
|
|
|
# able to include windows.h. Most of the types that follow are defined
|
|
|
|
# in this file. If we check for it here it will get included in the
|
|
|
|
# default list of header files.
|
|
|
|
if test "x$ompi_cv_c_compiler_vendor" = "xmicrosoft" ; then
|
2007-06-17 08:58:33 +04:00
|
|
|
|
|
|
|
ompi_show_subtitle "Microsoft specific detection"
|
|
|
|
|
2006-02-21 10:42:00 +03:00
|
|
|
#
|
2007-06-17 08:58:33 +04:00
|
|
|
# These 2 libraries are a minimum ...
|
2006-08-27 08:52:46 +04:00
|
|
|
SAVE_LDFLAGS="$LDFLAGS"
|
|
|
|
LDFLAGS="$LDFLAGS Ws2_32.lib Advapi32.lib"
|
2007-06-17 08:58:33 +04:00
|
|
|
|
2006-02-21 10:42:00 +03:00
|
|
|
AC_CHECK_HEADERS([windows.h winsock2.h wdm.h])
|
|
|
|
|
|
|
|
# The atomic functions are defined in a very unuasual manner.
|
|
|
|
# Some of them are intrinsic defined in windows.h others are
|
|
|
|
# exported by kernel32.dll. If we force the usage of AC_TRY_RUN
|
|
|
|
# here we will check for both in same time: compilation and run.
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(for working InterlockedCompareExchange)
|
|
|
|
AC_TRY_RUN( [#include <windows.h>
|
2006-09-23 03:58:23 +04:00
|
|
|
int main() {
|
2006-02-21 10:42:00 +03:00
|
|
|
LONG dest = 1, exchange = 0, comperand = 1;
|
|
|
|
SetErrorMode(SEM_FAILCRITICALERRORS);
|
|
|
|
InterlockedCompareExchange( &dest, exchange, comperand );
|
|
|
|
return (int)dest;
|
|
|
|
}],
|
|
|
|
[AC_MSG_RESULT(yes)
|
|
|
|
ompi_windows_have_support_for_32_bits_atomic=1],
|
|
|
|
[AC_MSG_RESULT(no)
|
|
|
|
ompi_windows_have_support_for_32_bits_atomic=0])
|
|
|
|
AC_DEFINE_UNQUOTED(HAVE_INTERLOCKEDCOMPAREEXCHANGE,
|
|
|
|
$ompi_windows_have_support_for_32_bits_atomic,
|
|
|
|
[Whether we support 32 bits atomic operations on Windows])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(for working InterlockedCompareExchangeAcquire)
|
|
|
|
AC_TRY_RUN( [#include <windows.h>
|
2006-09-23 03:58:23 +04:00
|
|
|
int main() {
|
2006-02-21 10:42:00 +03:00
|
|
|
LONG dest = 1, exchange = 0, comperand = 1;
|
|
|
|
SetErrorMode(SEM_FAILCRITICALERRORS);
|
|
|
|
InterlockedCompareExchangeAcquire( &dest, exchange, comperand );
|
|
|
|
return (int)dest;
|
|
|
|
}],
|
|
|
|
[AC_MSG_RESULT(yes)
|
|
|
|
ompi_windows_have_support_for_32_bits_atomic=1],
|
|
|
|
[AC_MSG_RESULT(no)
|
|
|
|
ompi_windows_have_support_for_32_bits_atomic=0])
|
|
|
|
AC_DEFINE_UNQUOTED(HAVE_INTERLOCKEDCOMPAREEXCHANGEACQUIRE,
|
|
|
|
$ompi_windows_have_support_for_32_bits_atomic,
|
|
|
|
[Whether we support 32 bits atomic operations on Windows])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(for working InterlockedCompareExchangeRelease)
|
|
|
|
AC_TRY_RUN( [#include <windows.h>
|
2006-09-23 03:58:23 +04:00
|
|
|
int main() {
|
2006-02-21 10:42:00 +03:00
|
|
|
LONG dest = 1, exchange = 0, comperand = 1;
|
|
|
|
SetErrorMode(SEM_FAILCRITICALERRORS);
|
|
|
|
InterlockedCompareExchangeRelease( &dest, exchange, comperand );
|
|
|
|
return (int)dest;
|
|
|
|
}],
|
|
|
|
[AC_MSG_RESULT(yes)
|
|
|
|
ompi_windows_have_support_for_32_bits_atomic=1],
|
|
|
|
[AC_MSG_RESULT(no)
|
|
|
|
ompi_windows_have_support_for_32_bits_atomic=0])
|
|
|
|
AC_DEFINE_UNQUOTED(HAVE_INTERLOCKEDCOMPAREEXCHANGERELEASE,
|
|
|
|
$ompi_windows_have_support_for_32_bits_atomic,
|
|
|
|
[Whether we support 32 bits atomic operations on Windows])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING(for working InterlockedCompareExchange64)
|
|
|
|
AC_TRY_RUN( [#include <windows.h>
|
2006-09-23 03:58:23 +04:00
|
|
|
int main() {
|
2006-02-21 10:42:00 +03:00
|
|
|
LONGLONG dest = 1, exchange = 0, comperand = 1;
|
|
|
|
SetErrorMode(SEM_FAILCRITICALERRORS);
|
|
|
|
InterlockedCompareExchange64( &dest, exchange, comperand );
|
|
|
|
return (int)dest;
|
|
|
|
}],
|
|
|
|
[AC_MSG_RESULT(yes)
|
|
|
|
ompi_windows_have_support_for_64_bits_atomic=1],
|
|
|
|
[AC_MSG_RESULT(no)
|
|
|
|
ompi_windows_have_support_for_64_bits_atomic=0])
|
|
|
|
AC_DEFINE_UNQUOTED(HAVE_INTERLOCKEDCOMPAREEXCHANGE64,
|
|
|
|
$ompi_windows_have_support_for_64_bits_atomic,
|
|
|
|
[Whether we support 64 bits atomic operations on Windows])
|
|
|
|
|
2006-08-27 08:52:46 +04:00
|
|
|
ompi_show_title "Windows Type tests"
|
2006-02-21 10:42:00 +03:00
|
|
|
|
2007-06-17 08:58:33 +04:00
|
|
|
AC_DEFINE([pid_t], [intptr_t], [Windows pid_t type is a pointer])
|
2006-08-27 08:52:46 +04:00
|
|
|
AC_DEFINE_UNQUOTED([SIZEOF_PID_T], $ac_cv_sizeof_int,
|
|
|
|
[and here is it's size])
|
|
|
|
AC_CHECK_TYPES([socklen_t], [AC_DEFINE([HAVE_SOCKLEN_T], [1],
|
|
|
|
[Whether we have socklen_t or not])],
|
|
|
|
[AC_DEFINE(socklen_t, unsigned int,
|
|
|
|
[Define to unsigned int if you dont have it])],
|
|
|
|
[#include <winsock2.h>
|
|
|
|
#include <ws2tcpip.h>])
|
2006-02-21 10:42:00 +03:00
|
|
|
|
2006-08-27 08:52:46 +04:00
|
|
|
AC_CHECK_TYPES([struct sockaddr_in], [], [],
|
|
|
|
[AC_INCLUDES_DEFAULT
|
|
|
|
#include <winsock2.h>
|
|
|
|
#include <ws2tcpip.h>])
|
2006-02-21 10:42:00 +03:00
|
|
|
|
2006-08-27 08:52:46 +04:00
|
|
|
LDFLAGS="$SAVE_LDFLAGS"
|
2006-02-21 10:42:00 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
])
|