pf2 0.7.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/README.md +11 -0
  4. data/Rakefile +9 -2
  5. data/doc/development.md +11 -0
  6. data/examples/mandelbrot.rb +69 -0
  7. data/examples/mandelbrot_ractor.rb +77 -0
  8. data/ext/pf2/build.rs +7 -0
  9. data/ext/pf2/src/ruby_c_api_helper.c +6 -0
  10. data/ext/pf2/src/serialization/profile.rs +1 -0
  11. data/ext/pf2/src/serialization/serializer.rs +4 -0
  12. data/ext/pf2/src/signal_scheduler.rs +1 -1
  13. data/ext/pf2/src/util.rs +2 -1
  14. data/ext/pf2c/backtrace_state.c +10 -0
  15. data/ext/pf2c/backtrace_state.h +10 -0
  16. data/ext/pf2c/configuration.c +90 -0
  17. data/ext/pf2c/configuration.h +23 -0
  18. data/ext/pf2c/extconf.rb +21 -0
  19. data/ext/pf2c/pf2.c +17 -0
  20. data/ext/pf2c/pf2.h +8 -0
  21. data/ext/pf2c/ringbuffer.c +74 -0
  22. data/ext/pf2c/ringbuffer.h +24 -0
  23. data/ext/pf2c/sample.c +70 -0
  24. data/ext/pf2c/sample.h +22 -0
  25. data/ext/pf2c/serializer.c +377 -0
  26. data/ext/pf2c/serializer.h +58 -0
  27. data/ext/pf2c/session.c +344 -0
  28. data/ext/pf2c/session.h +51 -0
  29. data/lib/pf2/cli.rb +33 -2
  30. data/lib/pf2/reporter/annotate.rb +101 -0
  31. data/lib/pf2/reporter/firefox_profiler.rb +1 -1
  32. data/lib/pf2/reporter/firefox_profiler_ser2.rb +308 -0
  33. data/lib/pf2/reporter.rb +2 -0
  34. data/lib/pf2/version.rb +1 -1
  35. data/vendor/libbacktrace/.gitignore +5 -0
  36. data/vendor/libbacktrace/Isaac.Newton-Opticks.txt +9286 -0
  37. data/vendor/libbacktrace/LICENSE +29 -0
  38. data/vendor/libbacktrace/Makefile.am +708 -0
  39. data/vendor/libbacktrace/Makefile.in +2820 -0
  40. data/vendor/libbacktrace/README.md +46 -0
  41. data/vendor/libbacktrace/aclocal.m4 +864 -0
  42. data/vendor/libbacktrace/alloc.c +167 -0
  43. data/vendor/libbacktrace/allocfail.c +136 -0
  44. data/vendor/libbacktrace/allocfail.sh +104 -0
  45. data/vendor/libbacktrace/atomic.c +113 -0
  46. data/vendor/libbacktrace/backtrace-supported.h.in +66 -0
  47. data/vendor/libbacktrace/backtrace.c +129 -0
  48. data/vendor/libbacktrace/backtrace.h +189 -0
  49. data/vendor/libbacktrace/btest.c +517 -0
  50. data/vendor/libbacktrace/compile +348 -0
  51. data/vendor/libbacktrace/config/enable.m4 +38 -0
  52. data/vendor/libbacktrace/config/lead-dot.m4 +31 -0
  53. data/vendor/libbacktrace/config/libtool.m4 +7545 -0
  54. data/vendor/libbacktrace/config/ltoptions.m4 +369 -0
  55. data/vendor/libbacktrace/config/ltsugar.m4 +123 -0
  56. data/vendor/libbacktrace/config/ltversion.m4 +23 -0
  57. data/vendor/libbacktrace/config/lt~obsolete.m4 +98 -0
  58. data/vendor/libbacktrace/config/multi.m4 +68 -0
  59. data/vendor/libbacktrace/config/override.m4 +117 -0
  60. data/vendor/libbacktrace/config/unwind_ipinfo.m4 +37 -0
  61. data/vendor/libbacktrace/config/warnings.m4 +227 -0
  62. data/vendor/libbacktrace/config.guess +1700 -0
  63. data/vendor/libbacktrace/config.h.in +185 -0
  64. data/vendor/libbacktrace/config.sub +1885 -0
  65. data/vendor/libbacktrace/configure +15952 -0
  66. data/vendor/libbacktrace/configure.ac +642 -0
  67. data/vendor/libbacktrace/dwarf.c +4593 -0
  68. data/vendor/libbacktrace/edtest.c +120 -0
  69. data/vendor/libbacktrace/edtest2.c +43 -0
  70. data/vendor/libbacktrace/elf.c +7471 -0
  71. data/vendor/libbacktrace/fileline.c +407 -0
  72. data/vendor/libbacktrace/filenames.h +52 -0
  73. data/vendor/libbacktrace/filetype.awk +13 -0
  74. data/vendor/libbacktrace/install-debuginfo-for-buildid.sh.in +65 -0
  75. data/vendor/libbacktrace/install-sh +501 -0
  76. data/vendor/libbacktrace/instrumented_alloc.c +114 -0
  77. data/vendor/libbacktrace/internal.h +428 -0
  78. data/vendor/libbacktrace/ltmain.sh +8636 -0
  79. data/vendor/libbacktrace/macho.c +1361 -0
  80. data/vendor/libbacktrace/missing +215 -0
  81. data/vendor/libbacktrace/mmap.c +331 -0
  82. data/vendor/libbacktrace/mmapio.c +110 -0
  83. data/vendor/libbacktrace/move-if-change +83 -0
  84. data/vendor/libbacktrace/mtest.c +410 -0
  85. data/vendor/libbacktrace/nounwind.c +66 -0
  86. data/vendor/libbacktrace/pecoff.c +1123 -0
  87. data/vendor/libbacktrace/posix.c +104 -0
  88. data/vendor/libbacktrace/print.c +117 -0
  89. data/vendor/libbacktrace/read.c +110 -0
  90. data/vendor/libbacktrace/simple.c +108 -0
  91. data/vendor/libbacktrace/sort.c +108 -0
  92. data/vendor/libbacktrace/state.c +72 -0
  93. data/vendor/libbacktrace/stest.c +137 -0
  94. data/vendor/libbacktrace/test-driver +148 -0
  95. data/vendor/libbacktrace/test_format.c +55 -0
  96. data/vendor/libbacktrace/testlib.c +234 -0
  97. data/vendor/libbacktrace/testlib.h +110 -0
  98. data/vendor/libbacktrace/ttest.c +161 -0
  99. data/vendor/libbacktrace/unittest.c +92 -0
  100. data/vendor/libbacktrace/unknown.c +65 -0
  101. data/vendor/libbacktrace/xcoff.c +1617 -0
  102. data/vendor/libbacktrace/xztest.c +508 -0
  103. data/vendor/libbacktrace/zstdtest.c +523 -0
  104. data/vendor/libbacktrace/ztest.c +541 -0
  105. metadata +122 -3
@@ -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