Mailing-List: contact cygwin-apps-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-apps-owner AT sourceware DOT cygnus DOT com List-Subscribe: List-Archive: List-Post: List-Help: , Delivered-To: mailing list cygwin-apps AT sources DOT redhat DOT com To: "Robert Collins" Cc: , Subject: Re: win32 compiler test V3a References: <035401c0ac91$3ba21fd0$0200a8c0 AT lifelesswks> <022001c0accf$29b724d0$0200a8c0 AT lifelesswks> <007f01c0ad2e$f3dc5d20$0200a8c0 AT lifelesswks> <00a301c0ad32$57ad0220$0200a8c0 AT lifelesswks> <00c801c0ad36$01ec3370$0200a8c0 AT lifelesswks> <011a01c0ad41$c0fbc9a0$0200a8c0 AT lifelesswks> <01b801c0ad4b$9b2f1380$0200a8c0 AT lifelesswks> <01c401c0ad4c$7e469ad0$0200a8c0 AT lifelesswks> <000001c0ad53$b37dc9b0$9865fea9 AT edward> <3AB0C6A2 DOT 8AFE126C AT yahoo DOT com> <023d01c0ad57$68af41d0$0200a8c0 AT lifelesswks> <026c01c0ad5b$4a2a76e0$0200a8c0 AT lifelesswks> From: Akim Demaille Date: 15 Mar 2001 15:46:29 +0100 In-Reply-To: <026c01c0ad5b$4a2a76e0$0200a8c0@lifelesswks> Message-ID: Lines: 106 User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii | Hopefully this is it (barring a rename on the high level interface. | I missed the CPPFLAGS in the last version.. | If you're code is portable this is effective with a simple | AC_API_WIN32 You should really read the CVS Autoconf documentation. Your quotation is dangerous at some points, and there are a few suggestions in there on how to unobfuscate M4 code. | dnl COMPILER WIN32 support ==================================== | 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, | 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 Move the comments out of the macro, use `#', not dnl, quote the name being defined. | AC_REQUIRE([AC_PROG_CC]) dnl at the end | echo $ECHO_N "checking how to access the Win32 API..." >&6 This is wrong, use the AC_FD_* if you need to, otherwise you certainly mean AC_MSG_* | WIN32FLAGS= | AC_TRY_COMPILE(,[#ifndef WIN32 | #ifndef _WIN32 | #error WIN32 or _WIN32 not defined | #endif | #endif], #error is suspected to cause problems, although I don't recall having seen it happen. Please indent cpp directives. | [ | dnl found windows.h with the current config. | echo "${ECHO_T}Win32 API found by default" >&6 | ], [ You must not use ECHO_N, you are breaking the abstraction layers :) | dnl try -mwin32 | save_cc="$ac_compile" You break out of the Autoconf name space: use ac_compile_save for readability. | 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 | ac_compile="$save_cc" | CC="$save_CC" | WIN32FLAGS="-mwin32" | ], [ | ac_compile="$save_cc" | CC="$save_CC" | echo "${ECHO_T}Win32 API Not found" >&6 | ]) | ]) | | AC_PROVIDE([$0]) Huh? Don't, AC_DEFUN did for you. | AC_DEFUN(AC_PROG_CXX_WIN32, [ Same comments. | 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" | CPPFLAGS="$WIN32FLAGS $CPPFLAGS"], | [C++], AC_PROG_CXX_WIN32 [CXXFLAGS="$WIN32FLAGS $CXXFLAGS" | CPPFLAGS="$WIN32FLAGS $CPPFLAGS"], | [echo "No macro support for WIN32 with $_AC_LANG" | exit 1]) | ]) Use AC_FATAL. Quote the exec parts. And in fact, just factor AC_PROG_CXX_WIN32 as an AC_REQUIRE of this macros.