@@ -134,15 +134,9 @@ AX_PYTHON_MODULE([psutil], [fatal])
134
134
135
135
_SPLIT_PATCH_NOPS=""
136
136
137
- # Check if compiler provides -msplit-patch-nops. It may be required on
138
- # some architectures.
139
- AX_CHECK_COMPILE_FLAG ( [ -msplit-patch-nops] ,
140
- [ _SPLIT_PATCH_NOPS="-msplit-patch-nops"] ,
141
- [ _SPLIT_PATCH_NOPS=""] )
142
-
143
137
# Add the following flags to the compilation of all files
144
- AC_SUBST ( [ AM_CFLAGS] , [ "-Wall -Wextra -Werror $_SPLIT_PATCH_NOPS "] )
145
- AC_SUBST ( [ AM_CXXFLAGS] , [ "-Wall -Wextra -Werror $_SPLIT_PATCH_NOPS "] )
138
+ AC_SUBST ( [ AM_CFLAGS] , [ "-Wall -Wextra -Werror"] )
139
+ AC_SUBST ( [ AM_CXXFLAGS] , [ "-Wall -Wextra -Werror"] )
146
140
AC_SUBST ( [ AM_CCASFLAGS] , [ "-Wa,--fatal-warnings"] )
147
141
148
142
# Checking the call stack of all threads enables libpulp to only apply a live
@@ -272,6 +266,12 @@ AC_DEFINE_UNQUOTED([LD_LINUX], ["$_LD_LINUX"],
272
266
AM_CONDITIONAL([ CPU_X86_64] , [ test "$_PROC" == "x86_64"] )
273
267
AM_CONDITIONAL([ CPU_PPC64LE] , [ test "$_PROC" == "powerpc64le"] )
274
268
269
+ # Check if compiler provides -msplit-patch-nops. It may be required on
270
+ # some architectures.
271
+ AX_CHECK_COMPILE_FLAG ( [ -msplit-patch-nops] ,
272
+ [ AX_APPEND_FLAG ( [ -msplit-patch-nops] ) ] ,
273
+ [ ] )
274
+
275
275
# Check if -fpatchable-function-entry=$ULP_NOPS_LEN,$RE_NOPS_LEN works
276
276
# correctly.
277
277
AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
@@ -281,13 +281,37 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
281
281
[ patchable_works=yes] ,
282
282
[ patchable_works=no] )
283
283
284
- # Fix some problems with the Makefiles expecting a default value for AM_LDFLAGS
285
- AC_SUBST ( [ AM_LDFLAGS] , [ ""] )
286
-
287
284
AS_IF ( [ test "x$patchable_works" == "xno"] ,
288
285
AC_MSG_ERROR (
289
286
[ The -fpatchable-functions-entry flag of your C compiler does not work correctly] ) )
290
287
288
+ # Now check for C++.
289
+ AC_LANG_PUSH ( [ C++] )
290
+ # Check if compiler provides -msplit-patch-nops. It may be required on
291
+ # some architectures.
292
+ AX_CHECK_COMPILE_FLAG ( [ -msplit-patch-nops] ,
293
+ [ AX_APPEND_FLAG ( [ -msplit-patch-nops] ) ] ,
294
+ [ ] )
295
+
296
+ # Check if -fpatchable-function-entry=$ULP_NOPS_LEN,$RE_NOPS_LEN works
297
+ # correctly.
298
+ AC_COMPILE_IFELSE ( [ AC_LANG_PROGRAM (
299
+ [ [ extern void g(void);
300
+ __attribute__((patchable_function_entry($_NOPS_LEN, $_PRE_NOPS_LEN)))
301
+ void f(void) { g(); }] ] ) ] ,
302
+ [ patchable_works=yes] ,
303
+ [ patchable_works=no] )
304
+
305
+ AS_IF ( [ test "x$patchable_works" == "xno"] ,
306
+ AC_MSG_ERROR (
307
+ [ The -fpatchable-functions-entry flag of your C++ compiler does not work correctly] ) )
308
+
309
+ AC_LANG_POP ( [ C++] )
310
+
311
+ # Fix some problems with the Makefiles expecting a default value for AM_LDFLAGS
312
+ AC_SUBST ( [ AM_LDFLAGS] , [ ""] )
313
+
314
+
291
315
AC_CONFIG_FILES ( [ Makefile
292
316
include/Makefile
293
317
lib/Makefile
0 commit comments