代码之家  ›  专栏  ›  技术社区  ›  jww avp

基于编译器动态更改“configure--help”字符串

  •  1
  • jww avp  · 技术社区  · 6 年前

    这个问题与 Help string variable substitution for “configure --help” . 我们的 configure.ac 有以下内容。 IS_SUN_COMPILER 按预期工作。

    IS_SUN_COMPILER=`echo $COMPILER_VERSION | $EGREP -i -c -E 'Sun C\+\+'`
    ...
    
    if test "$IS_SUN_COMPILER" = "1"; then
       DEF_VALUE_TLS=no
       m4_define([HELP_STRING_TLS], [enable thread storage (default is no)])
    else
       DEF_VALUE_TLS=yes
       m4_define([HELP_STRING_TLS], [enable thread storage (default is yes)])
    fi
    
    AC_ARG_ENABLE(tls,
       AS_HELP_STRING([--enable-tls], [HELP_STRING_TLS]),
       ac_enable_tls=$enableval,
       ac_enable_tls=$DEF_VALUE_TLS)
    AM_CONDITIONAL(HAS_PTHREADS, test $ac_enable_tls = yes)
    

    在Linux和OS X上测试正常,并且 默认为是 显示。当我使用suncc在Solaris上测试时,默认值是 默认为是 这是不正确的:

    CXX=/opt/developerstudio12.6/bin/CC ./configure --help
    ...
    
      --enable-tls            enable thread storage (default is yes)
    

    如何动态更改默认值和帮助字符串?

    1 回复  |  直到 6 年前
        1
  •  1
  •   John Bollinger    6 年前

    configure --help

    m4 configure

    if test "$IS_SUN_COMPILER" = "1"; then
       DEF_VALUE_TLS=no
       m4_define([HELP_STRING_TLS], [enable thread storage (default is no)])
    else
       DEF_VALUE_TLS=yes
       m4_define([HELP_STRING_TLS], [enable thread storage (default is yes)])
    fi
    

    HELP_STRING_TLS if


    enable-tls

    AC_ARG_ENABLE([tls],
      AS_HELP_STRING([--enable-tls],
        [enable thread-local storage (default is compiler-dependent)]),
      [], [enable_tls=""]
    )
    # note: you get shell variable $enable_tls for free when the --enable or
    # --disable option is given; no need to create another variable
    
    # ...
    
    AS_IF([test "x$enable_tls" = x], [
      AS_IF([test "$IS_SUN_COMPILER" = "1"], [
        enable_tls=no
      ], [
        enable_tls=yes
      ]
    ])
    
    AM_CONDITIONAL([HAS_PTHREADS], [test "$enable_tls" = yes])
    


    • ac_

    • HAS_PTHREADS USE_PTHREADS --enable-pthreads