ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-apps/2001/03/14/16:44:37

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: <mailto:cygwin-apps-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-apps/>
List-Post: <mailto:cygwin-apps AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-apps-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/lists.html#faqs>
Delivered-To: mailing list cygwin-apps AT sources DOT redhat DOT com
Message-ID: <022001c0accf$29b724d0$0200a8c0@lifelesswks>
From: "Robert Collins" <robert DOT collins AT itdomain DOT com DOT au>
To: <cygwin-apps AT sources DOT redhat DOT com>
Cc: <autoconf AT gnu DOT org>
References: <035401c0ac91$3ba21fd0$0200a8c0 AT lifelesswks>
Subject: updated win32 macro
Date: Thu, 15 Mar 2001 08:38:50 +1100
MIME-Version: 1.0
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: 14 Mar 2001 21:32:55.0964 (UTC) FILETIME=[553C75C0:01C0ACCE]

This is a multi-part message in MIME format.

------=_NextPart_000_021D_01C0AD2B.5BFD9BC0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Ok,
    version 2.. returns true/false now. I've also updated te sample code
to reflect this

... updated email ...
I've put together a autoconf macro to configure CC to include the Win32
API, if it is available. I've only put in the methods _I know of and can
test_, more fallback tests are welcome.

Sample code to use it in configure.in, when the program _needs_ the
win32 API:

AC_CANONICAL_HOST

case "${host}" in
*-*-cygwin*)
        AC_PROG_CC_WIN32
        if $ac_cc_win32; then
        dnl do nothing here - any header checks /library checks etc
later in configure.in will now pass
        else
            echo "configure: error: Win32 API needed and no acceptable
cc could be found" 1>&2;
            exit 1;
        fi        ;;
esac


AC_PROG_CC_WIN32  sets $ac_cc_win32 to true or false as appropriate, so
test writers in
configure.in can do an AC_SUBST or AC_DEFINE and switch off bits of
their code, or do as above, and fail the configure script.

It's my first foray into m4 beyond being a bare bones configure.in
tweaker, so if I'm breaking coding rules etc just let me know and I'll
go fix it up.

This test should allow existing programs that build under the Cygwin net
release gcc-2.95.2-6 or before (current release) or under the new
gcc-2.95.2-9 which no longer has the Win32 API by default.

If this looks ok I'll submit it to the autoconf macro archive..

Rob

------=_NextPart_000_021D_01C0AD2B.5BFD9BC0
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 <rbtcollins AT hotmail DOT com>=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<larsa AT sim DOT no>=0A=
dnl=0A=
=0A=
AC_REQUIRE([AC_PROG_CC])=0A=
echo $ECHO_N "checking how to access the Win32 API..." >&6=0A=
AC_TRY_CPP([#include <windows.h>], [=0A=
dnl found windows.h with the current config.=0A=
echo "${ECHO_T}Win32 API found by default" >&6=0A=
ac_cc_win32=3Dtrue=0A=
], [=0A=
dnl try -mwin32=0A=
save_cpp=3D"$ac_cpp"=0A=
ac_cpp=3D"$ac_cpp -mwin32"=0A=
AC_TRY_CPP([#include <windows.h>], [=0A=
dnl found windows.h using -mwin32=0A=
echo "${ECHO_T}Win32 API found via -mwin32" >&6=0A=
ac_cc_win32=3Dtrue=0A=
ac_compile=3D"$ac_compile -mwin32"=0A=
ac_link=3D"$ac_link -mwin32"=0A=
CC=3D"$CC -mwin32"=0A=
], [=0A=
ac_cc_win32=3Dfalse=0A=
ac_cpp=3D"$save_cpp"=0A=
echo "${ECHO_T}Win32 API Not found" >&6=0A=
])=0A=
])=0A=
=0A=
AC_PROVIDE([$0])=0A=
])=0A=

------=_NextPart_000_021D_01C0AD2B.5BFD9BC0--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019