Blame SOURCES/papi-config.patch

95553c
commit 38290c41abbb105ca198411ec3c466ac027f5b8f
95553c
Author: Frank Winkler <frankbook@Franks-MacBook-Air.local>
95553c
Date:   Fri Apr 24 16:18:22 2020 +0200
95553c
95553c
    Fixed configure options for shared and static builds.
95553c
    
95553c
    1) --with-static-lib=no (force PAPI to build shared libraries and tools)
95553c
    2) --with-shlib-tools (use internal libpfm via rpath-link)
95553c
95553c
diff --git a/src/configure.in b/src/configure.in
95553c
index 3cf47edc1..1f58f7c8e 100644
95553c
--- a/src/configure.in
95553c
+++ b/src/configure.in
95553c
@@ -200,9 +200,13 @@ else
95553c
 		AC_MSG_ERROR([cannot find dlopen and dlerror symbols neither in the base system libraries nor in -ldl])
95553c
 	fi
95553c
 fi
95553c
+
95553c
+# Disable LDL for static builds
95553c
+# if test "x${STATIC}" = "x"; then
95553c
+#   LDL=""
95553c
+# fi
95553c
 AC_SUBST(LDL)
95553c
-        
95553c
-    
95553c
+
95553c
 if test "$OS" = "CLE"; then
95553c
   virtualtimer=times
95553c
   tls=__thread
95553c
@@ -827,10 +831,6 @@ AC_ARG_WITH(static_tools,
95553c
 	    AC_MSG_RESULT(yes)],
95553c
 	    [AC_MSG_RESULT(no)])
95553c
 
95553c
-if test "$static_lib" = "no"; then
95553c
-   AC_MSG_ERROR(Building tests and utilities static but no static papi library to be built)
95553c
-fi
95553c
-
95553c
 AC_MSG_CHECKING(for linking with papi shared library of tests and utilities)
95553c
 AC_ARG_WITH(shlib_tools,
95553c
 	        [  --with-shlib-tools		Specify linking with papi library of tests and utilities],
95553c
@@ -839,6 +839,14 @@ AC_ARG_WITH(shlib_tools,
95553c
 		[shlib_tools=no
95553c
 		AC_MSG_RESULT(no)])
95553c
 
95553c
+if test "$static_lib" = "no"; then
95553c
+   shlib_tools=yes
95553c
+fi
95553c
+
95553c
+if test "$static_lib" = "no" -a "$shlib_tools" = "no"; then
95553c
+   AC_MSG_ERROR(Building tests and utilities static but no static papi library to be built)
95553c
+fi
95553c
+
95553c
 if test "$shlib_tools" = "yes"; then
95553c
    if test "$shared_lib" != "yes"; then	
95553c
       AC_MSG_ERROR(Building static but specified shared linking for tests and utilities)
95553c
@@ -847,6 +855,8 @@ if test "$shlib_tools" = "yes"; then
95553c
       AC_MSG_ERROR([Building shared but specified static linking])
95553c
    fi
95553c
    LINKLIB='$(SHLIB)'
95553c
+   #WORKAROUND: if libpfm cannot be found at link time
95553c
+   LDFLAGS="$LDFLAGS -Wl,-rpath-link,$PWD/libpfm4/lib"
95553c
 elif test "$shlib_tools" = "no"; then
95553c
    if test "$static_lib" != "yes"; then
95553c
       AC_MSG_ERROR([Building shared but specified static linking for tests and utilities])
95553c
commit d6f4e34d083f18cfdba38dd5e4bbfb2a580b8a9e
95553c
Author: Frank Winkler <frankbook@Franks-MacBook-Air.local>
95553c
Date:   Fri Apr 24 16:38:18 2020 +0200
95553c
95553c
    Another test for "--with-static-tools".
95553c
95553c
diff --git a/src/configure.in b/src/configure.in
95553c
index 1f58f7c8e..e8d769578 100644
95553c
--- a/src/configure.in
95553c
+++ b/src/configure.in
95553c
@@ -201,10 +201,6 @@ else
95553c
 	fi
95553c
 fi
95553c
 
95553c
-# Disable LDL for static builds
95553c
-# if test "x${STATIC}" = "x"; then
95553c
-#   LDL=""
95553c
-# fi
95553c
 AC_SUBST(LDL)
95553c
 
95553c
 if test "$OS" = "CLE"; then
95553c
@@ -831,6 +827,11 @@ AC_ARG_WITH(static_tools,
95553c
 	    AC_MSG_RESULT(yes)],
95553c
 	    [AC_MSG_RESULT(no)])
