1 # Copyright (C) 2001-2007, The Perl Foundation.
6 config/gen/config_h.pm - Configuration Header
10 Generates F<include/parrot/config.h> with platform-specific configuration
11 values, F<include/parrot/has_header.h> with platform-specific header
12 information, and F<include/parrot/feature.h> with information on optional
17 package gen
::config_h
;
22 use base
qw(Parrot::Configure::Step);
24 use Parrot
::Configure
::Utils
':gen';
30 $data{description
} = q{Generating C headers};
36 my ( $self, $conf ) = @_;
38 $conf->genfile('config/gen/config_h/config_h.in', 'include/parrot/config.h',
40 ignore_pattern
=> 'PARROT_CONFIG_DATE',
41 conditioned_lines
=> 1
44 $conf->genfile('config/gen/config_h/feature_h.in', 'include/parrot/feature.h',
46 ignore_pattern
=> 'PARROT_CONFIG_DATE',
50 my $hh = "include/parrot/has_header.h";
51 $conf->append_configure_log($hh);
52 open( my $HH, ">", "$hh.tmp" )
53 or die "Can't open has_header.h: $!";
57 ** !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
59 ** This file is generated automatically by Configure.pl
62 #ifndef PARROT_HAS_HEADER_H_GUARD
63 #define PARROT_HAS_HEADER_H_GUARD
66 * i_(\\w+) header includes
71 for ( sort( $conf->data->keys() ) ) {
72 next unless /i_(\w+)/;
73 if ( $conf->data->get($_) ) {
74 print {$HH} "#define PARROT_HAS_HEADER_\U$1 1\n";
77 print {$HH} "#undef PARROT_HAS_HEADER_\U$1\n";
81 my $osname = $conf->data->get_p5('OSNAME');
82 print {$HH} "\n#define BUILD_OS_NAME \"$osname\"\n";
84 my $define = $conf->options->get('define');
87 my @vals = split /,/, $define;
91 * defines from commandline
96 print {$HH} "#define PARROT_DEF_" . uc($_), " 1\n";
104 * HAS_(\\w+) config entries
108 for ( sort( $conf->data->keys() ) ) {
109 next unless /HAS_(\w+)/;
110 if ( $conf->data->get($_) ) {
111 print {$HH} "#define PARROT_HAS_\U$1 1\n";
117 * D_(\\w+) config entries
121 for ( sort( $conf->data->keys() ) ) {
122 next unless /D_(\w+)/;
124 if ( $val = $conf->data->get($_) ) {
125 print {$HH} "#define PARROT_\U$1 $val\n";
129 # append the guard endif and C code coda
132 #endif /* PARROT_HAS_HEADER_H_GUARD */
136 * c-file-style: "parrot"
138 * vim: expandtab shiftwidth=4:
144 move_if_diff
( "$hh.tmp", $hh );
153 # cperl-indent-level: 4
156 # vim: expandtab shiftwidth=4: