Blame README.md

Packit Service 1ec3b4
# NAME
Packit Service 1ec3b4
Packit Service 1ec3b4
Config::AutoConf - A module to implement some of AutoConf macros in pure perl.
Packit Service 1ec3b4
Packit Service 1ec3b4
# ABSTRACT
Packit Service 1ec3b4
Packit Service 1ec3b4
With this module I pretend to simulate some of the tasks AutoConf
Packit Service 1ec3b4
macros do. To detect a command, to detect a library, etc.
Packit Service 1ec3b4
Packit Service 1ec3b4
# SYNOPSIS
Packit Service 1ec3b4
Packit Service 1ec3b4
    use Config::AutoConf;
Packit Service 1ec3b4
Packit Service 1ec3b4
    Config::AutoConf->check_prog("agrep");
Packit Service 1ec3b4
    my $grep = Config::AutoConf->check_progs("agrep", "egrep", "grep");
Packit Service 1ec3b4
Packit Service 1ec3b4
    Config::AutoConf->check_header("ncurses.h");
Packit Service 1ec3b4
    my $curses = Config::AutoConf->check_headers("ncurses.h","curses.h");
Packit Service 1ec3b4
Packit Service 1ec3b4
    Config::AutoConf->check_prog_awk;
Packit Service 1ec3b4
    Config::AutoConf->check_prog_egrep;
Packit Service 1ec3b4
Packit Service 1ec3b4
    Config::AutoConf->check_cc();
Packit Service 1ec3b4
Packit Service 1ec3b4
    Config::AutoConf->check_lib("ncurses", "tgoto");
Packit Service 1ec3b4
Packit Service 1ec3b4
    Config::AutoConf->check_file("/etc/passwd"); # -f && -r
