# Add PAPI library if needed
ifeq "$(GhcRtsWithPapi)" "YES"
-SRC_HC_OPTS += -optc-DUSE_PAPI
+
+SRC_CC_OPTS += -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
# use a variety of types to represent closure pointers (StgPtr,
# StgClosure, StgMVar, etc.), and without -fno-strict-aliasing gcc is
# allowed to assume that these pointers do not alias. eg. without
-# this flag we get problems in GC.c:copy() with gcc 3.4.3, the
+# this flag we get problems in sm/Evac.c:copy() with gcc 3.4.3, the
# upd_evacee() assigments get moved before the object copy.
SRC_CC_OPTS += -fno-strict-aliasing