diff --git a/papi-3.7.2-config.patch b/papi-3.7.2-config.patch new file mode 100644 index 0000000..f8f2de3 --- /dev/null +++ b/papi-3.7.2-config.patch @@ -0,0 +1,112 @@ +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= 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= 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= 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= Specify path of pmapi on aix system ], diff --git a/papi.spec b/papi.spec index 3bf3f15..487de62 100644 --- a/papi.spec +++ b/papi.spec @@ -1,16 +1,18 @@ Summary: Performance Application Programming Interface Name: papi Version: 3.7.2 -Release: 2%{?dist} +Release: 3%{?dist} License: BSD Group: Development/System URL: http://icl.cs.utk.edu/papi/ Source0: http://icl.cs.utk.edu/projects/papi/downloads/%{name}-%{version}.tar.gz +Patch1: papi-3.7.2-config.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: ncurses-devel BuildRequires: kernel-headers >= 2.6.31 BuildRequires: gcc-gfortran BuildRequires: chrpath +BuildRequires: autoconf #Right now libpfm does not know anything about s390 and will fail ExcludeArch: s390, s390x @@ -30,9 +32,12 @@ that uses PAPI. %prep %setup -q +%patch1 -p1 -b .header + %build cd src -%configure --with-pcl=yes --disable-static --with-pcl-incdir=/usr/include/linux +autoconf +%configure --disable-static make %{?_smp_mflags} #%check @@ -70,6 +75,9 @@ rm -rf $RPM_BUILD_ROOT %doc %{_mandir}/man3/* %changelog +* Thu Dec 10 2009 William Cohen - 3.7.2-3 +- Adjust configure. + * Mon Dec 9 2009 William Cohen - 3.7.2-2 - Remove dependency on kernel-devel.