<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>7634</bug_id>
          
          <creation_ts>2015-04-21 09:00:09 +0000</creation_ts>
          <short_desc>recipetool: extend autotools recipe creation</short_desc>
          <delta_ts>2016-03-02 21:33:40 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>1.8</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>2.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Paul Eggleton">bluelightning</reporter>
          <assigned_to name="Paul Eggleton">bluelightning</assigned_to>
          <cc>kergoth</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>ross.burton</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>50434</commentid>
    <comment_count>0</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2015-04-21 09:00:09 +0000</bug_when>
    <thetext>recipetool has the ability to create recipes for software that uses autoconf/automake with a fairly basic ability to extract dependencies and other information from configure.ac; however there are macros and syntax that this doesn&apos;t currently handle. Someone with a better understanding of autotools needs to extend it; we may need to properly parse the files instead of the keyword searching we are doing now.

The implementation for this is in scripts/lib/recipetool/create_buildsys.py.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52181</commentid>
    <comment_count>1</comment_count>
    <who name="Christopher Larson">kergoth</who>
    <bug_when>2015-07-07 16:18:56 +0000</bug_when>
    <thetext>I once had some prototyped autotools.bbclass changes which pulled e.g. the gettext macro from a call to autoconf rather than grep, we could probably do something similar here.

E.g. this old snippet:
+	if [ -n &quot;`autoconf -t AC_CANONICAL_BUILD`&quot; ]; then
+		macrodir=&quot;`autoconf -t AC_CONFIG_MACRO_DIR|cut -d: -f4|tail -n 1`&quot;
+		if [ -z &quot;$macrodir&quot; ]; then
+			macrodir=&quot;.&quot;
+		fi

Admittedly running autoconf repeatedly wasn&apos;t ideal, but you get the idea -- you can use autoconf tracing to determine if a macro is called, and if so, with what arguments:

       -t, --trace=MACRO[:FORMAT]
              report the list of calls to MACRO</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>52486</commentid>
    <comment_count>2</comment_count>
    <who name="Christopher Larson">kergoth</who>
    <bug_when>2015-07-20 17:32:48 +0000</bug_when>
    <thetext>$ cd bash
$ autoconf -t AC_CHECK_LIB
configure.ac:416:AC_CHECK_LIB:cposix:strerror:LIBS=&quot;$LIBS -lcposix&quot;
configure.ac:543:AC_CHECK_LIB:termcap:tgetent:bash_cv_termcap_lib=libtermcap:AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo, [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses, [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, bash_cv_termcap_lib=gnutermcap)])])
configure.ac:543:AC_CHECK_LIB:tinfo:tgetent:bash_cv_termcap_lib=libtinfo:AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses, [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, bash_cv_termcap_lib=gnutermcap)])
configure.ac:543:AC_CHECK_LIB:curses:tgetent:bash_cv_termcap_lib=libcurses:AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, bash_cv_termcap_lib=gnutermcap)
configure.ac:543:AC_CHECK_LIB:ncurses:tgetent:bash_cv_termcap_lib=libncurses:bash_cv_termcap_lib=gnutermcap
configure.ac:855:AC_CHECK_LIB:dl:dlopen
configure.ac:870:AC_CHECK_LIB:sun:getpwent
configure.ac:875:AC_CHECK_LIB:socket:getpeername:bash_cv_have_socklib=yes:bash_cv_have_socklib=no:-lnsl
configure.ac:875:AC_CHECK_LIB:nsl:t_open:bash_cv_have_libnsl=yes:bash_cv_have_libnsl=no
configure.ac:1033:AC_CHECK_LIB:termcap:tgetent:bash_cv_termcap_lib=libtermcap:AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo, [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses, [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, bash_cv_termcap_lib=gnutermcap)])])
configure.ac:1033:AC_CHECK_LIB:tinfo:tgetent:bash_cv_termcap_lib=libtinfo:AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses, [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, bash_cv_termcap_lib=gnutermcap)])
configure.ac:1033:AC_CHECK_LIB:curses:tgetent:bash_cv_termcap_lib=libcurses:AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, bash_cv_termcap_lib=gnutermcap)
configure.ac:1033:AC_CHECK_LIB:ncurses:tgetent:bash_cv_termcap_lib=libncurses:bash_cv_termcap_lib=gnutermcap</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54405</commentid>
    <comment_count>3</comment_count>
    <who name="Christopher Larson">kergoth</who>
    <bug_when>2015-09-21 17:53:19 +0000</bug_when>
    <thetext>First, a note. You can pass any number of -t &lt;macro&gt; arguments to one autoconf execution, to get everything we need from one, and parse the output.

