1AC_DEFUN([AC_FL_WIN32], [
2case "$target_os" in
3     *mingw*)
4        target_win32="yes"
5        target_mingw32="yes"
6        ;;
7     *cygwin*|*win32*|*w32*)
8        target_win32="yes"
9        ;;
10     *)
11        target_win32="no"
12        ;;
13esac
14
15if test "x$target_win32" = "xyes"; then
16    AC_CHECK_PROG([WINDRES], [${ac_tool_prefix}windres], [${ac_tool_prefix}windres])
17    if [ test "x$WINDRES" = "x" ]; then
18        AC_MSG_WARN([The windres utility could not be found])
19    fi
20    AC_DEFINE([__WOE32__], 1, [Define to 1 if we are building on mingw])
21    AC_DEFINE([__MINGW32__], 1, [Define to 1 if we are building on cygwin or mingw])
22    AC_DEFINE([_WINDOWS], 1, [Define to 1 if we are building on cygwin or mingw])
23fi
24
25if test "x$target_mingw32" = "xyes"; then
26    AC_CHECK_PROG([MAKENSIS], [makensis], [makensis])
27fi
28
29AC_SUBST([WINDRES])
30AM_CONDITIONAL([HAVE_WINDRES], [test "x$WINDRES" != "x"])
31AC_SUBST([MAKENSIS])
32AM_CONDITIONAL([HAVE_NSIS], [test "x$MAKENSIS" != "x"])
33AM_CONDITIONAL([WIN32], [test "x$target_win32" = "xyes"])
34AM_CONDITIONAL([MINGW32], [test "x$target_mingw32" = "xyes"])
35
36
37AC_ARG_VAR([PTW32_CFLAGS], [C compiler flags for pthreads-w32])
38AC_ARG_VAR([PTW32_LIBS], [linker flags for pthreads-w32])
39
40AC_ARG_WITH([ptw32],
41            AC_HELP_STRING([--with-ptw32@<:@=DIR@:>@],
42                           [search for pthreads-w32 in DIR/include and DIR/lib @<:@mingw32 only@:>@]),
43            [ac_cv_want_ptw32="$withval"],
44            [ac_cv_want_ptw32=no])
45
46if test "x$ac_cv_want_ptw32" != "xno"; then
47    if test "x$ac_cv_want_ptw32" != "xyes"; then # set -I and -L switches
48        ptw32_default_cflags="-I${ac_cv_want_ptw32}/include"
49        ptw32_default_libs="-L${ac_cv_want_ptw32}/lib"
50    fi
51    ptw32_default_libs="$ptw32_default_libs -lpthreadGC2 -lws2_32"
52
53    # don't override the user-specified vars
54    PTW32_CFLAGS="${PTW32_CFLAGS:-$ptw32_default_cflags}"
55    PTW32_LIBS="${PTW32_LIBS:-$ptw32_default_libs}"
56    ac_cv_want_ptw32="yes"
57else
58    if test "x$target_mingw32" = "xyes"; then
59    PTW32_LIBS="-lpthread -lwsock32 -lws2_32"
60    fi
61fi
62
63AC_SUBST([PTW32_CFLAGS])
64AC_SUBST([PTW32_LIBS])
65])
66