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.

Content-Type: text/plain;
Content-Transfer-Encoding: 7bit

    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:


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

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..


Content-Type: application/octet-stream;
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;

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 =
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 =
dnl send bug reports to Robert Collins <rbtcollins AT hotmail DOT com>=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 2001-03-15 - Changed from yes/no to true/false -suggested by Lars J =
Aas<larsa AT sim DOT no>=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=
], [=0A=
dnl try -mwin32=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_compile=3D"$ac_compile -mwin32"=0A=
ac_link=3D"$ac_link -mwin32"=0A=
CC=3D"$CC -mwin32"=0A=
], [=0A=
echo "${ECHO_T}Win32 API Not found" >&6=0A=


- Raw text -

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