Blame README.md

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