Re: bug in config - Mailing list pgsql-cygwin

From Jason Tishler
Subject Re: bug in config
Date
Msg-id 20020823131732.GD1356@tishler.net
Whole thread Raw
In response to bug in config  ("Scott" <scott.ellis@aetas.com.au>)
List pgsql-cygwin
Scott,

On Sun, Aug 18, 2002 at 10:14:07PM +1000, Scott wrote:
> Anyway, I built the
> libpq++ libs using the win32.mak files and NMAKE for use in my vc++
> progs, then I ran the configure script for cygwin and built
> postgresql...I found afterward that the "pg_config_os.h" (in
> postgresql-7.2.1/src/include) contained a line that said " #include
> <cygwin/version.h>", but this line occurs just before an "#ifdef
> __CYGWIN__" statement. This stopped my vc++ programs from compiling. I
> found that putting the include after the ifdef allows me to use the
> same headers under both environments...

I don't believe that the above is the right solution.  If it works then,
you are lucky.  It's also a very fragile solution that is subject to
break in the future.

> I'm supposing that this include statement is written into the code by the
> configure scripts, and that moving it down a line or two would be a simple
> thing for someone in the know :)

Under Cygwin (and the other Unixes), pg_config.h is created by
configure.  pg_config.h #includes pg_config_os.h which is a symlink to
the OS specific header file -- port/win.h is this case.  Under Windows,
pg_config.h is a copy of pg_config.h.win32 which is *only* created
during nmake if pg_config.h did not previously exist.

So, you were "lucky" that building with VC++ after configuring for
Cygwin almost worked.  My WAG is if you configure for a different Unix
such as Solaris you would have more than one line to "fix."

IMO, the best solution is to add an install target to win32.mak.  In
this way, one could do a nmake install and then point VC++ to this
installation directory.  Now your VC++ builds are independent of the
source tree -- freeing it up for other platform builds.

Since you have the VC++ itch, please submit a patch to pgsql-patches to
rectify this situation.  Please include a patch to the documentation
too:

    doc/src/sgml/install-win32.sgml

Thanks,
Jason

pgsql-cygwin by date:

Previous
From: Yared Mengistu
Date:
Subject: A newbie question
Next
From: "E.Boyd"
Date:
Subject: Problems installing DBI