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 Message-ID: <022101c0ad54$92979680$0200a8c0@lifelesswks> From: "Robert Collins" To: , 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> <01ea01c0ad4f$fe94f350$0200a8c0 AT lifelesswks> Subject: win32 macro version 3 Date: Fri, 16 Mar 2001 00:33:45 +1100 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_021E_01C0ADB0.C25F51D0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-OriginalArrivalTime: 15 Mar 2001 13:27:57.0519 (UTC) FILETIME=[BF9FDDF0:01C0AD53] This is a multi-part message in MIME format. ------=_NextPart_000_021E_01C0ADB0.C25F51D0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit This has a better test that ; a high level interface and two low level interfaces. I had _no_ idea what the high level interface should be called, so I called it AC_API_WIN32 - please suggest a better name. The low level interface sets WIN32FLAGS to the needed flags for that language (but doesn't check the current language is infact C or C++). It defines WIN32 so that the user _can test if they want to_ in configure.in in order to skip other tests or turn on compilation of win32 specific programs. basic use: AC_API_WIN32 can't get easier really. advanced use AC_API_WIN32 if test -z "$WIN32" ; then dnl we are able to build win32 code. Compile the win32 only bonus programs dnl within all source files any win32 code is #ifdef WIN32 EXTRA_PROGRAMS="$EXTRA_PROGRAMS servicemon serviceinstall" fi Rob ------=_NextPart_000_021E_01C0ADB0.C25F51D0 Content-Type: application/octet-stream; name="acinclude.m4" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="acinclude.m4" AC_DEFUN(AC_PROG_CC_WIN32, [=0A= dnl figure out how to run CC with access to the win32 api if present=0A= dnl configure that as the CC program, and set ac_cc_win32 to yes if found=0A= dnl or no if not found. We don't simply abort because=0A= dnl some folk may just want to test their environment and fallback with = #defines=0A= dnl in their code.=0A= dnl WIN32 may be present with WINE, under cygwin, or under mingw,=0A= dnl or cross compilers targeting those same three targets.=0A= dnl as it happens, I can only test cygwin, so extra input here will be = appreciated=0A= dnl send bug reports to Robert Collins =0A= =0A= dnl logic: is CC already configured? if not, call AC_PROG_CC.=0A= dnl if so - try it. If that doesn't work ,try -mwin32. If that doesn't = work, fail=0A= dnl=0A= dnl 2001-03-15 - Changed from yes/no to true/false -suggested by Lars J = Aas=0A= dnl * Change true to : - suggest by Alexandre Oliva = =0A= dnl * changed layout on the basis of autoconf mailing list:=0A= dnl there are now two interfaces, a language specific one which sets=0A= dnl or clears WIN32 && WIN32FLAGS as appropriate=0A= dnl=0A= =0A= AC_REQUIRE([AC_PROG_CC])=0A= echo $ECHO_N "checking how to access the Win32 API..." >&6=0A= WIN32FLAGS=3D=0A= AC_TRY_COMPILE(,[#ifndef WIN32=0A= #ifndef _WIN32=0A= #error WIN32 or _WIN32 not defined=0A= #endif=0A= #endif], [=0A= dnl found windows.h with the current config.=0A= echo "${ECHO_T}Win32 API found by default" >&6=0A= WIN32=3D"yes"=0A= ], [=0A= dnl try -mwin32=0A= save_cc=3D"$ac_compile"=0A= dnl we change CC so config.log looks correct=0A= save_CC=3D"$CC"=0A= ac_compile=3D"$ac_compile -mwin32"=0A= CC=3D"$CC -mwin32"=0A= AC_TRY_COMPILE(,[#ifndef WIN32=0A= #ifndef _WIN32=0A= #error WIN32 or _WIN32 not defined=0A= #endif=0A= #endif], [=0A= dnl found windows.h using -mwin32=0A= echo "${ECHO_T}Win32 API found via -mwin32" >&6=0A= WIN32=3D"yes"=0A= ac_compile=3D"$save_cc"=0A= CC=3D"$save_CC"=0A= WIN32FLAGS=3D"-mwin32"=0A= ], [=0A= WIN32=3D=0A= ac_compile=3D"$save_cc"=0A= CC=3D"$save_CC"=0A= echo "${ECHO_T}Win32 API Not found" >&6=0A= ])=0A= ])=0A= =0A= AC_PROVIDE([$0])=0A= ])=0A= =0A= AC_DEFUN(AC_PROG_CXX_WIN32, [=0A= dnl figure out how to run CXX with access to the win32 api if present=0A= dnl configure that as the CXX program, and set ac_cc_win32 to yes if = found=0A= dnl or no if not found. We don't simply abort because=0A= dnl some folk may just want to test their environment and fallback with = #defines=0A= dnl in their code.=0A= dnl WIN32 may be present with WINE, under cygwin, or under mingw,=0A= dnl or cross compilers targeting those same three targets.=0A= dnl as it happens, I can only test cygwin, so extra input here will be = appreciated=0A= dnl send bug reports to Robert Collins =0A= =0A= echo $ECHO_N "checking how to access the Win32 API..." >&6=0A= WIN32FLAGS=3D=0A= AC_TRY_COMPILE(,[#ifndef WIN32=0A= #ifndef _WIN32=0A= #error WIN32 or _WIN32 not defined=0A= #endif=0A= #endif], [=0A= dnl found windows.h with the current config.=0A= echo "${ECHO_T}Win32 API found by default" >&6=0A= WIN32=3D"yes"=0A= ], [=0A= dnl try -mwin32=0A= save_cc=3D"$ac_compile"=0A= dnl we change CC so config.log looks correct=0A= save_CXX=3D"$CXX"=0A= ac_compile=3D"$ac_compile -mwin32"=0A= CXX=3D"$CXX -mwin32"=0A= AC_TRY_COMPILE(,[#ifndef WIN32=0A= #ifndef _WIN32=0A= #error WIN32 or _WIN32 not defined=0A= #endif=0A= #endif], [=0A= dnl found windows.h using -mwin32=0A= echo "${ECHO_T}Win32 API found via -mwin32" >&6=0A= WIN32=3D"yes"=0A= ac_compile=3D"$save_cc"=0A= CXX=3D"$save_CXX"=0A= WIN32FLAGS=3D"-mwin32"=0A= ], [=0A= WIN32=3D=0A= ac_compile=3D"$save_cc"=0A= CXX=3D"$save_CXX"=0A= echo "${ECHO_T}Win32 API Not found" >&6=0A= ])=0A= ])=0A= =0A= AC_PROVIDE([$0])=0A= ])=0A= =0A= =0A= AC_DEFUN(AC_API_WIN32, [=0A= dnl high level interface for finding out compiler support for win32.=0A= =0A= AC_LANG_CASE([C], AC_PROG_CC_WIN32 [CFLAGS=3D"$WIN32FLAGS $CFLAGS"],=0A= [C++], AC_PROG_CXX_WIN32 [CXXFLAGS=3D"$WIN32FLAGS = $CXXFLAGS"],=0A= [echo "No macro support for WIN32 with $_AC_LANG"=0A= exit 1])=0A= =0A= ])=0A= =0A= ------=_NextPart_000_021E_01C0ADB0.C25F51D0--