Changeset 96fc67 in git


Ignore:
Timestamp:
Nov 14, 2022, 11:23:41 AM (3 months ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
Children:
53bb34c61620c64ea3918faddfdebe69fb462864
Parents:
5416d13394a558a137ad68ab6bb7241079911448
Message:
update m4/ax_*
Location:
m4
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • m4/ax_append_compile_flags.m4

    r5416d1 r96fc67  
    1 # ===========================================================================
    2 #  http://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
    3 # ===========================================================================
     1# ============================================================================
     2#  https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
     3# ============================================================================
    44#
    55# SYNOPSIS
    66#
    7 #   AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS])
     7#   AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
    88#
    99# DESCRIPTION
     
    2121#   force the compiler to issue an error when a bad flag is given.
    2222#
     23#   INPUT gives an alternative input source to AC_COMPILE_IFELSE.
     24#
    2325#   NOTE: This macro depends on the AX_APPEND_FLAG and
    2426#   AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with
     
    2931#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
    3032#
    31 #   This program is free software: you can redistribute it and/or modify it
    32 #   under the terms of the GNU General Public License as published by the
    33 #   Free Software Foundation, either version 3 of the License, or (at your
    34 #   option) any later version.
    35 #
    36 #   This program is distributed in the hope that it will be useful, but
    37 #   WITHOUT ANY WARRANTY; without even the implied warranty of
    38 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
    39 #   Public License for more details.
    40 #
    41 #   You should have received a copy of the GNU General Public License along
    42 #   with this program. If not, see <http://www.gnu.org/licenses/>.
    43 #
    44 #   As a special exception, the respective Autoconf Macro's copyright owner
    45 #   gives unlimited permission to copy, distribute and modify the configure
    46 #   scripts that are the output of Autoconf when processing the Macro. You
    47 #   need not follow the terms of the GNU General Public License when using
    48 #   or distributing such scripts, even though portions of the text of the
    49 #   Macro appear in them. The GNU General Public License (GPL) does govern
    50 #   all other use of the material that constitutes the Autoconf Macro.
    51 #
    52 #   This special exception to the GPL applies to versions of the Autoconf
    53 #   Macro released by the Autoconf Archive. When you make and distribute a
    54 #   modified version of the Autoconf Macro, you may extend this special
    55 #   exception to the GPL to apply to your modified version as well.
     33#   Copying and distribution of this file, with or without modification, are
     34#   permitted in any medium without royalty provided the copyright notice
     35#   and this notice are preserved.  This file is offered as-is, without any
     36#   warranty.
    5637
    57 #serial 3
     38#serial 7
    5839
    5940AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
    60 [AC_REQUIRE([AX_CHECK_COMPILE_FLAG])
    61 AC_REQUIRE([AX_APPEND_FLAG])
     41[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
     42AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
    6243for flag in $1; do
    63   AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3])
     44  AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4])
    6445done
    6546])dnl AX_APPEND_COMPILE_FLAGS
     47
  • m4/ax_append_flag.m4

    r5416d1 r96fc67  
    11# ===========================================================================
    2 #      http://www.gnu.org/software/autoconf-archive/ax_append_flag.html
     2#      https://www.gnu.org/software/autoconf-archive/ax_append_flag.html
    33# ===========================================================================
    44#
     
    2424#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
    2525#
    26 #   This program is free software: you can redistribute it and/or modify it
    27 #   under the terms of the GNU General Public License as published by the
    28 #   Free Software Foundation, either version 3 of the License, or (at your
    29 #   option) any later version.
    30 #
    31 #   This program is distributed in the hope that it will be useful, but
    32 #   WITHOUT ANY WARRANTY; without even the implied warranty of
    33 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
    34 #   Public License for more details.
    35 #
    36 #   You should have received a copy of the GNU General Public License along
    37 #   with this program. If not, see <http://www.gnu.org/licenses/>.
    38 #
    39 #   As a special exception, the respective Autoconf Macro's copyright owner
    40 #   gives unlimited permission to copy, distribute and modify the configure
    41 #   scripts that are the output of Autoconf when processing the Macro. You
    42 #   need not follow the terms of the GNU General Public License when using
    43 #   or distributing such scripts, even though portions of the text of the
    44 #   Macro appear in them. The GNU General Public License (GPL) does govern
    45 #   all other use of the material that constitutes the Autoconf Macro.
    46 #
    47 #   This special exception to the GPL applies to versions of the Autoconf
    48 #   Macro released by the Autoconf Archive. When you make and distribute a
    49 #   modified version of the Autoconf Macro, you may extend this special
    50 #   exception to the GPL to apply to your modified version as well.
     26#   Copying and distribution of this file, with or without modification, are
     27#   permitted in any medium without royalty provided the copyright notice
     28#   and this notice are preserved.  This file is offered as-is, without any
     29#   warranty.
    5130
    52 #serial 2
     31#serial 8
    5332
    5433AC_DEFUN([AX_APPEND_FLAG],
    55 [AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
    56 AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])dnl
    57 AS_VAR_SET_IF(FLAGS,
    58   [case " AS_VAR_GET(FLAGS) " in
    59     *" $1 "*)
    60       AC_RUN_LOG([: FLAGS already contains $1])
    61       ;;
    62     *)
    63       AC_RUN_LOG([: FLAGS="$FLAGS $1"])
    64       AS_VAR_SET(FLAGS, ["AS_VAR_GET(FLAGS) $1"])
    65       ;;
    66    esac],
    67   [AS_VAR_SET(FLAGS,["$1"])])
     34[dnl
     35AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
     36AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
     37AS_VAR_SET_IF(FLAGS,[
     38  AS_CASE([" AS_VAR_GET(FLAGS) "],
     39    [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
     40    [
     41     AS_VAR_APPEND(FLAGS,[" $1"])
     42     AC_RUN_LOG([: FLAGS="$FLAGS"])
     43    ])
     44  ],
     45  [
     46  AS_VAR_SET(FLAGS,[$1])
     47  AC_RUN_LOG([: FLAGS="$FLAGS"])
     48  ])
    6849AS_VAR_POPDEF([FLAGS])dnl
    6950])dnl AX_APPEND_FLAG
     51
  • m4/ax_append_link_flags.m4

    r5416d1 r96fc67  
    11# ===========================================================================
    2 #   http://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html
     2#   https://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html
    33# ===========================================================================
    44#
    55# SYNOPSIS
    66#
    7 #   AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS])
     7#   AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
    88#
    99# DESCRIPTION
     
    2020#   issue an error when a bad flag is given.
    2121#
     22#   INPUT gives an alternative input source to AC_COMPILE_IFELSE.
     23#
    2224#   NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG.
    2325#   Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS.
     
    2729#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
    2830#
    29 #   This program is free software: you can redistribute it and/or modify it
    30 #   under the terms of the GNU General Public License as published by the
    31 #   Free Software Foundation, either version 3 of the License, or (at your
    32 #   option) any later version.
    33 #
    34 #   This program is distributed in the hope that it will be useful, but
    35 #   WITHOUT ANY WARRANTY; without even the implied warranty of
    36 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
    37 #   Public License for more details.
    38 #
    39 #   You should have received a copy of the GNU General Public License along
    40 #   with this program. If not, see <http://www.gnu.org/licenses/>.
    41 #
    42 #   As a special exception, the respective Autoconf Macro's copyright owner
    43 #   gives unlimited permission to copy, distribute and modify the configure
    44 #   scripts that are the output of Autoconf when processing the Macro. You
    45 #   need not follow the terms of the GNU General Public License when using
    46 #   or distributing such scripts, even though portions of the text of the
    47 #   Macro appear in them. The GNU General Public License (GPL) does govern
    48 #   all other use of the material that constitutes the Autoconf Macro.
    49 #
    50 #   This special exception to the GPL applies to versions of the Autoconf
    51 #   Macro released by the Autoconf Archive. When you make and distribute a
    52 #   modified version of the Autoconf Macro, you may extend this special
    53 #   exception to the GPL to apply to your modified version as well.
     31#   Copying and distribution of this file, with or without modification, are
     32#   permitted in any medium without royalty provided the copyright notice
     33#   and this notice are preserved.  This file is offered as-is, without any
     34#   warranty.
    5435
    55 #serial 3
     36#serial 7
    5637
    5738AC_DEFUN([AX_APPEND_LINK_FLAGS],
    58 [AC_REQUIRE([AX_CHECK_LINK_FLAG])
    59 AC_REQUIRE([AX_APPEND_FLAG])
     39[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
     40AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
    6041for flag in $1; do
    61   AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3])
     42  AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3], [$4])
    6243done
    6344])dnl AX_APPEND_LINK_FLAGS
     45
  • m4/ax_check_compile_flag.m4

    r5416d1 r96fc67  
    11# ===========================================================================
    2  http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
     2https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
    33# ===========================================================================
    44#
    55# SYNOPSIS
    66#
    7 #   AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
     7#   AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
    88#
    99# DESCRIPTION
     
    2020#   force the compiler to issue an error when a bad flag is given.
    2121#
     22#   INPUT gives an alternative input source to AC_COMPILE_IFELSE.
     23#
    2224#   NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
    2325#   macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
     
    2830#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
    2931#
    30 #   This program is free software: you can redistribute it and/or modify it
    31 #   under the terms of the GNU General Public License as published by the
    32 #   Free Software Foundation, either version 3 of the License, or (at your
    33 #   option) any later version.
    34 #
    35 #   This program is distributed in the hope that it will be useful, but
    36 #   WITHOUT ANY WARRANTY; without even the implied warranty of
    37 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
    38 #   Public License for more details.
    39 #
    40 #   You should have received a copy of the GNU General Public License along
    41 #   with this program. If not, see <http://www.gnu.org/licenses/>.
    42 #
    43 #   As a special exception, the respective Autoconf Macro's copyright owner
    44 #   gives unlimited permission to copy, distribute and modify the configure
    45 #   scripts that are the output of Autoconf when processing the Macro. You
    46 #   need not follow the terms of the GNU General Public License when using
    47 #   or distributing such scripts, even though portions of the text of the
    48 #   Macro appear in them. The GNU General Public License (GPL) does govern
    49 #   all other use of the material that constitutes the Autoconf Macro.
    50 #
    51 #   This special exception to the GPL applies to versions of the Autoconf
    52 #   Macro released by the Autoconf Archive. When you make and distribute a
    53 #   modified version of the Autoconf Macro, you may extend this special
    54 #   exception to the GPL to apply to your modified version as well.
     32#   Copying and distribution of this file, with or without modification, are
     33#   permitted in any medium without royalty provided the copyright notice
     34#   and this notice are preserved.  This file is offered as-is, without any
     35#   warranty.
    5536
    56 #serial 2
     37#serial 6
    5738
    5839AC_DEFUN([AX_CHECK_COMPILE_FLAG],
    59 [AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
     40[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
    6041AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
    6142AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
    6243  ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
    63   _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1 -Werror"
    64   AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
     44  _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
     45  AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
    6546    [AS_VAR_SET(CACHEVAR,[yes])],
    6647    [AS_VAR_SET(CACHEVAR,[no])])
    6748  _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
    68 AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
     49AS_VAR_IF(CACHEVAR,yes,
    6950  [m4_default([$2], :)],
    7051  [m4_default([$3], :)])
    7152AS_VAR_POPDEF([CACHEVAR])dnl
    7253])dnl AX_CHECK_COMPILE_FLAGS
     54
  • m4/ax_check_link_flag.m4

    r5416d1 r96fc67  
    11# ===========================================================================
    2 #    http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
     2#    https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
    33# ===========================================================================
    44#
    55# SYNOPSIS
    66#
    7 #   AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
     7#   AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
    88#
    99# DESCRIPTION
     
    2020#   issue an error when a bad flag is given.
    2121#
     22#   INPUT gives an alternative input source to AC_LINK_IFELSE.
     23#
    2224#   NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
    2325#   macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
     
    2830#   Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
    2931#
    30 #   This program is free software: you can redistribute it and/or modify it
    31 #   under the terms of the GNU General Public License as published by the
    32 #   Free Software Foundation, either version 3 of the License, or (at your
    33 #   option) any later version.
    34 #
    35 #   This program is distributed in the hope that it will be useful, but
    36 #   WITHOUT ANY WARRANTY; without even the implied warranty of
    37 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
    38 #   Public License for more details.
    39 #
    40 #   You should have received a copy of the GNU General Public License along
    41 #   with this program. If not, see <http://www.gnu.org/licenses/>.
    42 #
    43 #   As a special exception, the respective Autoconf Macro's copyright owner
    44 #   gives unlimited permission to copy, distribute and modify the configure
    45 #   scripts that are the output of Autoconf when processing the Macro. You
    46 #   need not follow the terms of the GNU General Public License when using
    47 #   or distributing such scripts, even though portions of the text of the
    48 #   Macro appear in them. The GNU General Public License (GPL) does govern
    49 #   all other use of the material that constitutes the Autoconf Macro.
    50 #
    51 #   This special exception to the GPL applies to versions of the Autoconf
    52 #   Macro released by the Autoconf Archive. When you make and distribute a
    53 #   modified version of the Autoconf Macro, you may extend this special
    54 #   exception to the GPL to apply to your modified version as well.
     32#   Copying and distribution of this file, with or without modification, are
     33#   permitted in any medium without royalty provided the copyright notice
     34#   and this notice are preserved.  This file is offered as-is, without any
     35#   warranty.
    5536
    56 #serial 2
     37#serial 6
    5738
    5839AC_DEFUN([AX_CHECK_LINK_FLAG],
    59 [AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
     40[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
     41AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
    6042AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
    6143  ax_check_save_flags=$LDFLAGS
    6244  LDFLAGS="$LDFLAGS $4 $1"
    63   _save_cflags="$CFLAGS"
    64   CFLAGS="$CFLAGS -Werror"
    65   AC_LINK_IFELSE([AC_LANG_PROGRAM()],
     45  AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
    6646    [AS_VAR_SET(CACHEVAR,[yes])],
    6747    [AS_VAR_SET(CACHEVAR,[no])])
    68   CFLAGS="$_save_cflags"
    6948  LDFLAGS=$ax_check_save_flags])
    70 AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
     49AS_VAR_IF(CACHEVAR,yes,
    7150  [m4_default([$2], :)],
    7251  [m4_default([$3], :)])
    7352AS_VAR_POPDEF([CACHEVAR])dnl
    7453])dnl AX_CHECK_LINK_FLAGS
     54
  • m4/ax_compute_relative_paths.m4

    r5416d1 r96fc67  
    1 # =============================================================================
    2 #  http://www.gnu.org/software/autoconf-archive/ax_compute_relative_paths.html
    3 # =============================================================================
     1# ==============================================================================
     2#  https://www.gnu.org/software/autoconf-archive/ax_compute_relative_paths.html
     3# ==============================================================================
    44#
    55# SYNOPSIS
     
    3434#   encode $bin_to_data and try to determine $bindir at run-time.
    3535#
    36 #   This macro requires AX_NORMALIZE_PATH.
     36#   This macro requires AX_NORMALIZE_PATH and AX_RECURSIVE_EVAL.
    3737#
    3838# LICENSE
     
    5151#
    5252#   You should have received a copy of the GNU General Public License along
    53 #   with this program. If not, see <http://www.gnu.org/licenses/>.
     53#   with this program. If not, see <https://www.gnu.org/licenses/>.
    5454#
    5555#   As a special exception, the respective Autoconf Macro's copyright owner
     
    6666#   exception to the GPL to apply to your modified version as well.
    6767
    68 #serial 6
     68#serial 12
    6969
    7070AU_ALIAS([ADL_COMPUTE_RELATIVE_PATHS], [AX_COMPUTE_RELATIVE_PATHS])
     
    9696dnl of $RESULT to that value.  This function work on raw filenames
    9797dnl (for instead it will considerate /usr//local and /usr/local as
    98 dnl two distinct paths), you should really use AX_COMPUTE_REALTIVE_PATHS
     98dnl two distinct paths), you should really use AX_COMPUTE_RELATIVE_PATHS
    9999dnl instead to have the paths sanitized automatically.
    100100dnl
     
    136136dnl AX_COMPUTE_SUFFIX_PATH(PATH, SUBPATH, RESULT)
    137137dnl ==============================================
    138 dnl Substrack $SUBPATH from $PATH, and set the resulting suffix
     138dnl Subtract $SUBPATH from $PATH, and set the resulting suffix
    139139dnl (or the empty string if $SUBPATH is not a subpath of $PATH)
    140140dnl to $RESULT.
    141141dnl
    142 dnl For instace:
     142dnl For instance:
    143143dnl    first_path=/somewhere/on/my/disk/bin
    144144dnl    second_path=/somewhere/on
     
    173173done])
    174174
    175 
    176 dnl AX_RECURSIVE_EVAL(VALUE, RESULT)
    177 dnl =================================
    178 dnl Interpolate the VALUE in loop until it doesn't change,
    179 dnl and set the result to $RESULT.
    180 dnl WARNING: It's easy to get an infinite loop with some unsane input.
    181 AC_DEFUN([AX_RECURSIVE_EVAL],
    182 [_lcl_receval="$1"
    183 $2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix"
    184      test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
    185      _lcl_receval_old=''
    186      while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do
    187        _lcl_receval_old="[$]_lcl_receval"
    188        eval _lcl_receval="\"[$]_lcl_receval\""
    189      done
    190      echo "[$]_lcl_receval")`])
  • m4/ax_normalize_path.m4

    r5416d1 r96fc67  
    11# ===========================================================================
    2 #     http://www.gnu.org/software/autoconf-archive/ax_normalize_path.html
     2#    https://www.gnu.org/software/autoconf-archive/ax_normalize_path.html
    33# ===========================================================================
    44#
     
    8181#
    8282#   You should have received a copy of the GNU General Public License along
    83 #   with this program. If not, see <http://www.gnu.org/licenses/>.
     83#   with this program. If not, see <https://www.gnu.org/licenses/>.
    8484#
    8585#   As a special exception, the respective Autoconf Macro's copyright owner
     
    9696#   exception to the GPL to apply to your modified version as well.
    9797
    98 #serial 5
     98#serial 8
    9999
    100100AU_ALIAS([ADL_NORMALIZE_PATH], [AX_NORMALIZE_PATH])
     
    107107  :*:) ;;
    108108esac
    109 # squeze repeated slashes
     109# squeeze repeated slashes
    110110case ifelse($2,,"[$]$1",$2) in
    111111# if the path contains any backslashes, turn slashes into backslashes
     
    114114 *) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1/,g'` ;;
    115115esac])
     116
  • m4/ax_prog_cc_for_build.m4

    r5416d1 r96fc67  
    3333#   warranty.
    3434
    35 #serial 18
     35#serial 21
    3636
    3737AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
     
    4545pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
    4646pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_c89)dnl
     47pushdef([ac_cv_prog_cc_c99], ac_cv_build_prog_cc_c99)dnl
     48pushdef([ac_cv_prog_cc_c11], ac_cv_build_prog_cc_c11)dnl
    4749pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
    4850pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
     
    8486
    8587AC_LANG_PUSH([C])
     88
     89dnl The pushdef([ac_cv_c_compiler_gnu], ...) currently does not cover
     90dnl the use of this variable in _AC_LANG_COMPILER_GNU called by
     91dnl AC_PROG_CC. Unset this cache variable temporarily as a workaround.
     92was_set_c_compiler_gnu=${[ac_cv_c_compiler_gnu]+y}
     93AS_IF([test ${was_set_c_compiler_gnu}],
     94    [saved_c_compiler_gnu=$[ac_cv_c_compiler_gnu]
     95    AS_UNSET([[ac_cv_c_compiler_gnu]])])
     96
    8697AC_PROG_CC
     98
     99dnl Restore ac_cv_c_compiler_gnu
     100AS_IF([test ${was_set_c_compiler_gnu}],
     101  [[ac_cv_c_compiler_gnu]=$[saved_c_compiler_gnu]])
     102
    87103_AC_COMPILER_EXEEXT
    88104_AC_COMPILER_OBJEXT
     
    138154AC_SUBST([LDFLAGS_FOR_BUILD])dnl
    139155])
     156
  • m4/ax_pthread.m4

    r5416d1 r96fc67  
    11# ===========================================================================
    2 #        http://www.gnu.org/software/autoconf-archive/ax_pthread.html
     2#        https://www.gnu.org/software/autoconf-archive/ax_pthread.html
    33# ===========================================================================
    44#
     
    1515#   flags/libs to be tested by setting these environment variables.)
    1616#
    17 #   Also sets PTHREAD_CC to any special C compiler that is needed for
    18 #   multi-threaded programs (defaults to the value of CC otherwise). (This
    19 #   is necessary on AIX to use the special cc_r compiler alias.)
     17#   Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is
     18#   needed for multi-threaded programs (defaults to the value of CC
     19#   respectively CXX otherwise). (This is necessary on e.g. AIX to use the
     20#   special cc_r/CC_r compiler alias.)
    2021#
    2122#   NOTE: You are assumed to not only compile your program with these flags,
    2223#   but also to link with them as well. For example, you might link with
    2324#   $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
     25#   $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
    2426#
    2527#   If you are only building threaded programs, you may wish to use these
     
    2830#     LIBS="$PTHREAD_LIBS $LIBS"
    2931#     CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
     32#     CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
    3033#     CC="$PTHREAD_CC"
     34#     CXX="$PTHREAD_CXX"
    3135#
    3236#   In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
     
    5660#   Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
    5761#   Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
     62#   Copyright (c) 2019 Marc Stevens <marc.stevens@cwi.nl>
    5863#
    5964#   This program is free software: you can redistribute it and/or modify it
     
    6873#
    6974#   You should have received a copy of the GNU General Public License along
    70 #   with this program. If not, see <http://www.gnu.org/licenses/>.
     75#   with this program. If not, see <https://www.gnu.org/licenses/>.
    7176#
    7277#   As a special exception, the respective Autoconf Macro's copyright owner
     
    8388#   exception to the GPL to apply to your modified version as well.
    8489
    85 #serial 23
     90#serial 31
    8691
    8792AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
     
    105110        ax_pthread_save_LIBS="$LIBS"
    106111        AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
     112        AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"])
    107113        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
    108114        LIBS="$PTHREAD_LIBS $LIBS"
     
    124130# libraries is broken (non-POSIX).
    125131
    126 # Create a list of thread flags to try.  Items starting with a "-" are
    127 # C compiler flags, and other items are library names, except for "none"
    128 # which indicates that we try without any flags at all, and "pthread-config"
    129 # which is a program returning the flags for the Pth emulation library.
     132# Create a list of thread flags to try. Items with a "," contain both
     133# C compiler flags (before ",") and linker flags (after ","). Other items
     134# starting with a "-" are C compiler flags, and remaining items are
     135# library names, except for "none" which indicates that we try without
     136# any flags at all, and "pthread-config" which is a program returning
     137# the flags for the Pth emulation library.
    130138
    131139ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
     
    195203        # standard Solaris way of linking pthreads (-mt -lpthread).
    196204
    197         ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags"
     205        ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags"
    198206        ;;
    199207esac
    200 
    201 # GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
    202 
    203 AS_IF([test "x$GCC" = "xyes"],
    204       [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"])
    205 
    206 # The presence of a feature test macro requesting re-entrant function
    207 # definitions is, on some systems, a strong hint that pthreads support is
    208 # correctly enabled
    209 
    210 case $host_os in
    211         darwin* | hpux* | linux* | osf* | solaris*)
    212         ax_pthread_check_macro="_REENTRANT"
    213         ;;
    214 
    215         aix*)
    216         ax_pthread_check_macro="_THREAD_SAFE"
    217         ;;
    218 
    219         *)
    220         ax_pthread_check_macro="--"
    221         ;;
    222 esac
    223 AS_IF([test "x$ax_pthread_check_macro" = "x--"],
    224       [ax_pthread_check_cond=0],
    225       [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
    226208
    227209# Are we compiling with Clang?
     
    243225ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
    244226
    245 ax_pthread_clang_warning=no
     227
     228# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
     229
     230# Note that for GCC and Clang -pthread generally implies -lpthread,
     231# except when -nostdlib is passed.
     232# This is problematic using libtool to build C++ shared libraries with pthread:
     233# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
     234# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333
     235# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555
     236# To solve this, first try -pthread together with -lpthread for GCC
     237
     238AS_IF([test "x$GCC" = "xyes"],
     239      [ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"])
     240
     241# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first
     242
     243AS_IF([test "x$ax_pthread_clang" = "xyes"],
     244      [ax_pthread_flags="-pthread,-lpthread -pthread"])
     245
     246
     247# The presence of a feature test macro requesting re-entrant function
     248# definitions is, on some systems, a strong hint that pthreads support is
     249# correctly enabled
     250
     251case $host_os in
     252        darwin* | hpux* | linux* | osf* | solaris*)
     253        ax_pthread_check_macro="_REENTRANT"
     254        ;;
     255
     256        aix*)
     257        ax_pthread_check_macro="_THREAD_SAFE"
     258        ;;
     259
     260        *)
     261        ax_pthread_check_macro="--"
     262        ;;
     263esac
     264AS_IF([test "x$ax_pthread_check_macro" = "x--"],
     265      [ax_pthread_check_cond=0],
     266      [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
     267
     268
     269if test "x$ax_pthread_ok" = "xno"; then
     270for ax_pthread_try_flag in $ax_pthread_flags; do
     271
     272        case $ax_pthread_try_flag in
     273                none)
     274                AC_MSG_CHECKING([whether pthreads work without any flags])
     275                ;;
     276
     277                *,*)
     278                PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"`
     279                PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"`
     280                AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"])
     281                ;;
     282
     283                -*)
     284                AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
     285                PTHREAD_CFLAGS="$ax_pthread_try_flag"
     286                ;;
     287
     288                pthread-config)
     289                AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
     290                AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
     291                PTHREAD_CFLAGS="`pthread-config --cflags`"
     292                PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
     293                ;;
     294
     295                *)
     296                AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
     297                PTHREAD_LIBS="-l$ax_pthread_try_flag"
     298                ;;
     299        esac
     300
     301        ax_pthread_save_CFLAGS="$CFLAGS"
     302        ax_pthread_save_LIBS="$LIBS"
     303        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
     304        LIBS="$PTHREAD_LIBS $LIBS"
     305
     306        # Check for various functions.  We must include pthread.h,
     307        # since some functions may be macros.  (On the Sequent, we
     308        # need a special flag -Kthread to make this header compile.)
     309        # We check for pthread_join because it is in -lpthread on IRIX
     310        # while pthread_create is in libc.  We check for pthread_attr_init
     311        # due to DEC craziness with -lpthreads.  We check for
     312        # pthread_cleanup_push because it is one of the few pthread
     313        # functions on Solaris that doesn't have a non-functional libc stub.
     314        # We try pthread_create on general principles.
     315
     316        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
     317#                       if $ax_pthread_check_cond
     318#                        error "$ax_pthread_check_macro must be defined"
     319#                       endif
     320                        static void *some_global = NULL;
     321                        static void routine(void *a)
     322                          {
     323                             /* To avoid any unused-parameter or
     324                                unused-but-set-parameter warning.  */
     325                             some_global = a;
     326                          }
     327                        static void *start_routine(void *a) { return a; }],
     328                       [pthread_t th; pthread_attr_t attr;
     329                        pthread_create(&th, 0, start_routine, 0);
     330                        pthread_join(th, 0);
     331                        pthread_attr_init(&attr);
     332                        pthread_cleanup_push(routine, 0);
     333                        pthread_cleanup_pop(0) /* ; */])],
     334            [ax_pthread_ok=yes],
     335            [])
     336
     337        CFLAGS="$ax_pthread_save_CFLAGS"
     338        LIBS="$ax_pthread_save_LIBS"
     339
     340        AC_MSG_RESULT([$ax_pthread_ok])
     341        AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
     342
     343        PTHREAD_LIBS=""
     344        PTHREAD_CFLAGS=""
     345done
     346fi
     347
    246348
    247349# Clang needs special handling, because older versions handle the -pthread
     
    261363        # -pthread does define _REENTRANT, and while the Darwin headers
    262364        # ignore this macro, third-party headers might not.)
    263 
    264         PTHREAD_CFLAGS="-pthread"
    265         PTHREAD_LIBS=
    266 
    267         ax_pthread_ok=yes
    268365
    269366        # However, older versions of Clang make a point of warning the user
     
    295392             ax_pthread_save_ac_link="$ac_link"
    296393             ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
    297              ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"`
     394             ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"`
    298395             ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
    299396             ax_pthread_save_CFLAGS="$CFLAGS"
     
    321418fi # $ax_pthread_clang = yes
    322419
    323 if test "x$ax_pthread_ok" = "xno"; then
    324 for ax_pthread_try_flag in $ax_pthread_flags; do
    325 
    326         case $ax_pthread_try_flag in
    327                 none)
    328                 AC_MSG_CHECKING([whether pthreads work without any flags])
    329                 ;;
    330 
    331                 -mt,pthread)
    332                 AC_MSG_CHECKING([whether pthreads work with -mt -lpthread])
    333                 PTHREAD_CFLAGS="-mt"
    334                 PTHREAD_LIBS="-lpthread"
    335                 ;;
    336 
    337                 -*)
    338                 AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
    339                 PTHREAD_CFLAGS="$ax_pthread_try_flag"
    340                 ;;
    341 
    342                 pthread-config)
    343                 AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
    344                 AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
    345                 PTHREAD_CFLAGS="`pthread-config --cflags`"
    346                 PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
    347                 ;;
    348 
    349                 *)
    350                 AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
    351                 PTHREAD_LIBS="-l$ax_pthread_try_flag"
    352                 ;;
    353         esac
    354 
    355         ax_pthread_save_CFLAGS="$CFLAGS"
    356         ax_pthread_save_LIBS="$LIBS"
    357         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
    358         LIBS="$PTHREAD_LIBS $LIBS"
    359 
    360         # Check for various functions.  We must include pthread.h,
    361         # since some functions may be macros.  (On the Sequent, we
    362         # need a special flag -Kthread to make this header compile.)
    363         # We check for pthread_join because it is in -lpthread on IRIX
    364         # while pthread_create is in libc.  We check for pthread_attr_init
    365         # due to DEC craziness with -lpthreads.  We check for
    366         # pthread_cleanup_push because it is one of the few pthread
    367         # functions on Solaris that doesn't have a non-functional libc stub.
    368         # We try pthread_create on general principles.
    369 
    370         AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
    371 #                       if $ax_pthread_check_cond
    372 #                        error "$ax_pthread_check_macro must be defined"
    373 #                       endif
    374                         static void routine(void *a) { a = 0; }
    375                         static void *start_routine(void *a) { return a; }],
    376                        [pthread_t th; pthread_attr_t attr;
    377                         pthread_create(&th, 0, start_routine, 0);
    378                         pthread_join(th, 0);
    379                         pthread_attr_init(&attr);
    380                         pthread_cleanup_push(routine, 0);
    381                         pthread_cleanup_pop(0) /* ; */])],
    382             [ax_pthread_ok=yes],
    383             [])
    384 
    385         CFLAGS="$ax_pthread_save_CFLAGS"
    386         LIBS="$ax_pthread_save_LIBS"
    387 
    388         AC_MSG_RESULT([$ax_pthread_ok])
    389         AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
    390 
    391         PTHREAD_LIBS=""
    392         PTHREAD_CFLAGS=""
    393 done
    394 fi
     420
    395421
    396422# Various other checks:
     
    439465            [ax_cv_PTHREAD_PRIO_INHERIT],
    440466            [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
    441                                              [[int i = PTHREAD_PRIO_INHERIT;]])],
     467                                             [[int i = PTHREAD_PRIO_INHERIT;
     468                                               return i;]])],
    442469                            [ax_cv_PTHREAD_PRIO_INHERIT=yes],
    443470                            [ax_cv_PTHREAD_PRIO_INHERIT=no])
     
    461488                     AS_CASE(["x$CC"],
    462489                         [x/*],
    463                          [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
    464                          [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
     490                         [
     491                           AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])
     492                           AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])])
     493                         ],
     494                         [
     495                           AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])
     496                           AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])])
     497                         ]
     498                     )
     499                    ])
    465500                ;;
    466501            esac
     
    469504
    470505test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
     506test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
    471507
    472508AC_SUBST([PTHREAD_LIBS])
    473509AC_SUBST([PTHREAD_CFLAGS])
    474510AC_SUBST([PTHREAD_CC])
     511AC_SUBST([PTHREAD_CXX])
    475512
    476513# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
     
    484521AC_LANG_POP
    485522])dnl AX_PTHREAD
     523
Note: See TracChangeset for help on using the changeset viewer.