bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: You may need to add #include directives for the following .h files


From: Gary V. Vaughan
Subject: Re: You may need to add #include directives for the following .h files
Date: Sun, 27 Jan 2013 20:35:51 +0700

On 27 Jan 2013, at 03:27, Bruce Korb <address@hidden> wrote:
> Hi Gary,

Hey Bruce!

> Speaking of bootstrap wishes, how about a hack that captures the
> "You may need to include this" list?  As the various modules
> change dependencies and add new headers, I'd as soon glue the
> "you may need to add" cruft to the end of config.h.

Well, the beauty of the hook and require core of my bootstrap rewrite
is that you don't need to wish for such things... just write some new
shell functions in your bootstrap.conf (feeling free to build on the
shoulders of all the require_* functions provided by bootstrap) and
then hook them in at the place you'd like them to be called back.

Here's something I hacked together in 30 minutes (that is, only very
light testing was performed) to add to your bootstrap.conf:

 # sharutils_append_all_gnulib_includes_config_h
 # ---------------------------------------------
 # Append all gnulib mandated header files to the end of the first
 # AC_CONFIG_HEADER{,S} file from $configure_ac.
 sharutils_append_all_gnulib_includes_config_h ()
 {
     $debug_cmd

     func_extract_trace AC_CONFIG_HEADERS
     test -n "$func_extract_trace_result" \
         || func_extract_trace AC_CONFIG_HEADER

     test -n "$func_extract_trace_result" && {
       $require_all_gnulib_includes

       test -n "$all_gnulib_includes" && {
         for header in $func_extract_trace_result; do
           # Take care to honor config.h:config-h.in specifications.
           case $header in
             *:*) header=`echo $header |sed 's|^.*:||'` ;;
             *)   header=$header.in ;;
           esac

           func_verbose "appending gnulib includes to '$header'"
           echo "$all_gnulib_includes" >> $header

           # Ignore remaining header specs.
           break
         done
       }
     }
 }
 func_add_hook func_fini sharutils_append_all_gnulib_includes_config_h


 # require_all_gnulib_includes
 # ---------------------------
 # Ensure `$all_gnulib_includes' contains a sorted uniquified list of
 # every gnulib mandated header file.
 require_all_gnulib_includes=func_require_all_gnulib_includes
 func_require_all_gnulib_includes ()
 {
     $debug_cmd
 
     $require_gnulib_tool
 
     test true = "$gnulib_tool" || {
       $require_all_gnulib_modules
       $require_gnulib_tool_base_options
 
       gnulib_mode=--extract-include-directive
       gnulib_tool_all_options="$gnulib_mode $gnulib_tool_base_options"
       all_gnulib_includes=`\
         $gnulib_tool $gnulib_tool_all_options $all_gnulib_modules \
         |sed '/^$/d' |sort |uniq`
 
       # put <> includes before "" includes
       all_gnulib_includes=`\
         echo "$all_gnulib_includes" | grep -v '"';
         echo "$all_gnulib_includes" | grep '"'`
 
       test -n "all_gnulib_includes" || func_verbose "found gnulib includes"
     }
 
     require_all_gnulib_includes=:
 }
 
 
 # require_all_gnulib_modules
 # --------------------------
 # Ensure `$all_gnulib_modules' contains the fully expanded list of
 # gnulib modules with dependencies expanded.
 require_all_gnulib_modules=func_require_all_gnulib_modules
 func_require_all_gnulib_modules ()
 {
     $debug_cmd
 
     $require_gnulib_tool
 
     test true = "$gnulib_tool" || {
       $require_gnulib_tool_base_options
 
       all_gnulib_modules=$gnulib_modules
       gnulib_mode=--extract-dependencies
       gnulib_tool_all_options="$gnulib_mode $gnulib_tool_base_options"
       while :; do
         my_add_modules=false
         for module in $gnulib_modules; do
           for depend in `$gnulib_tool $gnulib_tool_all_options $module`; do
             case " "`echo $my_full_module_list`" " in
               *" $depend "*) ;;
               *) my_add_modules=:
                  my_full_module_list="$my_full_module_list
         $depend"
                  ;;
             esac
           done
         done
         $my_add_modules || break
       done
     }
 
     test "$all_gnulib_modules" = "$gnulib_modules" \
         || func_verbose 'recursively expanding $gnulib_modules list'
 
     require_all_gnulib_modules=:
 }

Note, that I factored the require_gnulib_tool_base_options function out just
now in latest libtool master HEAD of bootstrap in order to avoid having to
copy the gnulib-tool option setting code out of bootstrap into the functions
above.  It may work for you anyway, provided that you are already using the
gnulib-tool defaults for --aux-dir, --m4-base, --doc-base, --lib, --local-dir
and --source-base, but I'd recommend pulling the latest libtool bootstrap
just to be future-proof. :)

HTH,
-- 
Gary V. Vaughan (gary AT gnu DOT org)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]