Config::AutoConf - A module to implement some of AutoConf macros in pure perl.
With this module I pretend to simulate some of the tasks AutoConf macros do. To detect a command, to detect a library, etc.
use Config::AutoConf; Config::AutoConf->check_prog("agrep"); my $grep = Config::AutoConf->check_progs("agrep", "egrep", "grep"); Config::AutoConf->check_header("ncurses.h"); my $curses = Config::AutoConf->check_headers("ncurses.h","curses.h"); Config::AutoConf->check_prog_awk; Config::AutoConf->check_prog_egrep; Config::AutoConf->check_cc(); Config::AutoConf->check_lib("ncurses", "tgoto"); Config::AutoConf->check_file("/etc/passwd"); # -f && -r
This function checks if a file exists in the system and is readable by the user. Returns a boolean. You can use '-f $file && -r $file' so you don't need to use a function call.
This function checks if a set of files exist in the system and are readable by the user. Returns a boolean.
This function checks for a program with the supplied name. In success returns the full path for the executable;
This function takes a list of program names. Returns the full path for the first found on the system. Returns undef if none was found.
From the autoconf documentation,
If `bison' is found, set [...] `bison -y'. Otherwise, if `byacc' is found, set [...] `byacc'. Otherwise set [...] `yacc'.
Returns the full path, if found.
Check for `gawk', `mawk', `nawk', and `awk', in that order, and set output [...] to the first one that is found. It tries `gawk' first because that is reported to be the best implementation.
Note that it returns the full path, if found.
Check for `grep -E' and `egrep', in that order, and [...] output [...] the first one that is found.
This function checks if you have a running C compiler.
This function uses check_header to check if a set of include files exist in the system and can be included and compiled by the available compiler. Returns the name of the first header file found.
This function is used to check if a specific header file is present in the system: if we detect it and if we can compile anything with that header included. Note that normally you want to check for a header first, and then check for the corresponding library (not all at once).
The standard usage for this module is:
Config::AutoConf->check_header("ncurses.h");
This function will return a true value (1) on success, and a false value if the header is not present or not available for common usage.
This function is used to check if a specific library includes some function. Call it with the library name (without the lib portion), and the name of the function you want to test:
Config::AutoConf->check_lib("z", "gzopen");
It returns 1 if the function exist, 0 otherwise.
Alberto Simões, <ambs@cpan.org>
<ambs@cpan.org>
Although a lot of work needs to be done, this is the next steps I intent to take.
- detect flex/lex - detect yacc/bison/byacc - detect ranlib (not sure about its importance)
These are the ones I think not too much important, and will be addressed later, or by request.
- detect an 'install' command - detect a 'ln -s' command -- there should be a module doing this kind of task.
A lot. Portability is a pain. <Patches welcome!>.
Please report any bugs or feature requests to bug-extutils-autoconf@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-extutils-autoconf@rt.cpan.org
Michael Schwern for kind MacOS X help.
Ken Williams for ExtUtils::CBuilder
Copyright 2004-2005 Alberto Simões, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
ExtUtils::CBuilder(3)
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'Simões,'. Assuming CP1252
To install Config::AutoConf, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::AutoConf
CPAN shell
perl -MCPAN -e shell install Config::AutoConf
For more information on module installation, please visit the detailed CPAN module installation guide.