Thread: Building natively on win32 with mingw32/Cygwin

Building natively on win32 with mingw32/Cygwin

From
Gerhard Häring
Date:
Hello,

I've recently submitted a patch to the pgsql-patches list that adds Makefiles
for building libpq (and potentially more parts, but I only cared about libpq)
with mingw32. The current state on win32 is that only proprietary Makefiles for
M$ Visual C++ are supported.

The powers that be have stated that they'd prefer to integrate the native
mingw32 build into the existing autoconf-based build process.

I'd like to tackle only the minimum for now: building a native win32 libpq with
Cygwin's mingw32 mode ("-mno-cygwin").

My problem is that I have next to zero experience with the autoconf toolset.
I'd very much appreciate any help you can give me here.

Problem #1: How should it work?
===============================

With which options to configure should the native compilation work? What's the
standard way to get this to work? I assumed "./configure --target=i386-mingw32"
should be all that is necessary. I assume the configure script must then do all
the rest like:

- determine the host system
- determine the executable name of gcc
- determine the options to pass to gcc ("-mno-cygwin")

Or is there more to it? Setting additional variables?

Problem #2 is how to get this to work. But first I need to know for which
things to trigger in the configure stuff.

Thanks,

Gerhard
--
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))

Re: Building natively on win32 with mingw32/Cygwin

From
Jason Tishler
Date:
Gerhard,

On Mon, Sep 24, 2001 at 06:49:52AM +0200, Gerhard Häring wrote:
> The powers that be have stated that they'd prefer to integrate the native
> mingw32 build into the existing autoconf-based build process.

I agree that this is the way to go.

> I'd like to tackle only the minimum for now: building a native win32 libpq
> with Cygwin's mingw32 mode ("-mno-cygwin").

See the following mailing list threads for some work by Christof Petig
in this area:

    http://archives.postgresql.org/pgsql-cygwin/2001-07/msg00003.php
    http://archives.postgresql.org/pgsql-cygwin/2001-07/msg00027.php

> My problem is that I have next to zero experience with the autoconf toolset.
> I'd very much appreciate any help you can give me here.

See the online version of the "goat" book for information of the
autotools:

    http://sources.redhat.com/autobook/

> Problem #1: How should it work?
> ===============================
>
> With which options to configure should the native compilation work? What's the
> standard way to get this to work? I assumed "./configure
> --target=i386-mingw32" should be all that is necessary. I assume the
> configure script must then do all the rest like:
>
> - determine the host system
> - determine the executable name of gcc
> - determine the options to pass to gcc ("-mno-cygwin")
>
> Or is there more to it? Setting additional variables?

There are autoconf macros AC_CYGWIN and AC_MINGW32 that should help you
determine whether you are running under Cygwin or Mingw.  Sorry, but I'm
not a autoconf guru, so you will have to dig some more yourself.

> Problem #2 is how to get this to work. But first I need to know for which
> things to trigger in the configure stuff.

I think that a harder issue will be to prevent the Mingw build from
trying to build everything (like Cygwin) than determining which platform.

Jason

Re: Building natively on win32 with mingw32/Cygwin

From
Gerhard Häring
Date:
On Mon, Sep 24, 2001 at 06:49:52AM +0200, Gerhard Häring wrote:
> Hello,
>
> I've recently submitted a patch to the pgsql-patches list that adds
> Makefiles for building libpq (and potentially more parts, but I only
> cared about libpq) with mingw32. The current state on win32 is that
> only proprietary Makefiles for M$ Visual C++ are supported.
>
> The powers that be have stated that they'd prefer to integrate the
> native mingw32 build into the existing autoconf-based build process.
>
> I'd like to tackle only the minimum for now: building a native win32
> libpq with Cygwin's mingw32 mode ("-mno-cygwin"). [...]

Unfortunately, I currently don't have the time and motivation to pursue
this any further.

The number of projects that use autoconf to build with mingw32 seems
*very low*. The only one I could find is XEmacs.

Gerhard
--
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))