=head1 NAME
Config - access Perl configuration information
=head1 SYNOPSIS
use Config;
if ($Config{usethreads}) {
print "has thread support\n"
}
use Config qw(myconfig config_sh config_vars config_re);
print myconfig();
print config_sh();
print config_re();
config_vars(qw(osname archname));
=head1 DESCRIPTION
The Config module contains all the information that was available to
the C program at Perl build time (over 900 values).
Shell variables from the F file (written by Configure) are
stored in the readonly-variable C<%Config>, indexed by their names.
Values stored in config.sh as 'undef' are returned as undefined
values. The perl C function can be used to check if a
named variable exists.
For a description of the variables, please have a look at the
Glossary file, as written in the Porting folder, or use the url:
http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/Glossary
=over 4
=item myconfig()
Returns a textual summary of the major perl configuration values.
See also C<-V> in L.
=item config_sh()
Returns the entire perl configuration information in the form of the
original config.sh shell variable assignment script.
=item config_re($regex)
Like config_sh() but returns, as a list, only the config entries who's
names match the $regex.
=item config_vars(@names)
Prints to STDOUT the values of the named configuration variable. Each is
printed on a separate line in the form:
name='value';
Names which are unknown are output as C.
See also C<-V:name> in L.
=back
=head1 EXAMPLE
Here's a more sophisticated example of using %Config:
use Config;
use strict;
my %sig_num;
my @sig_name;
unless($Config{sig_name} && $Config{sig_num}) {
die "No sigs?";
} else {
my @names = split ' ', $Config{sig_name};
@sig_num{@names} = split ' ', $Config{sig_num};
foreach (@names) {
$sig_name[$sig_num{$_}] ||= $_;
}
}
print "signal #17 = $sig_name[17]\n";
if ($sig_num{ALRM}) {
print "SIGALRM is $sig_num{ALRM}\n";
}
=head1 WARNING
Because this information is not stored within the perl executable
itself it is possible (but unlikely) that the information does not
relate to the actual perl binary which is being used to access it.
The Config module is installed into the architecture and version
specific library directory ($Config{installarchlib}) and it checks the
perl version number when loaded.
The values stored in config.sh may be either single-quoted or
double-quoted. Double-quoted strings are handy for those cases where you
need to include escape sequences in the strings. To avoid runtime variable
interpolation, any C<$> and C<@> characters are replaced by C<\$> and
C<\@>, respectively. This isn't foolproof, of course, so don't embed C<\$>
or C<\@> in double-quoted strings unless you're willing to deal with the
consequences. (The slashes will end up escaped and the C<$> or C<@> will
trigger variable interpolation)
=head1 GLOSSARY
Most C variables are determined by the C script
on platforms supported by it (which is most UNIX platforms). Some
platforms have custom-made C variables, and may thus not have
some of the variables described below, or may have extraneous variables
specific to that particular port. See the port specific documentation
in such cases.
=cut
=head2 _
=over 4
=cut
=item C<_a>
From F:
This variable defines the extension used for ordinary library files.
For unix, it is F<.a>. The F<.> is included. Other possible
values include F<.lib>.
=item C<_exe>
From F:
This variable defines the extension used for executable files.
C, Cygwin and F use F<.exe>. Stratus C uses F<.pm>.
On operating systems which do not require a specific extension
for executable files, this variable is empty.
=item C<_o>
From F:
This variable defines the extension used for object files.
For unix, it is F<.o>. The F<.> is included. Other possible
values include F<.obj>.
=back
=cut
=head2 a
=over 4
=cut
=item C
From F:
This variable is set to C if C (Andrew File System) is used
on the system, C otherwise. It is possible to override this
with a hint value or command line option, but you'd better know
what you are doing.
=item C
From F:
This variable is by default set to F. In the unlikely case
this is not the correct root, it is possible to override this with
a hint value or command line option. This will be used in subsequent
tests for AFSness in the configure and test process.
=item C
From F:
This variable holds the number of bytes required to align a
double-- or a long double when applicable. Usual values are
2, 4 and 8. The default is eight, for safety.
=item C
From F:
This variable is set if the user needs to run ansi2knr.
Currently, this is not supported, so we just abort.
=item C
From F:
This variable contains the command which can be used to compute the
host name. The command is fully qualified by its absolute path, to make
it safe when used by a process with super-user privileges.
=item C
From F:
The three variables, api_revision, api_version, and
api_subversion, specify the version of the oldest perl binary
compatible with the present perl. In a full version string
such as F<5.6.1>, api_revision is the C<5>.
Prior to 5.5.640, the format was a floating point number,
like 5.00563.
F:incpush() and F will automatically search in
F<$sitelib/.>. for older directories back to the limit specified
by these api_ variables. This is only useful if you have a
perl library directory tree structured like the default one.
See C for how this works. The versioned site_perl
directory was introduced in 5.005, so that is the lowest
possible value. The version list appropriate for the current
system is determined in F.
C To do: Since compatibility can depend on compile time
options (such as bincompat, longlong, etc.) it should
(perhaps) be set by Configure, but currently it isn't.
Currently, we read a hard-wired value from F.
Perhaps what we ought to do is take the hard-wired value from
F but then modify it if the current Configure
options warrant. F then would use an #ifdef guard.
=item C
From F:
The three variables, api_revision, api_version, and
api_subversion, specify the version of the oldest perl binary
compatible with the present perl. In a full version string
such as F<5.6.1>, api_subversion is the C<1>. See api_revision for
full details.
=item C
From F:
The three variables, api_revision, api_version, and
api_subversion, specify the version of the oldest perl binary
compatible with the present perl. In a full version string
such as F<5.6.1>, api_version is the C<6>. See api_revision for
full details. As a special case, 5.5.0 is rendered in the
old-style as 5.005. (In the 5.005_0x maintenance series,
this was the only versioned directory in $sitelib.)
=item C
From F:
This variable combines api_revision, api_version, and
api_subversion in a format such as 5.6.1 (or 5_6_1) suitable
for use as a directory name. This is filesystem dependent.
=item C
From F:
This variable is used internally by Configure to determine the
full pathname (if any) of the ar program. After Configure runs,
the value is reset to a plain C and is not useful.
=item C
From F:
This variable holds the name of the directory in which the user wants
to put architecture-dependent public library files for $package.
It is most often a local directory such as F.
Programs using this variable must be prepared to deal
with filename expansion.
=item C
From F:
This variable is the same as the archlib variable, but is
filename expanded at configuration time, for convenient use.
=item C
From F:
This variable is a short name to characterize the current
architecture. It is used mainly to construct the default archlib.
=item C
From F:
This variable is used for the 64-bitness part of $archname.
=item C
From F:
This variable defines any additional objects that must be linked
in with the program on this architecture. On unix, it is usually
empty. It is typically used to include emulations of unix calls
or other facilities. For perl on F, for example, this would
include F.
=item C
From F:
This variable encodes the prototype of asctime_r.
It is zero if d_asctime_r is undef, and one of the
C macros of F if d_asctime_r
is defined.
=item C
From F:
This variable is used internally by Configure to determine the
full pathname (if any) of the awk program. After Configure runs,
the value is reset to a plain C and is not useful.
=back
=cut
=head2 b
=over 4
=cut
=item C
From F:
The base revision level of this package, from the F<.package> file.
=item C
From F:
This variable is defined but not used by Configure.
The value is the empty string and is not useful.
=item C
From F:
This variable holds the name of the directory in which the user wants
to put publicly executable images for the package in question. It
is most often a local directory such as F. Programs using
this variable must be prepared to deal with F<~name> substitution.
=item C
From F:
This is the same as the bin variable, but is filename expanded at
configuration time, for use in your makefiles.
=item C
From F:
This variable is used internally by Configure to determine the
full pathname (if any) of the bison program. After Configure runs,
the value is reset to a plain C and is not useful.
=item C
From F:
This variable is used internally by Configure to determine the
full pathname (if any) of the byacc program. After Configure runs,
the value is reset to a plain C and is not useful.
=item C
From F:
This variable holds the byte order in a C. In the following,
larger digits indicate more significance. The variable byteorder
is either 4321 on a big-endian machine, or 1234 on a little-endian,
or 87654321 on a Cray ... or 3412 with weird order !
=back
=cut
=head2 c
=over 4
=cut
=item C
From F:
This variable contains the \c string if that is what causes the echo
command to suppress newline. Otherwise it is null. Correct usage is
$echo $n "prompt for a question: $c".
=item C
From F:
This variable contains a flag that precise difficulties the
compiler has casting odd floating values to unsigned long:
0 = ok
1 = couldn't cast < 0
2 = couldn't cast >= 0x80000000
4 = couldn't cast in argument expression list
=item C
From F:
This variable is used internally by Configure to determine the
full pathname (if any) of the cat program. After Configure runs,
the value is reset to a plain C and is not useful.
=item C
From F:
This variable holds the name of a command to execute a C compiler which
can resolve multiple global references that happen to have the same
name. Usual values are C and C.
Fervent C compilers may be called C. C has xlc.
=item C
From F:
This variable contains any special flags that might need to be
passed with C to compile modules to be used to create a shared
library that will be used for dynamic loading. For hpux, this
should be +z. It is up to the makefile to use it.
=item C
From F:
This variable contains any special flags that might need to be
passed to cc to link with a shared library for dynamic loading.
It is up to the makefile to use it. For sunos 4.1, it should
be empty.
=item C
From F:
This variable contains any additional C compiler flags desired by
the user. It is up to the Makefile to use this.
=item C
From F:
This variable contains the compiler flags needed by large file builds
and added to ccflags by hints files.
=item C
From F:
This can set either by hints files or by Configure. If using
gcc, this is gcc, and if not, usually equal to cc, unimpressive, no?
Some platforms, however, make good use of this by storing the
flavor of the C compiler being used here. For example if using
the Sun WorkShop suite, ccname will be C.
=item C
From F:
The variable contains the symbols defined by the C compiler alone.
The symbols defined by cpp or by cc when it calls cpp are not in
this list, see cppsymbols and cppccsymbols.
The list is a space-separated list of symbol=value tokens.
=item C
From F:
This can set either by hints files or by Configure. If using
a (non-gcc) vendor cc, this variable may contain a version for
the compiler.
=item C
From F:
Login name of the person who ran the Configure script and answered the
questions. This is used to tag both F and F.
=item C
From F:
Electronic mail address of the person who ran Configure. This can be
used by units that require the user's e-mail, like F.
=item C
From F:
Holds the output of the C command when the configuration file was
produced. This is used to tag both F and F.
=item C
From F:
This variable is defined but not used by Configure.
The value is the empty string and is not useful.
=item C
From F:
This variable is used internally by Configure to determine the
full pathname (if any) of the chmod program. After Configure runs,
the value is reset to a plain C and is not useful.
=item C
From F:
This variable is defined but not used by Configure.
The value is the empty string and is not useful.
=item C
From F:
This variable holds the type returned by times(). It can be long,
or clock_t on C sites (in which case should be
included).
=item C
From F:
This variable is used internally by Configure to determine the
full pathname (if any) of the comm program. After Configure runs,
the value is reset to a plain C and is not useful.
=item C
From F:
This variable is defined but not used by Configure.
The value is the empty string and is not useful.
=item C
From F:
This variable holds the command to do a grep with a proper return
status. On most sane systems it is simply C. On insane systems
it is a grep followed by a cat followed by a test. This variable
is primarily for the use of other Configure units.
=item C
From F:
This variable is used internally by Configure to determine the
full pathname (if any) of the cp program. After Configure runs,
the value is reset to a plain C and is not useful.
=item C
From F:
This variable is defined but not used by Configure.
The value is the empty string and is not useful.
=item C
From F:
This variable is used internally by Configure to determine the
full pathname (if any) of the cpp program. After Configure runs,
the value is reset to a plain C and is not useful.
=item C
From F:
This variable contains an identification of the concatenation mechanism
used by the C preprocessor.
=item C
From F:
The variable contains the symbols defined by the C compiler
when it calls cpp. The symbols defined by the cc alone or cpp
alone are not in this list, see ccsymbols and cppsymbols.
The list is a space-separated list of symbol=value tokens.
=item C
From F:
This variable holds the flags that will be passed to the C pre-
processor. It is up to the Makefile to use it.
=item C
From F:
This variable has the same functionality as cppminus, only it applies
to cpprun and not cppstdin.
=item C
From F:
This variable contains the second part of the string which will invoke
the C preprocessor on the standard input and produce to standard
output. This variable will have the value C<-> if cppstdin needs
a minus to specify standard input, otherwise the value is "".
=item C
From F:
This variable contains the command which will invoke a C preprocessor
on standard input and put the output to stdout. It is guaranteed not
to be a wrapper and may be a null string if no preprocessor can be
made directly available. This preprocessor might be different from the
one used by the C compiler. Don't forget to append cpplast after the
preprocessor options.
=item C
From F:
This variable contains the command which will invoke the C
preprocessor on standard input and put the output to stdout.
It is primarily used by other Configure units that ask about
preprocessor symbols.
=item C
From F:
The variable contains the symbols defined by the C preprocessor
alone. The symbols defined by cc or by cc when it calls cpp are
not in this list, see ccsymbols and cppccsymbols.
The list is a space-separated list of symbol=value tokens.
=item C
From F:
This variable encodes the prototype of crypt_r.
It is zero if d_crypt_r is undef, and one of the
C macros of F if d_crypt_r
is defined.
=item C
From F:
This variable holds -lcrypt or the path to a F archive if
the crypt() function is not defined in the standard C library. It is
up to the Makefile to use this.
=item C
From F:
This variable is used internally by Configure to determine the
full pathname (if any) of the csh program. After Configure runs,
the value is reset to a plain C and is not useful.
=item C
From F:
This variable encodes the prototype of ctermid_r.
It is zero if d_ctermid_r is undef, and one of the
C macros of F if d_ctermid_r
is defined.
=item C
From F:
This variable encodes the prototype of ctime_r.
It is zero if d_ctime_r is undef, and one of the
C macros of F if d_ctime_r
is defined.
=back
=cut
=head2 d
=over 4
=cut
=item C
From F:
This variable conditionally defines C if _fwalk() is
available to apply a function to all the file handles.
=item C
From F:
This variable conditionally defines C if the access() system
call is available to check for access permissions using real IDs.
=item C
From F:
This variable conditionally defines the C symbol, which
indicates to the C program that the accessx() routine is available.
=item C
From F:
This variable conditionally defines the C symbol, which
indicates to the C program that the aintl() routine is available.
If copysignl is also present we can emulate modfl.
=item C
From F:
This variable conditionally defines the C symbol, which
indicates to the C program that the alarm() routine is available.
=item C
From F:
This variable conditionally defines C to hold the pathname
of architecture-dependent library files for $package. If
$archlib is the same as $privlib, then this is set to undef.
=item C
From F:
This variable conditionally defines the HAS_ASCTIME64 symbol, which
indicates to the C program that the asctime64 () routine is available.
=item C
From F:
This variable conditionally defines the C symbol,
which indicates to the C program that the asctime_r()
routine is available.
=item C
From F:
This variable conditionally defines the C symbol, which
indicates to the C program that the atolf() routine is available.
=item C
From F:
This variable conditionally defines the C symbol, which
indicates to the C program that the atoll() routine is available.
=item C
From F:
This variable conditionally defines C, which
indicates that C can handle the attribute for marking deprecated
APIs
=item C
From F:
This variable conditionally defines C, which
indicates the C compiler can check for printf-like formats.
=item C
From F:
This variable conditionally defines C, which
indicates the C compiler can understand functions as having
malloc-like semantics.
=item C
From F:
This variable conditionally defines C, which
indicates that the C compiler can know that certain arguments
must not be C, and will check accordingly at compile time.
=item C
From F:
This variable conditionally defines C, which
indicates that the C compiler can know that certain functions
are guaranteed never to return.
=item C
From F:
This variable conditionally defines C, which
indicates that the C compiler can know that certain functions
are C functions, meaning that they have no side effects, and
only rely on function input F global data for their results.
=item C
From F:
This variable conditionally defines C, which
indicates that the C compiler can know that certain variables
and arguments may not always be used, and to not throw warnings
if they don't get used.
=item C
From F:
This variable conditionally defines
C, which indicates that the C
compiler can know that certain functions have a return values
that must not be ignored, such as malloc() or open().
=item C
From F:
This variable conditionally defines the C symbol if
the bcmp() routine is available to compare strings.
=item C
From F:
This variable conditionally defines the C symbol if
the bcopy() routine is available to copy strings.
=item C
From F:
This symbol conditionally defines the symbol C when running on a
C system.
=item C
From F:
This variable conditionally defines C if
getpgrp needs one arguments whereas C one needs none.
=item C