but what you want to do is quite simple: ...
Hm. The only reference in Makefile.pl to libpq the following which comes after WriteMakeFile() has been called, and is used to check if it was detected (It is; I get no errors):
my $output = WriteMakefile(%opts);
if (!exists $output->{EXTRALIBS} or
($output->{EXTRALIBS} !~ /\-lpq/ and $output->{EXTRALIBS} !~ /libp
+q/)) {
my $makefile = exists $output->{MAKEFILE}
? "\nRemoving ($output->{MAKEFILE})\n" : '';
warn qq{
==========================================================
WARNING! No libpq libraries were detected!
You need to install the postgresql-libs package for your system,
or set the POSTGRES_LIB environment variable to the correct place.
$makefile
===========================================================
};
## Do not let make proceed
unlink $output->{MAKEFILE} if $makefile;
exit 1;
}
exit 0;
And the only references to the key LIBS in %opts as passed to WriteMakeFile() are these:
LIBS => ["-L$POSTGRES_LIB -lpq -lm"],
...
elsif ($os =~ /Win32/) {
my $msdir = $POSTGRES_LIB;
$msdir =~ s{"$}{/ms"};
$opts{LIBS}[0] .= " -L$msdir -lsecur32";
So, I guess the "subtle point to my question" is how (and where/when) does -lpq get manipulated to cause it to add the reference to -llibpq?
On the basis that it EU::MM might simply generate references to all .libs it finds in the directory denoted by $ENV{ POSTGRES_LIB }, I tried placing a copy of libpq64.lb there, but it is ignored. As are the other .lib files that are located there: postgres.lib, libpgport.lib; libecpg.lib;.
So, something, somewhere, is telling EU::MM to generate references to libpq.lib, but I cannot see where or when that is occuring.
The second part of my question was how to automate the choice of whether to use libpq.lib or libpq64.lib. Your pseudo-code above neatly dodges both parts of that question.
- What goes inside your running_on_64bit()?
Ie. How to reliably determine that the target is X64 (on Windows).
- Where in the makefile.pl would I position your pseudo-code?
Given I can't see where libpq.lib is being referenced (other than in the post-facto test), it's hard to see where I would incorporate your code.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.