squid_cv_resuid_works="no" ],[:])
)
])
+
+dnl check that we have functional CPU clock access for the profiler
+dnl sets squid_cv_profiler_works to "yes" or "no"
+
+AC_DEFUN([SQUID_CHECK_FUNCTIONAL_CPU_PROFILER],[
+ AC_CACHE_CHECK([for operational CPU clock access],
+ squid_cv_cpu_profiler_works,
+ AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
+#if defined(__GNUC__) && ( defined(__i386) || defined(__i386__) )
+// okay
+#elif defined(__GNUC__) && ( defined(__x86_64) || defined(__x86_64__) )
+// okay
+#elif defined(__GNUC__) && defined(__alpha)
+// okay
+#elif defined(_M_IX86) && defined(_MSC_VER) /* x86 platform on Microsoft C Compiler ONLY */
+// okay
+#else
+#error This CPU is unsupported. No profiling available here.
+#endif
+ ]])],[
+ squid_cv_cpu_profiler_works=yes],[
+ squid_cv_cpu_profiler_works=no])
+ )
+])
SQUID_YESNO([$enableval],
[unrecognized argument to --enable-cpu-profiling: $enableval])
])
+if test "x$enable_cpu_profiling" != "xno"; then
+ SQUID_CHECK_FUNCTIONAL_CPU_PROFILER
+ if test "x$enable_cpu_profiling" = "xyes" -a "x$squid_cv_cpu_profiler_works" = "xno"; then
+ AC_MSG_ERROR([CPU profiling will not be functional in this build.])
+ elif test "x$squid_cv_cpu_profiler_works" = "xno"; then
+ AC_MSG_NOTICE([CPU profiling will not be functional in this build.])
+ fi
+ enable_cpu_profiling="$squid_cv_cpu_profiler_works"
+fi
SQUID_DEFINE_BOOL(USE_XPROF_STATS,${enable_cpu_profiling:=no},
[Define to enable CPU profiling within Squid])
AM_CONDITIONAL(ENABLE_XPROF_STATS,
#if USE_XPROF_STATS
+/*
+ * Ensure that any changes here are synchronised with SQUID_CHECK_FUNCTIONAL_CPU_PROFILER
+ */
+
#if !_SQUID_SOLARIS_
typedef int64_t hrtime_t;
#endif
#else
/* This CPU is unsupported. Short-circuit, no profiling here */
-#define get_tick() 0
-#undef USE_XPROF_STATS
-#define USE_XPROF_STATS 0
+// #error for configure tests to prevent library construction
+#error This CPU is unsupported. No profiling available here.
#endif
#endif /* USE_XPROF_STATS */
# --enable-win32-service \
# --with-valgrind-debug \
#
+# --enable-cpu-profiling \ Requires CPU support.
+#
#
# NP: DISTCHECK_CONFIGURE_FLAGS is a magic automake macro for the
# distcheck target recursive tests beteen scripted runs.
--enable-mempools \
--enable-unlinkd \
--enable-stacktraces \
- --enable-cpu-profiling \
--enable-vary \
--enable-x-accelerator-vary \
--enable-ipv6 \