95553c
 
95553c
+# Disable LDL for static builds
95553c
+# if test "$STATIC" = "-static"; then
95553c
+#   LDL=""
95553c
+# fi
95553c
+
95553c
 AC_MSG_CHECKING(for linking with papi shared library of tests and utilities)
95553c
 AC_ARG_WITH(shlib_tools,
95553c
 	        [  --with-shlib-tools		Specify linking with papi library of tests and utilities],
95553c
commit 1c333c9954b872cda1b4d873fa81b14ec58a58a7
95553c
Author: Frank Winkler <frankbook@Franks-MacBook-Air.local>
95553c
Date:   Thu Apr 30 18:51:34 2020 +0200
95553c
95553c
    Fixed static build.
95553c
    - SDE component is disabled
95553c
    - "ctest" shlib is disabled
95553c
95553c
diff --git a/src/configure.in b/src/configure.in
95553c
index e8d769578..0eee98ea1 100644
95553c
--- a/src/configure.in
95553c
+++ b/src/configure.in
95553c
@@ -827,10 +827,11 @@ AC_ARG_WITH(static_tools,
95553c
 	    AC_MSG_RESULT(yes)],
95553c
 	    [AC_MSG_RESULT(no)])
95553c
 
95553c
-# Disable LDL for static builds
95553c
-# if test "$STATIC" = "-static"; then
95553c
-#   LDL=""
95553c
-# fi
95553c
+# Disable LDL AND SDE for static builds
95553c
+if test "$STATIC" = "-static"; then
95553c
+  LDL=""
95553c
+  SDE_ENABLED=
95553c
+fi
95553c
 
95553c
 AC_MSG_CHECKING(for linking with papi shared library of tests and utilities)
