ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-apps/2001/03/14/09:17:06

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: <035401c0ac91$3ba21fd0$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>
Subject: -mwin32 test macro
Date: Thu, 15 Mar 2001 01:15:31 +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 14:09:36.0796 (UTC) FILETIME=[66E585C0:01C0AC90]

This is a multi-part message in MIME format.

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

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
        test "$ac_cc_win32" = "no" && { echo "configure: error: Win32
API needed and no ac
ceptable cc could be found" 1>&2; exit 1; }

It sets ac_cc_win32 to yes or no 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=
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