2 # ABSTRACT: detect and/or install zeromq
7 use String
::ShellQuote qw
/shell_quote/;
11 Upon installation, the target system is probed for the presence of libzmq. If
12 it is not found, B<libzmq 3.2.2> is installed in a shared directory. In
13 short, modules that need libzmq can depend on this module to make sure that it
16 This module is still B<EXPERIMENTAL>. In particular, I'm still pondering on
17 how S<libzmq-2.x> should be handled. Currently, if S<libzmq-2.x> is found on
18 the system, L<Alien::ZMQ> will use it, but there is no way to install
19 S<libzmq-2.x> with L<Alien::ZMQ>. I'm not sure what the most useful behavior
20 with regards to S<libzmq-2.x> is, so please talk to me if you have any ideas.
27 my $version = version->parse(Alien::ZMQ::lib_version);
28 my $lib_dir = Alien::ZMQ::lib_dir;
30 print "zeromq $version is installed at $lib_dir\n";
34 These options to F<Build.PL> affect the installation of this module.
38 =item --zmq-skip-probe
40 By default, libzmq is not compiled and installed if it is detected to already
41 be on the system. Use this to skip those checks and always install libzmq.
45 Pass extra flags to the compiler when probing for an existing installation of
46 libzmq. You can use this, along with L</--zmq-libs>, to help the probing
47 function locate your libzmq installation if it is installed in an unexpected
48 place. For example, if your libzmq is installed at F</opt/zeromq>, you can do
51 perl ./Build.PL --zmq-cflags="-I/opt/zeromq/include" \
52 --zmq-libs="-L/opt/zeromq/lib -lzmq"
54 These flags are only used by the probing function to locate libzmq; they will
55 not be used when compiling libzmq from source (if it needs to be). To affect
56 the compiling of libzmq, using the L</--zmq-config> flag instead.
58 A better alternative to using L</--zmq-cflags> and L</--zmq-libs> is to help
59 the L<pkg-config(1)> command find your libzmq using the C<PKG_CONFIG_PATH>
60 environment variable. Of course, this method requires that you have the
61 L<pkg-config(1)> program installed. Here's an example:
64 PKG_CONFIG_PATH=/opt/zeromq/lib/pkgconfig ./Build
68 Pass extra flags to the linker when probing for an existing installation of
69 libzmq. You can use this, along with L</--zmq-cflags>, to help the probing
70 function locate your libzmq installation if it is installed in an unexpected
71 place. Like L</--zmq-cflags>, these flags are only used by the probing
72 function to locate libzmq.
76 Pass extra flags to the libzmq F<configure> script. You may want to consider
77 passing either C<--with-pgm> or C<--with-system-pgm> if you need support for
78 PGM; this is not enabled by default because it is not supported by every
85 Probing is only done during the installation of this module, so if you are
86 using a system-installed version of libzmq and you uninstall or upgrade it,
87 you will also need to reinstall L<Alien::ZMQ>.
91 MSWin32 is not yet supported, but cygwin works.
97 =item * L<GitHub project|https://github.com/chazmcgarvey/p5-Alien-ZMQ>
99 =item * L<ZMQ> - good perl bindings for zeromq
101 =item * L<ZeroMQ|http://www.zeromq.org/> - official libzmq website
105 =head1 ACKNOWLEDGEMENTS
107 The design and implementation of this module were influenced by other L<Alien>
108 modules, including L<Alien::GMP> and L<Alien::Tidyp>.
112 Get the version number of libzmq as a v-string (version string), according to
113 the F<zmq.h> header file.
121 Get the version number of libzmq as a v-string
(version string
), according to
122 the F
<libzmq
.so
> file
.
130 Get the directory containing the F
<zmq
.h
> header file
.
138 Get the directory containing the F
<libzmq
.so
> file
.
146 Get the C compiler flags required to compile a program that uses libzmq
. This
147 is a shortcut
for constructing a C
<-I
> flag using L
</inc_dir
>.
152 "-I" . shell_quote
(inc_dir
);
157 Get the linker flags required to
link a program against libzmq
. This
is
158 a shortcut
for constructing a C
<-L
> flag using L
</lib_dir
>, plus C
<-lzmq
>. On
159 some platforms
, you may also want to add the library path to your executable
160 or library as a runtime path
; this can be done by passing C
<-rpath
> to the
161 linker
. Something like this could work
:
163 my $mylibs = Alien
::ZMQ
::libs
. " -Wl,-rpath=" . Alien
::ZMQ
::lib_dir
;
165 This will allow your program to find libzmq
, even
if it
is installed
in
166 a non-standard location
, but this isn
't necessary on some platforms.
171 "-L" . shell_quote(lib_dir) . " -lzmq";