95553c
 AC_ARG_WITH(shlib_tools,
95553c
@@ -1768,6 +1769,7 @@ for comp in $components; do
95553c
   if test "x$comp" = "xsde" ; then
95553c
     LDFLAGS="$LDFLAGS $LRT"
95553c
     LIBS="$LIBS $LRT"
95553c
+    SDE_ENABLED=1
95553c
   fi
95553c
 done
95553c
 
95553c
@@ -1862,6 +1864,7 @@ AC_SUBST(BGP_SYSDIR)
95553c
 AC_SUBST(BITFLAGS)
95553c
 AC_SUBST(COMPONENT_RULES)
95553c
 AC_SUBST(COMPONENTS)
95553c
+AC_SUBST(SDE_ENABLED)
95553c
 AC_SUBST(FTEST_TARGETS)
95553c
 AC_SUBST(HAVE_NO_OVERRIDE_INIT)
95553c
 AC_SUBST(BGPM_INSTALL_DIR)
95553c
diff --git a/src/ctests/Makefile.recipies b/src/ctests/Makefile.recipies
95553c
index b7c1963d7..44e19b398 100644
95553c
--- a/src/ctests/Makefile.recipies
95553c
+++ b/src/ctests/Makefile.recipies
95553c
@@ -11,7 +11,11 @@ MPX	= max_multiplex multiplex1 multiplex2 mendes-alt sdsc-mpx sdsc2-mpx \
95553c
 MPXPTHR	= multiplex1_pthreads multiplex3_pthreads kufrin
95553c
 MPI	= mpi_hl mpi_omp_hl \
95553c
 	mpifirst
95553c
+
95553c
+ifeq ($(STATIC),)
95553c
 SHARED  = shlib
95553c
+endif
95553c
+
95553c
 SERIAL  = serial_hl serial_hl_ll_comb\
95553c
 	all_events all_native_events branches calibrate case1 case2 \
95553c
 	cmpinfo code2name derived describe destroy disable_component \
95553c
@@ -344,8 +348,10 @@ case2: case2.c $(TESTLIB) $(PAPILIB)
95553c
 low-level: low-level.c $(TESTLIB) $(DOLOOPS) $(PAPILIB)
95553c
 	$(CC) $(INCLUDE) $(CFLAGS) $(TOPTFLAGS) low-level.c $(TESTLIB) $(DOLOOPS) $(PAPILIB) $(LDFLAGS) -o low-level
95553c
 
95553c
+ifeq ($(STATIC),)
95553c
 shlib: shlib.c $(TESTLIB) $(PAPILIB)
95553c
 	$(CC) $(INCLUDE) $(CFLAGS) $(TOPTFLAGS) shlib.c $(TESTLIB) $(PAPILIB) $(LDFLAGS) -o shlib $(LDL)
95553c
+endif
95553c
 
95553c
 exeinfo: exeinfo.c $(TESTLIB) $(PAPILIB)
95553c
 	-$(CC) $(INCLUDE) $(CFLAGS) $(TOPTFLAGS) exeinfo.c $(TESTLIB) $(PAPILIB) $(LDFLAGS) -o exeinfo 
95553c
diff --git a/src/ctests/Makefile.target.in b/src/ctests/Makefile.target.in
95553c
index edc04f1b7..af64e157c 100644
95553c
--- a/src/ctests/Makefile.target.in
95553c
+++ b/src/ctests/Makefile.target.in
95553c
@@ -10,6 +10,7 @@ INCLUDE = -I. -I@includedir@ -I$(testlibdir) -I$(validationlibdir)
95553c
 LIBDIR  = @libdir@
95553c
 LIBRARY = @LIBRARY@
95553c
 SHLIB   = @SHLIB@
95553c
+STATIC  = @STATIC@
95553c
 PAPILIB = ../@LINKLIB@
95553c
 TESTLIB = $(testlibdir)/libtestlib.a
95553c
 LDFLAGS = @LDFLAGS@ @LDL@ @STATIC@
95553c
diff --git a/src/utils/Makefile b/src/utils/Makefile
95553c
index 4abfd6cb8..64a2b8f9f 100644
95553c
--- a/src/utils/Makefile
95553c
+++ b/src/utils/Makefile
95553c
@@ -48,8 +48,13 @@ papi_mem_info: papi_mem_info.o $(PAPILIB)
95553c
 papi_multiplex_cost: papi_multiplex_cost.o $(PAPILIB) cost_utils.o
95553c
 	$(CC) -o papi_multiplex_cost papi_multiplex_cost.o cost_utils.o $(PAPILIB) -lm $(LDFLAGS)
95553c
 
95553c
+ifneq ($(SDE_ENABLED),)
95553c
 papi_native_avail: papi_native_avail.o $(PAPILIB) print_header.o papi_sde_interface.o
95553c
 	$(CC) -o papi_native_avail papi_native_avail.o $(PAPILIB) print_header.o $(LDFLAGS) papi_sde_interface.o
95553c
+else
95553c
+papi_native_avail: papi_native_avail.o $(PAPILIB) print_header.o
95553c
+	$(CC) -o papi_native_avail papi_native_avail.o $(PAPILIB) print_header.o $(LDFLAGS)
95553c
+endif
95553c
 
95553c
 papi_version: papi_version.o $(PAPILIB)
95553c
 	$(CC) -o papi_version papi_version.o $(PAPILIB) $(LDFLAGS)
95553c
@@ -65,8 +70,10 @@ cost_utils.o: ../testlib/papi_test.h cost_utils.c
95553c
 print_header.o: print_header.h print_header.c
95553c
 	$(CC) $(INCLUDE) $(CFLAGS) $(OPTFLAGS) -c print_header.c
95553c
 
95553c
+ifneq ($(SDE_ENABLED),)
95553c
 papi_sde_interface.o: papi_sde_interface.c
95553c
 	$(CC) $(INCLUDE) $(CFLAGS) $(OPTFLAGS) -c papi_sde_interface.c
95553c
+endif
95553c
 
95553c
 clean:
95553c
 	rm -f *.o *.stderr *.stdout core *~ $(ALL)
95553c
diff --git a/src/utils/Makefile.target.in b/src/utils/Makefile.target.in
95553c
index bcdbe94e9..9c76b37af 100644
95553c
--- a/src/utils/Makefile.target.in
95553c
+++ b/src/utils/Makefile.target.in
95553c
@@ -9,6 +9,7 @@ INCLUDE = -I. -I@includedir@ -I$(testlibdir)
95553c
 LIBDIR  = @libdir@
95553c
 LIBRARY = @LIBRARY@
95553c
 SHLIB   = @SHLIB@
95553c
+SDE_ENABLED  = @SDE_ENABLED@
95553c
 PAPILIB = ../@LINKLIB@
95553c
 TESTLIB = $(testlibdir)/libtestlib.a
95553c
 LDFLAGS = @LDFLAGS@ @LDL@ @STATIC@
95553c
diff --git a/src/utils/papi_native_avail.c b/src/utils/papi_native_avail.c
95553c
index ae6dbb9e5..902ed7996 100644
95553c
--- a/src/utils/papi_native_avail.c
95553c
+++ b/src/utils/papi_native_avail.c
95553c
@@ -51,8 +51,9 @@
95553c
 
95553c
 #include "papi.h"
95553c
 #include "print_header.h"
95553c
+#ifdef SDE_ENABLED
95553c
 #include "components/sde/interface/papi_sde_interface.h"
95553c
-
95553c
+#endif
95553c
 #define EVT_LINE 80
95553c
 #define EVT_LINE_BUF_SIZE 4096
95553c
 
95553c
@@ -84,7 +85,9 @@ print_help( char **argv )
95553c
 	printf( "\nGeneral command options:\n" );
95553c
 	printf( "\t-h, --help       print this help message\n" );
95553c
 	printf( "\t-c, --check      attempts to add each event\n");
95553c
+#ifdef SDE_ENABLED
95553c
 	printf( "\t-sde FILE        lists SDEs that are registered by the library or executable in FILE\n" );
95553c
+#endif
95553c
 	printf( "\t-e EVENTNAME     display detailed information about named native event\n" );
95553c
 	printf( "\t-i EVENTSTR      include only event names that contain EVENTSTR\n" );
95553c
 	printf( "\t-x EVENTSTR      exclude any event names that contain EVENTSTR\n" );
95553c
@@ -368,6 +371,7 @@ parse_event_qualifiers( PAPI_event_info_t * info )
95553c
 	return ( 1 );
95553c
 }
