autogen.sh: check for libtool before automake fails to find it #7530

pull knocte wants to merge 1 commits into bitcoin:master from knocte:libtool-check changing 1 files +10 −3
  1. knocte commented at 10:17 AM on February 13, 2016: contributor

    Changes the error message from: $ ./autogen.sh configure.ac:28: installing 'build-aux/install-sh' configure.ac:28: installing 'build-aux/missing' Makefile.am:8: error: Libtool library used but 'LIBTOOL' is undefined Makefile.am:8: The usual way to define 'LIBTOOL' is to add 'LT_INIT' Makefile.am:8: to 'configure.ac' and run 'aclocal' and 'autoconf' again. Makefile.am:8: If 'LT_INIT' is in 'configure.ac', make sure Makefile.am:8: its definition is in aclocal's search path.

    To: $ ./autogen.sh libtool is required, please install it first

  2. laanwj added the label Build system on Feb 13, 2016
  3. in autogen.sh:None in 9693edb885 outdated
       1 | @@ -2,8 +2,13 @@
       2 |  set -e
       3 |  srcdir="$(dirname $0)"
       4 |  cd "$srcdir"
       5 | +
       6 |  if [ -z ${LIBTOOLIZE} ] && GLIBTOOLIZE="`which glibtoolize 2>/dev/null`"; then
       7 |    LIBTOOLIZE="${GLIBTOOLIZE}"
       8 |    export LIBTOOLIZE
       9 |  fi
      10 | +if [ -z ${LIBTOOLIZE} ]; then
    


    laanwj commented at 10:26 AM on February 13, 2016:

    -z is not the right check here, you probably want ! -x to check for executableness

  4. paveljanik commented at 11:07 AM on February 13, 2016: contributor

    All builds failed with:

    libtool is required, please install it first
    

    Empty LIBTOOLIZE is valid use case! Even -x doesn't help here.

    The test should be rewritten IMO. But it looks to me that some part in the master is missing, something like:

    [ -z ${LIBTOOLIZE} ] && LIBTOOLIZE="`which libtoolize 2>/dev/null`"
    

    Then your code makes sense (after -z -> -x).

  5. knocte commented at 11:33 AM on February 13, 2016: contributor

    Empty LIBTOOLIZE is valid use case!

    So $LIBTOOLIZE is actually not used in some build? What use case is that?

  6. paveljanik commented at 11:46 AM on February 13, 2016: contributor

    Right now, you can export LIBTOOLIZE="" and finish the build. With your change, you can't. Looks weird, yes. But it is this way right now.

    The variable LIBTOOLIZE is used by autoconf. It can be empty. E.g. try setting it to NONSENSE and run autoreconf:

    Can't exec "NONSENSE": No such file or directory at /opt/local/share/autoconf/Autom4te/FileUtils.pm line 345, <GEN7> line 5.
    autoreconf: failed to run NONSENSE: No such file or directory
    autoreconf: libtoolize is needed because this package uses Libtool
    

    The current code expects the user can have LIBTOOLIZE already set in the environment. If it is empty or not set, it checks for glibtoolize. But it CAN end up with empty LIBTOOLIZE which is valid case.

    I'd suggest to add the line I mentioned above and use -x. This should solve all cases.

  7. knocte force-pushed on Feb 15, 2016
  8. knocte commented at 6:54 AM on February 15, 2016: contributor

    @paveljanik ok thanks for the insight. I've force-pushed new approach following your advice, which works in my box (ubuntu 15.10 fyi) and passes in travis too.

  9. paveljanik commented at 4:46 PM on February 15, 2016: contributor

    @knocte Can you please rebase?

  10. autogen.sh: check for libtoolize before automake fails to find it
    Changes the error message from:
    $ ./autogen.sh
    configure.ac:28: installing 'build-aux/install-sh'
    configure.ac:28: installing 'build-aux/missing'
    Makefile.am:8: error: Libtool library used but 'LIBTOOL' is undefined
    Makefile.am:8:   The usual way to define 'LIBTOOL' is to add 'LT_INIT'
    Makefile.am:8:   to 'configure.ac' and run 'aclocal' and 'autoconf' again.
    Makefile.am:8:   If 'LT_INIT' is in 'configure.ac', make sure
    Makefile.am:8:   its definition is in aclocal's search path.
    
    To:
    $ ./autogen.sh
    glibtoolize/libtoolize not found (usually packaged in libtool-bin/libtool)
    f2373dba7c
  11. knocte force-pushed on Feb 15, 2016
  12. knocte commented at 5:23 PM on February 15, 2016: contributor

    @paveljanik sure, done

  13. theuni commented at 5:29 AM on February 16, 2016: member

    I think this might be fixed more nicely with an m4_ifdef in configure.ac ?

    Edit: I think nevermind that.

  14. knocte commented at 7:02 AM on February 16, 2016: contributor

    What about this? LIBTOOLIZE="which glibtoolize 2>/dev/null" || LIBTOOLIZE="which libtoolize 2>/dev/null" @paveljanik Yeah I like your improvements, but I guess you didn't test it :-P I tried to beautify it myself too, but there's a set -e directive at the start of the file that would make the execution abort if any of the which calls fails. But with the current approach in the pull request now it works.

    Edit: I think nevermind that. @theuni why nevermind? I could explore that. But maybe in a subsequent commit/PR?

  15. laanwj commented at 8:51 AM on February 17, 2016: member

    @theuni why nevermind? I could explore that. But maybe in a subsequent commit/PR?

    Probably a chicken-and-egg problem :-)

  16. paveljanik commented at 4:07 PM on February 17, 2016: contributor

    @knocte Yes, I do not usually test shell scripts (only in own PRs ;-). What about this? You can just add || : at the end of the checks or use:

    # Find executable (g)libtoolize or warn user early
    if [ -z ${LIBTOOLIZE} ]; then
      LIBTOOLIZE="`which glibtoolize 2>/dev/null`" || LIBTOOLIZE="`which libtoolize 2>/dev/null`" || \
      [ ! -x "$LIBTOOLIZE" ] && (
           echo "(g)libtoolize not found, please install libtool";  exit 1
        )
    fi
    
  17. laanwj commented at 9:25 AM on April 14, 2016: member

    So did anyone test this or check this out further?

  18. paveljanik commented at 8:18 PM on April 22, 2016: contributor

    I didn't. @knocte?

  19. arowser commented at 8:44 AM on May 25, 2016: contributor

    Can one of the admins verify this patch?

  20. laanwj commented at 12:02 PM on June 8, 2016: member

    Closing due to lack of activity

  21. laanwj closed this on Jun 8, 2016

  22. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-15 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me