Packit Service 1ec3b4
Packit Service 1ec3b4
# DESCRIPTION
Packit Service 1ec3b4
Packit Service 1ec3b4
Config::AutoConf is intended to provide the same opportunities to Perl
Packit Service 1ec3b4
developers as [GNU Autoconf](http://www.gnu.org/software/autoconf/)
Packit Service 1ec3b4
does for Shell developers.
Packit Service 1ec3b4
Packit Service 1ec3b4
As Perl is the second most deployed language (mind: every Unix comes
Packit Service 1ec3b4
with Perl, several mini-computers have Perl and even lot's of Windows
Packit Service 1ec3b4
machines run Perl software - which requires deployed Perl there, too),
Packit Service 1ec3b4
this gives wider support than Shell based probes.
Packit Service 1ec3b4
Packit Service 1ec3b4
The API is leaned against GNU Autoconf, but we try to make the API
Packit Service 1ec3b4
(especially optional arguments) more Perl'ish than m4 abilities allow
Packit Service 1ec3b4
to the original.
Packit Service 1ec3b4
Packit Service 1ec3b4
# CONSTRUCTOR
Packit Service 1ec3b4
Packit Service 1ec3b4
## new
Packit Service 1ec3b4
Packit Service 1ec3b4
This function instantiates a new instance of Config::AutoConf, eg. to
Packit Service 1ec3b4
configure child components. The constructor adds also values set via
Packit Service 1ec3b4
environment variable `PERL5_AUTOCONF_OPTS`.
Packit Service 1ec3b4
Packit Service 1ec3b4
# METHODS
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_file
Packit Service 1ec3b4
Packit Service 1ec3b4
This function checks if a file exists in the system and is readable by
Packit Service 1ec3b4
the user. Returns a boolean. You can use '-f $file && -r $file' so you
Packit Service 1ec3b4
don't need to use a function call.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_files
Packit Service 1ec3b4
Packit Service 1ec3b4
This function checks if a set of files exist in the system and are
Packit Service 1ec3b4
readable by the user. Returns a boolean.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_prog( $prog, \\@dirlist?, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
This function checks for a program with the supplied name. In success
Packit Service 1ec3b4
returns the full path for the executable;
Packit Service 1ec3b4
Packit Service 1ec3b4
An optional array reference containing a list of directories to be searched
Packit Service 1ec3b4
instead of $PATH is gracefully honored.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_progs(progs, \[dirlist\])
Packit Service 1ec3b4
Packit Service 1ec3b4
This function takes a list of program names. Returns the full path for
Packit Service 1ec3b4
the first found on the system. Returns undef if none was found.
Packit Service 1ec3b4
Packit Service 1ec3b4
An optional array reference containing a list of directories to be searched
Packit Service 1ec3b4
instead of $PATH is gracefully honored.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively. The
Packit Service 1ec3b4
name of the _$prog_ to check and the found full path are passed as first
Packit Service 1ec3b4
and second argument to the _action\_on\_true_ callback.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_prog\_yacc
Packit Service 1ec3b4
Packit Service 1ec3b4
From the autoconf documentation,
Packit Service 1ec3b4
Packit Service 1ec3b4
    If `bison' is found, set [...] `bison -y'.
Packit Service 1ec3b4
    Otherwise, if `byacc' is found, set [...] `byacc'. 
Packit Service 1ec3b4
    Otherwise set [...] `yacc'.  The result of this test can be influenced
Packit Service 1ec3b4
    by setting the variable YACC or the cache variable ac_cv_prog_YACC.
Packit Service 1ec3b4
Packit Service 1ec3b4
Returns the full path, if found.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_prog\_awk
Packit Service 1ec3b4
Packit Service 1ec3b4
From the autoconf documentation,
Packit Service 1ec3b4
Packit Service 1ec3b4
    Check for `gawk', `mawk', `nawk', and `awk', in that order, and
Packit Service 1ec3b4
    set output [...] to the first one that is found.  It tries
Packit Service 1ec3b4
    `gawk' first because that is reported to be the best implementation.
Packit Service 1ec3b4
    The result can be overridden by setting the variable AWK or the
Packit Service 1ec3b4
    cache variable ac_cv_prog_AWK.
Packit Service 1ec3b4
Packit Service 1ec3b4
Note that it returns the full path, if found.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_prog\_egrep
Packit Service 1ec3b4
Packit Service 1ec3b4
From the autoconf documentation,
Packit Service 1ec3b4
Packit Service 1ec3b4
    Check for `grep -E' and `egrep', in that order, and [...] output
Packit Service 1ec3b4
    [...] the first one that is found.  The result can be overridden by
Packit Service 1ec3b4
    setting the EGREP variable and is cached in the ac_cv_path_EGREP
Packit Service 1ec3b4
    variable. 
Packit Service 1ec3b4
Packit Service 1ec3b4
Note that it returns the full path, if found.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_prog\_lex
Packit Service 1ec3b4
Packit Service 1ec3b4
From the autoconf documentation,
Packit Service 1ec3b4
Packit Service 1ec3b4
    If flex is found, set output [...] to ‘flex’ and [...] to -lfl, if that
Packit Service 1ec3b4
    library is in a standard place. Otherwise set output [...] to ‘lex’ and
Packit Service 1ec3b4
    [...] to -ll, if found. If [...] packages [...] ship the generated
Packit Service 1ec3b4
    file.yy.c alongside the source file.l, this [...] allows users without a
Packit Service 1ec3b4
    lexer generator to still build the package even if the timestamp for
Packit Service 1ec3b4
    file.l is inadvertently changed.
Packit Service 1ec3b4
Packit Service 1ec3b4
Note that it returns the full path, if found.
Packit Service 1ec3b4
Packit Service 1ec3b4
The structure $self->{lex} is set with attributes
Packit Service 1ec3b4
Packit Service 1ec3b4
    prog => $LEX
Packit Service 1ec3b4
    lib => $LEXLIB
Packit Service 1ec3b4
    root => $lex_root
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_prog\_sed
Packit Service 1ec3b4
Packit Service 1ec3b4
From the autoconf documentation,
Packit Service 1ec3b4
Packit Service 1ec3b4
    Set output variable [...] to a Sed implementation that conforms to Posix
Packit Service 1ec3b4
    and does not have arbitrary length limits. Report an error if no
Packit Service 1ec3b4
    acceptable Sed is found. See Limitations of Usual Tools, for more
Packit Service 1ec3b4
    information about portability problems with Sed.
Packit Service 1ec3b4
Packit Service 1ec3b4
    The result of this test can be overridden by setting the SED variable and
Packit Service 1ec3b4
    is cached in the ac_cv_path_SED variable. 
Packit Service 1ec3b4
Packit Service 1ec3b4
Note that it returns the full path, if found.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_prog\_pkg\_config
Packit Service 1ec3b4
Packit Service 1ec3b4
Checks for `pkg-config` program. No additional tests are made for it ...
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_prog\_cc
Packit Service 1ec3b4
Packit Service 1ec3b4
Determine a C compiler to use. Currently the probe is delegated to [ExtUtils::CBuilder](https://metacpan.org/pod/ExtUtils::CBuilder).
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_cc
Packit Service 1ec3b4
Packit Service 1ec3b4
(Deprecated) Old name of ["check\_prog\_cc"](#check_prog_cc).
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_valid\_compiler
Packit Service 1ec3b4
Packit Service 1ec3b4
This function checks for a valid compiler for the currently active language.
Packit Service 1ec3b4
At the very moment only `C` is understood (corresponding to your compiler
Packit Service 1ec3b4
default options, e.g. -std=gnu89).
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_valid\_compilers(;\\@)
Packit Service 1ec3b4
Packit Service 1ec3b4
Checks for valid compilers for each given language. When unspecified
Packit Service 1ec3b4
defaults to `[ "C" ]`.
Packit Service 1ec3b4
Packit Service 1ec3b4
## msg\_checking
Packit Service 1ec3b4
Packit Service 1ec3b4
Prints "Checking @\_ ..."
Packit Service 1ec3b4
Packit Service 1ec3b4
## msg\_result
Packit Service 1ec3b4
Packit Service 1ec3b4
Prints result \\n
Packit Service 1ec3b4
Packit Service 1ec3b4
## msg\_notice
Packit Service 1ec3b4
Packit Service 1ec3b4
Prints "configure: " @\_ to stdout
Packit Service 1ec3b4
Packit Service 1ec3b4
## msg\_warn
Packit Service 1ec3b4
Packit Service 1ec3b4
Prints "configure: " @\_ to stderr
Packit Service 1ec3b4
Packit Service 1ec3b4
## msg\_error
Packit Service 1ec3b4
Packit Service 1ec3b4
Prints "configure: " @\_ to stderr and exits with exit code 0 (tells
Packit Service 1ec3b4
toolchain to stop here and report unsupported environment)
Packit Service 1ec3b4
Packit Service 1ec3b4
## msg\_failure
Packit Service 1ec3b4
Packit Service 1ec3b4
Prints "configure: " @\_ to stderr and exits with exit code 0 (tells
Packit Service 1ec3b4
toolchain to stop here and report unsupported environment). Additional
Packit Service 1ec3b4
details are provides in config.log (probably more information in a
Packit Service 1ec3b4
later stage).
Packit Service 1ec3b4
Packit Service 1ec3b4
## define\_var( $name, $value \[, $comment \] )
Packit Service 1ec3b4
Packit Service 1ec3b4
Defines a check variable for later use in further checks or code to compile.
Packit Service 1ec3b4
Returns the value assigned value
Packit Service 1ec3b4
Packit Service 1ec3b4
## write\_config\_h( \[$target\] )
Packit Service 1ec3b4
Packit Service 1ec3b4
Writes the defined constants into given target:
Packit Service 1ec3b4
Packit Service 1ec3b4
    Config::AutoConf->write_config_h( "config.h" );
Packit Service 1ec3b4
Packit Service 1ec3b4
## push\_lang(lang \[, implementor \])
Packit Service 1ec3b4
Packit Service 1ec3b4
Puts the current used language on the stack and uses specified language
Packit Service 1ec3b4
for subsequent operations until ending pop\_lang call.
Packit Service 1ec3b4
Packit Service 1ec3b4
## pop\_lang(\[ lang \])
Packit Service 1ec3b4
Packit Service 1ec3b4
Pops the currently used language from the stack and restores previously used
Packit Service 1ec3b4
language. If _lang_ specified, it's asserted that the current used language
Packit Service 1ec3b4
equals to specified language (helps finding control flow bugs).
Packit Service 1ec3b4
Packit Service 1ec3b4
## lang\_call( \[prologue\], function )
Packit Service 1ec3b4
Packit Service 1ec3b4
Builds program which simply calls given function.
Packit Service 1ec3b4
When given, prologue is prepended otherwise, the default
Packit Service 1ec3b4
includes are used.
Packit Service 1ec3b4
Packit Service 1ec3b4
## lang\_build\_program( prologue, body )
Packit Service 1ec3b4
Packit Service 1ec3b4
Builds program for current chosen language. If no prologue is given
Packit Service 1ec3b4
(_undef_), the default headers are used. If body is missing, default
Packit Service 1ec3b4
body is used.
Packit Service 1ec3b4
Packit Service 1ec3b4
Typical call of
Packit Service 1ec3b4
Packit Service 1ec3b4
    Config::AutoConf->lang_build_program( "const char hw[] = \"Hello, World\\n\";",
Packit Service 1ec3b4
                                          "fputs (hw, stdout);" )
Packit Service 1ec3b4
Packit Service 1ec3b4
will create
Packit Service 1ec3b4
Packit Service 1ec3b4
    const char hw[] = "Hello, World\n";
Packit Service 1ec3b4
Packit Service 1ec3b4
    /* Override any gcc2 internal prototype to avoid an error.  */
Packit Service 1ec3b4
    #ifdef __cplusplus
Packit Service 1ec3b4
    extern "C" {
Packit Service 1ec3b4
    #endif
Packit Service 1ec3b4
Packit Service 1ec3b4
    int
Packit Service 1ec3b4
    main (int argc, char **argv)
Packit Service 1ec3b4
    {
Packit Service 1ec3b4
      (void)argc;
Packit Service 1ec3b4
      (void)argv;
Packit Service 1ec3b4
      fputs (hw, stdout);;
Packit Service 1ec3b4
      return 0;
Packit Service 1ec3b4
    }
Packit Service 1ec3b4
Packit Service 1ec3b4
    #ifdef __cplusplus
Packit Service 1ec3b4
    }
Packit Service 1ec3b4
    #endif
Packit Service 1ec3b4
Packit Service 1ec3b4
## lang\_build\_bool\_test (prologue, test, \[@decls\])
Packit Service 1ec3b4
Packit Service 1ec3b4
Builds a static test which will fail to compile when test
Packit Service 1ec3b4
evaluates to false. If `@decls` is given, it's prepended
Packit Service 1ec3b4
before the test code at the variable definition place.
Packit Service 1ec3b4
Packit Service 1ec3b4
## push\_includes
Packit Service 1ec3b4
Packit Service 1ec3b4
Adds given list of directories to preprocessor/compiler
Packit Service 1ec3b4
invocation. This is not proved to allow adding directories
Packit Service 1ec3b4
which might be created during the build.
Packit Service 1ec3b4
Packit Service 1ec3b4
## push\_preprocess\_flags
Packit Service 1ec3b4
Packit Service 1ec3b4
Adds given flags to the parameter list for preprocessor invocation.
Packit Service 1ec3b4
Packit Service 1ec3b4
## push\_compiler\_flags
Packit Service 1ec3b4
Packit Service 1ec3b4
Adds given flags to the parameter list for compiler invocation.
Packit Service 1ec3b4
Packit Service 1ec3b4
## push\_libraries
Packit Service 1ec3b4
Packit Service 1ec3b4
Adds given list of libraries to the parameter list for linker invocation.
Packit Service 1ec3b4
Packit Service 1ec3b4
## push\_library\_paths
Packit Service 1ec3b4
Packit Service 1ec3b4
Adds given list of library paths to the parameter list for linker invocation.
Packit Service 1ec3b4
Packit Service 1ec3b4
## push\_link\_flags
Packit Service 1ec3b4
Packit Service 1ec3b4
Adds given flags to the parameter list for linker invocation.
Packit Service 1ec3b4
Packit Service 1ec3b4
## compile\_if\_else( $src, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
This function tries to compile specified code and returns a boolean value
Packit Service 1ec3b4
containing check success state.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
## link\_if\_else( $src, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
This function tries to compile and link specified code and returns a boolean
Packit Service 1ec3b4
value containing check success state.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_cached( $cache-key, $check-title, \\&check-call, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
Retrieves the result of a previous ["check\_cached"](#check_cached) invocation from
Packit Service 1ec3b4
`cache-key`, or (when called for the first time) populates the cache
Packit Service 1ec3b4
by invoking `\&check_call`. 
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed on **every** call
Packit Service 1ec3b4
to check\_cached (not just the first cache-populating invocation), respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
## cache\_val
Packit Service 1ec3b4
Packit Service 1ec3b4
This function returns the value of a previously check\_cached call.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_decl( $symbol, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
This method actually tests whether symbol is defined as a macro or can be
Packit Service 1ec3b4
used as an r-value, not whether it is really declared, because it is much
Packit Service 1ec3b4
safer to avoid introducing extra declarations when they are not needed.
Packit Service 1ec3b4
In order to facilitate use of C++ and overloaded function declarations, it
Packit Service 1ec3b4
is possible to specify function argument types in parentheses for types
Packit Service 1ec3b4
which can be zero-initialized:
Packit Service 1ec3b4
Packit Service 1ec3b4
    Config::AutoConf->check_decl("basename(char *)")
Packit Service 1ec3b4
Packit Service 1ec3b4
This method caches its result in the `ac_cv_decl_<set lang>`\_symbol
Packit Service 1ec3b4
variable.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
When a _prologue_ exists in the optional hash at end, it will be favoured
Packit Service 1ec3b4
over `default includes` (represented by ["\_default\_includes"](#_default_includes)). If any of
Packit Service 1ec3b4
_action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined, both callbacks
Packit Service 1ec3b4
are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or _action\_on\_false_ to
Packit Service 1ec3b4
`check_cached`, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_decls( symbols, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
For each of the symbols (with optional function argument types for C++
Packit Service 1ec3b4
overloads), run [check\_decl](https://metacpan.org/pod/check_decl).
Packit Service 1ec3b4
Packit Service 1ec3b4
Contrary to GNU autoconf, this method does not declare HAVE\_DECL\_symbol
Packit Service 1ec3b4
macros for the resulting `confdefs.h`, because it differs as `check_decl`
Packit Service 1ec3b4
between compiling languages.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
When a _prologue_ exists in the optional hash at end, it will be favoured
Packit Service 1ec3b4
over `default includes` (represented by ["\_default\_includes"](#_default_includes)). If any of
Packit Service 1ec3b4
_action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined, both callbacks
Packit Service 1ec3b4
are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or _action\_on\_false_ to
Packit Service 1ec3b4
`check_cached`, respectively.
Packit Service 1ec3b4
Given callbacks for _action\_on\_symbol\_true_ or _action\_on\_symbol\_false_ are
Packit Service 1ec3b4
called for each symbol checked using ["check\_decl"](#check_decl) receiving the symbol as
Packit Service 1ec3b4
first argument.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_func( $function, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
This method actually tests whether _$funcion_ can be linked into a program
Packit Service 1ec3b4
trying to call _$function_.  This method caches its result in the
Packit Service 1ec3b4
ac\_cv\_func\_FUNCTION variable.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
If any of _action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined,
Packit Service 1ec3b4
both callbacks are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or
Packit Service 1ec3b4
_action\_on\_false_ to `check_cached`, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
Returns: True if the function was found, false otherwise
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_funcs( \\@functions-list, $action-if-true?, $action-if-false? )
Packit Service 1ec3b4
Packit Service 1ec3b4
The same as check\_func, but takes a list of functions in _\\@functions-list_
Packit Service 1ec3b4
to look for and checks for each in turn. Define HAVE\_FUNCTION for each
Packit Service 1ec3b4
function that was found.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
If any of _action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined,
Packit Service 1ec3b4
both callbacks are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or
Packit Service 1ec3b4
_action\_on\_false_ to `check_cached`, respectively.  Given callbacks
Packit Service 1ec3b4
for _action\_on\_function\_true_ or _action\_on\_function\_false_ are called for
Packit Service 1ec3b4
each symbol checked using ["check\_func"](#check_func) receiving the symbol as first
Packit Service 1ec3b4
argument.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_type( $symbol, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
Check whether type is defined. It may be a compiler builtin type or defined
Packit Service 1ec3b4
by the includes.  In C, type must be a type-name, so that the expression
Packit Service 1ec3b4
`sizeof (type)` is valid (but `sizeof ((type))` is not).
Packit Service 1ec3b4
Packit Service 1ec3b4
If _type_ type is defined, preprocessor macro HAVE\__type_ (in all
Packit Service 1ec3b4
capitals, with "\*" replaced by "P" and spaces and dots replaced by
Packit Service 1ec3b4
underscores) is defined.
Packit Service 1ec3b4
Packit Service 1ec3b4
This method caches its result in the `ac_cv_type_`type variable.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
When a _prologue_ exists in the optional hash at end, it will be favoured
Packit Service 1ec3b4
over `default includes` (represented by ["\_default\_includes"](#_default_includes)). If any of
Packit Service 1ec3b4
_action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined, both callbacks
Packit Service 1ec3b4
are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or _action\_on\_false_ to
Packit Service 1ec3b4
`check_cached`, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_types( \\@type-list, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
For each type in _@type-list_, call [check\_type](https://metacpan.org/pod/check_type) is called to check
Packit Service 1ec3b4
for type and return the accumulated result (accumulation op is binary and).
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
When a _prologue_ exists in the optional hash at end, it will be favoured
Packit Service 1ec3b4
over `default includes` (represented by ["\_default\_includes"](#_default_includes)). If any of
Packit Service 1ec3b4
_action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined, both callbacks
Packit Service 1ec3b4
are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or _action\_on\_false_ to
Packit Service 1ec3b4
`check_cached`, respectively.
Packit Service 1ec3b4
Given callbacks for _action\_on\_type\_true_ or _action\_on\_type\_false_ are
Packit Service 1ec3b4
called for each symbol checked using ["check\_type"](#check_type) receiving the symbol as
Packit Service 1ec3b4
first argument.
Packit Service 1ec3b4
Packit Service 1ec3b4
## compute\_int( $expression, @decls?, \\%options )
Packit Service 1ec3b4
Packit Service 1ec3b4
Returns the value of the integer _expression_. The value should fit in an
Packit Service 1ec3b4
initializer in a C variable of type signed long.  It should be possible
Packit Service 1ec3b4
to evaluate the expression at compile-time. If no includes are specified,
Packit Service 1ec3b4
the default includes are used.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
When a _prologue_ exists in the optional hash at end, it will be favoured
Packit Service 1ec3b4
over `default includes` (represented by ["\_default\_includes"](#_default_includes)). If any of
Packit Service 1ec3b4
_action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined, both callbacks
Packit Service 1ec3b4
are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or _action\_on\_false_ to
Packit Service 1ec3b4
`check_cached`, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_sizeof\_type( $type, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
Checks for the size of the specified type by compiling and define
Packit Service 1ec3b4
`SIZEOF_type` using the determined size.
Packit Service 1ec3b4
Packit Service 1ec3b4
In opposition to GNU AutoConf, this method can determine size of structure
Packit Service 1ec3b4
members, eg.
Packit Service 1ec3b4
Packit Service 1ec3b4
    $ac->check_sizeof_type( "SV.sv_refcnt", { prologue => $include_perl } );
Packit Service 1ec3b4
    # or
Packit Service 1ec3b4
    $ac->check_sizeof_type( "struct utmpx.ut_id", { prologue => "#include <utmpx.h>" } );
Packit Service 1ec3b4
Packit Service 1ec3b4
This method caches its result in the `ac_cv_sizeof_<set lang>`\_type variable.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
When a _prologue_ exists in the optional hash at end, it will be favoured
Packit Service 1ec3b4
over `default includes` (represented by ["\_default\_includes"](#_default_includes)). If any of
Packit Service 1ec3b4
_action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined, both callbacks
Packit Service 1ec3b4
are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or _action\_on\_false_ to
Packit Service 1ec3b4
`check_cached`, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_sizeof\_types( type, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
For each type [check\_sizeof\_type](https://metacpan.org/pod/check_sizeof_type) is called to check for size of type.
Packit Service 1ec3b4
Packit Service 1ec3b4
If _action-if-found_ is given, it is additionally executed when all of the
Packit Service 1ec3b4
sizes of the types could determined. If _action-if-not-found_ is given, it
Packit Service 1ec3b4
is executed when one size of the types could not determined.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
When a _prologue_ exists in the optional hash at end, it will be favoured
Packit Service 1ec3b4
over `default includes` (represented by ["\_default\_includes"](#_default_includes)). If any of
Packit Service 1ec3b4
_action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined, both callbacks
Packit Service 1ec3b4
are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or _action\_on\_false_ to
Packit Service 1ec3b4
`check_cached`, respectively.
Packit Service 1ec3b4
Given callbacks for _action\_on\_size\_true_ or _action\_on\_size\_false_ are
Packit Service 1ec3b4
called for each symbol checked using ["check\_sizeof\_type"](#check_sizeof_type) receiving the
Packit Service 1ec3b4
symbol as first argument.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_alignof\_type( type, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
Define ALIGNOF\_type to be the alignment in bytes of type. _type_ must
Packit Service 1ec3b4
be valid as a structure member declaration or _type_ must be a structure
Packit Service 1ec3b4
member itself.
Packit Service 1ec3b4
Packit Service 1ec3b4
This method caches its result in the `ac_cv_alignof_<set lang>`\_type
Packit Service 1ec3b4
variable, with _\*_ mapped to `p` and other characters not suitable for a
Packit Service 1ec3b4
variable name mapped to underscores.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
When a _prologue_ exists in the optional hash at end, it will be favoured
Packit Service 1ec3b4
over `default includes` (represented by ["\_default\_includes"](#_default_includes)). If any of
Packit Service 1ec3b4
_action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined, both callbacks
Packit Service 1ec3b4
are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or _action\_on\_false_ to
Packit Service 1ec3b4
`check_cached`, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_alignof\_types (type, \[action-if-found\], \[action-if-not-found\], \[prologue = default includes\])
Packit Service 1ec3b4
Packit Service 1ec3b4
For each type [check\_alignof\_type](https://metacpan.org/pod/check_alignof_type) is called to check for align of type.
Packit Service 1ec3b4
Packit Service 1ec3b4
If _action-if-found_ is given, it is additionally executed when all of the
Packit Service 1ec3b4
aligns of the types could determined. If _action-if-not-found_ is given, it
Packit Service 1ec3b4
is executed when one align of the types could not determined.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
When a _prologue_ exists in the optional hash at end, it will be favoured
Packit Service 1ec3b4
over `default includes` (represented by ["\_default\_includes"](#_default_includes)). If any of
Packit Service 1ec3b4
_action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined, both callbacks
Packit Service 1ec3b4
are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or _action\_on\_false_ to
Packit Service 1ec3b4
`check_cached`, respectively.
Packit Service 1ec3b4
Given callbacks for _action\_on\_align\_true_ or _action\_on\_align\_false_ are
Packit Service 1ec3b4
called for each symbol checked using ["check\_alignof\_type"](#check_alignof_type) receiving the
Packit Service 1ec3b4
symbol as first argument.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_member( member, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
Check whether _member_ is in form of _aggregate_._member_ and
Packit Service 1ec3b4
_member_ is a member of the _aggregate_ aggregate.
Packit Service 1ec3b4
Packit Service 1ec3b4
which are used prior to the aggregate under test.
Packit Service 1ec3b4
Packit Service 1ec3b4
    Config::AutoConf->check_member(
Packit Service 1ec3b4
      "struct STRUCT_SV.sv_refcnt",
Packit Service 1ec3b4
      {
Packit Service 1ec3b4
        action_on_false => sub { Config::AutoConf->msg_failure( "sv_refcnt member required for struct STRUCT_SV" ); },
Packit Service 1ec3b4
        prologue => "#include <EXTERN.h>\n#include <perl.h>"
Packit Service 1ec3b4
      }
Packit Service 1ec3b4
    );
Packit Service 1ec3b4
Packit Service 1ec3b4
This function will return a true value (1) if the member is found.
Packit Service 1ec3b4
Packit Service 1ec3b4
If _aggregate_ aggregate has _member_ member, preprocessor
Packit Service 1ec3b4
macro HAVE\__aggregate_\__MEMBER_ (in all capitals, with spaces
Packit Service 1ec3b4
and dots replaced by underscores) is defined.
Packit Service 1ec3b4
Packit Service 1ec3b4
This macro caches its result in the `ac_cv_`aggr\_member variable.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
When a _prologue_ exists in the optional hash at end, it will be favoured
Packit Service 1ec3b4
over `default includes` (represented by ["\_default\_includes"](#_default_includes)). If any of
Packit Service 1ec3b4
_action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined, both callbacks
Packit Service 1ec3b4
are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or _action\_on\_false_ to
Packit Service 1ec3b4
`check_cached`, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_members( members, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
For each member [check\_member](https://metacpan.org/pod/check_member) is called to check for member of aggregate.
Packit Service 1ec3b4
Packit Service 1ec3b4
This function will return a true value (1) if at least one member is found.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
When a _prologue_ exists in the optional hash at end, it will be favoured
Packit Service 1ec3b4
over `default includes` (represented by ["\_default\_includes"](#_default_includes)). If any of
Packit Service 1ec3b4
_action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined, both callbacks
Packit Service 1ec3b4
are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or _action\_on\_false_ to
Packit Service 1ec3b4
`check_cached`, respectively.
Packit Service 1ec3b4
Given callbacks for _action\_on\_member\_true_ or _action\_on\_member\_false_ are
Packit Service 1ec3b4
called for each symbol checked using ["check\_member"](#check_member) receiving the symbol as
Packit Service 1ec3b4
first argument.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_header( $header, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
This function is used to check if a specific header file is present in
Packit Service 1ec3b4
the system: if we detect it and if we can compile anything with that
Packit Service 1ec3b4
header included. Note that normally you want to check for a header
Packit Service 1ec3b4
first, and then check for the corresponding library (not all at once).
Packit Service 1ec3b4
Packit Service 1ec3b4
The standard usage for this module is:
Packit Service 1ec3b4
Packit Service 1ec3b4
    Config::AutoConf->check_header("ncurses.h");
Packit Service 1ec3b4
    
Packit Service 1ec3b4
Packit Service 1ec3b4
This function will return a true value (1) on success, and a false value
Packit Service 1ec3b4
if the header is not present or not available for common usage.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
When a _prologue_ exists in the optional hash at end, it will be prepended
Packit Service 1ec3b4
to the tested header. If any of _action\_on\_cache\_true_,
Packit Service 1ec3b4
_action\_on\_cache\_false_ is defined, both callbacks are passed to
Packit Service 1ec3b4
["check\_cached"](#check_cached) as _action\_on\_true_ or _action\_on\_false_ to
Packit Service 1ec3b4
`check_cached`, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_headers
Packit Service 1ec3b4
Packit Service 1ec3b4
This function uses check\_header to check if a set of include files exist
Packit Service 1ec3b4
in the system and can be included and compiled by the available compiler.
Packit Service 1ec3b4
Returns the name of the first header file found.
Packit Service 1ec3b4
Packit Service 1ec3b4
Passes an optional \\%options hash to each ["check\_header"](#check_header) call.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_all\_headers
Packit Service 1ec3b4
Packit Service 1ec3b4
This function checks each given header for usability and returns true
Packit Service 1ec3b4
when each header can be used -- otherwise false.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
Each of existing key/value pairs using _prologue_, _action\_on\_cache\_true_
Packit Service 1ec3b4
or _action\_on\_cache\_false_ as key are passed-through to each call of
Packit Service 1ec3b4
["check\_header"](#check_header).
Packit Service 1ec3b4
Given callbacks for _action\_on\_header\_true_ or _action\_on\_header\_false_ are
Packit Service 1ec3b4
called for each symbol checked using ["check\_header"](#check_header) receiving the symbol as
Packit Service 1ec3b4
first argument.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_stdc\_headers
Packit Service 1ec3b4
Packit Service 1ec3b4
Checks for standard C89 headers, namely stdlib.h, stdarg.h, string.h and float.h.
Packit Service 1ec3b4
If those are found, additional all remaining C89 headers are checked: assert.h,
Packit Service 1ec3b4
ctype.h, errno.h, limits.h, locale.h, math.h, setjmp.h, signal.h, stddef.h,
Packit Service 1ec3b4
stdio.h and time.h.
Packit Service 1ec3b4
Packit Service 1ec3b4
Returns a false value if it fails.
Packit Service 1ec3b4
Packit Service 1ec3b4
Passes an optional \\%options hash to each ["check\_all\_headers"](#check_all_headers) call.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_default\_headers
Packit Service 1ec3b4
Packit Service 1ec3b4
This function checks for some default headers, the std c89 headers and
Packit Service 1ec3b4
sys/types.h, sys/stat.h, memory.h, strings.h, inttypes.h, stdint.h and unistd.h
Packit Service 1ec3b4
Packit Service 1ec3b4
Passes an optional \\%options hash to each ["check\_all\_headers"](#check_all_headers) call.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_dirent\_header
Packit Service 1ec3b4
Packit Service 1ec3b4
Check for the following header files. For the first one that is found and
Packit Service 1ec3b4
defines 'DIR', define the listed C preprocessor macro:
Packit Service 1ec3b4
Packit Service 1ec3b4
    dirent.h      HAVE_DIRENT_H
Packit Service 1ec3b4
    sys/ndir.h    HAVE_SYS_NDIR_H
Packit Service 1ec3b4
    sys/dir.h     HAVE_SYS_DIR_H
Packit Service 1ec3b4
    ndir.h        HAVE_NDIR_H
Packit Service 1ec3b4
Packit Service 1ec3b4
The directory-library declarations in your source code should look
Packit Service 1ec3b4
something like the following:
Packit Service 1ec3b4
Packit Service 1ec3b4
    #include <sys/types.h>
Packit Service 1ec3b4
    #ifdef HAVE_DIRENT_H
Packit Service 1ec3b4
    # include <dirent.h>
Packit Service 1ec3b4
    # define NAMLEN(dirent) strlen ((dirent)->d_name)
Packit Service 1ec3b4
    #else
Packit Service 1ec3b4
    # define dirent direct
Packit Service 1ec3b4
    # define NAMLEN(dirent) ((dirent)->d_namlen)
Packit Service 1ec3b4
    # ifdef HAVE_SYS_NDIR_H
Packit Service 1ec3b4
    #  include <sys/ndir.h>
Packit Service 1ec3b4
    # endif
Packit Service 1ec3b4
    # ifdef HAVE_SYS_DIR_H
Packit Service 1ec3b4
    #  include <sys/dir.h>
Packit Service 1ec3b4
    # endif
Packit Service 1ec3b4
    # ifdef HAVE_NDIR_H
Packit Service 1ec3b4
    #  include <ndir.h>
Packit Service 1ec3b4
    # endif
Packit Service 1ec3b4
    #endif
Packit Service 1ec3b4
Packit Service 1ec3b4
Using the above declarations, the program would declare variables to be of
Packit Service 1ec3b4
type `struct dirent`, not `struct direct`, and would access the length
Packit Service 1ec3b4
of a directory entry name by passing a pointer to a `struct dirent` to
Packit Service 1ec3b4
the `NAMLEN` macro.
Packit Service 1ec3b4
Packit Service 1ec3b4
This method might be obsolescent, as all current systems with directory
Packit Service 1ec3b4
libraries have `<<dirent.h>`>. Programs supporting only newer OS
Packit Service 1ec3b4
might not need to use this method.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
Each of existing key/value pairs using _prologue_, _action\_on\_header\_true_
Packit Service 1ec3b4
(as _action\_on\_true_ having the name of the tested header as first argument)
Packit Service 1ec3b4
or _action\_on\_header\_false_ (as _action\_on\_false_ having the name of the
Packit Service 1ec3b4
tested header as first argument) as key are passed-through to each call of
Packit Service 1ec3b4
["\_check\_header"](#_check_header).
Packit Service 1ec3b4
Given callbacks for _action\_on\_cache\_true_ or _action\_on\_cache\_false_ are
Packit Service 1ec3b4
passed to the call of ["check\_cached"](#check_cached).
Packit Service 1ec3b4
Packit Service 1ec3b4
## \_check\_perlapi\_program
Packit Service 1ec3b4
Packit Service 1ec3b4
This method provides the program source which is suitable to do basic
Packit Service 1ec3b4
compile/link tests to prove perl development environment.
Packit Service 1ec3b4
Packit Service 1ec3b4
## \_check\_compile\_perlapi
Packit Service 1ec3b4
Packit Service 1ec3b4
This method can be used from other checks to prove whether we have a perl
Packit Service 1ec3b4
development environment or not (perl.h, reasonable basic checks - types, etc.)
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_compile\_perlapi
Packit Service 1ec3b4
Packit Service 1ec3b4
This method can be used from other checks to prove whether we have a perl
Packit Service 1ec3b4
development environment or not (perl.h, reasonable basic checks - types, etc.)
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_compile\_perlapi\_or\_die
Packit Service 1ec3b4
Packit Service 1ec3b4
Dies when not being able to compile using the Perl API
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_linkable\_xs\_so
Packit Service 1ec3b4
Packit Service 1ec3b4
Checks whether a dynamic loadable object containing an XS module can be
Packit Service 1ec3b4
linked or not. Due the nature of the beast, this test currently always
Packit Service 1ec3b4
succeed.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_linkable\_xs\_so\_or\_die
Packit Service 1ec3b4
Packit Service 1ec3b4
Dies when ["check\_linkable\_xs\_so"](#check_linkable_xs_so) fails.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_loadable\_xs\_so
Packit Service 1ec3b4
Packit Service 1ec3b4
Checks whether a dynamic loadable object containing an XS module can be
Packit Service 1ec3b4
loaded or not. Due the nature of the beast, this test currently always
Packit Service 1ec3b4
succeed.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_loadable\_xs\_so\_or\_die
Packit Service 1ec3b4
Packit Service 1ec3b4
Dies when ["check\_loadable\_xs\_so"](#check_loadable_xs_so) fails.
Packit Service 1ec3b4
Packit Service 1ec3b4
## \_check\_link\_perlapi
Packit Service 1ec3b4
Packit Service 1ec3b4
This method can be used from other checks to prove whether we have a perl
Packit Service 1ec3b4
development environment including a suitable libperl or not (perl.h,
Packit Service 1ec3b4
reasonable basic checks - types, etc.)
Packit Service 1ec3b4
Packit Service 1ec3b4
Caller must ensure that the linker flags are set appropriate (`-lperl`
Packit Service 1ec3b4
or similar).
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_link\_perlapi
Packit Service 1ec3b4
Packit Service 1ec3b4
This method can be used from other checks to prove whether we have a perl
Packit Service 1ec3b4
development environment or not (perl.h, libperl.la, reasonable basic
Packit Service 1ec3b4
checks - types, etc.)
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_lib( lib, func, @other-libs?, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
This function is used to check if a specific library includes some
Packit Service 1ec3b4
function. Call it with the library name (without the lib portion), and
Packit Service 1ec3b4
the name of the function you want to test:
Packit Service 1ec3b4
Packit Service 1ec3b4
    Config::AutoConf->check_lib("z", "gzopen");
Packit Service 1ec3b4
Packit Service 1ec3b4
It returns 1 if the function exist, 0 otherwise.
Packit Service 1ec3b4
Packit Service 1ec3b4
In case of function found, the HAVE\_LIBlibrary (all in capitals)
Packit Service 1ec3b4
preprocessor macro is defined with 1 and $lib together with @other\_libs
Packit Service 1ec3b4
are added to the list of libraries to link with.
Packit Service 1ec3b4
Packit Service 1ec3b4
If linking with library results in unresolved symbols that would be
Packit Service 1ec3b4
resolved by linking with additional libraries, give those libraries
Packit Service 1ec3b4
as the _other-libs_ argument: e.g., `[qw(Xt X11)]`.
Packit Service 1ec3b4
Otherwise, this routine may fail to detect that library is present,
Packit Service 1ec3b4
because linking the test program can fail with unresolved symbols.
Packit Service 1ec3b4
The other-libraries argument should be limited to cases where it is
Packit Service 1ec3b4
desirable to test for one library in the presence of another that
Packit Service 1ec3b4
is not already in LIBS. 
Packit Service 1ec3b4
Packit Service 1ec3b4
This method caches its result in the `ac_cv_lib_`lib\_func variable.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
If any of _action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined,
Packit Service 1ec3b4
both callbacks are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or
Packit Service 1ec3b4
_action\_on\_false_ to `check_cached`, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
It's recommended to use [search\_libs](https://metacpan.org/pod/search_libs) instead of check\_lib these days.
Packit Service 1ec3b4
Packit Service 1ec3b4
## search\_libs( function, search-libs, @other-libs?, \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
Search for a library defining function if it's not already available.
Packit Service 1ec3b4
This equates to calling
Packit Service 1ec3b4
Packit Service 1ec3b4
    Config::AutoConf->link_if_else(
Packit Service 1ec3b4
        Config::AutoConf->lang_call( "", "$function" ) );
Packit Service 1ec3b4
Packit Service 1ec3b4
first with no libraries, then for each library listed in search-libs.
Packit Service 1ec3b4
_search-libs_ must be specified as an array reference to avoid
Packit Service 1ec3b4
confusion in argument order.
Packit Service 1ec3b4
Packit Service 1ec3b4
Prepend -llibrary to LIBS for the first library found to contain function.
Packit Service 1ec3b4
Packit Service 1ec3b4
If linking with library results in unresolved symbols that would be
Packit Service 1ec3b4
resolved by linking with additional libraries, give those libraries as
Packit Service 1ec3b4
the _other-libraries_ argument: e.g., `[qw(Xt X11)]`. Otherwise, this
Packit Service 1ec3b4
method fails to detect that function is present, because linking the
Packit Service 1ec3b4
test program always fails with unresolved symbols.
Packit Service 1ec3b4
Packit Service 1ec3b4
The result of this test is cached in the ac\_cv\_search\_function variable
Packit Service 1ec3b4
as "none required" if function is already available, as `0` if no
Packit Service 1ec3b4
library containing function was found, otherwise as the -llibrary option
Packit Service 1ec3b4
that needs to be prepended to LIBS.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
If any of _action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined,
Packit Service 1ec3b4
both callbacks are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or
Packit Service 1ec3b4
_action\_on\_false_ to `check_cached`, respectively.  Given callbacks
Packit Service 1ec3b4
for _action\_on\_lib\_true_ or _action\_on\_lib\_false_ are called for
Packit Service 1ec3b4
each library checked using ["link\_if\_else"](#link_if_else) receiving the library as
Packit Service 1ec3b4
first argument and all `@other_libs` subsequently.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_lm( \\%options? )
Packit Service 1ec3b4
Packit Service 1ec3b4
This method is used to check if some common `math.h` functions are
Packit Service 1ec3b4
available, and if `-lm` is needed. Returns the empty string if no
Packit Service 1ec3b4
library is needed, or the "-lm" string if libm is needed.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
Each of existing key/value pairs using _action\_on\_func\_true_ (as
Packit Service 1ec3b4
_action\_on\_true_ having the name of the tested functions as first argument),
Packit Service 1ec3b4
_action\_on\_func\_false_ (as _action\_on\_false_ having the name of the tested
Packit Service 1ec3b4
functions as first argument), _action\_on\_func\_lib\_true_ (as
Packit Service 1ec3b4
_action\_on\_lib\_true_ having the name of the tested functions as first
Packit Service 1ec3b4
argument), _action\_on\_func\_lib\_false_ (as _action\_on\_lib\_false_ having
Packit Service 1ec3b4
the name of the tested functions as first argument) as key are passed-
Packit Service 1ec3b4
through to each call of ["search\_libs"](#search_libs).
Packit Service 1ec3b4
Given callbacks for _action\_on\_lib\_true_, _action\_on\_lib\_false_,
Packit Service 1ec3b4
_action\_on\_cache\_true_ or _action\_on\_cache\_false_ are passed to the
Packit Service 1ec3b4
call of ["search\_libs"](#search_libs).
Packit Service 1ec3b4
Packit Service 1ec3b4
**Note** that _action\_on\_lib\_true_ and _action\_on\_func\_lib\_true_ or
Packit Service 1ec3b4
_action\_on\_lib\_false_ and _action\_on\_func\_lib\_false_ cannot be used
Packit Service 1ec3b4
at the same time, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
## pkg\_config\_package\_flags($package, \\%options?)
Packit Service 1ec3b4
Packit Service 1ec3b4
Search for pkg-config flags for package as specified. The flags which are
Packit Service 1ec3b4
extracted are `--cflags` and `--libs`. The extracted flags are appended
Packit Service 1ec3b4
to the global `extra_compile_flags` and `extra_link_flags`, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
Call it with the package you're looking for and optional callback whether
Packit Service 1ec3b4
found or not.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
If any of _action\_on\_cache\_true_, _action\_on\_cache\_false_ is defined,
Packit Service 1ec3b4
both callbacks are passed to ["check\_cached"](#check_cached) as _action\_on\_true_ or
Packit Service 1ec3b4
_action\_on\_false_ to ["check\_cached"](#check_cached), respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
## \_check\_mm\_pureperl\_build\_wanted
Packit Service 1ec3b4
Packit Service 1ec3b4
This method proves the `_argv` attribute and (when set) the `PERL_MM_OPT`
Packit Service 1ec3b4
whether they contain _PUREPERL\_ONLY=(0|1)_ or not. The attribute `_force_xs`
Packit Service 1ec3b4
is set as appropriate, which allows a compile test to bail out when `Makefile.PL`
Packit Service 1ec3b4
is called with _PUREPERL\_ONLY=0_.
Packit Service 1ec3b4
Packit Service 1ec3b4
## \_check\_mb\_pureperl\_build\_wanted
Packit Service 1ec3b4
Packit Service 1ec3b4
This method proves the `_argv` attribute and (when set) the `PERL_MB_OPT`
Packit Service 1ec3b4
whether they contain _--pureperl-only_ or not.
Packit Service 1ec3b4
Packit Service 1ec3b4
## \_check\_pureperl\_required
Packit Service 1ec3b4
Packit Service 1ec3b4
This method calls `_check_mm_pureperl_build_wanted` when running under
Packit Service 1ec3b4
[ExtUtils::MakeMaker](https://metacpan.org/pod/ExtUtils::MakeMaker) (`Makefile.PL`) or `_check_mb_pureperl_build_wanted`
Packit Service 1ec3b4
when running under a `Build.PL` ([Module::Build](https://metacpan.org/pod/Module::Build) compatible) environment.
Packit Service 1ec3b4
Packit Service 1ec3b4
When neither is found (`$0` contains neither `Makefile.PL` nor `Build.PL`),
Packit Service 1ec3b4
simply 0 is returned.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_pureperl\_required
Packit Service 1ec3b4
Packit Service 1ec3b4
This check method proves whether a pureperl build is wanted or not by
Packit Service 1ec3b4
cached-checking `$self->_check_pureperl_required`.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_produce\_xs\_build
Packit Service 1ec3b4
Packit Service 1ec3b4
This routine checks whether XS can be produced. Therefore it does
Packit Service 1ec3b4
following checks in given order:
Packit Service 1ec3b4
Packit Service 1ec3b4
- check pureperl environment variables (["check\_pureperl\_required"](#check_pureperl_required)) or
Packit Service 1ec3b4
command line arguments and return false when pure perl is requested
Packit Service 1ec3b4
- check whether a compiler is available (["check\_valid\_compilers"](#check_valid_compilers)) and
Packit Service 1ec3b4
return false if none found
Packit Service 1ec3b4
- check whether a test program accessing Perl API can be compiled and
Packit Service 1ec3b4
die with error if not
Packit Service 1ec3b4
Packit Service 1ec3b4
When all checks passed successfully, return a true value.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
## check\_produce\_loadable\_xs\_build
Packit Service 1ec3b4
Packit Service 1ec3b4
This routine proves whether XS should be built and it's possible to create
Packit Service 1ec3b4
a dynamic linked object which can be loaded using Perl's Dynaloader.
Packit Service 1ec3b4
Packit Service 1ec3b4
The extension over ["check\_produce\_xs\_build"](#check_produce_xs_build) can be avoided by adding the
Packit Service 1ec3b4
`notest_loadable_xs` to `$ENV{PERL5_AC_OPTS}`.
Packit Service 1ec3b4
Packit Service 1ec3b4
If the very last parameter contains a hash reference, `CODE` references
Packit Service 1ec3b4
to _action\_on\_true_ or _action\_on\_false_ are executed, respectively.
Packit Service 1ec3b4
Packit Service 1ec3b4
## \_set\_argv
Packit Service 1ec3b4
Packit Service 1ec3b4
Intended to act as a helper for evaluating given command line arguments.
Packit Service 1ec3b4
Stores given arguments in instances `_argv` attribute.
Packit Service 1ec3b4
Packit Service 1ec3b4
Call once at very begin of `Makefile.PL` or `Build.PL`:
Packit Service 1ec3b4
Packit Service 1ec3b4
    Your::Pkg::Config::AutoConf->_set_args(@ARGV);
Packit Service 1ec3b4
Packit Service 1ec3b4
## \_default\_includes
Packit Service 1ec3b4
Packit Service 1ec3b4
returns a string containing default includes for program prologue taken
Packit Service 1ec3b4
from autoconf/headers.m4:
Packit Service 1ec3b4
Packit Service 1ec3b4
    #include <stdio.h>
Packit Service 1ec3b4
    #ifdef HAVE_SYS_TYPES_H
Packit Service 1ec3b4
    # include <sys/types.h>
Packit Service 1ec3b4
    #endif
Packit Service 1ec3b4
    #ifdef HAVE_SYS_STAT_H
Packit Service 1ec3b4
    # include <sys/stat.h>
Packit Service 1ec3b4
    #endif
Packit Service 1ec3b4
    #ifdef STDC_HEADERS
Packit Service 1ec3b4
    # include <stdlib.h>
Packit Service 1ec3b4
    # include <stddef.h>
Packit Service 1ec3b4
    #else
Packit Service 1ec3b4
    # ifdef HAVE_STDLIB_H
Packit Service 1ec3b4
    #  include <stdlib.h>
Packit Service 1ec3b4
    # endif
Packit Service 1ec3b4
    #endif
Packit Service 1ec3b4
    #ifdef HAVE_STRING_H
Packit Service 1ec3b4
    # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
Packit Service 1ec3b4
    #  include <memory.h>
Packit Service 1ec3b4
    # endif
Packit Service 1ec3b4
    # include <string.h>
Packit Service 1ec3b4
    #endif
Packit Service 1ec3b4
    #ifdef HAVE_STRINGS_H
Packit Service 1ec3b4
    # include <strings.h>
Packit Service 1ec3b4
    #endif
Packit Service 1ec3b4
    #ifdef HAVE_INTTYPES_H
Packit Service 1ec3b4
    # include <inttypes.h>
Packit Service 1ec3b4
    #endif
Packit Service 1ec3b4
    #ifdef HAVE_STDINT_H
Packit Service 1ec3b4
    # include <stdint.h>
Packit Service 1ec3b4
    #endif
Packit Service 1ec3b4
    #ifdef HAVE_UNISTD_H
Packit Service 1ec3b4
    # include <unistd.h>
Packit Service 1ec3b4
    #endif
Packit Service 1ec3b4
Packit Service 1ec3b4
## \_default\_includes\_with\_perl
Packit Service 1ec3b4
Packit Service 1ec3b4
returns a string containing default includes for program prologue containing
Packit Service 1ec3b4
_\_default\_includes_ plus
Packit Service 1ec3b4
Packit Service 1ec3b4
    #include <EXTERN.h>
Packit Service 1ec3b4
    #include <perl.h>
Packit Service 1ec3b4
Packit Service 1ec3b4
## add\_log\_fh
Packit Service 1ec3b4
Packit Service 1ec3b4
Push new file handles at end of log-handles to allow tee-ing log-output
Packit Service 1ec3b4
Packit Service 1ec3b4
## delete\_log\_fh
Packit Service 1ec3b4
Packit Service 1ec3b4
Removes specified log file handles. This method allows you to shoot
Packit Service 1ec3b4
yourself in the foot - it doesn't prove whether the primary nor the last handle
Packit Service 1ec3b4
is removed. Use with caution.
Packit Service 1ec3b4
Packit Service 1ec3b4
# AUTHOR
Packit Service 1ec3b4
Packit Service 1ec3b4
Alberto Simões, `<ambs@cpan.org>`
Packit Service 1ec3b4
Packit Service 1ec3b4
Jens Rehsack, `<rehsack@cpan.org>`
Packit Service 1ec3b4
Packit Service 1ec3b4
# NEXT STEPS
Packit Service 1ec3b4
Packit Service 1ec3b4
Although a lot of work needs to be done, these are the next steps I
Packit Service 1ec3b4
intend to take.
Packit Service 1ec3b4
Packit Service 1ec3b4
    - detect flex/lex
Packit Service 1ec3b4
    - detect yacc/bison/byacc
Packit Service 1ec3b4
    - detect ranlib (not sure about its importance)
Packit Service 1ec3b4
Packit Service 1ec3b4
These are the ones I think not too much important, and will be
Packit Service 1ec3b4
addressed later, or by request.
Packit Service 1ec3b4
Packit Service 1ec3b4
    - detect an 'install' command
Packit Service 1ec3b4
    - detect a 'ln -s' command -- there should be a module doing
Packit Service 1ec3b4
      this kind of task.
Packit Service 1ec3b4
Packit Service 1ec3b4
# BUGS
Packit Service 1ec3b4
Packit Service 1ec3b4
A lot. Portability is a pain. **<Patches welcome!**>.
Packit Service 1ec3b4
Packit Service 1ec3b4
Please report any bugs or feature requests to
Packit Service 1ec3b4
`bug-Config-AutoConf@rt.cpan.org`, or through the web interface at
Packit Service 1ec3b4
[http://rt.cpan.org/NoAuth/Bugs.html?Dist=Config-AutoConf](http://rt.cpan.org/NoAuth/Bugs.html?Dist=Config-AutoConf).  We will
Packit Service 1ec3b4
be notified, and then you'll automatically be notified of progress
Packit Service 1ec3b4
on your bug as we make changes.
Packit Service 1ec3b4
Packit Service 1ec3b4
# SUPPORT
Packit Service 1ec3b4
Packit Service 1ec3b4
You can find documentation for this module with the perldoc command.
Packit Service 1ec3b4
Packit Service 1ec3b4
    perldoc Config::AutoConf
Packit Service 1ec3b4
Packit Service 1ec3b4
You can also look for information at:
Packit Service 1ec3b4
Packit Service 1ec3b4
- AnnoCPAN: Annotated CPAN documentation
Packit Service 1ec3b4
Packit Service 1ec3b4
    [http://annocpan.org/dist/Config-AutoConf](http://annocpan.org/dist/Config-AutoConf)
Packit Service 1ec3b4
Packit Service 1ec3b4
- CPAN Ratings
Packit Service 1ec3b4
Packit Service 1ec3b4
    [http://cpanratings.perl.org/dist/Config-AutoConf](http://cpanratings.perl.org/dist/Config-AutoConf)
Packit Service 1ec3b4
Packit Service 1ec3b4
- MetaCPAN
Packit Service 1ec3b4
Packit Service 1ec3b4
    [https://metacpan.org/release/Config-AutoConf](https://metacpan.org/release/Config-AutoConf)
Packit Service 1ec3b4
Packit Service 1ec3b4
- Git Repository
Packit Service 1ec3b4
Packit Service 1ec3b4
    [https://github.com/ambs/Config-AutoConf](https://github.com/ambs/Config-AutoConf)
Packit Service 1ec3b4
Packit Service 1ec3b4
# ACKNOWLEDGEMENTS
Packit Service 1ec3b4
Packit Service 1ec3b4
Michael Schwern for kind MacOS X help.
Packit Service 1ec3b4
Packit Service 1ec3b4
Ken Williams for ExtUtils::CBuilder
Packit Service 1ec3b4
Packit Service 1ec3b4
Peter Rabbitson for help on refactoring and making the API more Perl'ish
Packit Service 1ec3b4
Packit Service 1ec3b4
# COPYRIGHT & LICENSE
Packit Service 1ec3b4
Packit Service 1ec3b4
Copyright 2004-2016 by the Authors
Packit Service 1ec3b4
Packit Service 1ec3b4
This program is free software; you can redistribute it and/or modify it
Packit Service 1ec3b4
under the same terms as Perl itself.
Packit Service 1ec3b4
Packit Service 1ec3b4
# SEE ALSO
Packit Service 1ec3b4
Packit Service 1ec3b4
ExtUtils::CBuilder(3)