allow PAPI to be installed somewhere non-standard
authorSimon Marlow <simonmar@microsoft.com>
Thu, 1 Nov 2007 15:03:25 +0000 (15:03 +0000)
committerSimon Marlow <simonmar@microsoft.com>
Thu, 1 Nov 2007 15:03:25 +0000 (15:03 +0000)
mk/config.mk.in
rts/Makefile
rts/package.conf.in

index 783f4f9..e19a1cd 100644 (file)
@@ -468,7 +468,8 @@ GhcRtsWithFrontPanel = NO
 # Include support for CPU performance counters via the PAPI library in the RTS?
 # (PAPI: http://icl.cs.utk.edu/papi/)
 GhcRtsWithPapi = NO
-HavePapi = @HavePapi@
+PapiLibDir=
+PapiIncludeDir=
 
 ################################################################################
 #
index 9437253..7d12d0b 100644 (file)
@@ -277,9 +277,23 @@ endif
 # Add PAPI library if needed
 
 ifeq "$(GhcRtsWithPapi)" "YES"
+
 SRC_HC_OPTS            += -optc-DUSE_PAPI
 PACKAGE_CPP_OPTS       += -DUSE_PAPI
+
+PACKAGE_CPP_OPTS += -DPAPI_INCLUDE_DIR=$(PapiIncludeDir)
+PACKAGE_CPP_OPTS += -DPAPI_LIB_DIR=$(PapiLibDir)
+
+ifneq "$(PapiIncludeDir)" ""
+SRC_HC_OPTS += -I$(PapiIncludeDir)
+SRC_CC_OPTS += -I$(PapiIncludeDir)
+SRC_HSC2HS_OPTS += -I$(PapiIncludeDir)
 endif
+ifneq "$(PapiLibDirs)" ""
+SRC_LD_OPTS += -L$(PapiLibDirs)
+endif
+
+endif # GhcRtsWithPapi==YES
 
 #-----------------------------------------------------------------------------
 # make depend setup
index 7e0ee02..557bb99 100644 (file)
@@ -15,13 +15,13 @@ hidden-modules:
 import-dirs:
 
 #ifdef INSTALLING
-library-dirs:          LIB_DIR GMP_LIB_DIRS
+library-dirs:          LIB_DIR GMP_LIB_DIRS PAPI_LIB_DIR
 # ifdef mingw32_HOST_OS
                        , LIB_DIR"/gcc-lib"
                        /* force the dist-provided gcc-lib/ into scope. */
 # endif
 #else /* !INSTALLING */
-library-dirs:          FPTOOLS_TOP_ABS"/rts" GMP_LIB_DIRS
+library-dirs:          FPTOOLS_TOP_ABS"/rts" GMP_LIB_DIRS PAPI_LIB_DIR
 # if !defined(HAVE_LIBGMP) && !defined(HAVE_FRAMEWORK_GMP)
                        , FPTOOLS_TOP_ABS"/gmp"
 # endif
@@ -60,7 +60,7 @@ extra-libraries:              "m"             /* for ldexp() */
 #endif
 
 #ifdef INSTALLING
-include-dirs:          INCLUDE_DIR GMP_INCLUDE_DIRS
+include-dirs:          INCLUDE_DIR GMP_INCLUDE_DIRS PAPI_INCLUDE_DIR
 # ifdef mingw32_HOST_OS
                        , INCLUDE_DIR"/mingw"
 # endif