NAME

Config::AutoConf::INI - Drive Config::AutoConf with an INI file

VERSION

version 0.005

SYNOPSIS

use Config::AutoConf::INI;

#
# Config::AutoConf::INI->new() is an instance of Config::AutoConf
#
Config::AutoConf::INI->new()->check('config.ini');
Config::AutoConf::INI->new()->check();

#
# Shortest form
#
Config::AutoConf::INI->check;

DESCRIPTION

This module is a extending Config::AutoConf, using a INI-like config file.

SUBROUTINES/METHODS

check($config_ini)

Performs all checks that are in the INI file $config_ini and that are responsible for configuring Config::AutoConf or defining autoconf variables. The following sections are supported, and executed in the order listed below. Within every section, entries are executed in the same order as the INI file.

This method can be used using an Config::AutoConf::INI instance, or the class itself:

my $self = Config::AutoConf::INI->new();
$self->check('config.ini');
$self->write_config_h('somewhere_else.h');

Config::AutoConf::INI->check();

The default value for $config_ini is 'config_autoconf.ini'.

The result value is always an instance of Config::AutoConf::INI

Configuration sections
Includes

This is an interface to Config::AutoConf's push_includes.

[includes]
; Anything on the the left-hand side is used if the right-hand side is a true value.
; Example:
. = 1
/this/path = 0
C:\Windows\Temp = 1
Preprocessor flags

This is an interface to Config::AutoConf's push_preprocess_flags.

[preprocess_flags]
; Anything on the the left-hand side is used if the right-hand side is a true value.
; Example:
-DCPPFLAG0N = 1
-DCPPFLAG0FF = 0
Compiler flags

This is an interface to Config::AutoConf's push_compiler_flags.

[compiler_flags]
; Anything on the the left-hand side is used if the right-hand side is a true value.
; Example:
-DCCFLAG0N = 1
-DCCFLAG0FF = 0
Linker flags

This is an interface to Config::AutoConf's push_link_flags.

[link_flags]
; Anything on the the left-hand side is used if the right-hand side is a true value.
; Example:
--very = 1
--special = 0
Check sections

In the following sections, if the right-hand side is a true value the check is executed.

If the right-hand side does not look like a number then a variable is explicitly created with that name (e.g. I_HAVE_STDIO_H), with the exception of the [bundle] section where right-hand side is always used as a boolean. This does not prevent a Config::AutoConf default variable, if any, to be created (i.e.g HAVE_STDIO_H), though the wanted variable name can very well be equal to the default.

Files

This is an interface to Config::AutoConf's check_file.

[files]
/etc/passwd = HAVE_ETC_PASSWD
/tmp/this = 0
/tmp/that = HAVE_TMP_THAT
Programs

This is an interface to Config::AutoConf's check_prog.

[progs]
cc = CC_NAME
Headers

This is an interface to Config::AutoConf's check_header.

[headers]
stddef.h = 0
time.h = 1

Please note that all found headers are systematically reinjected in any further test, in the same order as their configuration appearance in the INI file, in contrary to Config::AutoConf default behaviour, that is to reuse only STDC headers.

Bundled headers
[bundle]
; The bundle check on the left-hand side is done when the right-hand side is a true value.
; The only supported bundles are stdc_headers, default_headers and dirent_headers.
; Example:
stdc_headers = 1
default_headers = 1
dirent_headers = Treated_Like_A_Boolean

Note that the right-hand side is always considered as a boolean. Config::AutoConf::INI will keep new found headers in order, though the order depend on how Config::AutoConf is implemented.

Declarations

This is an interface to Config::AutoConf's check_decl.

[decls]
read = 1
Functions

This is an interface to Config::AutoConf's check_func.

[funcs]
read = 1
Types

This is an interface to Config::AutoConf's check_type.

[types]
size_t = 1
Types sizeof

This is an interface to Config::AutoConf's check_sizeof_types.

[sizeof_types]
size_t = 1
Types offset

This is an interface to Config::AutoConf's check_alignof_types.

[alignof_types]
struct tm.tm_year = 1
Aggregate members

This is an interface to Config::AutoConf's check_member.

[members]
struct tm.tm_year = 1
Result sections
Outputs

This is an interface to Config::AutoConf's write_config_h.

[outputs]
; Anything on the the left-hand side is produced if the right-hand side is a true value.
; Example:
config_autoconf.h = 1
config.h = 0

NOTES

Non-existing INI file

Trying to read a non-existing INI file is a no-op.

EXAMPLE

Here is an example of a .ini file:

[includes]
. = 1
/this/path = 1

[preprocess_flags]
-DFLAG01 = 1
-DFLAG02 = 0

[compiler_flags]
-DFLAG01 = 0
-DFLAG02 = 1

[link_flags]
-lm = 1
-loff = 0

[files]
/etc/passwd = HAVE_ETC_PASSWD
/tmp/this = HAVE_THIS
/tmp/that = HAVE_THAT
C:\Windows\Temp\foo = HAVE_C_WINDOWS_TEMP_FOO

[progs]
cc = CC_NAME

[headers]
stdio.h = 1
stddef.h = HAVE_STDDEF_H
time.h = 1

[bundle]
stdc_headers = 1
default_headers = 1
dirent_headers = 1

[decls]
read = 1
notchecked = 0

[funcs]
read = 1

[types]
size_t = 1

[sizeof_types]
size_t = 1

[alignof_types]
struct tm.tm_year = 1

[members]
struct tm.tm_year = 1

[outputs]
my_config.h = 1

SEE ALSO

Config::AutoConf, Config::Tiny::Ordered

AUTHOR

Jean-Damien Durand <jddpause@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Jean-Damien Durand.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.