1Imager::Probe(3)      User Contributed Perl Documentation     Imager::Probe(3)
2
3
4

NAME

6       Imager::Probe - hot needle of inquiry for libraries
7

SYNOPSIS

9         require Imager::Probe;
10
11         my %probe =
12           (
13            # short name of what we're looking for (displayed to user)
14            name => "FOO",
15            # pkg-config lookup
16            pkg => [ qw/name1 name2 name3/ ],
17            # perl subs that probe for the library
18            code => [ \&foo_probe1, \&foo_probe2 ],
19            # or just: code => \&foo_probe,
20            inccheck => sub { ... },
21            libcheck => sub { ... },
22            # search for this library if libcheck not supplied
23            libbase => "foo",
24            # library link time options, uses libbase to build options otherwise
25            libopts => "-lfoo",
26            # C code to check the library is sane
27            testcode => "...",
28            # header files needed
29            testcodeheaders => [ "stdio.h", "foo.h" ],
30           );
31         my $result = Imager::Probe->probe(\%probe)
32           or print "Foo library not found: ",Imager::Probe->error;
33

DESCRIPTION

35       Does the probes that were hidden in Imager's Makefile.PL, pulled out so
36       the file format libraries can be externalized.
37
38       The return value is either nothing if the probe fails, or a hash
39       containing:
40
41       ·   "INC" - "-I" and other C options
42
43       ·   "LIBS" - "-L", "-l" and other link-time options
44
45       ·   "DEFINE" - "-D" options, if any.
46
47       The possible values for the hash supplied to the probe() method are:
48
49       ·   "pkg" - an array of pkg-config names to probe for.  If the pkg-
50           config checks pass, "inccheck" and "libcheck" aren't used.
51
52       ·   "inccheck" - a code reference that checks if the supplied include
53           directory contains the required header files.
54
55       ·   "libcheck" - a code reference that checks if the supplied library
56           directory contains the required library files.  Note: the
57           Makefile.PL version of this was supplied all of the library file
58           names instead.
59
60       ·   "libbase" - if "inccheck" is supplied, but "libcheck" isn't, then a
61           "libcheck" that checks for "lib"libbase$Config{_a} and
62           "lib"libbase.$Config{so} is created.  If "libopts" isn't supplied
63           then that can be synthesized as "-l""<libbase">.
64
65       ·   "libopts" - if the libraries are found via "inccheck"/"libcheck",
66           these are the "-l" options to supply during the link phase.
67
68       ·   "code" - a code reference to perform custom checks.  Returns the
69           probe result directly.  Can also be an array ref of functions to
70           call.
71
72       ·   "testcode" - test C code that is run with Devel::CheckLib.  You
73           also need to set "testcodeheaders".
74
75       ·   "testcodeprologue" - C code to insert between the headers and the
76           main function.
77
78       ·   "incpath" - $Config{path_sep} separated list of header file
79           directories to check, or a reference to an array of such.
80
81       ·   "libpath" - $Config{path_sep} separated list of library file
82           directories to check, or a reference to an array of such.
83
84
85
86perl v5.12.3                      2011-06-06                  Imager::Probe(3)
Impressum