papi/papi-3.7.2-config.patch

113 lines
4.1 KiB
Diff

diff -up papi-3.7.2/src/configure.in.header papi-3.7.2/src/configure.in
--- papi-3.7.2/src/configure.in.header 2009-12-10 15:05:09.000000000 -0500
+++ papi-3.7.2/src/configure.in 2009-12-10 15:05:13.000000000 -0500
@@ -1013,61 +1013,63 @@ AC_ARG_WITH(pfm_libdir,
)
# PCL start
-# set PCL manually set with --with-pcl,
-# or by default if perfctr and perfmon are not available
-# and linux kernel version is >= 31
-
-if test "$cross_compiling" = "no" -a "$OS" = "linux" -a "`uname -r | grep "2.6."`"; then
-# gives the position in $OSVER of *first* character in substring "2.6."
-POS1=`expr index "$OSVER" "2.6."`
-POS2=`expr $POS1 + 4`
-VERS=`expr substr "$OSVER" "$POS2" 2`
-
-# Version 2.6.31 of the kernel uses perf_counter.h and all subsequent versions use perf_event.h
-if test "$VERS" = "31"; then
- perf_header="perf_counter.h"
- CFLAGS="$CFLAGS -DKERNEL31"
-elif test "$VERS" -gt 31; then
- perf_header="perf_event.h"
+if test "x$perfctr" != "xyes" -a "$perfmon" = "0"; then
+
+# Try to find perf_event.h or perf_counter.h on
+# user specific path or default of /usr/include/linux
+AC_ARG_WITH(pcl_incdir,
+ [ --with-pcl-incdir=<path> Specify path to the correct perf event header file],
+ [
+case "$with_pcl_incdir" in
+yes) AC_MSG_ERROR([--with-pcl-incdir requires an argument]) ;;
+''|no) ;;
+*) pcl_incdir=$with_pcl_incdir ;;
+esac],
+[pcl_incdir="/usr/include/linux"])
+
+# Linux 2.6.32 and newer check
+AC_CHECK_FILE($pcl_incdir/perf_event.h,
+ [pcl="yes" PCLPATH="$pcl_incdir/perf_event.h"])
+
+# Linux 2.6.31 check
+if test "x$PCLPATH" = "x"; then
+AC_CHECK_FILE($pcl_incdir/perf_counter.h,
+ [pcl="yes" PCLPATH="$pcl_incdir/perf_counter.h"
+ CFLAGS="$CFLAGS -DKERNEL31"])
fi
-if test "${VERS}" -ge 31; then
AC_ARG_WITH(pcl,
[ --with-pcl=<yes,no> Specify existence of Performance Counters for Linux],
- [pcl=$withval
- AC_CHECK_FILE(/lib/modules/$OSVER/source/include/linux/$perf_header, [ pcl="yes"
- PCLPATH="/lib/modules/$OSVER/source/include/linux/$perf_header"],
- [ pcl="no" ])
- ],
- [if test "$perfctr" = "no" -a "$perfmon" = "0"; then
- AC_CHECK_FILE(/lib/modules/$OSVER/source/include/linux/$perf_header, [ pcl="yes"
- PCLPATH="/lib/modules/$OSVER/source/include/linux/$perf_header"],
- [ pcl="no" ])
- fi
- ])
-elif test "$perfctr" = "no" -a "$perfmon" = "0"; then
-AC_MSG_ERROR([PAPI requires a patch for any kernel older than 2.6.31])
+ [pcl=$withval])
+
+#fall back check for the perf_event.h or perf_counter.h in -devel for running
+#linux kernel
+if test "x$cross_compiling" != "xyes" -a "$OS" = "linux" -a "x$PCLPATH" = "x"; then
+
+pcl_incdir="/lib/modules/$OSVER/source/include/linux"
+
+# Linux 2.6.32 and newer check
+AC_CHECK_FILE($pcl_incdir/perf_event.h,
+ [pcl="yes" PCLPATH="$pcl_incdir/perf_event.h"])
+
+# Linux 2.6.31 check
+if test "x$PCLPATH" = "x"; then
+AC_CHECK_FILE($pcl_incdir/perf_counter.h,
+ [pcl="yes" PCLPATH="$pcl_incdir/perf_counter.h"
+ CFLAGS="$CFLAGS -DKERNEL31"])
+fi
+
+if test "x$PCLPATH" = "x"; then
+ pcl=no
fi
-# If we are running a PCL kernel, the correct include file should have been found in
-# /lib/modules/$OSVER/source/include/linux. If the file was not found
-# see if the user has set a path and ensure it can be found there
-if test "$pcl" = "no"; then
-AC_ARG_WITH(pcl_incdir,
- [ --with-pcl-incdir=<path> Specify path to the correct perf event header file],
- [pcl_incdir=$withval
- AC_CHECK_FILE($pcl_incdir/$perf_header, [pcl="yes"
- PCLPATH="$pcl_incdir/$perf_header"],
- [AC_MSG_ERROR([$perf_header could not be found at $pcl_incdir])])
- ],
- [if test "$perfctr" = "no" -a "$perfmon" = "0"; then
- AC_MSG_ERROR([$perf_header could not be found and no patch is installed.])
- fi
- ])
fi
fi
# PCL end
+if test "x$pcl" != "xyes" -a "x$perfctr" != "xyes" -a "$perfmon" = "0"; then
+ AC_MSG_ERROR([No performance monitoring interface available])
+fi
AC_ARG_WITH(pmapi,
[ --with-pmapi=<path> Specify path of pmapi on aix system ],