| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Makeutils ; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | =head1 NAME | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | Makeutils - MakeMaker utilities | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | use Makeutils ; | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | Module provides a set of useful utility routines for creating Maefiles and config.h files. | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | =cut | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | #============================================================================================ | 
| 21 |  |  |  |  |  |  | # USES | 
| 22 |  |  |  |  |  |  | #============================================================================================ | 
| 23 | 1 |  |  | 1 |  | 51577 | use strict ; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 36 |  | 
| 24 | 1 |  |  | 1 |  | 1146 | use ExtUtils::MakeMaker ; | 
|  | 1 |  |  |  |  | 95939 |  | 
|  | 1 |  |  |  |  | 154 |  | 
| 25 | 1 |  |  | 1 |  | 1053 | use Env ; | 
|  | 1 |  |  |  |  | 2874 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 26 | 1 |  |  | 1 |  | 467 | use Config; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 26 |  | 
| 27 | 1 |  |  | 1 |  | 11 | use Cwd 'cwd'; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 34 |  | 
| 28 | 1 |  |  | 1 |  | 4 | use File::Basename ; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 47 |  | 
| 29 | 1 |  |  | 1 |  | 4 | use File::Path ; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 6651 |  | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | #============================================================================================ | 
| 33 |  |  |  |  |  |  | # EXPORTER | 
| 34 |  |  |  |  |  |  | #============================================================================================ | 
| 35 |  |  |  |  |  |  | require Exporter; | 
| 36 |  |  |  |  |  |  | our @ISA = qw(Exporter); | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | our @EXPORT = qw/ | 
| 39 |  |  |  |  |  |  | init | 
| 40 |  |  |  |  |  |  | add_install_progs | 
| 41 |  |  |  |  |  |  | add_defines | 
| 42 |  |  |  |  |  |  | get_makeopts | 
| 43 |  |  |  |  |  |  | process_makeopts | 
| 44 |  |  |  |  |  |  | update_manifest | 
| 45 |  |  |  |  |  |  | add_objects | 
| 46 |  |  |  |  |  |  | add_clibs | 
| 47 |  |  |  |  |  |  | c_try | 
| 48 |  |  |  |  |  |  | c_try_keywords | 
| 49 |  |  |  |  |  |  | c_inline | 
| 50 |  |  |  |  |  |  | have_builtin_expect | 
| 51 |  |  |  |  |  |  | have_lrintf | 
| 52 |  |  |  |  |  |  | c_always_inline | 
| 53 |  |  |  |  |  |  | c_restrict | 
| 54 |  |  |  |  |  |  | c_has_header | 
| 55 |  |  |  |  |  |  | c_has_function | 
| 56 |  |  |  |  |  |  | c_struct_timeval | 
| 57 |  |  |  |  |  |  | check_new_version | 
| 58 |  |  |  |  |  |  | have_h | 
| 59 |  |  |  |  |  |  | have_d | 
| 60 |  |  |  |  |  |  | havent_d | 
| 61 |  |  |  |  |  |  | have_func | 
| 62 |  |  |  |  |  |  | arch_name | 
| 63 |  |  |  |  |  |  | get_config | 
| 64 |  |  |  |  |  |  | get_makemakerdflt | 
| 65 |  |  |  |  |  |  | / ; | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | #============================================================================================ | 
| 69 |  |  |  |  |  |  | # GLOBALS | 
| 70 |  |  |  |  |  |  | #============================================================================================ | 
| 71 |  |  |  |  |  |  | our $VERSION = '1.07' ; | 
| 72 |  |  |  |  |  |  | our $DEBUG = 0 ; | 
| 73 |  |  |  |  |  |  | our $UPDATE_MANIFEST = 0 ; | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | our %ModuleInfo ; | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | #============================================================================================ | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | #============================================================================================ | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 83 |  |  |  |  |  |  | sub init | 
| 84 |  |  |  |  |  |  | { | 
| 85 | 1 |  |  | 1 | 0 | 9 | my ($modname) = @_ ; | 
| 86 |  |  |  |  |  |  |  | 
| 87 | 1 |  |  |  |  | 44 | print "(Using Makeutils.pm version $VERSION)\n" ; | 
| 88 |  |  |  |  |  |  |  | 
| 89 | 1 |  |  |  |  | 3 | my $name = $modname ; | 
| 90 | 1 | 50 |  |  |  | 4 | unless ($name) | 
| 91 |  |  |  |  |  |  | { | 
| 92 | 0 |  |  |  |  | 0 | $name = basename(cwd()); | 
| 93 | 0 |  |  |  |  | 0 | $name =~ s|[\-_][\d\.\-]+\z||; | 
| 94 |  |  |  |  |  |  | } | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | # eg Linux::DVB::DVBT::TS | 
| 97 | 1 |  |  |  |  | 2 | my $mod = $name ; | 
| 98 | 1 |  |  |  |  | 5 | $mod =~ s%\-%::%g ; | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | # eg Linux/DVB/DVBT/TS | 
| 101 | 1 |  |  |  |  | 2 | my $modpath = $name ; | 
| 102 | 1 |  |  |  |  | 4 | $modpath =~ s%\-%/%g ; | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | # eg TS | 
| 105 | 1 |  |  |  |  | 2 | my $root = $name ; | 
| 106 | 1 |  |  |  |  | 7 | $root =~ s%.*\-([^-]+)$%$1% ; | 
| 107 |  |  |  |  |  |  |  | 
| 108 | 1 |  |  |  |  | 20 | my $version = ExtUtils::MM->parse_version("lib/$modpath.pm"); | 
| 109 |  |  |  |  |  |  |  | 
| 110 | 1 |  |  |  |  | 11316 | %ModuleInfo = ( | 
| 111 |  |  |  |  |  |  | # eg Linux-DVB-DVBT-TS | 
| 112 |  |  |  |  |  |  | 'name'		=> $name, | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | # eg Linux::DVB::DVBT::TS | 
| 115 |  |  |  |  |  |  | 'mod'		=> $mod, | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | # eg Linux/DVB/DVBT/TS | 
| 118 |  |  |  |  |  |  | 'modpath'	=> $modpath, | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | # eg TS | 
| 121 |  |  |  |  |  |  | 'root'		=> $root, | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | 'version'	=> $version, | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | 'programs'	=> [], | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | 'mod_defines'	=> "", | 
| 128 |  |  |  |  |  |  | 'make_defines'	=> "", | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | ## Flags | 
| 131 |  |  |  |  |  |  | 'CCFLAGS'		=> '-o $@', | 
| 132 |  |  |  |  |  |  | 'OPTIMIZE'		=> '-O3', | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  | # included c-libraries | 
| 135 |  |  |  |  |  |  | 'clibs'			=> {}, | 
| 136 |  |  |  |  |  |  | 'includes'		=> "", | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | # String "list" of objects | 
| 139 |  |  |  |  |  |  | 'objects'		=> "$root.o ", | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | # additional objects | 
| 142 |  |  |  |  |  |  | 'obj_list' 		=> [], | 
| 143 |  |  |  |  |  |  |  | 
| 144 |  |  |  |  |  |  | 'config'		=> {}, | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  | 'COMMENTS'		=> {}, | 
| 147 |  |  |  |  |  |  | 'C_TRY'			=> {}, | 
| 148 |  |  |  |  |  |  |  | 
| 149 |  |  |  |  |  |  | ) ; | 
| 150 |  |  |  |  |  |  |  | 
| 151 | 1 |  |  |  |  | 5 | return \%ModuleInfo ; | 
| 152 |  |  |  |  |  |  | } | 
| 153 |  |  |  |  |  |  |  | 
| 154 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 155 |  |  |  |  |  |  | sub add_install_progs | 
| 156 |  |  |  |  |  |  | { | 
| 157 | 0 |  |  | 0 | 0 | 0 | my ($basedir, $progs_aref) = @_ ; | 
| 158 |  |  |  |  |  |  |  | 
| 159 | 0 | 0 | 0 |  |  | 0 | if ( (ref($progs_aref) eq 'ARRAY') && @$progs_aref) | 
| 160 |  |  |  |  |  |  | { | 
| 161 | 0 | 0 | 0 |  |  | 0 | if ( | 
|  |  |  | 0 |  |  |  |  | 
| 162 |  |  |  |  |  |  | grep $_ eq '-n', @main::ARGV | 
| 163 |  |  |  |  |  |  | or grep /^LIB=/, @main::ARGV and not grep /^INSTALLSCRIPT=/, @main::ARGV | 
| 164 |  |  |  |  |  |  | ) | 
| 165 |  |  |  |  |  |  | { | 
| 166 | 0 |  |  |  |  | 0 | @main::ARGV = grep $_ ne '-n', @main::ARGV; | 
| 167 | 0 |  |  |  |  | 0 | warn "Skipping installation of scripts...\n"; | 
| 168 |  |  |  |  |  |  |  | 
| 169 | 0 |  |  |  |  | 0 | while (@$progs_aref) | 
| 170 |  |  |  |  |  |  | { | 
| 171 | 0 |  |  |  |  | 0 | pop @$progs_aref ; | 
| 172 |  |  |  |  |  |  | } | 
| 173 |  |  |  |  |  |  | } | 
| 174 |  |  |  |  |  |  | else | 
| 175 |  |  |  |  |  |  | { | 
| 176 | 0 |  |  |  |  | 0 | warn < | 
| 177 |  |  |  |  |  |  |  | 
| 178 |  |  |  |  |  |  | This Perl module comes with several scripts which I would try to install in | 
| 179 |  |  |  |  |  |  | directory $Config{installscript}. | 
| 180 |  |  |  |  |  |  |  | 
| 181 |  |  |  |  |  |  | To skip install, rerun with option -n given to Makefile.PL. | 
| 182 |  |  |  |  |  |  |  | 
| 183 |  |  |  |  |  |  | EOW | 
| 184 |  |  |  |  |  |  | } | 
| 185 |  |  |  |  |  |  | } | 
| 186 |  |  |  |  |  |  |  | 
| 187 | 0 |  | 0 |  |  | 0 | $progs_aref ||= [] ; | 
| 188 | 0 |  |  |  |  | 0 | $ModuleInfo{'programs'} = [ map "$basedir$_", @$progs_aref ] ; | 
| 189 |  |  |  |  |  |  |  | 
| 190 | 0 |  |  |  |  | 0 | return @$progs_aref ; | 
| 191 |  |  |  |  |  |  | } | 
| 192 |  |  |  |  |  |  |  | 
| 193 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 194 |  |  |  |  |  |  | sub add_defines | 
| 195 |  |  |  |  |  |  | { | 
| 196 | 0 |  |  | 0 | 0 | 0 | my ($defines_href) = @_ ; | 
| 197 |  |  |  |  |  |  |  | 
| 198 | 0 | 0 | 0 |  |  | 0 | if ( (ref($defines_href) eq 'HASH') && keys %$defines_href) | 
| 199 |  |  |  |  |  |  | { | 
| 200 | 0 |  |  |  |  | 0 | foreach my $key (keys %$defines_href) | 
| 201 |  |  |  |  |  |  | { | 
| 202 | 0 | 0 | 0 |  |  | 0 | if (defined($defines_href->{$key}) && length($defines_href->{$key})) | 
| 203 |  |  |  |  |  |  | { | 
| 204 | 0 |  |  |  |  | 0 | $ModuleInfo{'mod_defines'} .= "-D$key=$defines_href->{$key} " ; | 
| 205 | 0 |  |  |  |  | 0 | $ModuleInfo{'make_defines'} .= "$key=$defines_href->{$key} " ; | 
| 206 |  |  |  |  |  |  | } | 
| 207 |  |  |  |  |  |  | else | 
| 208 |  |  |  |  |  |  | { | 
| 209 | 0 |  |  |  |  | 0 | $ModuleInfo{'mod_defines'} .= "-D$key " ; | 
| 210 | 0 |  |  |  |  | 0 | $ModuleInfo{'make_defines'} .= "$key=1 " ; | 
| 211 |  |  |  |  |  |  | } | 
| 212 |  |  |  |  |  |  | } | 
| 213 |  |  |  |  |  |  | } | 
| 214 |  |  |  |  |  |  | } | 
| 215 |  |  |  |  |  |  |  | 
| 216 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 217 |  |  |  |  |  |  | sub get_makeopts | 
| 218 |  |  |  |  |  |  | { | 
| 219 |  |  |  |  |  |  | ## -D = debug | 
| 220 | 0 |  |  | 0 | 0 | 0 | $Makeutils::DEBUG = 0 ; | 
| 221 | 0 | 0 |  |  |  | 0 | if ( | 
| 222 |  |  |  |  |  |  | grep $_ eq '-D', @main::ARGV | 
| 223 |  |  |  |  |  |  | ) | 
| 224 |  |  |  |  |  |  | { | 
| 225 | 0 |  |  |  |  | 0 | $Makeutils::DEBUG = 1 ; | 
| 226 |  |  |  |  |  |  | } | 
| 227 |  |  |  |  |  |  |  | 
| 228 |  |  |  |  |  |  | ## -d = debug | 
| 229 | 0 | 0 |  |  |  | 0 | if ( | 
| 230 |  |  |  |  |  |  | grep $_ eq '-d', @main::ARGV | 
| 231 |  |  |  |  |  |  | ) | 
| 232 |  |  |  |  |  |  | { | 
| 233 | 0 |  |  |  |  | 0 | @main::ARGV = grep $_ ne '-d', @main::ARGV; | 
| 234 | 0 |  |  |  |  | 0 | warn "Buidling version with extra debugging enabled...\n"; | 
| 235 | 0 |  |  |  |  | 0 | add_defines({ | 
| 236 |  |  |  |  |  |  | 'DEBUG'		=> 1, | 
| 237 |  |  |  |  |  |  | }) ; | 
| 238 |  |  |  |  |  |  |  | 
| 239 |  |  |  |  |  |  | # compile for debug | 
| 240 | 0 |  |  |  |  | 0 | $ModuleInfo{'OPTIMIZE'} = '-ggdb -O0' ; | 
| 241 |  |  |  |  |  |  | } | 
| 242 |  |  |  |  |  |  |  | 
| 243 |  |  |  |  |  |  | ## -M = udpate MANIFEST | 
| 244 | 0 |  |  |  |  | 0 | $Makeutils::UPDATE_MANIFEST = 0 ; | 
| 245 | 0 | 0 |  |  |  | 0 | if ( | 
| 246 |  |  |  |  |  |  | grep $_ eq '-M', @main::ARGV | 
| 247 |  |  |  |  |  |  | ) | 
| 248 |  |  |  |  |  |  | { | 
| 249 | 0 |  |  |  |  | 0 | $Makeutils::UPDATE_MANIFEST = 1 ; | 
| 250 |  |  |  |  |  |  | } | 
| 251 |  |  |  |  |  |  |  | 
| 252 |  |  |  |  |  |  | } | 
| 253 |  |  |  |  |  |  |  | 
| 254 |  |  |  |  |  |  |  | 
| 255 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 256 |  |  |  |  |  |  | sub process_makeopts | 
| 257 |  |  |  |  |  |  | { | 
| 258 | 0 | 0 |  | 0 | 0 | 0 | if ($Makeutils::UPDATE_MANIFEST) | 
| 259 |  |  |  |  |  |  | { | 
| 260 | 0 |  |  |  |  | 0 | update_manifest() ; | 
| 261 |  |  |  |  |  |  | } | 
| 262 |  |  |  |  |  |  | } | 
| 263 |  |  |  |  |  |  |  | 
| 264 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 265 |  |  |  |  |  |  | sub update_manifest | 
| 266 |  |  |  |  |  |  | { | 
| 267 |  |  |  |  |  |  | ## Read file | 
| 268 | 0 |  |  | 0 | 0 | 0 | my %manifest ; | 
| 269 |  |  |  |  |  |  | my $line ; | 
| 270 | 0 | 0 |  |  |  | 0 | open my $fh, " | 
| 271 | 0 |  |  |  |  | 0 | while(defined($line = <$fh>)) | 
| 272 |  |  |  |  |  |  | { | 
| 273 | 0 |  |  |  |  | 0 | chomp $line ; | 
| 274 | 0 |  |  |  |  | 0 | $line =~ s/[^[:ascii:]]/ /g; | 
| 275 | 0 |  |  |  |  | 0 | $line =~ s/^\s+// ; | 
| 276 | 0 |  |  |  |  | 0 | $line =~ s/\s+$// ; | 
| 277 | 0 |  |  |  |  | 0 | $line =~ s/^#.*// ; | 
| 278 | 0 | 0 |  |  |  | 0 | next unless $line ; | 
| 279 |  |  |  |  |  |  |  | 
| 280 | 0 |  |  |  |  | 0 | $manifest{$line} = 1 ; | 
| 281 |  |  |  |  |  |  | } | 
| 282 | 0 |  |  |  |  | 0 | close $fh ; | 
| 283 |  |  |  |  |  |  |  | 
| 284 |  |  |  |  |  |  | ## Build expected list | 
| 285 | 0 |  |  |  |  | 0 | my @expected = qw( | 
| 286 |  |  |  |  |  |  | MANIFEST | 
| 287 |  |  |  |  |  |  | README | 
| 288 |  |  |  |  |  |  | COPYING | 
| 289 |  |  |  |  |  |  | Changes | 
| 290 |  |  |  |  |  |  | Makefile.PL | 
| 291 |  |  |  |  |  |  | plib/Makeutils.pm | 
| 292 |  |  |  |  |  |  | ppport.h | 
| 293 |  |  |  |  |  |  | typemap | 
| 294 |  |  |  |  |  |  | ) ; | 
| 295 |  |  |  |  |  |  |  | 
| 296 |  |  |  |  |  |  | # xs | 
| 297 | 0 |  |  |  |  | 0 | push @expected, "$ModuleInfo{'root'}.xs" ; | 
| 298 | 0 |  |  |  |  | 0 | push @expected, find_recurse("xs", "*.xs") ; | 
| 299 |  |  |  |  |  |  |  | 
| 300 |  |  |  |  |  |  | # t | 
| 301 | 0 |  |  |  |  | 0 | push @expected, find_recurse("t", "*.t") ; | 
| 302 |  |  |  |  |  |  |  | 
| 303 |  |  |  |  |  |  | # scripts | 
| 304 | 0 |  |  |  |  | 0 | push @expected, @{$ModuleInfo{'programs'}} ; | 
|  | 0 |  |  |  |  | 0 |  | 
| 305 |  |  |  |  |  |  |  | 
| 306 |  |  |  |  |  |  | # Perl | 
| 307 | 0 |  |  |  |  | 0 | push @expected, find_recurse("lib", "*.pm") ; | 
| 308 |  |  |  |  |  |  |  | 
| 309 |  |  |  |  |  |  | # C | 
| 310 | 0 |  |  |  |  | 0 | push @expected, find_recurse("clib", "*.c") ; | 
| 311 | 0 |  |  |  |  | 0 | push @expected, find_recurse("clib", "*.h") ; | 
| 312 |  |  |  |  |  |  |  | 
| 313 |  |  |  |  |  |  |  | 
| 314 |  |  |  |  |  |  | ## Find any missing | 
| 315 | 0 |  |  |  |  | 0 | my @missing ; | 
| 316 | 0 |  |  |  |  | 0 | foreach my $file (@expected) | 
| 317 |  |  |  |  |  |  | { | 
| 318 | 0 | 0 |  |  |  | 0 | if (!exists($manifest{$file})) | 
| 319 |  |  |  |  |  |  | { | 
| 320 | 0 |  |  |  |  | 0 | push @missing, $file ; | 
| 321 |  |  |  |  |  |  | } | 
| 322 |  |  |  |  |  |  | } | 
| 323 |  |  |  |  |  |  |  | 
| 324 | 0 |  |  |  |  | 0 | print "\nUpdating MANIFEST\n" ; | 
| 325 | 0 |  |  |  |  | 0 | print   "=================\n" ; | 
| 326 | 0 | 0 |  |  |  | 0 | if (@missing) | 
| 327 |  |  |  |  |  |  | { | 
| 328 |  |  |  |  |  |  | ## Append | 
| 329 | 0 | 0 |  |  |  | 0 | open my $fh, ">>MANIFEST" or die "Error: Unable to write to MANIFEST file" ; | 
| 330 | 0 |  |  |  |  | 0 | print $fh "\n\n## Missing files:\n" ; | 
| 331 | 0 |  |  |  |  | 0 | foreach my $file (@missing) | 
| 332 |  |  |  |  |  |  | { | 
| 333 | 0 |  |  |  |  | 0 | print $fh "$file\n" ; | 
| 334 |  |  |  |  |  |  | } | 
| 335 | 0 |  |  |  |  | 0 | close $fh ; | 
| 336 |  |  |  |  |  |  |  | 
| 337 | 0 |  |  |  |  | 0 | print "Appended ", scalar(@missing), " files:\n" ; | 
| 338 | 0 |  |  |  |  | 0 | foreach my $file (@missing) | 
| 339 |  |  |  |  |  |  | { | 
| 340 | 0 |  |  |  |  | 0 | print "  $file\n" ; | 
| 341 |  |  |  |  |  |  | } | 
| 342 |  |  |  |  |  |  | } | 
| 343 |  |  |  |  |  |  | else | 
| 344 |  |  |  |  |  |  | { | 
| 345 | 0 |  |  |  |  | 0 | print "No files missing\n" ; | 
| 346 |  |  |  |  |  |  | } | 
| 347 |  |  |  |  |  |  |  | 
| 348 |  |  |  |  |  |  |  | 
| 349 | 0 |  |  |  |  | 0 | print "\nAll Files:\n" ; | 
| 350 | 0 |  |  |  |  | 0 | foreach my $file (@expected) | 
| 351 |  |  |  |  |  |  | { | 
| 352 | 0 |  |  |  |  | 0 | print "  $file\n" ; | 
| 353 |  |  |  |  |  |  | } | 
| 354 |  |  |  |  |  |  |  | 
| 355 | 0 |  |  |  |  | 0 | exit 0 ; | 
| 356 |  |  |  |  |  |  | } | 
| 357 |  |  |  |  |  |  |  | 
| 358 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 359 |  |  |  |  |  |  | sub find_recurse | 
| 360 |  |  |  |  |  |  | { | 
| 361 | 0 |  |  | 0 | 0 | 0 | my ($dir, $spec) = @_ ; | 
| 362 | 0 |  |  |  |  | 0 | my @files = () ; | 
| 363 |  |  |  |  |  |  |  | 
| 364 |  |  |  |  |  |  | # depth last | 
| 365 | 0 |  |  |  |  | 0 | foreach my $f (glob("$dir/$spec")) | 
| 366 |  |  |  |  |  |  | { | 
| 367 | 0 | 0 |  |  |  | 0 | if (-f $f) | 
| 368 |  |  |  |  |  |  | { | 
| 369 | 0 |  |  |  |  | 0 | push @files, $f ; | 
| 370 |  |  |  |  |  |  | } | 
| 371 |  |  |  |  |  |  | } | 
| 372 | 0 |  |  |  |  | 0 | foreach my $d (glob("$dir/*")) | 
| 373 |  |  |  |  |  |  | { | 
| 374 | 0 | 0 |  |  |  | 0 | if (-d $d) | 
| 375 |  |  |  |  |  |  | { | 
| 376 | 0 |  |  |  |  | 0 | push @files, find_recurse($d, $spec) ; | 
| 377 |  |  |  |  |  |  | } | 
| 378 |  |  |  |  |  |  | } | 
| 379 |  |  |  |  |  |  |  | 
| 380 | 0 |  |  |  |  | 0 | return @files ; | 
| 381 |  |  |  |  |  |  | } | 
| 382 |  |  |  |  |  |  |  | 
| 383 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 384 |  |  |  |  |  |  | sub add_objects | 
| 385 |  |  |  |  |  |  | { | 
| 386 | 0 |  |  | 0 | 0 | 0 | my ($basedir, $objs_aref) = @_ ; | 
| 387 |  |  |  |  |  |  |  | 
| 388 | 0 |  |  |  |  | 0 | foreach my $obj (@$objs_aref) | 
| 389 |  |  |  |  |  |  | { | 
| 390 | 0 |  |  |  |  | 0 | push @{$ModuleInfo{'obj_list'}}, "$basedir/$obj" ; | 
|  | 0 |  |  |  |  | 0 |  | 
| 391 |  |  |  |  |  |  | } | 
| 392 |  |  |  |  |  |  |  | 
| 393 |  |  |  |  |  |  | ## Recreate list of all objects | 
| 394 | 0 |  |  |  |  | 0 | _create_objects_list() ; | 
| 395 |  |  |  |  |  |  |  | 
| 396 |  |  |  |  |  |  | ## Create list of includes | 
| 397 | 0 |  |  |  |  | 0 | _create_includes_list() ; | 
| 398 |  |  |  |  |  |  | } | 
| 399 |  |  |  |  |  |  |  | 
| 400 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 401 |  |  |  |  |  |  | #		'dvb_lib'		=> {'mkf' => 'Subdir-min.mk'}, | 
| 402 |  |  |  |  |  |  | #		'dvb_ts_lib'	=> 1, | 
| 403 |  |  |  |  |  |  | #		'libmpeg2'		=> { | 
| 404 |  |  |  |  |  |  | #			'config'		=> { | 
| 405 |  |  |  |  |  |  | #				'file'			=> 'include/config.h', | 
| 406 |  |  |  |  |  |  | #				'func'			=> \&create_libmpeg2_config_h, | 
| 407 |  |  |  |  |  |  | #			}, | 
| 408 |  |  |  |  |  |  | #		}, | 
| 409 |  |  |  |  |  |  | #		'mpeg2audio'	=> { | 
| 410 |  |  |  |  |  |  | #			'config'		=> { | 
| 411 |  |  |  |  |  |  | #				'file'			=> 'config.h', | 
| 412 |  |  |  |  |  |  | #				'func'			=> \&create_mpeg2audio_config_h, | 
| 413 |  |  |  |  |  |  | #			}, | 
| 414 |  |  |  |  |  |  | #		}, | 
| 415 |  |  |  |  |  |  | # | 
| 416 |  |  |  |  |  |  | sub add_clibs | 
| 417 |  |  |  |  |  |  | { | 
| 418 | 0 |  |  | 0 | 0 | 0 | my ($basedir, $clibs_href) = @_ ; | 
| 419 |  |  |  |  |  |  |  | 
| 420 | 0 | 0 |  |  |  | 0 | print "add_clibs($basedir)\n" if $DEBUG ; | 
| 421 |  |  |  |  |  |  |  | 
| 422 |  |  |  |  |  |  | ## Include makefiles & get objects | 
| 423 | 0 |  |  |  |  | 0 | print "Including makefiles from sub libraries:\n" ; | 
| 424 | 0 |  |  |  |  | 0 | foreach my $lib (keys %$clibs_href) | 
| 425 |  |  |  |  |  |  | { | 
| 426 | 0 |  |  |  |  | 0 | my $libdir = "$basedir/$lib/" ; | 
| 427 |  |  |  |  |  |  |  | 
| 428 | 0 |  |  |  |  | 0 | $ModuleInfo{'clibs'}{$lib} = { | 
| 429 |  |  |  |  |  |  | 'file'		=> "", | 
| 430 |  |  |  |  |  |  | 'objects'	=> [], | 
| 431 |  |  |  |  |  |  | 'includes'	=> [ $libdir ], | 
| 432 |  |  |  |  |  |  | } ; | 
| 433 |  |  |  |  |  |  |  | 
| 434 | 0 |  |  |  |  | 0 | print " * $lib ... " ; | 
| 435 | 0 |  |  |  |  | 0 | my $mkf = "$libdir/" ; | 
| 436 | 0 |  |  |  |  | 0 | my $specified_mkf = 0 ; | 
| 437 | 0 | 0 |  |  |  | 0 | if ( ref($clibs_href->{$lib}) eq 'HASH') | 
| 438 |  |  |  |  |  |  | { | 
| 439 | 0 | 0 |  |  |  | 0 | if ( exists($clibs_href->{$lib}{'mkf'})) | 
| 440 |  |  |  |  |  |  | { | 
| 441 | 0 |  |  |  |  | 0 | ++$specified_mkf ; | 
| 442 | 0 |  |  |  |  | 0 | $mkf .= $clibs_href->{$lib}{'mkf'} ; | 
| 443 |  |  |  |  |  |  | } | 
| 444 |  |  |  |  |  |  | else | 
| 445 |  |  |  |  |  |  | { | 
| 446 | 0 |  |  |  |  | 0 | $mkf .= 'Subdir.mk' ; | 
| 447 |  |  |  |  |  |  | } | 
| 448 |  |  |  |  |  |  | } | 
| 449 |  |  |  |  |  |  | else | 
| 450 |  |  |  |  |  |  | { | 
| 451 | 0 |  |  |  |  | 0 | $mkf .= 'Subdir.mk' ; | 
| 452 |  |  |  |  |  |  | } | 
| 453 |  |  |  |  |  |  |  | 
| 454 | 0 | 0 |  |  |  | 0 | print "\n * * mkf = $mkf\n" if $DEBUG ; | 
| 455 |  |  |  |  |  |  |  | 
| 456 |  |  |  |  |  |  | ## read file | 
| 457 | 0 | 0 |  |  |  | 0 | if (-f $mkf) | 
| 458 |  |  |  |  |  |  | { | 
| 459 | 0 |  |  |  |  | 0 | open my $fh, "<$mkf" ; | 
| 460 | 0 | 0 |  |  |  | 0 | if ($fh) | 
| 461 |  |  |  |  |  |  | { | 
| 462 | 0 |  |  |  |  | 0 | $ModuleInfo{'clibs'}{$lib}{'file'} = do { local $/; <$fh> } ; | 
|  | 0 |  |  |  |  | 0 |  | 
|  | 0 |  |  |  |  | 0 |  | 
| 463 | 0 |  |  |  |  | 0 | close $fh ; | 
| 464 | 0 |  |  |  |  | 0 | print "ok" ; | 
| 465 |  |  |  |  |  |  | } | 
| 466 |  |  |  |  |  |  | else | 
| 467 |  |  |  |  |  |  | { | 
| 468 | 0 |  |  |  |  | 0 | print "Unable to read $mkf : $!\n" ; | 
| 469 | 0 | 0 |  |  |  | 0 | exit(1) if $specified_mkf ; | 
| 470 |  |  |  |  |  |  | } | 
| 471 |  |  |  |  |  |  | } | 
| 472 |  |  |  |  |  |  | else | 
| 473 |  |  |  |  |  |  | { | 
| 474 | 0 |  |  |  |  | 0 | print "$mkf not found\n" ; | 
| 475 | 0 | 0 |  |  |  | 0 | exit(1) if $specified_mkf ; | 
| 476 |  |  |  |  |  |  | } | 
| 477 | 0 |  |  |  |  | 0 | print "\n" ; | 
| 478 |  |  |  |  |  |  |  | 
| 479 |  |  |  |  |  |  | ## Process file | 
| 480 | 0 |  |  |  |  | 0 | my @lines = split /\n/, $ModuleInfo{'clibs'}{$lib}{'file'} ; | 
| 481 | 0 |  |  |  |  | 0 | foreach my $line (@lines) | 
| 482 |  |  |  |  |  |  | { | 
| 483 | 0 |  |  |  |  | 0 | chomp $line ; | 
| 484 | 0 |  |  |  |  | 0 | $line =~ s/#.*// ; | 
| 485 | 0 |  |  |  |  | 0 | $line =~ s/^\s+// ; | 
| 486 | 0 |  |  |  |  | 0 | $line =~ s/\s+$// ; | 
| 487 | 0 | 0 |  |  |  | 0 | next unless $line ; | 
| 488 |  |  |  |  |  |  |  | 
| 489 |  |  |  |  |  |  | # look for something like: | 
| 490 |  |  |  |  |  |  | #	OBJS-libdvb_ts_lib := \ | 
| 491 |  |  |  |  |  |  | #		$(libdvb_ts_lib)/ts_parse.o \ | 
| 492 |  |  |  |  |  |  | #		$(libdvb_ts_lib)/ts_skip.o \ | 
| 493 |  |  |  |  |  |  | #		$(libdvb_ts_lib)/ts_split.o \ | 
| 494 |  |  |  |  |  |  | #		$(libdvb_ts_lib)/ts_cut.o | 
| 495 |  |  |  |  |  |  | # | 
| 496 |  |  |  |  |  |  | # Get just the *.o | 
| 497 |  |  |  |  |  |  | # | 
| 498 | 0 | 0 |  |  |  | 0 | if ($line =~ m/(\S+\.o)/) | 
| 499 |  |  |  |  |  |  | { | 
| 500 | 0 |  |  |  |  | 0 | my $obj = $1 ; | 
| 501 |  |  |  |  |  |  |  | 
| 502 |  |  |  |  |  |  | # replace $(...) with the dir | 
| 503 | 0 |  |  |  |  | 0 | $obj =~ s%\$\([^)]+\)%$basedir/$lib% ; | 
| 504 | 0 |  |  |  |  | 0 | push @{$ModuleInfo{'clibs'}{$lib}{'objects'}}, $obj ; | 
|  | 0 |  |  |  |  | 0 |  | 
| 505 |  |  |  |  |  |  | } | 
| 506 |  |  |  |  |  |  | } | 
| 507 |  |  |  |  |  |  |  | 
| 508 |  |  |  |  |  |  | ## check for any include subdirs | 
| 509 | 0 |  |  |  |  | 0 | for my $incdir (qw/include inc h shared/) | 
| 510 |  |  |  |  |  |  | { | 
| 511 | 0 | 0 |  |  |  | 0 | if (-d "$libdir$incdir") | 
| 512 |  |  |  |  |  |  | { | 
| 513 | 0 |  |  |  |  | 0 | push @{$ModuleInfo{'clibs'}{$lib}{'includes'}}, "$libdir$incdir" ; | 
|  | 0 |  |  |  |  | 0 |  | 
| 514 |  |  |  |  |  |  | } | 
| 515 |  |  |  |  |  |  | } | 
| 516 |  |  |  |  |  |  | } | 
| 517 |  |  |  |  |  |  |  | 
| 518 |  |  |  |  |  |  | ## Create config files | 
| 519 | 0 |  |  |  |  | 0 | foreach my $lib (keys %$clibs_href) | 
| 520 |  |  |  |  |  |  | { | 
| 521 | 0 | 0 | 0 |  |  | 0 | if ( (ref($clibs_href->{$lib}) eq 'HASH') && (exists($clibs_href->{$lib}{'config'})) ) | 
| 522 |  |  |  |  |  |  | { | 
| 523 | 0 | 0 | 0 |  |  | 0 | if ( (ref($clibs_href->{$lib}{'config'}{'func'}) eq 'CODE') && (exists($clibs_href->{$lib}{'config'}{'file'})) ) | 
| 524 |  |  |  |  |  |  | { | 
| 525 | 0 |  |  |  |  | 0 | my $func = $clibs_href->{$lib}{'config'}{'func'} ; | 
| 526 | 0 |  |  |  |  | 0 | my $config_h = "$basedir/$lib/$clibs_href->{$lib}{'config'}{'file'}" ; | 
| 527 |  |  |  |  |  |  |  | 
| 528 | 0 |  |  |  |  | 0 | print "creating config file $config_h ... " ; | 
| 529 | 0 |  |  |  |  | 0 | &$func($config_h, %{$ModuleInfo{'config'}}) ; | 
|  | 0 |  |  |  |  | 0 |  | 
| 530 | 0 |  |  |  |  | 0 | print "ok\n" ; | 
| 531 |  |  |  |  |  |  | } | 
| 532 |  |  |  |  |  |  | } | 
| 533 |  |  |  |  |  |  | } | 
| 534 |  |  |  |  |  |  |  | 
| 535 |  |  |  |  |  |  | ## Recreate list of all objects | 
| 536 | 0 |  |  |  |  | 0 | _create_objects_list() ; | 
| 537 |  |  |  |  |  |  |  | 
| 538 |  |  |  |  |  |  | ## Create list of includes | 
| 539 | 0 |  |  |  |  | 0 | _create_includes_list() ; | 
| 540 |  |  |  |  |  |  | } | 
| 541 |  |  |  |  |  |  |  | 
| 542 |  |  |  |  |  |  |  | 
| 543 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 544 |  |  |  |  |  |  | sub _create_objects_list | 
| 545 |  |  |  |  |  |  | { | 
| 546 |  |  |  |  |  |  | ## root | 
| 547 | 0 |  |  | 0 |  | 0 | $ModuleInfo{'objects'} = "$ModuleInfo{'root'}.o " ; | 
| 548 |  |  |  |  |  |  |  | 
| 549 |  |  |  |  |  |  | ## include makefiles | 
| 550 | 0 |  |  |  |  | 0 | foreach my $lib (sort keys %{$ModuleInfo{'clibs'}}) | 
|  | 0 |  |  |  |  | 0 |  | 
| 551 |  |  |  |  |  |  | { | 
| 552 | 0 |  |  |  |  | 0 | $ModuleInfo{'objects'} .= join(' ', @{$ModuleInfo{'clibs'}{$lib}{'objects'}}) . " " ; | 
|  | 0 |  |  |  |  | 0 |  | 
| 553 |  |  |  |  |  |  | } | 
| 554 |  |  |  |  |  |  |  | 
| 555 |  |  |  |  |  |  | ## additional objects | 
| 556 | 0 |  |  |  |  | 0 | $ModuleInfo{'objects'} .= join(' ', @{$ModuleInfo{'obj_list'}}) . " " ; | 
|  | 0 |  |  |  |  | 0 |  | 
| 557 |  |  |  |  |  |  | } | 
| 558 |  |  |  |  |  |  |  | 
| 559 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 560 |  |  |  |  |  |  | sub _create_includes_list | 
| 561 |  |  |  |  |  |  | { | 
| 562 |  |  |  |  |  |  | ## include makefiles | 
| 563 | 0 |  |  | 0 |  | 0 | $ModuleInfo{'includes'} = "" ; | 
| 564 | 0 |  |  |  |  | 0 | foreach my $lib (sort keys %{$ModuleInfo{'clibs'}}) | 
|  | 0 |  |  |  |  | 0 |  | 
| 565 |  |  |  |  |  |  | { | 
| 566 | 0 |  |  |  |  | 0 | foreach my $inc ( @{$ModuleInfo{'clibs'}{$lib}{'includes'}} ) | 
|  | 0 |  |  |  |  | 0 |  | 
| 567 |  |  |  |  |  |  | { | 
| 568 | 0 |  |  |  |  | 0 | $ModuleInfo{'includes'} .= "-I$inc " ; | 
| 569 |  |  |  |  |  |  | } | 
| 570 |  |  |  |  |  |  | } | 
| 571 |  |  |  |  |  |  |  | 
| 572 |  |  |  |  |  |  | } | 
| 573 |  |  |  |  |  |  |  | 
| 574 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 575 |  |  |  |  |  |  | sub _c_try | 
| 576 |  |  |  |  |  |  | { | 
| 577 | 25 |  |  | 25 |  | 83 | my ($info_tag, $cc, $target, $msg, $code, $ok_val, $cflags, $exec_out_ref) = @_ ; | 
| 578 |  |  |  |  |  |  |  | 
| 579 | 25 | 50 | 33 |  |  | 96 | if ($DEBUG && $msg) | 
| 580 |  |  |  |  |  |  | { | 
| 581 | 0 |  |  |  |  | 0 | print "\n-------------------------\n" ; | 
| 582 |  |  |  |  |  |  | } | 
| 583 | 25 | 50 |  |  |  | 230 | if ($info_tag) | 
| 584 |  |  |  |  |  |  | { | 
| 585 | 25 |  | 100 |  |  | 362 | $ModuleInfo{'C_TRY'}{$info_tag} ||= [] ; | 
| 586 |  |  |  |  |  |  | } | 
| 587 |  |  |  |  |  |  |  | 
| 588 | 25 | 100 |  |  |  | 958 | print "$msg... " if $msg ; | 
| 589 |  |  |  |  |  |  |  | 
| 590 | 25 | 50 |  |  |  | 547 | $ok_val=1 unless defined $ok_val ; | 
| 591 |  |  |  |  |  |  |  | 
| 592 | 25 |  | 100 |  |  | 112 | $cflags ||= "" ; | 
| 593 | 25 |  |  |  |  | 65 | my $ok = "" ; | 
| 594 | 25 |  |  |  |  | 37 | my $conftest = "conftest.c" ; | 
| 595 | 25 |  |  |  |  | 38 | my $conferr = "conftest.err" ; | 
| 596 |  |  |  |  |  |  |  | 
| 597 | 25 | 50 |  |  |  | 2907 | open my $fh, ">$conftest" or die "Error: unable to create test file $conftest : $!"; | 
| 598 | 25 |  |  |  |  | 375 | print $fh $code ; | 
| 599 | 25 |  |  |  |  | 1373 | close $fh ; | 
| 600 |  |  |  |  |  |  |  | 
| 601 | 25 |  |  |  |  | 432 | unlink $target ; | 
| 602 |  |  |  |  |  |  |  | 
| 603 | 25 |  |  |  |  | 100 | my $cmd = "$cc $conftest $cflags 2> $conferr" ; | 
| 604 | 25 |  |  |  |  | 2004411 | my $rc = system($cmd) ; | 
| 605 | 25 |  |  |  |  | 333 | my $errstr ; | 
| 606 | 25 |  |  |  |  | 4257 | open $fh, "<$conferr" ; | 
| 607 | 25 | 50 |  |  |  | 486 | if ($fh) | 
| 608 |  |  |  |  |  |  | { | 
| 609 | 25 |  |  |  |  | 50 | $errstr = do { local $/; <$fh> } ; | 
|  | 25 |  |  |  |  | 547 |  | 
|  | 25 |  |  |  |  | 1637 |  | 
| 610 | 25 |  |  |  |  | 398 | close $fh ; | 
| 611 | 25 |  |  |  |  | 238 | $errstr =~ s/^\s+.//gm ; | 
| 612 |  |  |  |  |  |  | } | 
| 613 |  |  |  |  |  |  |  | 
| 614 | 25 | 50 |  |  |  | 115 | if ($DEBUG) | 
| 615 |  |  |  |  |  |  | { | 
| 616 | 0 |  |  |  |  | 0 | print "\n- - - - - - - - - - - - -\n" ; | 
| 617 | 0 |  |  |  |  | 0 | print "- RC: $rc\n" ; | 
| 618 | 0 |  |  |  |  | 0 | print "- - - - - - - - - - - - -\n" ; | 
| 619 | 0 |  |  |  |  | 0 | print "- Code:\n" ; | 
| 620 | 0 |  |  |  |  | 0 | print "- - - - - - - - - - - - -\n" ; | 
| 621 | 0 |  |  |  |  | 0 | print "$code\n" ; | 
| 622 | 0 |  |  |  |  | 0 | print "- - - - - - - - - - - - -\n" ; | 
| 623 | 0 |  |  |  |  | 0 | print "- Cmd: $cmd\n" ; | 
| 624 | 0 |  |  |  |  | 0 | print "- - - - - - - - - - - - -\n" ; | 
| 625 | 0 |  |  |  |  | 0 | print "- Target: $target [size=", -s $target, "]\n" ; | 
| 626 | 0 |  |  |  |  | 0 | print "- - - - - - - - - - - - -\n" ; | 
| 627 | 0 |  |  |  |  | 0 | print "- Compile errors:\n" ; | 
| 628 | 0 |  |  |  |  | 0 | print "- - - - - - - - - - - - -\n" ; | 
| 629 | 0 |  |  |  |  | 0 | print "$errstr" ; | 
| 630 |  |  |  |  |  |  | } | 
| 631 |  |  |  |  |  |  |  | 
| 632 | 25 | 50 |  |  |  | 93 | if ($info_tag) | 
| 633 |  |  |  |  |  |  | { | 
| 634 | 25 |  | 100 |  |  | 767 | my $size = -s $target || 0 ; | 
| 635 | 25 |  |  |  |  | 61 | push @{$ModuleInfo{'C_TRY'}{$info_tag}}, ( | 
|  | 25 |  |  |  |  | 1083 |  | 
| 636 |  |  |  |  |  |  | "- - - - - - - - - - - - -", | 
| 637 |  |  |  |  |  |  | "- RC: $rc", | 
| 638 |  |  |  |  |  |  | "- - - - - - - - - - - - -", | 
| 639 |  |  |  |  |  |  | "- Code:", | 
| 640 |  |  |  |  |  |  | "- - - - - - - - - - - - -", | 
| 641 |  |  |  |  |  |  | "$code", | 
| 642 |  |  |  |  |  |  | "- - - - - - - - - - - - -", | 
| 643 |  |  |  |  |  |  | "- Cmd: $cmd", | 
| 644 |  |  |  |  |  |  | "- - - - - - - - - - - - -", | 
| 645 |  |  |  |  |  |  | "- Target: $target [size=$size]", | 
| 646 |  |  |  |  |  |  | "- - - - - - - - - - - - -", | 
| 647 |  |  |  |  |  |  | "- Compile errors:", | 
| 648 |  |  |  |  |  |  | "- - - - - - - - - - - - -", | 
| 649 |  |  |  |  |  |  | "$errstr" | 
| 650 |  |  |  |  |  |  | ) ; | 
| 651 |  |  |  |  |  |  | } | 
| 652 |  |  |  |  |  |  |  | 
| 653 |  |  |  |  |  |  | # check for errors | 
| 654 | 25 | 50 | 66 |  |  | 691 | if ( ($rc==0) && (!$errstr) && (-s $target) ) | 
|  |  |  | 66 |  |  |  |  | 
| 655 |  |  |  |  |  |  | { | 
| 656 |  |  |  |  |  |  | # stop here because this worked | 
| 657 | 20 |  |  |  |  | 139 | $ok = $ok_val ; | 
| 658 |  |  |  |  |  |  |  | 
| 659 |  |  |  |  |  |  | #		## See if we want to run the code | 
| 660 |  |  |  |  |  |  | #		if ($exec_out_ref && ref($exec_out_ref)) | 
| 661 |  |  |  |  |  |  | #		{ | 
| 662 |  |  |  |  |  |  | #			my @out = `./$conftest` ; | 
| 663 |  |  |  |  |  |  | #		} | 
| 664 |  |  |  |  |  |  | } | 
| 665 |  |  |  |  |  |  |  | 
| 666 | 25 |  |  |  |  | 4136 | unlink $conftest ; | 
| 667 | 25 |  |  |  |  | 1429 | unlink $conferr ; | 
| 668 |  |  |  |  |  |  |  | 
| 669 | 25 | 100 |  |  |  | 108 | if ($msg) | 
| 670 |  |  |  |  |  |  | { | 
| 671 | 21 | 50 |  |  |  | 71 | if ($DEBUG) | 
| 672 |  |  |  |  |  |  | { | 
| 673 | 0 |  |  |  |  | 0 | print "- - - - - - - - - - - - -\n" ; | 
| 674 | 0 |  |  |  |  | 0 | print "- Return: [ok=$ok] " ; | 
| 675 |  |  |  |  |  |  | } | 
| 676 |  |  |  |  |  |  | #		print $ok ? "$ok\n" : "no\n" ; | 
| 677 | 21 | 100 |  |  |  | 3651 | print $ok ? "yes\n" : "no\n" ; | 
| 678 |  |  |  |  |  |  | } | 
| 679 |  |  |  |  |  |  |  | 
| 680 | 25 | 50 |  |  |  | 85 | if ($info_tag) | 
| 681 |  |  |  |  |  |  | { | 
| 682 | 25 |  |  |  |  | 41 | push @{$ModuleInfo{'C_TRY'}{$info_tag}}, ( | 
|  | 25 |  |  |  |  | 356 |  | 
| 683 |  |  |  |  |  |  | "- - - - - - - - - - - - -", | 
| 684 |  |  |  |  |  |  | "- Return: [ok=$ok]" | 
| 685 |  |  |  |  |  |  | ) ; | 
| 686 |  |  |  |  |  |  | } | 
| 687 |  |  |  |  |  |  |  | 
| 688 | 25 | 50 | 33 |  |  | 178 | if ($DEBUG && $msg) | 
| 689 |  |  |  |  |  |  | { | 
| 690 | 0 |  |  |  |  | 0 | print "-------------------------\n\n" ; | 
| 691 |  |  |  |  |  |  | } | 
| 692 |  |  |  |  |  |  |  | 
| 693 |  |  |  |  |  |  |  | 
| 694 | 25 |  |  |  |  | 1440 | return $ok ; | 
| 695 |  |  |  |  |  |  | } | 
| 696 |  |  |  |  |  |  |  | 
| 697 |  |  |  |  |  |  |  | 
| 698 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 699 |  |  |  |  |  |  | sub c_try | 
| 700 |  |  |  |  |  |  | { | 
| 701 | 20 |  |  | 20 | 0 | 66 | my ($info_tag, $msg, $code, $ok_val, $cflags, $exec_out_ref) = @_ ; | 
| 702 |  |  |  |  |  |  |  | 
| 703 | 20 |  |  |  |  | 45 | my $confobj = "conftest.o" ; | 
| 704 | 20 |  |  |  |  | 1298 | my $cc = "$Config{'cc'}  -o $confobj -c" ; | 
| 705 |  |  |  |  |  |  |  | 
| 706 | 20 |  |  |  |  | 124 | my $ok = _c_try($info_tag, $cc, $confobj, $msg, $code, $ok_val, $cflags, $exec_out_ref) ; | 
| 707 |  |  |  |  |  |  |  | 
| 708 | 20 |  |  |  |  | 1818 | unlink $confobj ; | 
| 709 |  |  |  |  |  |  |  | 
| 710 | 20 |  |  |  |  | 325 | return $ok ; | 
| 711 |  |  |  |  |  |  | } | 
| 712 |  |  |  |  |  |  |  | 
| 713 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 714 |  |  |  |  |  |  | sub c_try_link | 
| 715 |  |  |  |  |  |  | { | 
| 716 | 5 |  |  | 5 | 0 | 21 | my ($info_tag, $msg, $code, $ok_val, $cflags, $exec_out_ref, $ld_flags) = @_ ; | 
| 717 |  |  |  |  |  |  |  | 
| 718 | 5 |  | 100 |  |  | 39 | $ld_flags ||= "" ; | 
| 719 |  |  |  |  |  |  |  | 
| 720 | 5 |  |  |  |  | 507 | my $target = "conftest$Config{_exe}" ; | 
| 721 | 5 |  |  |  |  | 55 | my $cc = "$Config{'cc'} -o $target $ld_flags" ; | 
| 722 |  |  |  |  |  |  |  | 
| 723 | 5 |  |  |  |  | 30 | my $ok = _c_try($info_tag, $cc, $target, $msg, $code, $ok_val, $cflags, $exec_out_ref) ; | 
| 724 |  |  |  |  |  |  |  | 
| 725 | 5 |  |  |  |  | 215 | unlink $target ; | 
| 726 |  |  |  |  |  |  |  | 
| 727 | 5 |  |  |  |  | 32 | return $ok ; | 
| 728 |  |  |  |  |  |  | } | 
| 729 |  |  |  |  |  |  |  | 
| 730 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 731 |  |  |  |  |  |  | sub c_try_keywords | 
| 732 |  |  |  |  |  |  | { | 
| 733 | 2 |  |  | 2 | 0 | 14 | my ($info_tag, $msg, $code, $keywords_aref, $cflags) = @_ ; | 
| 734 |  |  |  |  |  |  |  | 
| 735 |  |  |  |  |  |  |  | 
| 736 | 2 | 50 |  |  |  | 7 | if ($DEBUG) | 
| 737 |  |  |  |  |  |  | { | 
| 738 | 0 |  |  |  |  | 0 | print "\n-------------------------\n" ; | 
| 739 |  |  |  |  |  |  | } | 
| 740 |  |  |  |  |  |  |  | 
| 741 | 2 | 50 |  |  |  | 79 | print "$msg... " if $msg ; | 
| 742 |  |  |  |  |  |  |  | 
| 743 | 2 |  |  |  |  | 20 | my $ok = "" ; | 
| 744 |  |  |  |  |  |  |  | 
| 745 | 2 |  |  |  |  | 7 | foreach my $ac_kw (@$keywords_aref) | 
| 746 |  |  |  |  |  |  | { | 
| 747 | 3 | 50 |  |  |  | 10 | if ($DEBUG) | 
| 748 |  |  |  |  |  |  | { | 
| 749 | 0 |  |  |  |  | 0 | print "\n- - - - - - - - - - - - -\n" ; | 
| 750 | 0 |  |  |  |  | 0 | print "- Keyword: $ac_kw" ; | 
| 751 |  |  |  |  |  |  | } | 
| 752 |  |  |  |  |  |  |  | 
| 753 | 3 |  |  |  |  | 6 | my $code_str = $code ; | 
| 754 | 3 |  |  |  |  | 32 | $code_str =~ s/\$ac_kw/$ac_kw/g ; | 
| 755 | 3 |  |  |  |  | 23 | $ok = c_try($info_tag, "", $code_str, $ac_kw, $cflags) ; | 
| 756 |  |  |  |  |  |  |  | 
| 757 | 3 | 100 |  |  |  | 41 | if ($ok) | 
| 758 |  |  |  |  |  |  | { | 
| 759 | 2 |  |  |  |  | 17 | last ; | 
| 760 |  |  |  |  |  |  | } | 
| 761 |  |  |  |  |  |  | } | 
| 762 |  |  |  |  |  |  |  | 
| 763 | 2 | 50 |  |  |  | 20 | if ($msg) | 
| 764 |  |  |  |  |  |  | { | 
| 765 | 2 | 50 |  |  |  | 10 | if ($DEBUG) | 
| 766 |  |  |  |  |  |  | { | 
| 767 | 0 |  |  |  |  | 0 | print "- - - - - - - - - - - - -\n" ; | 
| 768 | 0 |  |  |  |  | 0 | print "- Return: " ; | 
| 769 |  |  |  |  |  |  | } | 
| 770 | 2 | 50 |  |  |  | 360 | print $ok ? "$ok\n" : "no\n" ; | 
| 771 |  |  |  |  |  |  | } | 
| 772 |  |  |  |  |  |  |  | 
| 773 | 2 | 50 |  |  |  | 8 | if ($DEBUG) | 
| 774 |  |  |  |  |  |  | { | 
| 775 | 0 |  |  |  |  | 0 | print "-------------------------\n\n" ; | 
| 776 |  |  |  |  |  |  | } | 
| 777 |  |  |  |  |  |  |  | 
| 778 | 2 |  |  |  |  | 23 | return $ok ; | 
| 779 |  |  |  |  |  |  | } | 
| 780 |  |  |  |  |  |  |  | 
| 781 |  |  |  |  |  |  |  | 
| 782 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 783 |  |  |  |  |  |  | sub c_inline | 
| 784 |  |  |  |  |  |  | { | 
| 785 | 1 |  |  | 1 | 0 | 7 | my $code = <<'_ACEOF' ; | 
| 786 |  |  |  |  |  |  | #ifndef __cplusplus | 
| 787 |  |  |  |  |  |  | typedef int foo_t; | 
| 788 |  |  |  |  |  |  | static $ac_kw foo_t static_foo () {return 0; } | 
| 789 |  |  |  |  |  |  | $ac_kw foo_t foo () {return 0; } | 
| 790 |  |  |  |  |  |  | #endif | 
| 791 |  |  |  |  |  |  |  | 
| 792 |  |  |  |  |  |  | _ACEOF | 
| 793 |  |  |  |  |  |  |  | 
| 794 | 1 |  |  |  |  | 24 | my $ac_c_inline = c_try_keywords('inline', 'checking for inline', $code, [qw/inline __inline__ __inline/]) ; | 
| 795 | 1 |  |  |  |  | 11 | return $ac_c_inline ; | 
| 796 |  |  |  |  |  |  | } | 
| 797 |  |  |  |  |  |  |  | 
| 798 |  |  |  |  |  |  |  | 
| 799 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 800 |  |  |  |  |  |  | sub have_builtin_expect | 
| 801 |  |  |  |  |  |  | { | 
| 802 | 1 |  |  | 1 | 0 | 4 | my $code = <<_ACEOF ; | 
| 803 |  |  |  |  |  |  | int foo (int a) | 
| 804 |  |  |  |  |  |  | { | 
| 805 |  |  |  |  |  |  | a = __builtin_expect (a, 10); | 
| 806 |  |  |  |  |  |  | return a == 10 ? 0 : 1; | 
| 807 |  |  |  |  |  |  | } | 
| 808 |  |  |  |  |  |  | _ACEOF | 
| 809 |  |  |  |  |  |  |  | 
| 810 | 1 |  |  |  |  | 37 | my $ok = c_try('expect', 'checking for builtin expect', $code, 1) ; | 
| 811 |  |  |  |  |  |  |  | 
| 812 | 1 | 50 |  |  |  | 37 | return $ok ? "#define HAVE_BUILTIN_EXPECT 1" : "" ; | 
| 813 |  |  |  |  |  |  | } | 
| 814 |  |  |  |  |  |  |  | 
| 815 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 816 |  |  |  |  |  |  | sub have_lrintf | 
| 817 |  |  |  |  |  |  | { | 
| 818 | 0 |  |  | 0 | 0 | 0 | my $code = <<_ACEOF ; | 
| 819 |  |  |  |  |  |  | #include | 
| 820 |  |  |  |  |  |  | int foo (double a) | 
| 821 |  |  |  |  |  |  | { | 
| 822 |  |  |  |  |  |  | long int b ; | 
| 823 |  |  |  |  |  |  |  | 
| 824 |  |  |  |  |  |  | b = lrintf(a); | 
| 825 |  |  |  |  |  |  | return b == 10 ? 0 : 1; | 
| 826 |  |  |  |  |  |  | } | 
| 827 |  |  |  |  |  |  | _ACEOF | 
| 828 |  |  |  |  |  |  |  | 
| 829 | 0 |  |  |  |  | 0 | my $ok = c_try('lrintf', 'checking for lrintf', $code, 1) ; | 
| 830 |  |  |  |  |  |  |  | 
| 831 | 0 | 0 |  |  |  | 0 | return $ok ? "#define HAVE_LRINTF 1" : "" ; | 
| 832 |  |  |  |  |  |  | } | 
| 833 |  |  |  |  |  |  |  | 
| 834 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 835 |  |  |  |  |  |  | sub c_always_inline | 
| 836 |  |  |  |  |  |  | { | 
| 837 | 1 |  |  | 1 | 0 | 7 | my ($ac_c_inline) = @_ ; | 
| 838 |  |  |  |  |  |  |  | 
| 839 | 1 |  |  |  |  | 13 | my $ac_c_always_inline = "" ; | 
| 840 |  |  |  |  |  |  |  | 
| 841 | 1 | 50 | 33 |  |  | 62 | if ( ($Config{'cc'} =~ /gcc$/) && ($ac_c_inline eq 'inline') ) | 
| 842 |  |  |  |  |  |  | { | 
| 843 | 0 |  |  |  |  | 0 | my $code = <<_ACEOF ; | 
| 844 |  |  |  |  |  |  |  | 
| 845 |  |  |  |  |  |  | #ifndef __cplusplus | 
| 846 |  |  |  |  |  |  | #define inline $ac_c_inline | 
| 847 |  |  |  |  |  |  | #endif | 
| 848 |  |  |  |  |  |  |  | 
| 849 |  |  |  |  |  |  | int | 
| 850 |  |  |  |  |  |  | main () | 
| 851 |  |  |  |  |  |  | { | 
| 852 |  |  |  |  |  |  | __attribute__ ((__always_inline__)) void f (void); | 
| 853 |  |  |  |  |  |  | #ifdef __cplusplus | 
| 854 |  |  |  |  |  |  | 42 = 42;    // obviously illegal - we want c++ to fail here | 
| 855 |  |  |  |  |  |  | #endif | 
| 856 |  |  |  |  |  |  | ; | 
| 857 |  |  |  |  |  |  | return 0; | 
| 858 |  |  |  |  |  |  | } | 
| 859 |  |  |  |  |  |  | _ACEOF | 
| 860 |  |  |  |  |  |  |  | 
| 861 | 0 |  |  |  |  | 0 | $ac_c_always_inline = c_try('always_inline', 'checking for always_inline', $code, '__attribute__ ((__always_inline__))') ; | 
| 862 |  |  |  |  |  |  | } | 
| 863 |  |  |  |  |  |  |  | 
| 864 | 1 |  |  |  |  | 5 | return $ac_c_always_inline ; | 
| 865 |  |  |  |  |  |  | } | 
| 866 |  |  |  |  |  |  |  | 
| 867 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 868 |  |  |  |  |  |  | sub c_restrict | 
| 869 |  |  |  |  |  |  | { | 
| 870 |  |  |  |  |  |  |  | 
| 871 |  |  |  |  |  |  | ## protect $ac_kw for expansion in c_try_keywords() | 
| 872 | 1 |  |  | 1 | 0 | 4 | my $code = <<'_ACEOF' ; | 
| 873 |  |  |  |  |  |  | int | 
| 874 |  |  |  |  |  |  | main () | 
| 875 |  |  |  |  |  |  | { | 
| 876 |  |  |  |  |  |  | char * $ac_kw p; | 
| 877 |  |  |  |  |  |  | ; | 
| 878 |  |  |  |  |  |  | return 0; | 
| 879 |  |  |  |  |  |  | } | 
| 880 |  |  |  |  |  |  |  | 
| 881 |  |  |  |  |  |  | _ACEOF | 
| 882 |  |  |  |  |  |  |  | 
| 883 | 1 |  |  |  |  | 12 | my $ac_c_restrict = c_try_keywords('restrict', 'checking for restrict', $code, [qw/restrict __restrict__ __restrict/]) ; | 
| 884 | 1 |  |  |  |  | 29 | return $ac_c_restrict ; | 
| 885 |  |  |  |  |  |  | } | 
| 886 |  |  |  |  |  |  |  | 
| 887 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 888 |  |  |  |  |  |  | sub c_has_header | 
| 889 |  |  |  |  |  |  | { | 
| 890 | 14 |  |  | 14 | 0 | 20 | my ($header) = @_ ; | 
| 891 |  |  |  |  |  |  |  | 
| 892 | 14 |  |  |  |  | 46 | my $code = <<_ACEOF ; | 
| 893 |  |  |  |  |  |  | #include <$header> | 
| 894 |  |  |  |  |  |  |  | 
| 895 |  |  |  |  |  |  | typedef int foo_t; | 
| 896 |  |  |  |  |  |  | static foo_t static_foo () {return 0; } | 
| 897 |  |  |  |  |  |  |  | 
| 898 |  |  |  |  |  |  | int | 
| 899 |  |  |  |  |  |  | main () | 
| 900 |  |  |  |  |  |  | { | 
| 901 |  |  |  |  |  |  | return static_foo() ; | 
| 902 |  |  |  |  |  |  | } | 
| 903 |  |  |  |  |  |  | _ACEOF | 
| 904 |  |  |  |  |  |  |  | 
| 905 | 14 |  |  |  |  | 111 | my $ac_has_header = c_try($header, "checking for $header", $code, $header, '-Wall -Werror') ; | 
| 906 | 14 |  |  |  |  | 116 | return $ac_has_header ; | 
| 907 |  |  |  |  |  |  | } | 
| 908 |  |  |  |  |  |  |  | 
| 909 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 910 |  |  |  |  |  |  | sub c_has_function | 
| 911 |  |  |  |  |  |  | { | 
| 912 | 2 |  |  | 2 | 0 | 4 | my ($ac_func) = @_ ; | 
| 913 |  |  |  |  |  |  |  | 
| 914 | 2 |  |  |  |  | 23 | my $code = <<_ACEOF ; | 
| 915 |  |  |  |  |  |  | /* Define $ac_func to an innocuous variant, in case  declares $ac_func. | 
| 916 |  |  |  |  |  |  | For example, HP-UX 11i  declares gettimeofday.  */ | 
| 917 |  |  |  |  |  |  | #define $ac_func innocuous_$ac_func | 
| 918 |  |  |  |  |  |  |  | 
| 919 |  |  |  |  |  |  | /* System header to define __stub macros and hopefully few prototypes, | 
| 920 |  |  |  |  |  |  | which can conflict with char $ac_func (); below. | 
| 921 |  |  |  |  |  |  | Prefer  to  if __STDC__ is defined, since | 
| 922 |  |  |  |  |  |  | exists even on freestanding compilers.  */ | 
| 923 |  |  |  |  |  |  |  | 
| 924 |  |  |  |  |  |  | #ifdef __STDC__ | 
| 925 |  |  |  |  |  |  | # include | 
| 926 |  |  |  |  |  |  | #else | 
| 927 |  |  |  |  |  |  | # include | 
| 928 |  |  |  |  |  |  | #endif | 
| 929 |  |  |  |  |  |  |  | 
| 930 |  |  |  |  |  |  | #undef $ac_func | 
| 931 |  |  |  |  |  |  |  | 
| 932 |  |  |  |  |  |  | /* Override any GCC internal prototype to avoid an error. | 
| 933 |  |  |  |  |  |  | Use char because int might match the return type of a GCC | 
| 934 |  |  |  |  |  |  | builtin and then its argument prototype would still apply.  */ | 
| 935 |  |  |  |  |  |  | #ifdef __cplusplus | 
| 936 |  |  |  |  |  |  | extern "C" | 
| 937 |  |  |  |  |  |  | #endif | 
| 938 |  |  |  |  |  |  | char $ac_func (); | 
| 939 |  |  |  |  |  |  | /* The GNU C library defines this for functions which it implements | 
| 940 |  |  |  |  |  |  | to always fail with ENOSYS.  Some functions are actually named | 
| 941 |  |  |  |  |  |  | something starting with __ and the normal name is an alias.  */ | 
| 942 |  |  |  |  |  |  | #if defined __stub_$ac_func || defined __stub___$ac_func | 
| 943 |  |  |  |  |  |  | choke me | 
| 944 |  |  |  |  |  |  | #endif | 
| 945 |  |  |  |  |  |  |  | 
| 946 |  |  |  |  |  |  | int | 
| 947 |  |  |  |  |  |  | main () | 
| 948 |  |  |  |  |  |  | { | 
| 949 |  |  |  |  |  |  | return $ac_func (); | 
| 950 |  |  |  |  |  |  | ; | 
| 951 |  |  |  |  |  |  | return 0; | 
| 952 |  |  |  |  |  |  | } | 
| 953 |  |  |  |  |  |  | _ACEOF | 
| 954 |  |  |  |  |  |  |  | 
| 955 |  |  |  |  |  |  | #	c_try_link($msg, $code, $ok_val, $cflags, $exec_out_ref, $ld_flags) ; | 
| 956 | 2 |  |  |  |  | 30 | my $ac_has_function = c_try_link($ac_func, "checking for $ac_func", $code, $ac_func, '-Wall -Werror') ; | 
| 957 | 2 |  |  |  |  | 18 | return $ac_has_function ; | 
| 958 |  |  |  |  |  |  | } | 
| 959 |  |  |  |  |  |  |  | 
| 960 |  |  |  |  |  |  |  | 
| 961 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 962 |  |  |  |  |  |  | sub c_has_math_function | 
| 963 |  |  |  |  |  |  | { | 
| 964 | 1 |  |  | 1 | 0 | 2 | my ($ac_func) = @_ ; | 
| 965 |  |  |  |  |  |  |  | 
| 966 | 1 |  |  |  |  | 5 | my $code = <<_ACEOF ; | 
| 967 |  |  |  |  |  |  | #include | 
| 968 |  |  |  |  |  |  | float foo(float f) { return $ac_func (f); } | 
| 969 |  |  |  |  |  |  | int main (void) { return 0; } | 
| 970 |  |  |  |  |  |  | _ACEOF | 
| 971 |  |  |  |  |  |  |  | 
| 972 |  |  |  |  |  |  | #	c_try_link($msg, $code, $ok_val, $cflags, $exec_out_ref, $ld_flags) ; | 
| 973 | 1 |  |  |  |  | 11 | my $ac_has_function = c_try_link($ac_func, "checking for $ac_func", $code, $ac_func, '-Wall -Werror', undef, '-lm') ; | 
| 974 | 1 |  |  |  |  | 15 | return $ac_has_function ; | 
| 975 |  |  |  |  |  |  | } | 
| 976 |  |  |  |  |  |  |  | 
| 977 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 978 |  |  |  |  |  |  | sub c_replace_math_function | 
| 979 |  |  |  |  |  |  | { | 
| 980 | 1 |  |  | 1 | 0 | 4 | my ($ac_func) = @_ ; | 
| 981 |  |  |  |  |  |  |  | 
| 982 | 1 |  |  |  |  | 9 | my $code = <<_ACEOF ; | 
| 983 |  |  |  |  |  |  | #include | 
| 984 |  |  |  |  |  |  |  | 
| 985 |  |  |  |  |  |  | static inline long int $ac_func(float x) | 
| 986 |  |  |  |  |  |  | { | 
| 987 |  |  |  |  |  |  | return (int)(x); | 
| 988 |  |  |  |  |  |  | } | 
| 989 |  |  |  |  |  |  |  | 
| 990 |  |  |  |  |  |  | float foo(float f) { return $ac_func (f); } | 
| 991 |  |  |  |  |  |  | int main (void) { return 0; } | 
| 992 |  |  |  |  |  |  | _ACEOF | 
| 993 |  |  |  |  |  |  |  | 
| 994 |  |  |  |  |  |  | #	c_try_link($msg, $code, $ok_val, $cflags, $exec_out_ref, $ld_flags) ; | 
| 995 | 1 |  |  |  |  | 37 | my $ac_hasnt_function = c_try_link($ac_func, "", $code, $ac_func, '-Wall -Werror', undef, '-lm') ; | 
| 996 | 1 |  |  |  |  | 34 | return $ac_hasnt_function ; | 
| 997 |  |  |  |  |  |  | } | 
| 998 |  |  |  |  |  |  |  | 
| 999 |  |  |  |  |  |  |  | 
| 1000 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 1001 |  |  |  |  |  |  | sub c_struct_timeval | 
| 1002 |  |  |  |  |  |  | { | 
| 1003 | 1 |  |  | 1 | 0 | 8 | my $code = <<_ACEOF ; | 
| 1004 |  |  |  |  |  |  | #include | 
| 1005 |  |  |  |  |  |  | #include | 
| 1006 |  |  |  |  |  |  |  | 
| 1007 |  |  |  |  |  |  | typedef struct timeval ac__type_new_; | 
| 1008 |  |  |  |  |  |  | int | 
| 1009 |  |  |  |  |  |  | main () | 
| 1010 |  |  |  |  |  |  | { | 
| 1011 |  |  |  |  |  |  | if ((ac__type_new_ *) 0) | 
| 1012 |  |  |  |  |  |  | return 0; | 
| 1013 |  |  |  |  |  |  | if (sizeof (ac__type_new_)) | 
| 1014 |  |  |  |  |  |  | return 0; | 
| 1015 |  |  |  |  |  |  | ; | 
| 1016 |  |  |  |  |  |  | return 0; | 
| 1017 |  |  |  |  |  |  | } | 
| 1018 |  |  |  |  |  |  | _ACEOF | 
| 1019 |  |  |  |  |  |  |  | 
| 1020 | 1 |  |  |  |  | 11 | my $ac_struct_timeval = c_try('struct tmeval', "checking for struct timeval", $code, 1) ; | 
| 1021 | 1 |  |  |  |  | 21 | return $ac_struct_timeval ; | 
| 1022 |  |  |  |  |  |  | } | 
| 1023 |  |  |  |  |  |  |  | 
| 1024 |  |  |  |  |  |  |  | 
| 1025 |  |  |  |  |  |  |  | 
| 1026 |  |  |  |  |  |  |  | 
| 1027 |  |  |  |  |  |  |  | 
| 1028 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 1029 |  |  |  |  |  |  | sub check_new_version | 
| 1030 |  |  |  |  |  |  | { | 
| 1031 |  |  |  |  |  |  | #	my $version = ExtUtils::MM_Unix->parse_version("lib/$ModuleInfo{modpath}.pm"); | 
| 1032 |  |  |  |  |  |  |  | 
| 1033 | 0 |  |  | 0 | 0 | 0 | print "Installing Version: $ModuleInfo{version}\n" ; | 
| 1034 |  |  |  |  |  |  |  | 
| 1035 |  |  |  |  |  |  | ## Check for newer version | 
| 1036 | 0 |  |  |  |  | 0 | eval { | 
| 1037 | 0 |  |  |  |  | 0 | require LWP::UserAgent; | 
| 1038 |  |  |  |  |  |  | } ; | 
| 1039 | 0 | 0 |  |  |  | 0 | if (!$@) | 
| 1040 |  |  |  |  |  |  | { | 
| 1041 | 0 |  |  |  |  | 0 | print "Checking for later version...\n" ; | 
| 1042 |  |  |  |  |  |  |  | 
| 1043 |  |  |  |  |  |  | ## specify user name so that I can filter out my builds | 
| 1044 | 0 |  | 0 |  |  | 0 | my $user = $ENV{USER} || $ENV{USERNAME} || 'nobody' ; | 
| 1045 |  |  |  |  |  |  |  | 
| 1046 |  |  |  |  |  |  | # CPAN testers | 
| 1047 | 0 |  | 0 |  |  | 0 | my $cpan = $ENV{'PERL5_CPAN_IS_RUNNING'}||0 ; | 
| 1048 |  |  |  |  |  |  |  | 
| 1049 |  |  |  |  |  |  | ## check for OS-specific versions | 
| 1050 | 0 |  |  |  |  | 0 | my $os = $^O ; | 
| 1051 | 0 |  |  |  |  | 0 | my $url = "http://quartz.homelinux.com/CPAN/index.php?ver=$ModuleInfo{version}&mod=$ModuleInfo{name}&user=$user&os=$os&cpan=$cpan" ; | 
| 1052 |  |  |  |  |  |  |  | 
| 1053 | 0 |  |  |  |  | 0 | my $ua = LWP::UserAgent->new; | 
| 1054 | 0 |  |  |  |  | 0 | $ua->agent("CPAN-$ModuleInfo{name}/$ModuleInfo{version}") ; | 
| 1055 | 0 |  |  |  |  | 0 | $ua->timeout(10); | 
| 1056 | 0 |  |  |  |  | 0 | $ua->env_proxy; | 
| 1057 |  |  |  |  |  |  |  | 
| 1058 | 0 |  |  |  |  | 0 | my $response = $ua->get($url); | 
| 1059 | 0 | 0 |  |  |  | 0 | if ($response->is_success) | 
| 1060 |  |  |  |  |  |  | { | 
| 1061 | 0 |  |  |  |  | 0 | my $content = $response->content ; | 
| 1062 | 0 | 0 |  |  |  | 0 | if ($content =~ m/Current version : ([\d\.]+)/m) | 
| 1063 |  |  |  |  |  |  | { | 
| 1064 | 0 |  |  |  |  | 0 | print "Latest CPAN version is $1\n" ; | 
| 1065 |  |  |  |  |  |  | } | 
| 1066 | 0 | 0 |  |  |  | 0 | if ($content =~ m/Newer version/m) | 
| 1067 |  |  |  |  |  |  | { | 
| 1068 | 0 |  |  |  |  | 0 | print "** NOTE: A newer version than this is available. Please downloaded latest version **\n" ; | 
| 1069 |  |  |  |  |  |  | } | 
| 1070 |  |  |  |  |  |  | else | 
| 1071 |  |  |  |  |  |  | { | 
| 1072 | 0 |  |  |  |  | 0 | print "Got latest version\n" ; | 
| 1073 |  |  |  |  |  |  | } | 
| 1074 |  |  |  |  |  |  | } | 
| 1075 |  |  |  |  |  |  | else | 
| 1076 |  |  |  |  |  |  | { | 
| 1077 | 0 |  |  |  |  | 0 | print "Unable to connect, assuming latest\n" ; | 
| 1078 |  |  |  |  |  |  | #print $response->status_line; | 
| 1079 |  |  |  |  |  |  | } | 
| 1080 |  |  |  |  |  |  | } | 
| 1081 |  |  |  |  |  |  |  | 
| 1082 |  |  |  |  |  |  | } | 
| 1083 |  |  |  |  |  |  |  | 
| 1084 |  |  |  |  |  |  |  | 
| 1085 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 1086 |  |  |  |  |  |  | sub check_largefile | 
| 1087 |  |  |  |  |  |  | { | 
| 1088 | 1 |  |  | 1 | 0 | 7 | my $code = <<_ACEOF ; | 
| 1089 |  |  |  |  |  |  | #include | 
| 1090 |  |  |  |  |  |  |  | 
| 1091 |  |  |  |  |  |  | int | 
| 1092 |  |  |  |  |  |  | main () | 
| 1093 |  |  |  |  |  |  | { | 
| 1094 |  |  |  |  |  |  | off64_t i = 0 ; | 
| 1095 |  |  |  |  |  |  |  | 
| 1096 |  |  |  |  |  |  | return 0; | 
| 1097 |  |  |  |  |  |  | } | 
| 1098 |  |  |  |  |  |  | _ACEOF | 
| 1099 |  |  |  |  |  |  |  | 
| 1100 | 1 |  |  |  |  | 9 | $ModuleInfo{'config'}{'off64_t'} = "" ; | 
| 1101 | 1 |  |  |  |  | 11 | my $ac_off64_t = c_try('off64_t', "checking for off64_t support", $code, 1) ; | 
| 1102 | 1 | 50 |  |  |  | 25 | if (!$ac_off64_t) | 
| 1103 |  |  |  |  |  |  | { | 
| 1104 | 1 |  |  |  |  | 14 | $ModuleInfo{'config'}{'off64_t'} = "#define off64_t off_t" ; | 
| 1105 |  |  |  |  |  |  | } | 
| 1106 |  |  |  |  |  |  |  | 
| 1107 |  |  |  |  |  |  |  | 
| 1108 | 1 |  |  |  |  | 11 | $code = <<_ACEOF ; | 
| 1109 |  |  |  |  |  |  | #include | 
| 1110 |  |  |  |  |  |  | #include | 
| 1111 |  |  |  |  |  |  | #include | 
| 1112 |  |  |  |  |  |  |  | 
| 1113 |  |  |  |  |  |  | $ModuleInfo{'config'}{'off64_t'} | 
| 1114 |  |  |  |  |  |  |  | 
| 1115 |  |  |  |  |  |  | int | 
| 1116 |  |  |  |  |  |  | main () | 
| 1117 |  |  |  |  |  |  | { | 
| 1118 |  |  |  |  |  |  | int fd = open("tmp.txt", O_RDONLY) ; | 
| 1119 |  |  |  |  |  |  | off64_t size ; | 
| 1120 |  |  |  |  |  |  |  | 
| 1121 |  |  |  |  |  |  | size = lseek64(fd, -1, SEEK_END); | 
| 1122 |  |  |  |  |  |  | printf("size=%lld", (long long int)size) ; | 
| 1123 |  |  |  |  |  |  |  | 
| 1124 |  |  |  |  |  |  | return 0; | 
| 1125 |  |  |  |  |  |  | } | 
| 1126 |  |  |  |  |  |  | _ACEOF | 
| 1127 |  |  |  |  |  |  |  | 
| 1128 | 1 |  |  |  |  | 32 | $ModuleInfo{'config'}{'lseek64'} = "" ; | 
| 1129 |  |  |  |  |  |  |  | 
| 1130 |  |  |  |  |  |  | #	c_try_link($msg, $code, $ok_val, $cflags, $exec_out_ref, $ld_flags) ; | 
| 1131 | 1 |  |  |  |  | 9 | my $ac_lseek64 = c_try_link('lseek64', "checking for lseek64", $code, 1) ; | 
| 1132 | 1 | 50 |  |  |  | 57 | if (!$ac_lseek64) | 
| 1133 |  |  |  |  |  |  | { | 
| 1134 | 0 |  |  |  |  | 0 | $ModuleInfo{'config'}{'lseek64'} = "#define lseek64 lseek" ; | 
| 1135 |  |  |  |  |  |  | } | 
| 1136 |  |  |  |  |  |  |  | 
| 1137 |  |  |  |  |  |  | } | 
| 1138 |  |  |  |  |  |  |  | 
| 1139 |  |  |  |  |  |  |  | 
| 1140 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 1141 |  |  |  |  |  |  | sub have_h | 
| 1142 |  |  |  |  |  |  | { | 
| 1143 | 14 |  |  | 14 | 0 | 186 | my ($key, $header, $name, $val, $notval) = @_ ; | 
| 1144 |  |  |  |  |  |  |  | 
| 1145 | 14 | 50 |  |  |  | 68 | $val = "1" unless defined($val) ; | 
| 1146 | 14 | 50 |  |  |  | 43 | $notval = "" unless defined($notval) ; | 
| 1147 |  |  |  |  |  |  |  | 
| 1148 | 14 |  |  |  |  | 27 | my $def ; | 
| 1149 |  |  |  |  |  |  | #	if ($key && exists($Config{$key})) | 
| 1150 |  |  |  |  |  |  | #	{ | 
| 1151 |  |  |  |  |  |  | #		$def = $Config{$key} ; | 
| 1152 |  |  |  |  |  |  | #	} | 
| 1153 |  |  |  |  |  |  |  | 
| 1154 | 14 | 50 |  |  |  | 35 | if (!$def) | 
| 1155 |  |  |  |  |  |  | { | 
| 1156 | 14 |  |  |  |  | 51 | my $has = c_has_header($header) ; | 
| 1157 | 14 | 100 |  |  |  | 66 | if ($has) | 
| 1158 |  |  |  |  |  |  | { | 
| 1159 | 13 |  |  |  |  | 79 | $def = 'define' ; | 
| 1160 |  |  |  |  |  |  | } | 
| 1161 |  |  |  |  |  |  | } | 
| 1162 | 14 | 100 |  |  |  | 59 | if (!$def) | 
| 1163 |  |  |  |  |  |  | { | 
| 1164 | 1 |  |  |  |  | 19 | $def = 'undef' ; | 
| 1165 |  |  |  |  |  |  | } | 
| 1166 |  |  |  |  |  |  |  | 
| 1167 | 14 | 100 |  |  |  | 151 | my $str = "#$def $name " . ($def eq 'define' ? $val : $notval) ; | 
| 1168 | 14 |  |  |  |  | 295 | $ModuleInfo{'config'}{$name} = $str ; | 
| 1169 |  |  |  |  |  |  |  | 
| 1170 | 14 |  |  |  |  | 242 | return $str ; | 
| 1171 |  |  |  |  |  |  | } | 
| 1172 |  |  |  |  |  |  |  | 
| 1173 |  |  |  |  |  |  |  | 
| 1174 |  |  |  |  |  |  |  | 
| 1175 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 1176 |  |  |  |  |  |  | sub have_d | 
| 1177 |  |  |  |  |  |  | { | 
| 1178 | 1 |  |  | 1 | 0 | 9 | my ($key, $name, $val, $notval) = @_ ; | 
| 1179 |  |  |  |  |  |  |  | 
| 1180 | 1 | 50 |  |  |  | 19 | $val = "1" unless defined($val) ; | 
| 1181 | 1 | 50 |  |  |  | 11 | $notval = "" unless defined($notval) ; | 
| 1182 |  |  |  |  |  |  |  | 
| 1183 | 1 |  | 50 |  |  | 61 | my $def = $Config{$key} || 'undef' ; | 
| 1184 | 1 | 50 |  |  |  | 13 | my $str = "#$def $name " . ($def eq 'define' ? $val : $notval) ; | 
| 1185 | 1 |  |  |  |  | 10 | $ModuleInfo{'config'}{$name} = $str ; | 
| 1186 |  |  |  |  |  |  |  | 
| 1187 | 1 |  |  |  |  | 3 | return $str ; | 
| 1188 |  |  |  |  |  |  | } | 
| 1189 |  |  |  |  |  |  |  | 
| 1190 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 1191 |  |  |  |  |  |  | # Define if not available - otherwise don't define | 
| 1192 |  |  |  |  |  |  | sub havent_d | 
| 1193 |  |  |  |  |  |  | { | 
| 1194 | 2 |  |  | 2 | 0 | 8 | my ($key, $name, $val) = @_ ; | 
| 1195 |  |  |  |  |  |  |  | 
| 1196 | 2 | 50 |  |  |  | 101 | $val = "" unless defined($val) ; | 
| 1197 |  |  |  |  |  |  |  | 
| 1198 | 2 |  |  |  |  | 3 | my $str ; | 
| 1199 | 2 | 50 |  |  |  | 26 | if ($Config{$key} eq 'define') | 
| 1200 |  |  |  |  |  |  | { | 
| 1201 | 2 |  |  |  |  | 6 | $str = "/* #define $name $val */" | 
| 1202 |  |  |  |  |  |  | } | 
| 1203 |  |  |  |  |  |  | else | 
| 1204 |  |  |  |  |  |  | { | 
| 1205 | 0 |  |  |  |  | 0 | $str = "#define $name $val" | 
| 1206 |  |  |  |  |  |  | } | 
| 1207 | 2 |  |  |  |  | 14 | $ModuleInfo{'config'}{$name} = $str ; | 
| 1208 |  |  |  |  |  |  |  | 
| 1209 | 2 |  |  |  |  | 4 | return $str ; | 
| 1210 |  |  |  |  |  |  | } | 
| 1211 |  |  |  |  |  |  |  | 
| 1212 |  |  |  |  |  |  |  | 
| 1213 |  |  |  |  |  |  |  | 
| 1214 |  |  |  |  |  |  |  | 
| 1215 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 1216 |  |  |  |  |  |  | sub have_func | 
| 1217 |  |  |  |  |  |  | { | 
| 1218 | 2 |  |  | 2 | 0 | 10 | my ($key, $func, $name, $val, $notval) = @_ ; | 
| 1219 |  |  |  |  |  |  |  | 
| 1220 | 2 | 50 |  |  |  | 8 | $val = "1" unless defined($val) ; | 
| 1221 | 2 | 50 |  |  |  | 6 | $notval = "" unless defined($notval) ; | 
| 1222 |  |  |  |  |  |  |  | 
| 1223 | 2 |  |  |  |  | 2 | my $def ; | 
| 1224 |  |  |  |  |  |  | #	if ($key && exists($Config{$key})) | 
| 1225 |  |  |  |  |  |  | #	{ | 
| 1226 |  |  |  |  |  |  | #		$def = $Config{$key} ; | 
| 1227 |  |  |  |  |  |  | #	} | 
| 1228 |  |  |  |  |  |  |  | 
| 1229 | 2 | 50 |  |  |  | 6 | if (!$def) | 
| 1230 |  |  |  |  |  |  | { | 
| 1231 | 2 |  |  |  |  | 6 | my $has = c_has_function($func) ; | 
| 1232 | 2 | 50 |  |  |  | 6 | if ($has) | 
| 1233 |  |  |  |  |  |  | { | 
| 1234 | 2 |  |  |  |  | 10 | $def = 'define' ; | 
| 1235 |  |  |  |  |  |  | } | 
| 1236 |  |  |  |  |  |  | } | 
| 1237 | 2 | 50 |  |  |  | 4 | if (!$def) | 
| 1238 |  |  |  |  |  |  | { | 
| 1239 | 0 |  |  |  |  | 0 | $def = 'undef' ; | 
| 1240 |  |  |  |  |  |  | } | 
| 1241 |  |  |  |  |  |  |  | 
| 1242 | 2 | 50 |  |  |  | 17 | my $str = "#$def $name " . ($def eq 'define' ? $val : $notval) ; | 
| 1243 | 2 |  |  |  |  | 15 | $ModuleInfo{'config'}{$name} = $str ; | 
| 1244 |  |  |  |  |  |  |  | 
| 1245 | 2 |  |  |  |  | 25 | return $str ; | 
| 1246 |  |  |  |  |  |  | } | 
| 1247 |  |  |  |  |  |  |  | 
| 1248 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 1249 |  |  |  |  |  |  | sub have_mathfunc | 
| 1250 |  |  |  |  |  |  | { | 
| 1251 | 1 |  |  | 1 | 0 | 11 | my ($key, $func, $name, $val, $notval) = @_ ; | 
| 1252 |  |  |  |  |  |  |  | 
| 1253 | 1 | 50 |  |  |  | 19 | $val = "1" unless defined($val) ; | 
| 1254 | 1 | 50 |  |  |  | 8 | $notval = "" unless defined($notval) ; | 
| 1255 |  |  |  |  |  |  |  | 
| 1256 | 1 |  |  |  |  | 4 | my $def ; | 
| 1257 | 1 | 50 |  |  |  | 9 | if (!$def) | 
| 1258 |  |  |  |  |  |  | { | 
| 1259 | 1 |  |  |  |  | 4 | my $has = c_has_math_function($func) ; | 
| 1260 | 1 | 50 |  |  |  | 14 | if ($has) | 
| 1261 |  |  |  |  |  |  | { | 
| 1262 | 0 |  |  |  |  | 0 | $def = 'define' ; | 
| 1263 |  |  |  |  |  |  | } | 
| 1264 |  |  |  |  |  |  | else | 
| 1265 |  |  |  |  |  |  | { | 
| 1266 |  |  |  |  |  |  | # extra check to ensure it's not a false negative(?) | 
| 1267 | 1 |  |  |  |  | 18 | my $hasnt = c_replace_math_function($func) ; | 
| 1268 | 1 | 50 |  |  |  | 17 | if (!$hasnt) | 
| 1269 |  |  |  |  |  |  | { | 
| 1270 |  |  |  |  |  |  | # Failed, so we have really got it? | 
| 1271 | 1 |  |  |  |  | 11 | $def = 'define' ; | 
| 1272 | 1 |  |  |  |  | 22 | $ModuleInfo{'COMMENTS'}{$name} = 'failed check of replacement' ; | 
| 1273 |  |  |  |  |  |  | } | 
| 1274 |  |  |  |  |  |  | } | 
| 1275 |  |  |  |  |  |  | } | 
| 1276 | 1 | 50 |  |  |  | 11 | if (!$def) | 
| 1277 |  |  |  |  |  |  | { | 
| 1278 | 0 |  |  |  |  | 0 | $def = 'undef' ; | 
| 1279 |  |  |  |  |  |  | } | 
| 1280 |  |  |  |  |  |  |  | 
| 1281 | 1 | 50 |  |  |  | 32 | my $str = "#$def $name " . ($def eq 'define' ? $val : $notval) ; | 
| 1282 | 1 |  |  |  |  | 10 | $ModuleInfo{'config'}{$name} = $str ; | 
| 1283 |  |  |  |  |  |  |  | 
| 1284 | 1 |  |  |  |  | 18 | return $str ; | 
| 1285 |  |  |  |  |  |  | } | 
| 1286 |  |  |  |  |  |  |  | 
| 1287 |  |  |  |  |  |  |  | 
| 1288 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 1289 |  |  |  |  |  |  | sub _chk_arch_name | 
| 1290 |  |  |  |  |  |  | { | 
| 1291 | 1 |  |  | 1 |  | 2 | my ($arch_name) = @_ ; | 
| 1292 |  |  |  |  |  |  |  | 
| 1293 | 1 |  |  |  |  | 3 | my $arch = "" ; | 
| 1294 |  |  |  |  |  |  |  | 
| 1295 | 1 | 50 |  |  |  | 32 | if ($arch_name =~ /ppc\-.*|powerpc\-.*/i) | 
|  |  | 50 |  |  |  |  |  | 
|  |  | 50 |  |  |  |  |  | 
|  |  | 50 |  |  |  |  |  | 
|  |  | 50 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
| 1296 |  |  |  |  |  |  | { | 
| 1297 | 0 |  |  |  |  | 0 | $arch = "ARCH_PPC" ; | 
| 1298 |  |  |  |  |  |  |  | 
| 1299 |  |  |  |  |  |  | # altivec? | 
| 1300 |  |  |  |  |  |  | } | 
| 1301 |  |  |  |  |  |  | elsif ($arch_name =~ /sparc\-*|sparc64\-.*/i) | 
| 1302 |  |  |  |  |  |  | { | 
| 1303 | 0 |  |  |  |  | 0 | $arch = "ARCH_SPARC" ; | 
| 1304 |  |  |  |  |  |  | } | 
| 1305 |  |  |  |  |  |  | elsif ($arch_name =~ /alpha.*/i) | 
| 1306 |  |  |  |  |  |  | { | 
| 1307 | 0 |  |  |  |  | 0 | $arch = "ARCH_ALPHA" ; | 
| 1308 |  |  |  |  |  |  | } | 
| 1309 |  |  |  |  |  |  | elsif ($arch_name =~ /arm.*/i) | 
| 1310 |  |  |  |  |  |  | { | 
| 1311 | 0 |  |  |  |  | 0 | $arch = "ARCH_ARM" ; | 
| 1312 |  |  |  |  |  |  | } | 
| 1313 |  |  |  |  |  |  | elsif ($arch_name =~ /i.86\-.*|k.\-.*|x86_64\-.*|x86\-.*|amd64\-.*|x86/i) | 
| 1314 |  |  |  |  |  |  | { | 
| 1315 | 1 |  |  |  |  | 2 | $arch = "ARCH_X86" ; | 
| 1316 |  |  |  |  |  |  | } | 
| 1317 |  |  |  |  |  |  |  | 
| 1318 |  |  |  |  |  |  | # keep trying with slightly relaxed regexps | 
| 1319 |  |  |  |  |  |  | elsif ($arch_name =~ /ppc.*|powerpc.*/i) | 
| 1320 |  |  |  |  |  |  | { | 
| 1321 | 0 |  |  |  |  | 0 | $arch = "ARCH_PPC" ; | 
| 1322 |  |  |  |  |  |  |  | 
| 1323 |  |  |  |  |  |  | # altivec? | 
| 1324 |  |  |  |  |  |  | } | 
| 1325 |  |  |  |  |  |  | elsif ($arch_name =~ /sparc*|sparc64.*/i) | 
| 1326 |  |  |  |  |  |  | { | 
| 1327 | 0 |  |  |  |  | 0 | $arch = "ARCH_SPARC" ; | 
| 1328 |  |  |  |  |  |  | } | 
| 1329 |  |  |  |  |  |  | elsif ($arch_name =~ /i.86.*|x86_64.*|x86.*|amd64.*|x86/i) | 
| 1330 |  |  |  |  |  |  | { | 
| 1331 | 0 |  |  |  |  | 0 | $arch = "ARCH_X86" ; | 
| 1332 |  |  |  |  |  |  | } | 
| 1333 |  |  |  |  |  |  |  | 
| 1334 | 1 |  |  |  |  | 3 | return $arch ; | 
| 1335 |  |  |  |  |  |  | } | 
| 1336 |  |  |  |  |  |  |  | 
| 1337 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 1338 |  |  |  |  |  |  | sub arch_name | 
| 1339 |  |  |  |  |  |  | { | 
| 1340 | 1 |  |  | 1 | 0 | 4 | my $arch = "" ; | 
| 1341 | 1 |  |  |  |  | 5 | $ModuleInfo{'COMMENTS'}{'ARCH'} = "" ; | 
| 1342 |  |  |  |  |  |  |  | 
| 1343 |  |  |  |  |  |  | ## use %Config first | 
| 1344 | 1 |  |  |  |  | 18 | my $arch_name = $Config{'archname'} ; | 
| 1345 | 1 |  |  |  |  | 6 | $arch = _chk_arch_name($arch_name) ; | 
| 1346 | 1 |  |  |  |  | 5 | $ModuleInfo{'COMMENTS'}{'ARCH'} = "archname = $arch_name" ; | 
| 1347 |  |  |  |  |  |  |  | 
| 1348 | 1 | 50 |  |  |  | 5 | if (!$arch) | 
| 1349 |  |  |  |  |  |  | { | 
| 1350 |  |  |  |  |  |  | ## Failed, so attempt to run uname | 
| 1351 | 0 | 0 |  |  |  | 0 | if ($^O ne 'MSWin32') | 
| 1352 |  |  |  |  |  |  | { | 
| 1353 | 0 |  |  |  |  | 0 | $arch_name = `uname -a` ; | 
| 1354 | 0 |  |  |  |  | 0 | chomp $arch_name ; | 
| 1355 | 0 |  |  |  |  | 0 | $arch = _chk_arch_name($arch_name) ; | 
| 1356 | 0 |  |  |  |  | 0 | $ModuleInfo{'COMMENTS'}{'ARCH'} = "uname = $arch_name" ; | 
| 1357 |  |  |  |  |  |  | } | 
| 1358 |  |  |  |  |  |  | } | 
| 1359 |  |  |  |  |  |  |  | 
| 1360 |  |  |  |  |  |  | ## Catch-all if everything else has failed... | 
| 1361 | 1 | 50 |  |  |  | 4 | if (!$arch) | 
| 1362 |  |  |  |  |  |  | { | 
| 1363 | 0 |  |  |  |  | 0 | $arch = "ARCH_X86" ; | 
| 1364 | 0 |  | 0 |  |  | 0 | $ModuleInfo{'COMMENTS'}{'ARCH'} ||= "Unable to determine" ; | 
| 1365 |  |  |  |  |  |  | } | 
| 1366 |  |  |  |  |  |  |  | 
| 1367 | 1 |  |  |  |  | 3 | $ModuleInfo{'config'}{'ARCH'} = $arch ; | 
| 1368 |  |  |  |  |  |  |  | 
| 1369 | 1 |  |  |  |  | 2 | return $arch ; | 
| 1370 |  |  |  |  |  |  | } | 
| 1371 |  |  |  |  |  |  |  | 
| 1372 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 1373 |  |  |  |  |  |  | sub get_align | 
| 1374 |  |  |  |  |  |  | { | 
| 1375 | 1 |  |  | 1 | 0 | 11 | $ModuleInfo{'config'}{'ALIGN_BYTES'} = $Config{'alignbytes'} * 8 ; | 
| 1376 |  |  |  |  |  |  | } | 
| 1377 |  |  |  |  |  |  |  | 
| 1378 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 1379 |  |  |  |  |  |  | sub get_size_t | 
| 1380 |  |  |  |  |  |  | { | 
| 1381 | 1 | 50 |  | 1 | 0 | 21 | $ModuleInfo{'config'}{'size_t'} = $Config{'sizetype'} eq 'size_t' ? "" : "#define size_t unsigned int" ; | 
| 1382 |  |  |  |  |  |  | } | 
| 1383 |  |  |  |  |  |  |  | 
| 1384 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 1385 |  |  |  |  |  |  | sub get_endian | 
| 1386 |  |  |  |  |  |  | { | 
| 1387 | 1 |  |  | 1 | 0 | 5 | my $ENDIAN = " | 
| 1388 |  |  |  |  |  |  | #undef WORDS_BIGENDIAN | 
| 1389 |  |  |  |  |  |  | #undef SHORT_BIGENDIAN | 
| 1390 |  |  |  |  |  |  | #undef WORDS_LITTLEENDIAN | 
| 1391 |  |  |  |  |  |  | #undef SHORT_LITTLEENDIAN | 
| 1392 |  |  |  |  |  |  | " ; | 
| 1393 | 1 | 50 |  |  |  | 23 | if ($Config{'byteorder'} =~ /^1/) | 
| 1394 |  |  |  |  |  |  | { | 
| 1395 |  |  |  |  |  |  | # little | 
| 1396 | 1 | 50 |  |  |  | 24 | if ($Config{'byteorder'} eq '12345678') | 
| 1397 |  |  |  |  |  |  | { | 
| 1398 |  |  |  |  |  |  | # words | 
| 1399 | 1 |  |  |  |  | 5 | $ENDIAN = " | 
| 1400 |  |  |  |  |  |  | #undef WORDS_BIGENDIAN | 
| 1401 |  |  |  |  |  |  | #undef SHORT_BIGENDIAN | 
| 1402 |  |  |  |  |  |  | #define WORDS_LITTLEENDIAN	1 | 
| 1403 |  |  |  |  |  |  | #undef SHORT_LITTLEENDIAN | 
| 1404 |  |  |  |  |  |  | " ; | 
| 1405 |  |  |  |  |  |  | } | 
| 1406 |  |  |  |  |  |  | else | 
| 1407 |  |  |  |  |  |  | { | 
| 1408 | 0 |  |  |  |  | 0 | $ENDIAN = " | 
| 1409 |  |  |  |  |  |  | #undef WORDS_BIGENDIAN | 
| 1410 |  |  |  |  |  |  | #undef SHORT_BIGENDIAN | 
| 1411 |  |  |  |  |  |  | #undef WORDS_LITTLEENDIAN | 
| 1412 |  |  |  |  |  |  | #define SHORT_LITTLEENDIAN	1 | 
| 1413 |  |  |  |  |  |  | " ; | 
| 1414 |  |  |  |  |  |  | } | 
| 1415 |  |  |  |  |  |  | } | 
| 1416 |  |  |  |  |  |  | else | 
| 1417 |  |  |  |  |  |  | { | 
| 1418 |  |  |  |  |  |  | # big | 
| 1419 | 0 | 0 |  |  |  | 0 | if ($Config{'byteorder'} eq '87654321') | 
| 1420 |  |  |  |  |  |  | { | 
| 1421 |  |  |  |  |  |  | # words | 
| 1422 | 0 |  |  |  |  | 0 | $ENDIAN = " | 
| 1423 |  |  |  |  |  |  | #define WORDS_BIGENDIAN	1 | 
| 1424 |  |  |  |  |  |  | #undef SHORT_BIGENDIAN | 
| 1425 |  |  |  |  |  |  | #undef WORDS_LITTLEENDIAN | 
| 1426 |  |  |  |  |  |  | #undef SHORT_LITTLEENDIAN | 
| 1427 |  |  |  |  |  |  | " ; | 
| 1428 |  |  |  |  |  |  | } | 
| 1429 |  |  |  |  |  |  | else | 
| 1430 |  |  |  |  |  |  | { | 
| 1431 | 0 |  |  |  |  | 0 | $ENDIAN = " | 
| 1432 |  |  |  |  |  |  | #undef WORDS_BIGENDIAN | 
| 1433 |  |  |  |  |  |  | #define SHORT_BIGENDIAN	1 | 
| 1434 |  |  |  |  |  |  | #undef WORDS_LITTLEENDIAN | 
| 1435 |  |  |  |  |  |  | #undef SHORT_LITTLEENDIAN | 
| 1436 |  |  |  |  |  |  | " ; | 
| 1437 |  |  |  |  |  |  | } | 
| 1438 |  |  |  |  |  |  | } | 
| 1439 | 1 |  |  |  |  | 5 | $ModuleInfo{'config'}{'ENDIAN'} = $ENDIAN ; | 
| 1440 |  |  |  |  |  |  | } | 
| 1441 |  |  |  |  |  |  |  | 
| 1442 |  |  |  |  |  |  |  | 
| 1443 |  |  |  |  |  |  | ##------------------------------------------------------------------------------------------- | 
| 1444 |  |  |  |  |  |  | sub get_config | 
| 1445 |  |  |  |  |  |  | { | 
| 1446 | 1 |  |  | 1 | 0 | 7 | $ModuleInfo{'config'} = {} ; | 
| 1447 |  |  |  |  |  |  |  | 
| 1448 |  |  |  |  |  |  | # Arch | 
| 1449 | 1 |  |  |  |  | 4 | arch_name() ; | 
| 1450 |  |  |  |  |  |  |  | 
| 1451 |  |  |  |  |  |  | # OS | 
| 1452 | 1 |  |  |  |  | 5 | $ModuleInfo{'config'}{'OS'} = uc("OS_" . $^O) ; | 
| 1453 |  |  |  |  |  |  |  | 
| 1454 |  |  |  |  |  |  | # Alignment | 
| 1455 | 1 |  |  |  |  | 3 | get_align() ; | 
| 1456 |  |  |  |  |  |  |  | 
| 1457 |  |  |  |  |  |  | # Have ... | 
| 1458 | 1 |  |  |  |  | 7 | have_func('d_ftime', 'ftime', 'HAVE_FTIME') ; | 
| 1459 | 1 |  |  |  |  | 11 | have_func('d_gettimeod', 'gettimeofday', 'HAVE_GETTIMEOFDAY') ; | 
| 1460 | 1 |  |  |  |  | 15 | have_mathfunc('', 'lrintf', 'HAVE_LRINTF') ; | 
| 1461 |  |  |  |  |  |  |  | 
| 1462 | 1 |  |  |  |  | 15 | have_h('i_inttypes', 'inttypes.h', 'HAVE_INTTYPES_H') ; | 
| 1463 | 1 |  |  |  |  | 11 | have_h('', 'io.h', 'HAVE_IO_H') ; | 
| 1464 | 1 |  |  |  |  | 14 | have_h('i_memory', 'memory.h', 'HAVE_MEMORY_H') ; | 
| 1465 | 1 |  |  |  |  | 23 | have_h('', 'stdint.h', 'HAVE_STDINT_H') ; | 
| 1466 | 1 |  |  |  |  | 18 | have_h('i_stdlib', 'stdlib.h', 'HAVE_STDLIB_H') ; | 
| 1467 | 1 |  |  |  |  | 19 | have_h('', 'strings.h', 'HAVE_STRINGS_H') ; | 
| 1468 | 1 |  |  |  |  | 18 | have_h('i_string', 'string.h', 'HAVE_STRING_H') ; | 
| 1469 | 1 |  |  |  |  | 21 | have_h('i_sysstat', 'sys/stat.h', 'HAVE_SYS_STAT_H') ; | 
| 1470 | 1 |  |  |  |  | 26 | have_h('', 'sys/timeb.h', 'HAVE_SYS_TIMEB_H') ; | 
| 1471 | 1 |  |  |  |  | 14 | have_h('i_systime', 'sys/time.h', 'HAVE_SYS_TIME_H') ; | 
| 1472 | 1 |  |  |  |  | 21 | have_h('i_systypes', 'sys/types.h', 'HAVE_SYS_TYPES_H') ; | 
| 1473 | 1 |  |  |  |  | 22 | have_h('i_time', 'time.h', 'HAVE_TIME_H') ; | 
| 1474 | 1 |  |  |  |  | 19 | have_h('i_unistd', 'unistd.h', 'HAVE_UNISTD_H') ; | 
| 1475 | 1 |  |  |  |  | 26 | have_h('', 'getopt.h', 'HAVE_GETOPT_H') ; | 
| 1476 |  |  |  |  |  |  |  | 
| 1477 |  |  |  |  |  |  |  | 
| 1478 |  |  |  |  |  |  | # TODO: convert to live checks.... | 
| 1479 | 1 |  |  |  |  | 20 | have_d('uselargefiles', '_LARGE_FILES') ; | 
| 1480 | 1 |  |  |  |  | 10 | havent_d('d_const', 'const') ; | 
| 1481 | 1 |  |  |  |  | 6 | get_size_t() ; | 
| 1482 | 1 |  |  |  |  | 4 | havent_d('d_volatile', 'volatile') ; | 
| 1483 |  |  |  |  |  |  |  | 
| 1484 |  |  |  |  |  |  | # Endian | 
| 1485 | 1 |  |  |  |  | 6 | get_endian() ; | 
| 1486 |  |  |  |  |  |  |  | 
| 1487 |  |  |  |  |  |  | # inline ? | 
| 1488 | 1 |  |  |  |  | 6 | my $ac_c_inline = c_inline() ; | 
| 1489 | 1 |  |  |  |  | 15 | my $ac_c_always_inline = c_always_inline($ac_c_inline) ; | 
| 1490 | 1 |  | 50 |  |  | 23 | my $inline = $ac_c_always_inline || $ac_c_inline || "" ; | 
| 1491 | 1 | 50 |  |  |  | 5 | if ($inline eq 'inline') | 
| 1492 |  |  |  |  |  |  | { | 
| 1493 | 1 |  |  |  |  | 12 | $ModuleInfo{'config'}{'inline'} = "" ; | 
| 1494 |  |  |  |  |  |  | } | 
| 1495 |  |  |  |  |  |  | else | 
| 1496 |  |  |  |  |  |  | { | 
| 1497 | 0 |  |  |  |  | 0 | $ModuleInfo{'config'}{'inline'} = "#define inline $inline" ; | 
| 1498 |  |  |  |  |  |  | } | 
| 1499 |  |  |  |  |  |  |  | 
| 1500 |  |  |  |  |  |  | # restrict ? | 
| 1501 | 1 |  |  |  |  | 9 | $ModuleInfo{'config'}{'restrict'} = c_restrict() ; | 
| 1502 |  |  |  |  |  |  |  | 
| 1503 |  |  |  |  |  |  |  | 
| 1504 |  |  |  |  |  |  | # timeval | 
| 1505 | 1 |  |  |  |  | 21 | my $ac_struct_timeval = c_struct_timeval() ; | 
| 1506 | 1 | 50 |  |  |  | 20 | $ModuleInfo{'config'}{'HAVE_STRUCT_TIMEVAL'} = $ac_struct_timeval ? "#define HAVE_STRUCT_TIMEVAL 1" : "#undef HAVE_STRUCT_TIMEVAL" ; | 
| 1507 |  |  |  |  |  |  |  | 
| 1508 |  |  |  |  |  |  | # signal_t | 
| 1509 | 1 | 50 |  |  |  | 56 | $ModuleInfo{'config'}{'RETSIGTYPE'} = $Config{'signal_t'} ? "#define RETSIGTYPE $Config{'signal_t'}" : "#define RETSIGTYPE void" ; | 
| 1510 |  |  |  |  |  |  |  | 
| 1511 |  |  |  |  |  |  | # Builtin... | 
| 1512 | 1 |  |  |  |  | 13 | $ModuleInfo{'config'}{'HAVE_BUILTIN_EXPECT'} = have_builtin_expect() ; | 
| 1513 |  |  |  |  |  |  |  | 
| 1514 |  |  |  |  |  |  | # Large file support | 
| 1515 | 1 |  |  |  |  | 17 | check_largefile() ; | 
| 1516 |  |  |  |  |  |  |  | 
| 1517 | 1 |  |  |  |  | 8 | return %{$ModuleInfo{'config'}} ; | 
|  | 1 |  |  |  |  | 27 |  | 
| 1518 |  |  |  |  |  |  | } | 
| 1519 |  |  |  |  |  |  |  | 
| 1520 |  |  |  |  |  |  | #----------------------------------------------------------------------------------------------------------------------- | 
| 1521 |  |  |  |  |  |  | sub get_makemakerdflt | 
| 1522 |  |  |  |  |  |  | { | 
| 1523 | 0 |  |  | 0 | 0 |  | my $make =< | 
| 1524 |  |  |  |  |  |  |  | 
| 1525 |  |  |  |  |  |  | ## Show config | 
| 1526 |  |  |  |  |  |  | makemakerdflt : showconfig all | 
| 1527 |  |  |  |  |  |  | \$(NOECHO) \$(NOOP) | 
| 1528 |  |  |  |  |  |  |  | 
| 1529 |  |  |  |  |  |  | showconfig : FORCE | 
| 1530 |  |  |  |  |  |  | \$(NOECHO) \$(ECHO) "==================================================================" | 
| 1531 |  |  |  |  |  |  | \$(NOECHO) \$(ECHO) "== CONFIG                                                       ==" | 
| 1532 |  |  |  |  |  |  | \$(NOECHO) \$(ECHO) "==================================================================" | 
| 1533 |  |  |  |  |  |  | \$(NOECHO) \$(ECHO) "(Makeutils.pm version $VERSION)" | 
| 1534 |  |  |  |  |  |  | MAKEMAKERDFLT | 
| 1535 |  |  |  |  |  |  |  | 
| 1536 | 0 |  |  |  |  |  | foreach my $var (sort keys %{$ModuleInfo{'config'}}) | 
|  | 0 |  |  |  |  |  |  | 
| 1537 |  |  |  |  |  |  | { | 
| 1538 | 0 |  |  |  |  |  | my $padded = sprintf "%-24s", "$var:" ; | 
| 1539 | 0 |  |  |  |  |  | my $val = $ModuleInfo{'config'}{$var} ; | 
| 1540 |  |  |  |  |  |  |  | 
| 1541 |  |  |  |  |  |  | ## Special cases | 
| 1542 |  |  |  |  |  |  |  | 
| 1543 |  |  |  |  |  |  | # ENDIAN is multi-line | 
| 1544 | 0 | 0 |  |  |  |  | if ($var eq 'ENDIAN') | 
| 1545 |  |  |  |  |  |  | { | 
| 1546 | 0 | 0 |  |  |  |  | if ($val =~ m/#define (\w+)/) | 
| 1547 |  |  |  |  |  |  | { | 
| 1548 | 0 |  |  |  |  |  | $val = "#define $1 1" ; | 
| 1549 |  |  |  |  |  |  | } | 
| 1550 |  |  |  |  |  |  | else | 
| 1551 |  |  |  |  |  |  | { | 
| 1552 | 0 |  |  |  |  |  | $val = "" ; | 
| 1553 |  |  |  |  |  |  | } | 
| 1554 |  |  |  |  |  |  | } | 
| 1555 |  |  |  |  |  |  |  | 
| 1556 |  |  |  |  |  |  | # Check for comment | 
| 1557 |  |  |  |  |  |  | #		if (exists($ModuleInfo{'COMMENTS'}{$var})) | 
| 1558 |  |  |  |  |  |  | #		{ | 
| 1559 |  |  |  |  |  |  | #			$val .= "  ($ModuleInfo{'COMMENTS'}{$var})" ; | 
| 1560 |  |  |  |  |  |  | #		} | 
| 1561 | 0 |  |  |  |  |  | $make .= "\t\$(NOECHO) \$(ECHO) \"$padded $val\"\n" ; | 
| 1562 |  |  |  |  |  |  | } | 
| 1563 | 0 |  |  |  |  |  | $make .= "\t\$(NOECHO) \$(ECHO) \"==================================================================\"\n" ; | 
| 1564 | 0 |  |  |  |  |  | $make .= "\t\$(NOECHO) \$(ECHO) \"==\" \n" ; | 
| 1565 |  |  |  |  |  |  |  | 
| 1566 | 0 |  |  |  |  |  | return $make ; | 
| 1567 |  |  |  |  |  |  | } | 
| 1568 |  |  |  |  |  |  |  | 
| 1569 |  |  |  |  |  |  |  | 
| 1570 |  |  |  |  |  |  |  | 
| 1571 |  |  |  |  |  |  |  | 
| 1572 |  |  |  |  |  |  | # ============================================================================================ | 
| 1573 |  |  |  |  |  |  | # END OF PACKAGE | 
| 1574 |  |  |  |  |  |  |  | 
| 1575 |  |  |  |  |  |  |  | 
| 1576 |  |  |  |  |  |  | 1; | 
| 1577 |  |  |  |  |  |  |  | 
| 1578 |  |  |  |  |  |  | __END__ |