AC_DEFUN(AC_PROG_CC_WIN32, [ dnl figure out how to run CC with access to the win32 api if present dnl configure that as the CC program, and set ac_cc_win32 to yes if found dnl or no if not found. We don't simply abort because dnl some folk may just want to test their environment and fallback with #defines dnl in their code. dnl WIN32 may be present with WINE, under cygwin, or under mingw, dnl or cross compilers targeting those same three targets. dnl as it happens, I can only test cygwin, so extra input here will be appreciated dnl send bug reports to Robert Collins dnl logic: is CC already configured? if not, call AC_PROG_CC. dnl if so - try it. If that doesn't work ,try -mwin32. If that doesn't work, fail dnl dnl 2001-03-15 - Changed from yes/no to true/false -suggested by Lars J Aas dnl * Change true to : - suggest by Alexandre Oliva dnl * changed layout on the basis of autoconf mailing list: dnl there are now two interfaces, a language specific one which sets dnl or clears WIN32 && WIN32FLAGS as appropriate dnl AC_REQUIRE([AC_PROG_CC]) echo $ECHO_N "checking how to access the Win32 API..." >&6 WIN32FLAGS= AC_TRY_COMPILE(,[#ifndef WIN32 #ifndef _WIN32 #error WIN32 or _WIN32 not defined #endif #endif], [ dnl found windows.h with the current config. echo "${ECHO_T}Win32 API found by default" >&6 WIN32="yes" ], [ dnl try -mwin32 save_cc="$ac_compile" dnl we change CC so config.log looks correct save_CC="$CC" ac_compile="$ac_compile -mwin32" CC="$CC -mwin32" AC_TRY_COMPILE(,[#ifndef WIN32 #ifndef _WIN32 #error WIN32 or _WIN32 not defined #endif #endif], [ dnl found windows.h using -mwin32 echo "${ECHO_T}Win32 API found via -mwin32" >&6 WIN32="yes" ac_compile="$save_cc" CC="$save_CC" WIN32FLAGS="-mwin32" ], [ WIN32= ac_compile="$save_cc" CC="$save_CC" echo "${ECHO_T}Win32 API Not found" >&6 ]) ]) AC_PROVIDE([$0]) ]) AC_DEFUN(AC_PROG_CXX_WIN32, [ dnl figure out how to run CXX with access to the win32 api if present dnl configure that as the CXX program, and set ac_cc_win32 to yes if found dnl or no if not found. We don't simply abort because dnl some folk may just want to test their environment and fallback with #defines dnl in their code. dnl WIN32 may be present with WINE, under cygwin, or under mingw, dnl or cross compilers targeting those same three targets. dnl as it happens, I can only test cygwin, so extra input here will be appreciated dnl send bug reports to Robert Collins echo $ECHO_N "checking how to access the Win32 API..." >&6 WIN32FLAGS= AC_TRY_COMPILE(,[#ifndef WIN32 #ifndef _WIN32 #error WIN32 or _WIN32 not defined #endif #endif], [ dnl found windows.h with the current config. echo "${ECHO_T}Win32 API found by default" >&6 WIN32="yes" ], [ dnl try -mwin32 save_cc="$ac_compile" dnl we change CC so config.log looks correct save_CXX="$CXX" ac_compile="$ac_compile -mwin32" CXX="$CXX -mwin32" AC_TRY_COMPILE(,[#ifndef WIN32 #ifndef _WIN32 #error WIN32 or _WIN32 not defined #endif #endif], [ dnl found windows.h using -mwin32 echo "${ECHO_T}Win32 API found via -mwin32" >&6 WIN32="yes" ac_compile="$save_cc" CXX="$save_CXX" WIN32FLAGS="-mwin32" ], [ WIN32= ac_compile="$save_cc" CXX="$save_CXX" echo "${ECHO_T}Win32 API Not found" >&6 ]) ]) AC_PROVIDE([$0]) ]) AC_DEFUN(AC_API_WIN32, [ dnl high level interface for finding out compiler support for win32. AC_LANG_CASE([C], AC_PROG_CC_WIN32 [CFLAGS="$WIN32FLAGS $CFLAGS"], [C++], AC_PROG_CXX_WIN32 [CXXFLAGS="$WIN32FLAGS $CXXFLAGS"], [echo "No macro support for WIN32 with $_AC_LANG" exit 1]) ])