Next, from my personal todo, added here for safe-keeping:

- [ ] Use autoconf -t to reproduce the current capability for dependencies (AC_CHECK_LIB, PKG_CHECK_MODULES, AM_GNU_GETTEXT, AC_CHECK_PROG, AC_PATH_PROG, AC_PATH_X)
- [ ] Possibly also handle AC_SEARCH_LIBS
- [ ] Possibly also handle other prog variants: AC_CHECK_PROG, AC_CHECK_PROGS, AC_CHECK_TARGET_TOOL, AC_CHECK_TOOL, AC_CHECK_TARGET_TOOLS, AC_CHECK_TOOLS, AC_PATH_PROGS, AC_PATH_PROGS_FEATURE_CHECK, AC_PATH_TARGET_TOOL, AC_PATH_TOOL
- [ ] Possibly also check specific tool macros: AC_PROG_INSTALL, AC_PROG_AWK, AC_PROG_GREP, AC_PROG_EGREP, AC_PROG_FGREP, AC_PROG_MKDIR_P, AC_PROG_LEX, AC_PROG_LN_S, AC_PROG_RANLIB, AC_PROG_SED, AC_PROG_YACC (yacc &amp; lex being the important ones, for the flex-native/bison-native deps)
- [ ] Consider: checking for cross-compilation issues. This is tougher, since -t doesn&apos;t tell us if the macro is only called inside a if block for cross_compilation=&lt;yes,no&gt;, or if the macro is called inside an AC_CACHE_CHECK (though we might be able to figure that out, either through line number or examining the AC_CACHE_CHECK arguments). We could warn about *possible* issues for AC_CHECK_FILE, AC_CHECK_FILES, AC_RUN_IFELSE, and catch AC_CACHE_CHECK to try to reduce the false positives. We could also warn about passing the cross-compilation fallback argument of AC_RUN_IFELSE, as that value isn&apos;t generally target specific, so could well be wrong.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54406</commentid>
    <comment_count>4</comment_count>
    <who name="Christopher Larson">kergoth</who>
    <bug_when>2015-09-21 17:55:30 +0000</bug_when>
    <thetext>Example output with multiple -t&apos;s, with the macros we likely want to handle initially, run against GNU nano svn trunk:

$ autoconf -t AC_CHECK_LIB -t AC_SEARCH_LIBS -t PKG_CHECK_MODULES -t AC_CHECK_PROG -t AC_CHECK_PROGS -t AC_PATH_PROG -t AC_PATH_PROGS -t AC
_PATH_PROGS_FEATURE_CHECK -t AM_GNU_GETTEXT -t AC_PATH_X -t AC_PROG_YACC -t AC_PROG_LEX
configure.ac:35:AC_CHECK_PROG:CC:${ac_tool_prefix}gcc:${ac_tool_prefix}gcc::
configure.ac:35:AC_CHECK_PROG:CC:${ac_tool_prefix}cc:${ac_tool_prefix}cc
configure.ac:35:AC_CHECK_PROG:CC:cc:cc:::/usr/ucb/cc
configure.ac:35:AC_CHECK_PROG:CC:$ac_tool_prefix$ac_prog:$ac_tool_prefix$ac_prog::
configure.ac:35:AC_CHECK_PROGS:ac_ct_CC:cl.exe::
configure.ac:35:AC_CHECK_PROG:ac_ct_CC:$ac_prog:$ac_prog::
configure.ac:36:AC_CHECK_PROG:CC:${ac_tool_prefix}gcc:${ac_tool_prefix}gcc::
configure.ac:36:AC_CHECK_PROG:CC:${ac_tool_prefix}cc:${ac_tool_prefix}cc
configure.ac:36:AC_CHECK_PROG:CC:cc:cc:::/usr/ucb/cc
configure.ac:36:AC_CHECK_PROG:CC:$ac_tool_prefix$ac_prog:$ac_tool_prefix$ac_prog::
configure.ac:36:AC_CHECK_PROGS:ac_ct_CC:cl.exe::
configure.ac:36:AC_CHECK_PROG:ac_ct_CC:$ac_prog:$ac_prog::
configure.ac:38:AC_SEARCH_LIBS:strerror:cposix
configure.ac:243:AC_CHECK_LIB:${termlib}:tputs:tcap=&quot;-l$termlib&quot;
configure.ac:243:AC_CHECK_LIB:${termlib}:tputs:tcap=&quot;-l$termlib&quot;
configure.ac:491:AC_CHECK_PROG:NCURSESW_CONFIG:${ac_tool_prefix}ncursesw5-config:${ac_tool_prefix}ncursesw5-config::
configure.ac:496:AC_CHECK_LIB:ncursesw:get_wch:CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes
configure.ac:498:AC_CHECK_LIB:ncursesw:get_wch:CURSES_LIB=&quot;-lncursesw&quot; CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes
configure.ac:504:AC_CHECK_LIB:ncurses:initscr:CURSES_LIB=&quot;-lncurses&quot; CURSES_LIB_NAME=ncurses
configure.ac:512:AC_CHECK_LIB:curses:get_wch:CURSES_LIB=&quot;-lcurses&quot; CURSES_LIB_NAME=curses CURSES_LIB_WIDE=yes
configure.ac:516:AC_CHECK_LIB:curses:initscr:CURSES_LIB=&quot;-lcurses&quot; CURSES_LIB_NAME=curses
configure.ac:529:AC_CHECK_LIB:$CURSES_LIB_NAME:use_default_colors: $as_echo &quot;#define HAVE_USE_DEFAULT_COLORS 1&quot; &gt;&gt;confdefs.h
configure.ac:658:AC_CHECK_LIB:magic:magic_open
configure.ac:658:AC_CHECK_LIB:z:inflate
configure.ac:680:AC_CHECK_PROG:haveit:makeinfo:yes:no</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57962</commentid>
    <comment_count>5</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2016-01-19 18:01:35 +0000</bug_when>
    <thetext>I&apos;ve made a number of improvements to recipetool&apos;s ability to extract dependencies from configure.ac; it&apos;s still not perfect, but it&apos;s better.

I didn&apos;t end up going the route of using autoconf -t because it didn&apos;t really make things easier - I also found it didn&apos;t help with situations such as where other macros had been defined and then used within a statement; the code we have now is able to expand those.

I&apos;m not sure where we want to go with this bug. We&apos;re still stuck with situations such as where environment variables get used since they aren&apos;t really intended to be expanded until the configure script actually becomes a shell script; beyond actually implementing a proper M4 parser I can&apos;t see any practical way to improve this other than incrementally.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58096</commentid>
    <comment_count>6</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-01-21 22:25:19 +0000</bug_when>
    <thetext>A number of relevant patches were merged into oe-core as of c58669fb0977f7f0cb79f252484d5c5ef0dfb7e4.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>59641</commentid>
    <comment_count>7</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2016-03-02 21:33:40 +0000</bug_when>
    <thetext>I think I&apos;m going to call this done - if we need to extend the capabilities or fix issues then we can create more specific bugs.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>