configure: Use modern way to set AR #1088

pull real-or-random wants to merge 1 commits into bitcoin-core:master from real-or-random:202203-ar changing 2 files +6 −6
  1. real-or-random commented at 10:00 am on March 13, 2022: contributor

    This uses AM_PROG_AR to discover ar, which is the recommended way to do so. Among other advantages, it honors the AR environment variable (as set from the outside). The macro has been around since automake 1.11.2 (Dec 2011).

    This commit also removes code that discovers ranlib and strip. ranlib has been obsolete for decades (ar does its task now automatically), and anyway LT_INIT takes care of discovering it. The code we used to set STRIP was last mentioned in the automake 1.5 manual. Since automake 1.6 (Mar 2002), strip is discovered automatically when necessary (look for the private macro AM_PROG_INSTALL_STRIP in the automake manual).

    Alternative to #1086.

  2. real-or-random cross-referenced this on Mar 13, 2022 from issue configure: customizable AR and RANLIB by jb55
  3. real-or-random cross-referenced this on Mar 13, 2022 from issue ci: Add MSVC builds by real-or-random
  4. real-or-random force-pushed on Mar 13, 2022
  5. real-or-random commented at 12:13 pm on March 13, 2022: contributor
    Force-pushed to improve commit message.
  6. real-or-random force-pushed on Mar 14, 2022
  7. hebasto commented at 11:25 am on March 14, 2022: member
    Concept ACK.
  8. in configure.ac:30 in f9a1ddee2d outdated
    26@@ -27,17 +27,14 @@ AH_TOP([#define LIBSECP256K1_CONFIG_H])
    27 AH_BOTTOM([#endif /*LIBSECP256K1_CONFIG_H*/])
    28 AM_INIT_AUTOMAKE([foreign subdir-objects])
    29 
    30+AM_PROG_AR # must be called before LT_INIT
    


    hebasto commented at 12:41 pm on March 14, 2022:
    Why the comment does matter? Any docs link?

    real-or-random commented at 3:02 pm on March 14, 2022:

    ./autogen.sh will warn if you have it the other way around.

    The AM_PROG_AR felt a little bit out of place here (because all the other tools are detected below), so I thought a comment is good. Another way is to move AC_PROG_CC and AM_PROG_AS up, maybe I’ll do this.


    real-or-random commented at 3:37 pm on March 14, 2022:
    Fixed by moving LT_INIT down.

    hebasto commented at 4:54 pm on March 14, 2022:

    ./autogen.sh will warn if you have it the other way around.

    warning: LT_INIT was called before AM_PROG_AR

  9. hebasto commented at 12:46 pm on March 14, 2022: member

    The macro has been around since automake 1.11.2 (Dec 2011).

    Maybe specify minimum Automake version in the AM_INIT_AUTOMAKE macro explicitly?

    This commit also removes code that discovers ranlib and strip. Slightly prefer to split these changes into 2 commits – (1) ar-related, and (2) other changes.

  10. real-or-random force-pushed on Mar 14, 2022
  11. real-or-random force-pushed on Mar 14, 2022
  12. real-or-random commented at 3:52 pm on March 14, 2022: contributor

    @hebasto @fanquake I don’t think it hurts but one thing to be aware of is that AM_PROG_AR explicitly supports the MSVC archiver “lib.exe” and thus ./autogen.sh will install an additional wrapper script in build-aux. This will actually be helpful for my PR #1084, so I believe we even want this here.

    But if that’s not desired in Core, sticking with AC_PATH_TOOL(AR, ar) is fine for now. (Future versions of autoconf will have AC_PROG_AR (note the AC instead of AM) which essentially does this, see https://github.com/autotools-mirror/autoconf/commit/c48fdb81191c8b7c7c0dde6141b861b178a6a284). But even if this case, I think Core can still remove AC_PATH_TOOL(RANLIB, ranlib) and for AC_PATH_TOOL(STRIP, strip) for the reasons given above.

  13. hebasto commented at 4:37 pm on March 14, 2022: member

    AM_PROG_AR explicitly supports the MSVC archiver “lib.exe” and thus ./autogen.sh will install an additional wrapper script in build-aux.

    To be precise, it is the build-aux/ar-lib script.

  14. hebasto commented at 4:44 pm on March 14, 2022: member

    To be precise, it is the build-aux/ar-lib script.

    Mind adding:

     0diff --git a/.gitignore b/.gitignore
     1index 53941f2..d88627d 100644
     2--- a/.gitignore
     3+++ b/.gitignore
     4@@ -46,6 +46,7 @@ coverage.*.html
     5 
     6 src/libsecp256k1-config.h
     7 src/libsecp256k1-config.h.in
     8+build-aux/ar-lib
     9 build-aux/config.guess
    10 build-aux/config.sub
    11 build-aux/depcomp
    

    ?

  15. hebasto commented at 5:21 pm on March 14, 2022: member

    This commit also removes code that discovers ranlib and strip. ranlib has been obsolete for decades (ar does its task now automatically), and anyway LT_INIT takes care of discovering it. The code we used to set STRIP was last mentioned in the automake 1.5 manual. Since automake 1.6 (Mar 2002), strip is discovered automatically when necessary (look for the private macro AM_PROG_INSTALL_STRIP in the automake manual).

    Confirming. Here is an excerpt of the LT_INIT([win32-dll]) output:

    0checking for strip... strip
    1checking for ranlib... ranlib
    
  16. hebasto commented at 5:30 pm on March 14, 2022: member

    Approach ACK 67f4569db8be4d96d7016e7acea6ea3f051649c4.

    FWIW, here is a diff of ./configure output:

     0--- /home/hebasto/master
     1+++ /home/hebasto/pr1088
     2@@ -6,8 +6,9 @@
     3 checking for gawk... gawk
     4 checking whether make sets $(MAKE)... yes
     5 checking whether make supports nested variables... yes
     6-checking how to print strings... printf
     7-checking whether make supports the include directive... yes (GNU style)
     8+checking whether make supports nested variables... (cached) yes
     9+checking for pkg-config... /usr/bin/pkg-config
    10+checking pkg-config is at least version 0.9.0... yes
    11 checking for gcc... gcc
    12 checking whether the C compiler works... yes
    13 checking for C compiler default output file name... a.out
    14@@ -18,7 +19,12 @@
    15 checking whether gcc accepts -g... yes
    16 checking for gcc option to enable C11 features... none needed
    17 checking whether gcc understands -c and -o together... yes
    18+checking whether make supports the include directive... yes (GNU style)
    19+checking dependency style of gcc... gcc3
    20 checking dependency style of gcc... gcc3
    21+checking for ar... ar
    22+checking the archiver (ar) interface... ar
    23+checking how to print strings... printf
    24 checking for a sed that does not truncate output... /usr/bin/sed
    25 checking for grep that handles long lines and -e... /usr/bin/grep
    26 checking for egrep... /usr/bin/grep -E
    27@@ -36,7 +42,6 @@
    28 checking how to recognize dependent libraries... pass_all
    29 checking for dlltool... no
    30 checking how to associate runtime and link libraries... printf %s\n
    31-checking for ar... ar
    32 checking for archiver [@FILE](/bitcoin-core-secp256k1/contributor/file/) support... @
    33 checking for strip... strip
    34 checking for ranlib... ranlib
    35@@ -71,19 +76,6 @@
    36 checking if libtool supports shared libraries... yes
    37 checking whether to build shared libraries... yes
    38 checking whether to build static libraries... yes
    39-checking whether make supports nested variables... (cached) yes
    40-checking for pkg-config... /usr/bin/pkg-config
    41-checking pkg-config is at least version 0.9.0... yes
    42-checking for ar... /usr/bin/ar
    43-checking for ranlib... /usr/bin/ranlib
    44-checking for strip... /usr/bin/strip
    45-checking for gcc... (cached) gcc
    46-checking whether the compiler supports GNU C... (cached) yes
    47-checking whether gcc accepts -g... (cached) yes
    48-checking for gcc option to enable C11 features... (cached) none needed
    49-checking whether gcc understands -c and -o together... (cached) yes
    50-checking dependency style of gcc... (cached) gcc3
    51-checking dependency style of gcc... gcc3
    52 checking if gcc supports -Werror=unknown-warning-option... no
    53 checking if gcc supports -std=c89 -pedantic -Wno-long-long -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef... yes
    54 checking if gcc supports -Wno-overlength-strings... yes
    
  17. configure: Use modern way to set AR
    This uses AM_PROG_AR to discover ar, which is the recommended way to do
    so. Among other advantages, it honors the AR environment variable (as
    set from the outside). The macro has been around since automake 1.11.2
    (Dec 2011).
    
    This commit also removes code that discovers ranlib and strip. ranlib
    has been obsolete for decades (ar does its task now automatically), and
    anyway LT_INIT takes care of discovering it. The code we used to set
    STRIP was last mentioned in the automake 1.5 manual. Since automake 1.6
    (Mar 2002), strip is discovered automatically when necessary (look for
    the *private* macro AM_PROG_INSTALL_STRIP in the automake manual).
    0d253d52e8
  18. real-or-random force-pushed on Mar 14, 2022
  19. real-or-random commented at 5:37 pm on March 14, 2022: contributor
    0+build-aux/ar-lib
    

    Done, thanks.

  20. hebasto approved
  21. hebasto commented at 5:47 pm on March 14, 2022: member
    ACK 0d253d52e804a5affb0f1c851ec250071e7345d9
  22. hebasto cross-referenced this on Mar 14, 2022 from issue build: Drop redundant checks for ranlib and strip tools by hebasto
  23. jb55 commented at 6:00 pm on March 14, 2022: none

    tACK 0d253d52e804a5affb0f1c851ec250071e7345d9

    my lnsocket wasm build is happy with this

  24. roconnor-blockstream commented at 2:09 pm on March 16, 2022: contributor
    works for me.
  25. jonasnick commented at 3:11 pm on March 16, 2022: contributor
    ACK 0d253d52e804a5affb0f1c851ec250071e7345d9
  26. jonasnick merged this on Mar 16, 2022
  27. jonasnick closed this on Mar 16, 2022

  28. fanquake referenced this in commit 8f8631d826 on Mar 17, 2022
  29. fanquake referenced this in commit 4bb1d7e62a on Mar 17, 2022
  30. fanquake referenced this in commit 465d05253a on Mar 30, 2022
  31. real-or-random referenced this in commit 6c0aecf72b on Apr 1, 2022
  32. fanquake referenced this in commit afb7a6fe06 on Apr 6, 2022
  33. fanquake cross-referenced this on Apr 6, 2022 from issue Update libsecp256k1 subtree to current master by fanquake
  34. fanquake referenced this in commit 747cdf1d65 on Apr 9, 2022
  35. fanquake referenced this in commit 7cc1860b12 on May 5, 2022
  36. sidhujag referenced this in commit 6d75eb6d27 on May 5, 2022
  37. gwillen referenced this in commit 35d6112a72 on May 25, 2022
  38. patricklodder referenced this in commit 21badcf9d2 on Jul 25, 2022
  39. patricklodder referenced this in commit 03002a9013 on Jul 28, 2022
  40. janus referenced this in commit 3a0652a777 on Aug 4, 2022
  41. lyricidal cross-referenced this on Mar 31, 2023 from issue [Upstream] build: Drop redundant checks for ranlib and strip tools by lyricidal
  42. str4d referenced this in commit 522190d5c3 on Apr 21, 2023
  43. vmta referenced this in commit e1120c94a1 on Jun 4, 2023
  44. vmta referenced this in commit 8f03457eed on Jul 1, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-22 06:15 UTC

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