1 ################################################################################
5 ## $Date: 2006/07/03 10:21:55 +0200 $
7 ################################################################################
9 ## Version 3.x, Copyright (C) 2004-2006, Marcus Holland-Moritz.
10 ## Version 2.x, Copyright (C) 2001, Paul Marquess.
11 ## Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
13 ## This program is free software; you can redistribute it and/or
14 ## modify it under the same terms as Perl itself.
16 ################################################################################
34 ppport.h - Perl/Pollution/Portability version __VERSION__
38 perl ppport.h [options] [source files]
40 Searches current directory for files if no [source files] are given
42 --help show short help
44 --version show version
46 --patch=file write one patch file with changes
47 --copy=suffix write changed copies with suffix
48 --diff=program use diff program and options
50 --compat-version=version provide compatibility with Perl version
51 --cplusplus accept C++ comments
53 --quiet don't output anything except fatal errors
54 --nodiag don't show diagnostics
55 --nohints don't show hints
56 --nochanges don't suggest changes
57 --nofilter don't filter input files
59 --strip strip all script and doc functionality from
62 --list-provided list provided API
63 --list-unsupported list unsupported API
64 --api-info=name show Perl API portability information
68 This version of F<ppport.h> is designed to support operation with Perl
69 installations back to __MIN_PERL__, and has been tested up to __MAX_PERL__.
75 Display a brief usage summary.
79 Display the version of F<ppport.h>.
81 =head2 --patch=I<file>
83 If this option is given, a single patch file will be created if
84 any changes are suggested. This requires a working diff program
85 to be installed on your system.
87 =head2 --copy=I<suffix>
89 If this option is given, a copy of each file will be saved with
90 the given suffix that contains the suggested changes. This does
91 not require any external programs.
93 If neither C<--patch> or C<--copy> are given, the default is to
94 simply print the diffs for each file. This requires either
95 C<Text::Diff> or a C<diff> program to be installed.
97 =head2 --diff=I<program>
99 Manually set the diff program and options to use. The default
100 is to use C<Text::Diff>, when installed, and output unified
103 =head2 --compat-version=I<version>
105 Tell F<ppport.h> to check for compatibility with the given
106 Perl version. The default is to check for compatibility with Perl
107 version __MIN_PERL__. You can use this option to reduce the output
108 of F<ppport.h> if you intend to be backward compatible only
109 down to a certain Perl version.
113 Usually, F<ppport.h> will detect C++ style comments and
114 replace them with C style comments for portability reasons.
115 Using this option instructs F<ppport.h> to leave C++
120 Be quiet. Don't print anything except fatal errors.
124 Don't output any diagnostic messages. Only portability
125 alerts will be printed.
129 Don't output any hints. Hints often contain useful portability
134 Don't suggest any changes. Only give diagnostic output and hints
135 unless these are also deactivated.
139 Don't filter the list of input files. By default, files not looking
140 like source code (i.e. not *.xs, *.c, *.cc, *.cpp or *.h) are skipped.
144 Strip all script and documentation functionality from F<ppport.h>.
145 This reduces the size of F<ppport.h> dramatically and may be useful
146 if you want to include F<ppport.h> in smaller modules without
147 increasing their distribution size too much.
149 The stripped F<ppport.h> will have a C<--unstrip> option that allows
150 you to undo the stripping, but only if an appropriate C<Devel::PPPort>
153 =head2 --list-provided
155 Lists the API elements for which compatibility is provided by
156 F<ppport.h>. Also lists if it must be explicitly requested,
157 if it has dependencies, and if there are hints for it.
159 =head2 --list-unsupported
161 Lists the API elements that are known not to be supported by
162 F<ppport.h> and below which version of Perl they probably
163 won't be available or work.
165 =head2 --api-info=I<name>
167 Show portability information for API elements matching I<name>.
168 If I<name> is surrounded by slashes, it is interpreted as a regular
173 In order for a Perl extension (XS) module to be as portable as possible
174 across differing versions of Perl itself, certain steps need to be taken.
180 Including this header is the first major one. This alone will give you
181 access to a large part of the Perl API that hasn't been available in
182 earlier Perl releases. Use
184 perl ppport.h --list-provided
186 to see which API elements are provided by ppport.h.
190 You should avoid using deprecated parts of the API. For example, using
191 global Perl variables without the C<PL_> prefix is deprecated. Also,
192 some API functions used to have a C<perl_> prefix. Using this form is
193 also deprecated. You can safely use the supported API, as F<ppport.h>
194 will provide wrappers for older Perl versions.
198 If you use one of a few functions or variables that were not present in
199 earlier versions of Perl, and that can't be provided using a macro, you
200 have to explicitly request support for these functions by adding one or
201 more C<#define>s in your source code before the inclusion of F<ppport.h>.
203 These functions or variables will be marked C<explicit> in the list shown
204 by C<--list-provided>.
206 Depending on whether you module has a single or multiple files that
207 use such functions or variables, you want either C<static> or global
210 For a C<static> function or variable (used only in a single source
213 #define NEED_function
214 #define NEED_variable
216 For a global function or variable (used in multiple source files),
219 #define NEED_function_GLOBAL
220 #define NEED_variable_GLOBAL
222 Note that you mustn't have more than one global request for the
223 same function or variable in your project.
227 To avoid namespace conflicts, you can change the namespace of the
228 explicitly exported functions / variables using the C<DPPP_NAMESPACE>
229 macro. Just C<#define> the macro before including C<ppport.h>:
231 #define DPPP_NAMESPACE MyOwnNamespace_
234 The default namespace is C<DPPP_>.
238 The good thing is that most of the above can be checked by running
239 F<ppport.h> on your source code. See the next section for
244 To verify whether F<ppport.h> is needed for your module, whether you
245 should make any changes to your code, and whether any special defines
246 should be used, F<ppport.h> can be run as a Perl script to check your
247 source code. Simply say:
251 The result will usually be a list of patches suggesting changes
252 that should at least be acceptable, if not necessarily the most
253 efficient solution, or a fix for all possible problems.
255 If you know that your XS module uses features only available in
256 newer Perl releases, if you're aware that it uses C++ comments,
257 and if you want all suggestions as a single patch file, you could
258 use something like this:
260 perl ppport.h --compat-version=5.6.0 --cplusplus --patch=test.diff
262 If you only want your code to be scanned without any suggestions
265 perl ppport.h --nochanges
267 You can specify a different C<diff> program or options, using
268 the C<--diff> option:
270 perl ppport.h --diff='diff -C 10'
272 This would output context diffs with 10 lines of context.
274 To display portability information for the C<newSVpvn> function,
277 perl ppport.h --api-info=newSVpvn
279 Since the argument to C<--api-info> can be a regular expression,
282 perl ppport.h --api-info=/_nomg$/
284 to display portability information for all C<_nomg> functions or
286 perl ppport.h --api-info=/./
288 to display information for all known API elements.
292 If this version of F<ppport.h> is causing failure during
293 the compilation of this module, please check if newer versions
294 of either this module or C<Devel::PPPort> are available on CPAN
295 before sending a bug report.
297 If F<ppport.h> was generated using the latest version of
298 C<Devel::PPPort> and is causing failure of this module, please
299 file a bug report using the CPAN Request Tracker at L<http://rt.cpan.org/>.
301 Please include the following information:
307 The complete output from running "perl -V"
315 The name and version of the module you were trying to build.
319 A full log of the build that failed.
323 Any other information that you think could be relevant.
327 For the latest version of this code, please get the C<Devel::PPPort>
332 Version 3.x, Copyright (c) 2004-2006, Marcus Holland-Moritz.
334 Version 2.x, Copyright (C) 2001, Paul Marquess.
336 Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
338 This program is free software; you can redistribute it and/or
339 modify it under the same terms as Perl itself.
343 See L<Devel::PPPort>.