blob: eaded68c157160b7e10bb13b003db069fbe39315 [file] [log] [blame]
Emeric Vigier2f625822012-08-06 11:09:52 -04001dnl Check for M$-Compiler (C) 2000-2008 Fritz Elfert <felfert@to.com>
2dnl
3dnl This program is free software; you can redistribute it and/or modify
4dnl it under the terms of the GNU General Public License as published by
5dnl the Free Software Foundation; either version 2 of the License, or
6dnl (at your option) any later version.
7dnl
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11dnl GNU General Public License for more details.
12dnl
13dnl You should have received a copy of the GNU General Public License
14dnl along with this program; if not, write to the Free Software
15dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16dnl
17dnl As a special exception to the GNU General Public License, if you
18dnl distribute this file as part of a program that contains a configuration
19dnl script generated by Autoconf, you may include it under the same
20dnl distribution terms that you use for the rest of that program.
21
22AC_DEFUN([NP_FIND_DOSENV],[
23 save_IFS="$IFS"
24 $3=no
25 IFS=","
26 ENVVAR=`echo $$2 | tr ';' ','`
27 for i in $ENVVAR ; do
28 f=`cygpath -u "$i"`
29 if test -r "$f/$1" ; then
30 $3="$f"
31 break
32 fi
33 done
34 IFS="$save_IFS"
35])
36
37AC_DEFUN([NP_PROG_MSC],[
38 AC_ARG_WITH(wininc,
39 [ --with-wininc=DIR define windows include directory],
40 [win32inc="$withval"],[win32inc=no]
41 )
42 AC_ARG_WITH(winlib,
43 [ --with-winlib=DIR define windows lib directory],
44 [win32lib="$withval"],[win32lib=no]
45 )
46 AC_CACHE_CHECK(for MSC environment, np_cv_prog_msc, [
47 np_cv_prog_msc=no
48 cat > conftest.c <<EOF
49#ifndef _MSC_VER
50#error NOMSC
51#endif
52int main() {}
53EOF
54 RET=`cl -nologo -c conftest.c 2>&1`
55 case "$RET" in
56 conftest.c?)
57 np_cv_prog_msc=yes
58 ;;
59 *)
60 ;;
61 esac
62 ])
63 if test "x$np_cv_prog_msc" = "xyes" ; then
64 if test "$win32inc" = "no" ; then
65 AC_MSG_CHECKING(for Win32 include dir)
66 NP_FIND_DOSENV(ras.h,INCLUDE,win32inc)
67 AC_MSG_RESULT("$win32inc")
68 fi
69 if test "$win32inc" = "no" ; then
70 AC_MSG_ERROR([Unable to get Win32 include dir from environment.])
71 AC_MSG_ERROR([use --with-wininc=DIR to set it manually])
72 fi
73 if test "$win32lib" = "no" ; then
74 AC_MSG_CHECKING(for Win32 lib dir)
75 NP_FIND_DOSENV(wsock32.lib,LIB,win32lib)
76 AC_MSG_RESULT("$win32lib")
77 fi
78 if test "$win32lib" = "no" ; then
79 AC_MSG_ERROR([Unable to get Win32 lib dir from environment.])
80 AC_MSG_ERROR([use --with-winlib=DIR to set it manually])
81 fi
82 CC="cl -nologo -GX -D__WIN32__ -D_MT -D_WIN32_WINNT=0x0400 -I$win32inc"
83 CXX="cl -nologo -GX -D__WIN32__ -D_MT -D_WIN32_WINNT=0x0400 -I$win32inc"
84 LD="link /libpath:$win32lib"
85 AS=masm
86 fi
87 AM_CONDITIONAL(MSWIN32, test $np_cv_prog_msc = yes)
88])
89