95553c
 
95553c
+#ifdef SDE_ENABLED
95553c
 void
95553c
 invoke_hook_fptr( char *lib_path )
95553c
 {
95553c
@@ -394,6 +398,7 @@ invoke_hook_fptr( char *lib_path )
95553c
     dlclose(dl_handle);
95553c
     return;
95553c
 }
95553c
+#endif
95553c
 
95553c
 int
95553c
 main( int argc, char **argv )
95553c
@@ -444,6 +449,7 @@ main( int argc, char **argv )
95553c
 		return 2;
95553c
 	}
95553c
 
95553c
+#ifdef SDE_ENABLED
95553c
     /*
95553c
        The following code will execute if the user wants to list the SDEs in the
95553c
        library (or executable) stored in flags.path. This code will not list the
95553c
@@ -514,6 +520,7 @@ skip_lib:
95553c
         if( NULL != cmd ) free(cmd);
95553c
     }
95553c
 no_sdes:
95553c
+#endif //SDE_ENABLED
95553c
 
95553c
 	/* Do this code if the event name option was specified on the commandline */
95553c
 	if ( flags.named ) {
95553c
commit b5111efaf1b234541c94b8ef7e5791bf8eb094b3
95553c
Author: Frank Winkler <frankbook@franks-air.localdomain>
95553c
Date:   Thu May 7 09:00:53 2020 +0200
95553c
95553c
    Added CFLAG -DSDE.
95553c
95553c
diff --git a/src/configure.in b/src/configure.in
95553c
index 0eee98ea1..781148e5b 100644
95553c
--- a/src/configure.in
95553c
+++ b/src/configure.in
95553c
@@ -1767,6 +1767,7 @@ tests="$tests comp_tests"
95553c
 # check for SDE component to determine if we need -lrt in LDFLAGS
95553c
 for comp in $components; do
95553c
   if test "x$comp" = "xsde" ; then
95553c
+    CFLAGS="$CFLAGS -DSDE"
95553c
     LDFLAGS="$LDFLAGS $LRT"
95553c
     LIBS="$LIBS $LRT"
95553c
     SDE_ENABLED=1
95553c
diff --git a/src/utils/papi_native_avail.c b/src/utils/papi_native_avail.c
95553c
index 902ed7996..7d90c4064 100644
95553c
--- a/src/utils/papi_native_avail.c
95553c
+++ b/src/utils/papi_native_avail.c
95553c
@@ -51,9 +51,10 @@
95553c
 
95553c
 #include "papi.h"
95553c
 #include "print_header.h"
95553c
-#ifdef SDE_ENABLED
95553c
+#if SDE
95553c
 #include "components/sde/interface/papi_sde_interface.h"
95553c
 #endif
95553c
+
95553c
 #define EVT_LINE 80
95553c
 #define EVT_LINE_BUF_SIZE 4096
95553c
 
95553c
@@ -85,7 +86,7 @@ print_help( char **argv )
95553c
 	printf( "\nGeneral command options:\n" );
95553c
 	printf( "\t-h, --help       print this help message\n" );
95553c
 	printf( "\t-c, --check      attempts to add each event\n");
95553c
-#ifdef SDE_ENABLED
95553c
+#if SDE
95553c
 	printf( "\t-sde FILE        lists SDEs that are registered by the library or executable in FILE\n" );
95553c
 #endif
95553c
 	printf( "\t-e EVENTNAME     display detailed information about named native event\n" );
95553c
@@ -371,7 +372,7 @@ parse_event_qualifiers( PAPI_event_info_t * info )
95553c
 	return ( 1 );
95553c
 }
95553c
 
95553c
-#ifdef SDE_ENABLED
95553c
+#if SDE
95553c
 void
95553c
 invoke_hook_fptr( char *lib_path )
95553c
 {
95553c
@@ -449,7 +450,7 @@ main( int argc, char **argv )
95553c
 		return 2;
95553c
 	}
95553c
 
95553c
-#ifdef SDE_ENABLED
95553c
+#if SDE
95553c
     /*
95553c
        The following code will execute if the user wants to list the SDEs in the
95553c
        library (or executable) stored in flags.path. This code will not list the
95553c
@@ -520,7 +521,7 @@ skip_lib:
95553c
         if( NULL != cmd ) free(cmd);
95553c
     }
95553c
 no_sdes:
95553c
-#endif //SDE_ENABLED
95553c
+#endif //SDE
95553c
 
95553c
 	/* Do this code if the event name option was specified on the commandline */
95553c
 	if ( flags.named ) {