From: Pavel Roskin Date: Tue, 12 Dec 2000 12:45:41 +0000 (+0000) Subject: * autoscan.pl (init_tables): Allow spaces on the right hand side X-Git-Tag: autoconf-2.50~326 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7173ba3da5e0852751a1f9279783bcdfbb5bcdfa;p=thirdparty%2Fautoconf.git * autoscan.pl (init_tables): Allow spaces on the right hand side in autoscan tables. Die if there are no spaces at all. (scan_c_file): Use b instead of W so that keywords match at the beginning and the end of the line. (scan_sh_file): Likewise. (scan_makefile): Likewise. Use B to match before `-l'. (output): Suggest AC_CONFIG_HEADER if any C/C++ sources are found. * acidentifiers: Update macros for structure members st_blksize and st_rdev. --- diff --git a/ChangeLog b/ChangeLog index 2aa16a82c..4e67e02f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2000-12-12 Pavel Roskin + + * autoscan.pl (init_tables): Allow spaces on the right hand side + in autoscan tables. Die if there are no spaces at all. + (scan_c_file): Use \b instead of \W so that keywords match at + the beginning and the end of the line. + (scan_sh_file): Likewise. + (scan_makefile): Likewise. Use \B to match before `-l'. + (output): Suggest AC_CONFIG_HEADER if any C/C++ sources are + found. + * acidentifiers: Update macros for structure members st_blksize + and st_rdev. + 2000-12-12 Akim Demaille * tests/compile.at (GNU Fortran 77): Be robust to compilers that diff --git a/acidentifiers b/acidentifiers index e4ae03b05..ebf620088 100644 --- a/acidentifiers +++ b/acidentifiers @@ -29,7 +29,7 @@ S_ISREG AC_HEADER_STAT S_ISSOCK AC_HEADER_STAT # Members of structures. -st_blksize AC_STRUCT_ST_BLKSIZE +st_blksize AC_CHECK_MEMBERS([struct stat.st_blksize]) st_blocks AC_STRUCT_ST_BLOCKS -st_rdev AC_STRUCT_ST_RDEV +st_rdev AC_CHECK_MEMBERS([struct stat.st_rdev]) tm_zone AC_STRUCT_TIMEZONE diff --git a/autoscan.in b/autoscan.in index baf301c02..d7d6a36ee 100644 --- a/autoscan.in +++ b/autoscan.in @@ -125,7 +125,10 @@ sub init_tables die "$me: cannot open $datadir/ac$kind: $!\n"; while () { next if /^\s*$/ || /^\s*#/; # Ignore blank lines and comments. - ($word, $macro) = split; + unless (/^(\S+)\s+(\S.*)$/) { + die "$me: cannot parse definition in $datadir/ac$kind:\n$_\n"; + } + ($word, $macro) = ($1, $2); eval "\$$kind" . "_macros{\$word} = \$macro"; } close(TABLE); @@ -210,10 +213,10 @@ sub scan_c_file # Tokens in the code. # Maybe we should ignore function definitions (in column 0)? - while (s/\W([a-zA-Z_]\w*)\s*\(/ /) { + while (s/\b([a-zA-Z_]\w*)\s*\(/ /) { $functions{$1}++ if !defined($c_keywords{$1}); } - while (s/\W([a-zA-Z_]\w*)\W/ /) { + while (s/\b([a-zA-Z_]\w*)\b/ /) { $identifiers{$1}++ if !defined($c_keywords{$1}); } } @@ -252,15 +255,15 @@ sub scan_makefile s/@[^@]*@//g; # Variable assignments. - while (s/\W([a-zA-Z_]\w*)\s*=/ /) { + while (s/\b([a-zA-Z_]\w*)\s*=/ /) { $makevars{$1}++; } # Libraries. - while (s/\W-l([a-zA-Z_]\w*)\W/ /) { + while (s/\B-l([a-zA-Z_]\w*)\b/ /) { $libraries{$1}++; } # Tokens in the code. - while (s/\W([a-zA-Z_]\w*)\W/ /) { + while (s/\b([a-zA-Z_]\w*)\b/ /) { $programs{$1}++; } } @@ -298,7 +301,7 @@ sub scan_sh_file s/@[^@]*@//g; # Tokens in the code. - while (s/\W([a-zA-Z_]\w*)\W/ /) { + while (s/\b([a-zA-Z_]\w*)\b/ /) { $programs{$1}++; } } @@ -324,6 +327,9 @@ sub output if (defined $initfile) { print CONF "AC_CONFIG_SRCDIR([$initfile])\n"; } + if (defined $cfiles[0]) { + print CONF "AC_CONFIG_HEADER([config.h])\n"; + } &output_programs; &output_headers; diff --git a/autoscan.pl b/autoscan.pl index baf301c02..d7d6a36ee 100644 --- a/autoscan.pl +++ b/autoscan.pl @@ -125,7 +125,10 @@ sub init_tables die "$me: cannot open $datadir/ac$kind: $!\n"; while (
) { next if /^\s*$/ || /^\s*#/; # Ignore blank lines and comments. - ($word, $macro) = split; + unless (/^(\S+)\s+(\S.*)$/) { + die "$me: cannot parse definition in $datadir/ac$kind:\n$_\n"; + } + ($word, $macro) = ($1, $2); eval "\$$kind" . "_macros{\$word} = \$macro"; } close(TABLE); @@ -210,10 +213,10 @@ sub scan_c_file # Tokens in the code. # Maybe we should ignore function definitions (in column 0)? - while (s/\W([a-zA-Z_]\w*)\s*\(/ /) { + while (s/\b([a-zA-Z_]\w*)\s*\(/ /) { $functions{$1}++ if !defined($c_keywords{$1}); } - while (s/\W([a-zA-Z_]\w*)\W/ /) { + while (s/\b([a-zA-Z_]\w*)\b/ /) { $identifiers{$1}++ if !defined($c_keywords{$1}); } } @@ -252,15 +255,15 @@ sub scan_makefile s/@[^@]*@//g; # Variable assignments. - while (s/\W([a-zA-Z_]\w*)\s*=/ /) { + while (s/\b([a-zA-Z_]\w*)\s*=/ /) { $makevars{$1}++; } # Libraries. - while (s/\W-l([a-zA-Z_]\w*)\W/ /) { + while (s/\B-l([a-zA-Z_]\w*)\b/ /) { $libraries{$1}++; } # Tokens in the code. - while (s/\W([a-zA-Z_]\w*)\W/ /) { + while (s/\b([a-zA-Z_]\w*)\b/ /) { $programs{$1}++; } } @@ -298,7 +301,7 @@ sub scan_sh_file s/@[^@]*@//g; # Tokens in the code. - while (s/\W([a-zA-Z_]\w*)\W/ /) { + while (s/\b([a-zA-Z_]\w*)\b/ /) { $programs{$1}++; } } @@ -324,6 +327,9 @@ sub output if (defined $initfile) { print CONF "AC_CONFIG_SRCDIR([$initfile])\n"; } + if (defined $cfiles[0]) { + print CONF "AC_CONFIG_HEADER([config.h])\n"; + } &output_programs; &output_headers; diff --git a/bin/autoscan.in b/bin/autoscan.in index baf301c02..d7d6a36ee 100644 --- a/bin/autoscan.in +++ b/bin/autoscan.in @@ -125,7 +125,10 @@ sub init_tables die "$me: cannot open $datadir/ac$kind: $!\n"; while (
) { next if /^\s*$/ || /^\s*#/; # Ignore blank lines and comments. - ($word, $macro) = split; + unless (/^(\S+)\s+(\S.*)$/) { + die "$me: cannot parse definition in $datadir/ac$kind:\n$_\n"; + } + ($word, $macro) = ($1, $2); eval "\$$kind" . "_macros{\$word} = \$macro"; } close(TABLE); @@ -210,10 +213,10 @@ sub scan_c_file # Tokens in the code. # Maybe we should ignore function definitions (in column 0)? - while (s/\W([a-zA-Z_]\w*)\s*\(/ /) { + while (s/\b([a-zA-Z_]\w*)\s*\(/ /) { $functions{$1}++ if !defined($c_keywords{$1}); } - while (s/\W([a-zA-Z_]\w*)\W/ /) { + while (s/\b([a-zA-Z_]\w*)\b/ /) { $identifiers{$1}++ if !defined($c_keywords{$1}); } } @@ -252,15 +255,15 @@ sub scan_makefile s/@[^@]*@//g; # Variable assignments. - while (s/\W([a-zA-Z_]\w*)\s*=/ /) { + while (s/\b([a-zA-Z_]\w*)\s*=/ /) { $makevars{$1}++; } # Libraries. - while (s/\W-l([a-zA-Z_]\w*)\W/ /) { + while (s/\B-l([a-zA-Z_]\w*)\b/ /) { $libraries{$1}++; } # Tokens in the code. - while (s/\W([a-zA-Z_]\w*)\W/ /) { + while (s/\b([a-zA-Z_]\w*)\b/ /) { $programs{$1}++; } } @@ -298,7 +301,7 @@ sub scan_sh_file s/@[^@]*@//g; # Tokens in the code. - while (s/\W([a-zA-Z_]\w*)\W/ /) { + while (s/\b([a-zA-Z_]\w*)\b/ /) { $programs{$1}++; } } @@ -324,6 +327,9 @@ sub output if (defined $initfile) { print CONF "AC_CONFIG_SRCDIR([$initfile])\n"; } + if (defined $cfiles[0]) { + print CONF "AC_CONFIG_HEADER([config.h])\n"; + } &output_programs; &output_headers; diff --git a/lib/autoscan/identifiers b/lib/autoscan/identifiers index e4ae03b05..ebf620088 100644 --- a/lib/autoscan/identifiers +++ b/lib/autoscan/identifiers @@ -29,7 +29,7 @@ S_ISREG AC_HEADER_STAT S_ISSOCK AC_HEADER_STAT # Members of structures. -st_blksize AC_STRUCT_ST_BLKSIZE +st_blksize AC_CHECK_MEMBERS([struct stat.st_blksize]) st_blocks AC_STRUCT_ST_BLOCKS -st_rdev AC_STRUCT_ST_RDEV +st_rdev AC_CHECK_MEMBERS([struct stat.st_rdev]) tm_zone AC_STRUCT_TIMEZONE