pf2 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -2
  3. data/Cargo.lock +650 -0
  4. data/Cargo.toml +3 -0
  5. data/README.md +110 -13
  6. data/Rakefile +8 -0
  7. data/crates/backtrace-sys2/.gitignore +1 -0
  8. data/crates/backtrace-sys2/Cargo.toml +9 -0
  9. data/crates/backtrace-sys2/build.rs +48 -0
  10. data/crates/backtrace-sys2/src/lib.rs +5 -0
  11. data/crates/backtrace-sys2/src/libbacktrace/.gitignore +15 -0
  12. data/crates/backtrace-sys2/src/libbacktrace/Isaac.Newton-Opticks.txt +9286 -0
  13. data/crates/backtrace-sys2/src/libbacktrace/LICENSE +29 -0
  14. data/crates/backtrace-sys2/src/libbacktrace/Makefile.am +623 -0
  15. data/crates/backtrace-sys2/src/libbacktrace/Makefile.in +2666 -0
  16. data/crates/backtrace-sys2/src/libbacktrace/README.md +36 -0
  17. data/crates/backtrace-sys2/src/libbacktrace/aclocal.m4 +864 -0
  18. data/crates/backtrace-sys2/src/libbacktrace/alloc.c +167 -0
  19. data/crates/backtrace-sys2/src/libbacktrace/allocfail.c +136 -0
  20. data/crates/backtrace-sys2/src/libbacktrace/allocfail.sh +104 -0
  21. data/crates/backtrace-sys2/src/libbacktrace/atomic.c +113 -0
  22. data/crates/backtrace-sys2/src/libbacktrace/backtrace-supported.h.in +66 -0
  23. data/crates/backtrace-sys2/src/libbacktrace/backtrace.c +129 -0
  24. data/crates/backtrace-sys2/src/libbacktrace/backtrace.h +189 -0
  25. data/crates/backtrace-sys2/src/libbacktrace/btest.c +501 -0
  26. data/crates/backtrace-sys2/src/libbacktrace/compile +348 -0
  27. data/crates/backtrace-sys2/src/libbacktrace/config/enable.m4 +38 -0
  28. data/crates/backtrace-sys2/src/libbacktrace/config/lead-dot.m4 +31 -0
  29. data/crates/backtrace-sys2/src/libbacktrace/config/libtool.m4 +7436 -0
  30. data/crates/backtrace-sys2/src/libbacktrace/config/ltoptions.m4 +369 -0
  31. data/crates/backtrace-sys2/src/libbacktrace/config/ltsugar.m4 +123 -0
  32. data/crates/backtrace-sys2/src/libbacktrace/config/ltversion.m4 +23 -0
  33. data/crates/backtrace-sys2/src/libbacktrace/config/lt~obsolete.m4 +98 -0
  34. data/crates/backtrace-sys2/src/libbacktrace/config/multi.m4 +68 -0
  35. data/crates/backtrace-sys2/src/libbacktrace/config/override.m4 +117 -0
  36. data/crates/backtrace-sys2/src/libbacktrace/config/unwind_ipinfo.m4 +37 -0
  37. data/crates/backtrace-sys2/src/libbacktrace/config/warnings.m4 +227 -0
  38. data/crates/backtrace-sys2/src/libbacktrace/config.guess +1700 -0
  39. data/crates/backtrace-sys2/src/libbacktrace/config.h.in +182 -0
  40. data/crates/backtrace-sys2/src/libbacktrace/config.sub +1885 -0
  41. data/crates/backtrace-sys2/src/libbacktrace/configure +15740 -0
  42. data/crates/backtrace-sys2/src/libbacktrace/configure.ac +613 -0
  43. data/crates/backtrace-sys2/src/libbacktrace/dwarf.c +4402 -0
  44. data/crates/backtrace-sys2/src/libbacktrace/edtest.c +120 -0
  45. data/crates/backtrace-sys2/src/libbacktrace/edtest2.c +43 -0
  46. data/crates/backtrace-sys2/src/libbacktrace/elf.c +7443 -0
  47. data/crates/backtrace-sys2/src/libbacktrace/fileline.c +407 -0
  48. data/crates/backtrace-sys2/src/libbacktrace/filenames.h +52 -0
  49. data/crates/backtrace-sys2/src/libbacktrace/filetype.awk +13 -0
  50. data/crates/backtrace-sys2/src/libbacktrace/install-debuginfo-for-buildid.sh.in +65 -0
  51. data/crates/backtrace-sys2/src/libbacktrace/install-sh +501 -0
  52. data/crates/backtrace-sys2/src/libbacktrace/instrumented_alloc.c +114 -0
  53. data/crates/backtrace-sys2/src/libbacktrace/internal.h +389 -0
  54. data/crates/backtrace-sys2/src/libbacktrace/libtool.m4 +7436 -0
  55. data/crates/backtrace-sys2/src/libbacktrace/ltmain.sh +8636 -0
  56. data/crates/backtrace-sys2/src/libbacktrace/ltoptions.m4 +369 -0
  57. data/crates/backtrace-sys2/src/libbacktrace/ltsugar.m4 +123 -0
  58. data/crates/backtrace-sys2/src/libbacktrace/ltversion.m4 +23 -0
  59. data/crates/backtrace-sys2/src/libbacktrace/lt~obsolete.m4 +98 -0
  60. data/crates/backtrace-sys2/src/libbacktrace/macho.c +1355 -0
  61. data/crates/backtrace-sys2/src/libbacktrace/missing +215 -0
  62. data/crates/backtrace-sys2/src/libbacktrace/mmap.c +331 -0
  63. data/crates/backtrace-sys2/src/libbacktrace/mmapio.c +110 -0
  64. data/crates/backtrace-sys2/src/libbacktrace/move-if-change +83 -0
  65. data/crates/backtrace-sys2/src/libbacktrace/mtest.c +410 -0
  66. data/crates/backtrace-sys2/src/libbacktrace/nounwind.c +66 -0
  67. data/crates/backtrace-sys2/src/libbacktrace/pecoff.c +957 -0
  68. data/crates/backtrace-sys2/src/libbacktrace/posix.c +104 -0
  69. data/crates/backtrace-sys2/src/libbacktrace/print.c +92 -0
  70. data/crates/backtrace-sys2/src/libbacktrace/read.c +110 -0
  71. data/crates/backtrace-sys2/src/libbacktrace/simple.c +108 -0
  72. data/crates/backtrace-sys2/src/libbacktrace/sort.c +108 -0
  73. data/crates/backtrace-sys2/src/libbacktrace/state.c +72 -0
  74. data/crates/backtrace-sys2/src/libbacktrace/stest.c +137 -0
  75. data/crates/backtrace-sys2/src/libbacktrace/test-driver +148 -0
  76. data/crates/backtrace-sys2/src/libbacktrace/test_format.c +55 -0
  77. data/crates/backtrace-sys2/src/libbacktrace/testlib.c +234 -0
  78. data/crates/backtrace-sys2/src/libbacktrace/testlib.h +110 -0
  79. data/crates/backtrace-sys2/src/libbacktrace/ttest.c +161 -0
  80. data/crates/backtrace-sys2/src/libbacktrace/unittest.c +92 -0
  81. data/crates/backtrace-sys2/src/libbacktrace/unknown.c +65 -0
  82. data/crates/backtrace-sys2/src/libbacktrace/xcoff.c +1606 -0
  83. data/crates/backtrace-sys2/src/libbacktrace/xztest.c +508 -0
  84. data/crates/backtrace-sys2/src/libbacktrace/zstdtest.c +523 -0
  85. data/crates/backtrace-sys2/src/libbacktrace/ztest.c +541 -0
  86. data/ext/pf2/Cargo.toml +25 -0
  87. data/ext/pf2/build.rs +3 -0
  88. data/ext/pf2/extconf.rb +6 -1
  89. data/ext/pf2/src/backtrace.rs +126 -0
  90. data/ext/pf2/src/lib.rs +15 -0
  91. data/ext/pf2/src/profile.rs +65 -0
  92. data/ext/pf2/src/profile_serializer.rs +204 -0
  93. data/ext/pf2/src/ringbuffer.rs +152 -0
  94. data/ext/pf2/src/ruby_init.rs +74 -0
  95. data/ext/pf2/src/sample.rs +66 -0
  96. data/ext/pf2/src/siginfo_t.c +5 -0
  97. data/ext/pf2/src/signal_scheduler/configuration.rs +31 -0
  98. data/ext/pf2/src/signal_scheduler/timer_installer.rs +199 -0
  99. data/ext/pf2/src/signal_scheduler.rs +311 -0
  100. data/ext/pf2/src/timer_thread_scheduler.rs +319 -0
  101. data/ext/pf2/src/util.rs +30 -0
  102. data/lib/pf2/cli.rb +1 -1
  103. data/lib/pf2/reporter.rb +48 -16
  104. data/lib/pf2/version.rb +1 -1
  105. data/lib/pf2.rb +20 -5
  106. metadata +128 -5
  107. data/ext/pf2/pf2.c +0 -246
