From: Akim Demaille Date: Mon, 22 Jan 2001 19:01:23 +0000 (+0000) Subject: * autoscan.pl: Instead of undefined globals, set them to empty X-Git-Tag: autoconf-2.50~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85065e6ad0bf5edbc7f44fc8022473a3bdd2a0a4;p=thirdparty%2Fautoconf.git * autoscan.pl: Instead of undefined globals, set them to empty values. (%needed_macros): New. (&check_configure_ac): New. Call it. (&output_libraries): Eve out from &output_programs. (&print_unique): For the time being register in %needed_macros only argument less macros. --- diff --git a/ChangeLog b/ChangeLog index c5bdda75e..6a4caf3ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-01-22 Akim Demaille + + * autoscan.pl: Instead of undefined globals, set them to empty + values. + (%needed_macros): New. + (&check_configure_ac): New. Call it. + (&output_libraries): Eve out from &output_programs. + (&print_unique): For the time being register in %needed_macros + only argument less macros. + 2001-01-22 Lars J. Aas * aclang.m4 (_AC_PROG_CXX_EXIT_DECLARATION): First try no declaration, diff --git a/TODO b/TODO index 8ee4a26cf..21465756f 100644 --- a/TODO +++ b/TODO @@ -38,6 +38,15 @@ longer *ever* try to parse Autoconf files. ** Autotest Document it. +** Document AC_COMPILE_IFELSE, AC_LANG_PROGRAM etc. +And make AC_TRY_COMPILE etc. obsolete. + +** Autoscan macros +Can be introduced even before specializing macros. It just means that +specializing macros will call them. OTOH, this doubles our work, +since specializing macros will save us from additional typing. But +the more powerful autoscan is, the better... + * Autoconf 2.51 or later ** Libtool diff --git a/autoscan.in b/autoscan.in index e81f074f7..2c12724eb 100644 --- a/autoscan.in +++ b/autoscan.in @@ -27,15 +27,17 @@ $datadir = $ENV{"AC_MACRODIR"} || "@datadir@"; $verbose = 0; # Reference these variables to pacify perl -w. -undef %identifiers_macros; -undef %makevars_macros; -undef %programs_macros; +%identifiers_macros = (); +%makevars_macros = (); +%programs_macros = (); +%needed_macros = (); &parse_args; &init_tables; &find('.'); &scan_files; &output; +&check_configure_ac ('configure.in'); exit 0; @@ -317,7 +319,7 @@ sub scan_sh_file } } -# Print a configure.ac. +# Print a proto configure.ac. sub output { local (%unique_makefiles); @@ -332,6 +334,7 @@ sub output } &output_programs; + &output_libraries; &output_headers; &output_identifiers; &output_functions; @@ -342,7 +345,7 @@ sub output $unique_makefiles{$_}++; } print CONF "\nAC_CONFIG_FILES([", - join("\n ", keys(%unique_makefiles)), "])\n"; + join("\n ", keys(%unique_makefiles)), "])\n"; print CONF "AC_OUTPUT\n"; close CONF; @@ -356,6 +359,10 @@ sub print_unique if (defined($macro) && !defined($printed{$macro})) { print CONF "$macro\n"; $printed{$macro} = 1; + + # For the time being, just don't bother with macros with arguments. + $needed_macros{$macro} = 1 + if ($macro !~ /]|^AC_CHECK_.*S/); } } @@ -370,6 +377,12 @@ sub output_programs foreach $word (sort keys %makevars) { &print_unique($makevars_macros{$word}); } +} + +sub output_libraries +{ + local ($word); + print CONF "\n# Checks for libraries.\n"; foreach $word (sort keys %libraries) { print CONF "# FIXME: Replace `main' with a function in `-l$word':\n"; @@ -427,3 +440,33 @@ sub output_functions print CONF "AC_CHECK_FUNCS([" . join(' ', sort(@have_funcs)) . "])\n" if defined(@have_funcs); } + + +# Use autoconf to check if all the suggested macros are included +# in `configure.ac' +sub check_configure_ac +{ + local ($configure_ac) = $@; + local ($trace_option) = ''; + local ($word); + + print STDERR "$trace_option\n"; + foreach $macro (%needed_macros) + { + $trace_option .= " -t $macro"; + } + + open (TRACES, "/home/akim/src/ace/autoconf -A $datadir $trace_option $configure_ac|") || + die "$me: cannot create read traces: $!\n"; + + while () + { + local ($file, $line, $macro, $args) = split (/:/, $_, 4); + delete ($needed_macros{$macro}); + } + + foreach $macro (sort keys %needed_macros) + { + print STDERR "warning: missing $macro\n"; + } +} diff --git a/autoscan.pl b/autoscan.pl index e81f074f7..2c12724eb 100644 --- a/autoscan.pl +++ b/autoscan.pl @@ -27,15 +27,17 @@ $datadir = $ENV{"AC_MACRODIR"} || "@datadir@"; $verbose = 0; # Reference these variables to pacify perl -w. -undef %identifiers_macros; -undef %makevars_macros; -undef %programs_macros; +%identifiers_macros = (); +%makevars_macros = (); +%programs_macros = (); +%needed_macros = (); &parse_args; &init_tables; &find('.'); &scan_files; &output; +&check_configure_ac ('configure.in'); exit 0; @@ -317,7 +319,7 @@ sub scan_sh_file } } -# Print a configure.ac. +# Print a proto configure.ac. sub output { local (%unique_makefiles); @@ -332,6 +334,7 @@ sub output } &output_programs; + &output_libraries; &output_headers; &output_identifiers; &output_functions; @@ -342,7 +345,7 @@ sub output $unique_makefiles{$_}++; } print CONF "\nAC_CONFIG_FILES([", - join("\n ", keys(%unique_makefiles)), "])\n"; + join("\n ", keys(%unique_makefiles)), "])\n"; print CONF "AC_OUTPUT\n"; close CONF; @@ -356,6 +359,10 @@ sub print_unique if (defined($macro) && !defined($printed{$macro})) { print CONF "$macro\n"; $printed{$macro} = 1; + + # For the time being, just don't bother with macros with arguments. + $needed_macros{$macro} = 1 + if ($macro !~ /]|^AC_CHECK_.*S/); } } @@ -370,6 +377,12 @@ sub output_programs foreach $word (sort keys %makevars) { &print_unique($makevars_macros{$word}); } +} + +sub output_libraries +{ + local ($word); + print CONF "\n# Checks for libraries.\n"; foreach $word (sort keys %libraries) { print CONF "# FIXME: Replace `main' with a function in `-l$word':\n"; @@ -427,3 +440,33 @@ sub output_functions print CONF "AC_CHECK_FUNCS([" . join(' ', sort(@have_funcs)) . "])\n" if defined(@have_funcs); } + + +# Use autoconf to check if all the suggested macros are included +# in `configure.ac' +sub check_configure_ac +{ + local ($configure_ac) = $@; + local ($trace_option) = ''; + local ($word); + + print STDERR "$trace_option\n"; + foreach $macro (%needed_macros) + { + $trace_option .= " -t $macro"; + } + + open (TRACES, "/home/akim/src/ace/autoconf -A $datadir $trace_option $configure_ac|") || + die "$me: cannot create read traces: $!\n"; + + while () + { + local ($file, $line, $macro, $args) = split (/:/, $_, 4); + delete ($needed_macros{$macro}); + } + + foreach $macro (sort keys %needed_macros) + { + print STDERR "warning: missing $macro\n"; + } +} diff --git a/bin/autoscan.in b/bin/autoscan.in index e81f074f7..2c12724eb 100644 --- a/bin/autoscan.in +++ b/bin/autoscan.in @@ -27,15 +27,17 @@ $datadir = $ENV{"AC_MACRODIR"} || "@datadir@"; $verbose = 0; # Reference these variables to pacify perl -w. -undef %identifiers_macros; -undef %makevars_macros; -undef %programs_macros; +%identifiers_macros = (); +%makevars_macros = (); +%programs_macros = (); +%needed_macros = (); &parse_args; &init_tables; &find('.'); &scan_files; &output; +&check_configure_ac ('configure.in'); exit 0; @@ -317,7 +319,7 @@ sub scan_sh_file } } -# Print a configure.ac. +# Print a proto configure.ac. sub output { local (%unique_makefiles); @@ -332,6 +334,7 @@ sub output } &output_programs; + &output_libraries; &output_headers; &output_identifiers; &output_functions; @@ -342,7 +345,7 @@ sub output $unique_makefiles{$_}++; } print CONF "\nAC_CONFIG_FILES([", - join("\n ", keys(%unique_makefiles)), "])\n"; + join("\n ", keys(%unique_makefiles)), "])\n"; print CONF "AC_OUTPUT\n"; close CONF; @@ -356,6 +359,10 @@ sub print_unique if (defined($macro) && !defined($printed{$macro})) { print CONF "$macro\n"; $printed{$macro} = 1; + + # For the time being, just don't bother with macros with arguments. + $needed_macros{$macro} = 1 + if ($macro !~ /]|^AC_CHECK_.*S/); } } @@ -370,6 +377,12 @@ sub output_programs foreach $word (sort keys %makevars) { &print_unique($makevars_macros{$word}); } +} + +sub output_libraries +{ + local ($word); + print CONF "\n# Checks for libraries.\n"; foreach $word (sort keys %libraries) { print CONF "# FIXME: Replace `main' with a function in `-l$word':\n"; @@ -427,3 +440,33 @@ sub output_functions print CONF "AC_CHECK_FUNCS([" . join(' ', sort(@have_funcs)) . "])\n" if defined(@have_funcs); } + + +# Use autoconf to check if all the suggested macros are included +# in `configure.ac' +sub check_configure_ac +{ + local ($configure_ac) = $@; + local ($trace_option) = ''; + local ($word); + + print STDERR "$trace_option\n"; + foreach $macro (%needed_macros) + { + $trace_option .= " -t $macro"; + } + + open (TRACES, "/home/akim/src/ace/autoconf -A $datadir $trace_option $configure_ac|") || + die "$me: cannot create read traces: $!\n"; + + while () + { + local ($file, $line, $macro, $args) = split (/:/, $_, 4); + delete ($needed_macros{$macro}); + } + + foreach $macro (sort keys %needed_macros) + { + print STDERR "warning: missing $macro\n"; + } +}