Permalink
Browse files

Attempt to output some compiler information in case DBD::Pg fails to …

…load at all,

as can happen when we have multiple conflicting libpq versions, leading to
messages like this: lo_import_with_oid: referenced symbol not found
  • Loading branch information...
1 parent 97fa432 commit d908114dcd98156a3ac373b71309bff6065f4a59 @turnstep turnstep committed Aug 23, 2012
Showing with 20 additions and 1 deletion.
  1. +20 −1 t/00basic.t
View
@@ -10,8 +10,27 @@ use Test::More tests => 3;
select(($|=1,select(STDERR),$|=1)[1]);
BEGIN {
+
use_ok ('DBI') or BAIL_OUT 'Cannot continue without DBI';
- use_ok ('DBD::Pg') or BAIL_OUT 'Cannot continue without DBD::Pg';
+
+ ## If we cannot load DBD::Pg, output some compiler information for debugging:
+ if (! use_ok ('DBD::Pg')) {
+ my $file = 'Makefile';
+ if (! -e $file) {
+ $file = '../Makefile';
+ }
+ my $fh;
+ if (open $fh, '<', $file) {
+ { local $/; $_ = <$fh>; }
+ close $fh;
+ for my $keyword (qw/ CCFLAGS INC LIBS /) {
+ if (/^#\s+$keyword => (.+)/m) {
+ diag "$keyword: $1";
+ }
+ }
+ }
+ BAIL_OUT 'Cannot continue without DBD::Pg';
+ }
}
use DBD::Pg;
like ($DBD::Pg::VERSION, qr/^v?\d+\.\d+\.\d+(?:_\d+)?$/, qq{Found DBD::Pg::VERSION as "$DBD::Pg::VERSION"});

0 comments on commit d908114

Please sign in to comment.