@@ -0,0 +1,117 @@
1
+ dnl Fix Autoconf bugs by overriding broken internal Autoconf
2
+ dnl macros with backports of fixes from newer releases.
3
+ dnl
4
+ dnl The override bits of this file should be a no-op for the newest
5
+ dnl Autoconf version, which means they can be removed once the complete
6
+ dnl tree has moved to a new enough Autoconf version.
7
+ dnl
8
+ dnl The _GCC_AUTOCONF_VERSION_TEST ensures that exactly the desired
9
+ dnl Autoconf version is used. It should be kept for consistency.
10
+
11
+ dnl Use ifdef/ifelse over m4_ifdef/m4_ifelse to be clean for 2.13.
12
+ ifdef([m4_PACKAGE_VERSION], [
13
+
14
+ dnl Provide m4_copy_force and m4_rename_force for old Autoconf versions.
15
+
16
+ m4_ifndef([m4_copy_force],
17
+ [m4_define([m4_copy_force],
18
+ [m4_ifdef([$2], [m4_undefine([$2])])m4_copy($@)])])
19
+
20
+ m4_ifndef([m4_rename_force],
21
+ [m4_define([m4_rename_force],
22
+ [m4_ifdef([$2], [m4_undefine([$2])])m4_rename($@)])])
23
+
24
+ dnl AC_DEFUN a commonly used macro so this file is picked up.
25
+ m4_copy([AC_PREREQ], [_AC_PREREQ])
26
+ AC_DEFUN([AC_PREREQ], [frob])
27
+ m4_copy_force([_AC_PREREQ], [AC_PREREQ])
28
+
29
+
30
+ dnl Ensure exactly this Autoconf version is used
31
+ m4_ifndef([_GCC_AUTOCONF_VERSION],
32
+ [m4_define([_GCC_AUTOCONF_VERSION], [2.69])])
33
+
34
+ dnl Test for the exact version when AC_INIT is expanded.
35
+ dnl This allows to update the tree in steps (for testing)
36
+ dnl by putting
37
+ dnl m4_define([_GCC_AUTOCONF_VERSION], [X.Y])
38
+ dnl in configure.ac before AC_INIT,
39
+ dnl without rewriting this file.
40
+ dnl Or for updating the whole tree at once with the definition above.
41
+ AC_DEFUN([_GCC_AUTOCONF_VERSION_CHECK],
42
+ [m4_if(m4_defn([_GCC_AUTOCONF_VERSION]),
43
+ m4_defn([m4_PACKAGE_VERSION]), [],
44
+ [m4_fatal([Please use exactly Autoconf ]_GCC_AUTOCONF_VERSION[ instead of ]m4_defn([m4_PACKAGE_VERSION])[.])])
45
+ ])
46
+ dnl don't do this for libbacktrace
47
+ dnl m4_define([AC_INIT], m4_defn([AC_INIT])[
48
+ dnl _GCC_AUTOCONF_VERSION_CHECK
49
+ dnl ])
50
+
51
+
52
+ dnl Ensure we do not use a buggy M4.
53
+ m4_if(m4_index([..wi.d.], [.d.]), [-1],
54
+ [m4_fatal(m4_do([m4 with buggy strstr detected. Please install
55
+ GNU M4 1.4.16 or newer and set the M4 environment variable]))])
56
+
57
+
58
+ dnl Fix 2.64 cross compile detection for AVR and RTEMS
59
+ dnl by not trying to compile fopen.
60
+ m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.64],
61
+ [m4_foreach([_GCC_LANG], [C, C++, Fortran, Fortran 77],
62
+ [m4_define([_AC_LANG_IO_PROGRAM(]_GCC_LANG[)], m4_defn([AC_LANG_PROGRAM(]_GCC_LANG[)]))])])
63
+
64
+ m4_version_prereq([2.66],, [
65
+ dnl We need AC_CHECK_DECL which works for overloaded C++ functions.
66
+
67
+ # _AC_CHECK_DECL_BODY
68
+ # -------------------
69
+ # Shell function body for AC_CHECK_DECL.
70
+ m4_define([_AC_CHECK_DECL_BODY],
71
+ [ AS_LINENO_PUSH([$[]1])
72
+ [as_decl_name=`echo $][2|sed 's/ *(.*//'`]
73
+ [as_decl_use=`echo $][2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`]
74
+ AC_CACHE_CHECK([whether $as_decl_name is declared], [$[]3],
75
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$[]4],
76
+ [@%:@ifndef $[]as_decl_name
77
+ @%:@ifdef __cplusplus
78
+ (void) $[]as_decl_use;
79
+ @%:@else
80
+ (void) $[]as_decl_name;
81
+ @%:@endif
82
+ @%:@endif
83
+ ])],
84
+ [AS_VAR_SET([$[]3], [yes])],
85
+ [AS_VAR_SET([$[]3], [no])])])
86
+ AS_LINENO_POP
87
+ ])# _AC_CHECK_DECL_BODY
88
+
89
+ # _AC_CHECK_DECLS(SYMBOL, ACTION-IF_FOUND, ACTION-IF-NOT-FOUND,
90
+ # INCLUDES)
91
+ # -------------------------------------------------------------
92
+ # Helper to AC_CHECK_DECLS, which generates the check for a single
93
+ # SYMBOL with INCLUDES, performs the AC_DEFINE, then expands
94
+ # ACTION-IF-FOUND or ACTION-IF-NOT-FOUND.
95
+ m4_define([_AC_CHECK_DECLS],
96
+ [AC_CHECK_DECL([$1], [ac_have_decl=1], [ac_have_decl=0], [$4])]dnl
97
+ [AC_DEFINE_UNQUOTED(AS_TR_CPP(m4_bpatsubst(HAVE_DECL_[$1],[ *(.*])),
98
+ [$ac_have_decl],
99
+ [Define to 1 if you have the declaration of `$1',
100
+ and to 0 if you don't.])]dnl
101
+ [m4_ifvaln([$2$3], [AS_IF([test $ac_have_decl = 1], [$2], [$3])])])
102
+
103
+ ])
104
+
105
+ dnl If flex/lex are not found, the top level configure sets LEX to
106
+ dnl "/path_to/missing flex". When AC_PROG_LEX tries to find the flex
107
+ dnl output file, it calls $LEX to do so, but the current lightweight
108
+ dnl "missing" won't create a file. This results in an error.
109
+ dnl Avoid calling the bulk of AC_PROG_LEX when $LEX is "missing".
110
+ AC_DEFUN_ONCE([AC_PROG_LEX],
111
+ [AC_CHECK_PROGS(LEX, flex lex, :)
112
+ case "$LEX" in
113
+ :|*"missing "*) ;;
114
+ *) _AC_PROG_LEX_YYTEXT_DECL ;;
115
+ esac])
116
+
117
+ ])
@@ -0,0 +1,37 @@
1
+ dnl
2
+ dnl Check whether _Unwind_GetIPInfo is available without doing a link
3
+ dnl test so we can use this with libstdc++-v3 and libjava. Need to
4
+ dnl use $target to set defaults because automatic checking is not possible
5
+ dnl without a link test (and maybe even with a link test).
6
+ dnl
7
+
8
+ AC_DEFUN([GCC_CHECK_UNWIND_GETIPINFO], [
9
+ AC_ARG_WITH(system-libunwind,
10
+ [ --with-system-libunwind use installed libunwind])
11
+ # If system-libunwind was not specifically set, pick a default setting.
12
+ if test x$with_system_libunwind = x; then
13
+ case ${target} in
14
+ ia64-*-hpux*) with_system_libunwind=yes ;;
15
+ *) with_system_libunwind=no ;;
16
+ esac
17
+ fi
18
+ # Based on system-libunwind and target, do we have ipinfo?
19
+ if test x$with_system_libunwind = xyes; then
20
+ case ${target} in
21
+ ia64-*-*) have_unwind_getipinfo=no ;;
22
+ *) have_unwind_getipinfo=yes ;;
23
+ esac
24
+ else
25
+ # Darwin before version 9 does not have _Unwind_GetIPInfo.
26
+ changequote(,)
27
+ case ${target} in
28
+ *-*-darwin[3-8]|*-*-darwin[3-8].*) have_unwind_getipinfo=no ;;
29
+ *) have_unwind_getipinfo=yes ;;
30
+ esac
31
+ changequote([,])
32
+ fi
33
+
34
+ if test x$have_unwind_getipinfo = xyes; then
35
+ AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.])
36
+ fi
37
+ ])
@@ -0,0 +1,227 @@
1
+ # Autoconf include file defining macros related to compile-time warnings.
2
+
3
+ # Copyright 2004, 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
4
+
5
+ #This file is part of GCC.
6
+
7
+ #GCC is free software; you can redistribute it and/or modify it under
8
+ #the terms of the GNU General Public License as published by the Free
9
+ #Software Foundation; either version 3, or (at your option) any later
10
+ #version.
11
+
12
+ #GCC is distributed in the hope that it will be useful, but WITHOUT
13
+ #ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
+ #FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15
+ #for more details.
16
+
17
+ #You should have received a copy of the GNU General Public License
18
+ #along with GCC; see the file COPYING3. If not see
19
+ #<http://www.gnu.org/licenses/>.
20
+
21
+ # ACX_PROG_CC_WARNING_OPTS(WARNINGS, [VARIABLE = WARN_CFLAGS])
22
+ # Sets @VARIABLE@ to the subset of the given options which the
23
+ # compiler accepts.
24
+ AC_DEFUN([ACX_PROG_CC_WARNING_OPTS],
25
+ [AC_REQUIRE([AC_PROG_CC])dnl
26
+ AC_LANG_PUSH(C)
27
+ m4_pushdef([acx_Var], [m4_default([$2], [WARN_CFLAGS])])dnl
28
+ AC_SUBST(acx_Var)dnl
29
+ m4_expand_once([acx_Var=
30
+ ],m4_quote(acx_Var=))dnl
31
+ save_CFLAGS="$CFLAGS"
32
+ for real_option in $1; do
33
+ # Do the check with the no- prefix removed since gcc silently
34
+ # accepts any -Wno-* option on purpose
35
+ case $real_option in
36
+ -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;;
37
+ *) option=$real_option ;;
38
+ esac
39
+ AS_VAR_PUSHDEF([acx_Woption], [acx_cv_prog_cc_warning_$option])
40
+ AC_CACHE_CHECK([whether $CC supports $option], acx_Woption,
41
+ [CFLAGS="$option"
42
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
43
+ [AS_VAR_SET(acx_Woption, yes)],
44
+ [AS_VAR_SET(acx_Woption, no)])
45
+ ])
46
+ AS_IF([test AS_VAR_GET(acx_Woption) = yes],
47
+ [acx_Var="$acx_Var${acx_Var:+ }$real_option"])
48
+ AS_VAR_POPDEF([acx_Woption])dnl
49
+ done
50
+ CFLAGS="$save_CFLAGS"
51
+ m4_popdef([acx_Var])dnl
52
+ AC_LANG_POP(C)
53
+ ])# ACX_PROG_CC_WARNING_OPTS
54
+
55
+ # ACX_PROG_CC_WARNING_ALMOST_PEDANTIC(WARNINGS, [VARIABLE = WARN_PEDANTIC])
56
+ # Append to VARIABLE "-pedantic" + the argument, if the compiler is GCC
57
+ # and accepts all of those options simultaneously, otherwise to nothing.
58
+ AC_DEFUN([ACX_PROG_CC_WARNING_ALMOST_PEDANTIC],
59
+ [AC_REQUIRE([AC_PROG_CC])dnl
60
+ AC_LANG_PUSH(C)
61
+ m4_pushdef([acx_Var], [m4_default([$2], [WARN_PEDANTIC])])dnl
62
+ AC_SUBST(acx_Var)dnl
63
+ m4_expand_once([acx_Var=
64
+ ],m4_quote(acx_Var=))dnl
65
+ # Do the check with the no- prefix removed from the warning options
66
+ # since gcc silently accepts any -Wno-* option on purpose
67
+ m4_pushdef([acx_Woptions], [m4_bpatsubst([$1], [-Wno-], [-W])])dnl
68
+ AS_VAR_PUSHDEF([acx_Pedantic], [acx_cv_prog_cc_pedantic_]acx_Woptions)dnl
69
+ AS_IF([test "$GCC" = yes],
70
+ [AC_CACHE_CHECK([whether $CC supports -pedantic ]acx_Woptions, acx_Pedantic,
71
+ [save_CFLAGS="$CFLAGS"
72
+ CFLAGS="-pedantic acx_Woptions"
73
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
74
+ [AS_VAR_SET(acx_Pedantic, yes)],
75
+ [AS_VAR_SET(acx_Pedantic, no)])
76
+ CFLAGS="$save_CFLAGS"])
77
+ AS_IF([test AS_VAR_GET(acx_Pedantic) = yes],
78
+ [acx_Var="$acx_Var${acx_Var:+ }-pedantic $1"])
79
+ ])
80
+ AS_VAR_POPDEF([acx_Pedantic])dnl
81
+ m4_popdef([acx_Woptions])dnl
82
+ m4_popdef([acx_Var])dnl
83
+ AC_LANG_POP(C)
84
+ ])# ACX_PROG_CC_WARNING_ALMOST_PEDANTIC
85
+
86
+ # ACX_PROG_CC_WARNINGS_ARE_ERRORS([x.y.z], [VARIABLE = WERROR])
87
+ # sets @VARIABLE@ to "-Werror" if the compiler is GCC >=x.y.z, or if
88
+ # --enable-werror-always was given on the command line, otherwise
89
+ # to nothing.
90
+ # If the argument is the word "manual" instead of a version number,
91
+ # then @VARIABLE@ will be set to -Werror only if --enable-werror-always
92
+ # appeared on the configure command line.
93
+ AC_DEFUN([ACX_PROG_CC_WARNINGS_ARE_ERRORS],
94
+ [AC_REQUIRE([AC_PROG_CC])dnl
95
+ AC_LANG_PUSH(C)
96
+ m4_pushdef([acx_Var], [m4_default([$2], [WERROR])])dnl
97
+ AC_SUBST(acx_Var)dnl
98
+ m4_expand_once([acx_Var=
99
+ ],m4_quote(acx_Var=))dnl
100
+ AC_ARG_ENABLE(werror-always,
101
+ AS_HELP_STRING([--enable-werror-always],
102
+ [enable -Werror despite compiler version]),
103
+ [], [enable_werror_always=no])
104
+ AS_IF([test $enable_werror_always = yes],
105
+ [acx_Var="$acx_Var${acx_Var:+ }-Werror"])
106
+ m4_if($1, [manual],,
107
+ [AS_VAR_PUSHDEF([acx_GCCvers], [acx_cv_prog_cc_gcc_$1_or_newer])dnl
108
+ AC_CACHE_CHECK([whether $CC is GCC >=$1], acx_GCCvers,
109
+ [set fnord `echo $1 | tr '.' ' '`
110
+ shift
111
+ AC_PREPROC_IFELSE(
112
+ [#if __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ \
113
+ < [$]1 * 10000 + [$]2 * 100 + [$]3
114
+ #error insufficient
115
+ #endif],
116
+ [AS_VAR_SET(acx_GCCvers, yes)],
117
+ [AS_VAR_SET(acx_GCCvers, no)])])
118
+ AS_IF([test AS_VAR_GET(acx_GCCvers) = yes],
119
+ [acx_Var="$acx_Var${acx_Var:+ }-Werror"])
120
+ AS_VAR_POPDEF([acx_GCCvers])])
121
+ m4_popdef([acx_Var])dnl
122
+ AC_LANG_POP(C)
123
+ ])# ACX_PROG_CC_WARNINGS_ARE_ERRORS
124
+
125
+ # ACX_PROG_CXX_WARNING_OPTS(WARNINGS, [VARIABLE = WARN_CXXFLAGS])
126
+ # Sets @VARIABLE@ to the subset of the given options which the
127
+ # compiler accepts.
128
+ AC_DEFUN([ACX_PROG_CXX_WARNING_OPTS],
129
+ [AC_REQUIRE([AC_PROG_CXX])dnl
130
+ AC_LANG_PUSH(C++)
131
+ m4_pushdef([acx_Var], [m4_default([$2], [WARN_CXXFLAGS])])dnl
132
+ AC_SUBST(acx_Var)dnl
133
+ m4_expand_once([acx_Var=
134
+ ],m4_quote(acx_Var=))dnl
135
+ save_CXXFLAGS="$CXXFLAGS"
136
+ for real_option in $1; do
137
+ # Do the check with the no- prefix removed since gcc silently
138
+ # accepts any -Wno-* option on purpose
139
+ case $real_option in
140
+ -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;;
141
+ *) option=$real_option ;;
142
+ esac
143
+ AS_VAR_PUSHDEF([acx_Woption], [acx_cv_prog_cc_warning_$option])
144
+ AC_CACHE_CHECK([whether $CXX supports $option], acx_Woption,
145
+ [CXXFLAGS="$option"
146
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
147
+ [AS_VAR_SET(acx_Woption, yes)],
148
+ [AS_VAR_SET(acx_Woption, no)])
149
+ ])
150
+ AS_IF([test AS_VAR_GET(acx_Woption) = yes],
151
+ [acx_Var="$acx_Var${acx_Var:+ }$real_option"])
152
+ AS_VAR_POPDEF([acx_Woption])dnl
153
+ done
154
+ CXXFLAGS="$save_CXXFLAGS"
155
+ m4_popdef([acx_Var])dnl
156
+ AC_LANG_POP(C++)
157
+ ])# ACX_PROG_CXX_WARNING_OPTS
158
+
159
+ # ACX_PROG_CXX_WARNING_ALMOST_PEDANTIC(WARNINGS, [VARIABLE = WARN_PEDANTIC])
160
+ # Append to VARIABLE "-pedantic" + the argument, if the compiler is G++
161
+ # and accepts all of those options simultaneously, otherwise to nothing.
162
+ AC_DEFUN([ACX_PROG_CXX_WARNING_ALMOST_PEDANTIC],
163
+ [AC_REQUIRE([AC_PROG_CXX])dnl
164
+ AC_LANG_PUSH(C++)
165
+ m4_pushdef([acx_Var], [m4_default([$2], [WARN_PEDANTIC])])dnl
166
+ AC_SUBST(acx_Var)dnl
167
+ m4_expand_once([acx_Var=
168
+ ],m4_quote(acx_Var=))dnl
169
+ # Do the check with the no- prefix removed from the warning options
170
+ # since gcc silently accepts any -Wno-* option on purpose
171
+ m4_pushdef([acx_Woptions], [m4_bpatsubst([$1], [-Wno-], [-W])])dnl
172
+ AS_VAR_PUSHDEF([acx_Pedantic], [acx_cv_prog_cc_pedantic_]acx_Woptions)dnl
173
+ AS_IF([test "$GXX" = yes],
174
+ [AC_CACHE_CHECK([whether $CXX supports -pedantic ]acx_Woptions, acx_Pedantic,
175
+ [save_CXXFLAGS="$CXXFLAGS"
176
+ CXXFLAGS="-pedantic acx_Woptions"
177
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
178
+ [AS_VAR_SET(acx_Pedantic, yes)],
179
+ [AS_VAR_SET(acx_Pedantic, no)])
180
+ CXXFLAGS="$save_CXXFLAGS"])
181
+ AS_IF([test AS_VAR_GET(acx_Pedantic) = yes],
182
+ [acx_Var="$acx_Var${acx_Var:+ }-pedantic $1"])
183
+ ])
184
+ AS_VAR_POPDEF([acx_Pedantic])dnl
185
+ m4_popdef([acx_Woptions])dnl
186
+ m4_popdef([acx_Var])dnl
187
+ AC_LANG_POP(C++)
188
+ ])# ACX_PROG_CXX_WARNING_ALMOST_PEDANTIC
189
+
190
+ # ACX_PROG_CXX_WARNINGS_ARE_ERRORS([x.y.z], [VARIABLE = WERROR])
191
+ # sets @VARIABLE@ to "-Werror" if the compiler is G++ >=x.y.z, or if
192
+ # --enable-werror-always was given on the command line, otherwise
193
+ # to nothing.
194
+ # If the argument is the word "manual" instead of a version number,
195
+ # then @VARIABLE@ will be set to -Werror only if --enable-werror-always
196
+ # appeared on the configure command line.
197
+ AC_DEFUN([ACX_PROG_CXX_WARNINGS_ARE_ERRORS],
198
+ [AC_REQUIRE([AC_PROG_CXX])dnl
199
+ AC_LANG_PUSH(C++)
200
+ m4_pushdef([acx_Var], [m4_default([$2], [WERROR])])dnl
201
+ AC_SUBST(acx_Var)dnl
202
+ m4_expand_once([acx_Var=
203
+ ],m4_quote(acx_Var=))dnl
204
+ AC_ARG_ENABLE(werror-always,
205
+ AS_HELP_STRING([--enable-werror-always],
206
+ [enable -Werror despite compiler version]),
207
+ [], [enable_werror_always=no])
208
+ AS_IF([test $enable_werror_always = yes],
209
+ [acx_Var="$acx_Var${acx_Var:+ }-Werror"])
210
+ m4_if($1, [manual],,
211
+ [AS_VAR_PUSHDEF([acx_GXXvers], [acx_cv_prog_cxx_gxx_$1_or_newer])dnl
212
+ AC_CACHE_CHECK([whether $CXX is G++ >=$1], acx_GXXvers,
213
+ [set fnord `echo $1 | tr '.' ' '`
214
+ shift
215
+ AC_PREPROC_IFELSE(
216
+ [#if __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ \
217
+ < [$]1 * 10000 + [$]2 * 100 + [$]3
218
+ #error insufficient
219
+ #endif],
220
+ [AS_VAR_SET(acx_GXXvers, yes)],
221
+ [AS_VAR_SET(acx_GXXvers, no)])])
222
+ AS_IF([test AS_VAR_GET(acx_GXXvers) = yes],
223
+ [acx_Var="$acx_Var${acx_Var:+ }-Werror"])
224
+ AS_VAR_POPDEF([acx_GXXvers])])
225
+ m4_popdef([acx_Var])dnl
226
+ AC_LANG_POP(C++)
227
+ ])# ACX_PROG_CXX_WARNINGS_ARE_ERRORS