File itrace-SLES11-build.patch of Package itrace

---
 configure.in             |   14 ++-
 src/a2n/Makefile.am      |   40 ++++------
 src/driver/Makefile      |  179 ++++-------------------------------------------
 src/perfutil/Makefile.am |   14 +--
 src/wbirlog/Makefile.am  |    8 +-
 5 files changed, 57 insertions(+), 198 deletions(-)

--- a/configure.in
+++ b/configure.in
@@ -13,7 +13,16 @@ AC_CONFIG_HEADERS([include/config.h])
 AC_PROG_CC
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
-AC_PROG_RANLIB
+AC_PROG_LIBTOOL
+
+# set the libtool so version numbers
+lt_major=11
+lt_revision=0
+lt_age=0
+
+AC_SUBST(lt_major)
+AC_SUBST(lt_revision)
+AC_SUBST(lt_age)
 
 # Checks for libraries.
 AC_CHECK_LIB([c], [atoi], [], [AC_MSG_ERROR([[Please install libc.]])])
@@ -281,9 +290,6 @@ if test -e pi_temp ; then
   rm pi_temp
 fi
 
-prefix=$PWD
-AC_SUBST(prefix)
-
 AM_CONDITIONAL(build_arcf, test -f src/arcf/arc.c )
 AM_CONDITIONAL(pi_counters_supported, test "${HOSTTYPE}" = "x86_64" -o "${pi_hosttype}" = "i386" )
 
--- a/src/a2n/Makefile.am
+++ b/src/a2n/Makefile.am
@@ -23,7 +23,10 @@ if two_a2n
 
 # build both a2n versions, liba2n and liba2n2
 
-bin_PROGRAMS = liba2n.so liba2n2.so
+lib_LTLIBRARIES = liba2n.la liba2n2.la
+
+liba2n_la_LDFLAGS = -version-info @lt_major@:@lt_revision@:@lt_age@ -liberty -ldl -lc -lbfd
+liba2n2_la_LDFLAGS = -version-info @lt_major@:@lt_revision@:@lt_age@ -liberty -ldl -lc -lbfd
 
 liba2n_SOURCES = \
 	a2n.c	          \
@@ -38,9 +41,9 @@ liba2n_SOURCES = \
 	util.c
 
 
-liba2n_so_SOURCES = ${liba2n_SOURCES}
+liba2n_la_SOURCES = ${liba2n_SOURCES}
 
-liba2n2_so_SOURCES = \
+liba2n2_la_SOURCES = \
 	a2n.c	          \
 	a2nint.c	  \
 	initterm.c	  \
@@ -52,19 +55,13 @@ liba2n2_so_SOURCES = \
 	saveres.c	  \
 	util.c
 
-liba2n2_so_LDADD = \
-	-liberty -ldl -lc ${bfd_dir}/${bfd_name}
-
-liba2n_so_LDADD = \
-	-liberty -ldl -lc
-
-liba2n2_so_CFLAGS = -I ${top_srcdir}/INCLUDE \
+liba2n2_la_CFLAGS = -I ${top_srcdir}/INCLUDE \
             -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE \
-            -DDEBUG -DAUTOMAKE -fPIC -shared -DA2N_USE_BFD
+            -DDEBUG -DAUTOMAKE -fPIC -DA2N_USE_BFD
 
-liba2n_so_CFLAGS = -I ${top_srcdir}/INCLUDE \
+liba2n_la_CFLAGS = -I ${top_srcdir}/INCLUDE \
             -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE \
-            -DDEBUG -DAUTOMAKE -fPIC -shared
+            -DDEBUG -DAUTOMAKE -fPIC
 
 else
 
@@ -86,25 +83,22 @@ if build_stap
 
 noinst_LIBRARIES = liba2n.a
 liba2n_a_SOURCES = ${liba2n_SOURCES}
-#liba2n_a_LDADD = \
-#	-liberty -ldl -lc ${bfd_dir}/${bfd_name}
+
 liba2n_a_CFLAGS = -I ${top_srcdir}/INCLUDE \
             -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE \
             -DDEBUG -DAUTOMAKE -DA2N_USE_BFD
 
 else
 
-bin_PROGRAMS = liba2n.so
-liba2n_so_SOURCES = ${liba2n_SOURCES}
+lib_LTLIBRARIES = liba2n.la
+
+liba2n_la_LDFLAGS = -version-info @lt_major@:@lt_revision@:@lt_age@ -liberty -ldl -lbfd
 
-liba2n_so_LDADD = \
-	-liberty -ldl -lc ${bfd_dir}/${bfd_name}
-liba2n_so_LDFLAGS = \
-	 -fPIC -shared
+liba2n_la_SOURCES = ${liba2n_SOURCES}
 
-liba2n_so_CFLAGS = -I ${top_srcdir}/INCLUDE \
+liba2n_la_CFLAGS = -I ${top_srcdir}/INCLUDE \
             -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE \
-            -DDEBUG -DAUTOMAKE -fPIC -shared -DA2N_USE_BFD
+            -DDEBUG -DAUTOMAKE -fPIC -DA2N_USE_BFD
 
 endif
 endif
--- a/src/driver/Makefile
+++ b/src/driver/Makefile
@@ -1,164 +1,21 @@
-# Makefile
-# For verbose output do 'make V=1' (same as for the main line Linux Kernel)
+src := $(ITRACE_DIR)/obj/ppc64
+EXTRA_CFLAGS += -D_LINUX
+EXTRA_CFLAGS += -I$(src)/../../include
 
-# The Makefile is read twice
-# The first time invokes the kernel build system
-# The second time does the work.
-
-EXTRA_CFLAGS += -D_LINUX -fomit-frame-pointer
-
-ifneq (${KERNELRELEASE},)
-	EXTRA_CFLAGS += -DPI_TPROF
-	EXTRA_CFLAGS += -I${PI_INSPECTOR_DIR} -I${KDIR}/include -I${KDIR}/include/asm/mach-default
-	EXTRA_CFLAGS += -I${PI_INCLUDE_DIR}
-
-	obj-m := pitrace.o
-	pitrace-objs := pi_init.o  pi_hash.o pi_hooks.o
-
-ifneq (${DEBUG},)
-	EXTRA_CFLAGS += -DPI_DEBUG
-endif
-
-ifneq (${WARN},)
-       EXTRA_CFLAGS += -W -Wall
-endif
-
-ifneq (${ITRACE_ONLY},)
-       EXTRA_CFLAGS += -D_ST_ITRACE_ONLY
-endif
-
-
-ifeq (${PROFILE_HOOK},1)
-        EXTRA_CFLAGS += -DOLD_STYLE
-endif
-
-ifeq (${TIMER_HOOK},0)
-        EXTRA_CFLAGS += -DTIMER_NOTIFIER
-endif
-
-ifeq ($(CONFIG_X86),y)
-	DUMMY := $(shell ${GH_PROG} ${HF} 'pi_schedule_tail_address' '[^dD][\. ]{1}schedule_tail$$')
-ifeq ($(CONFIG_X86_64),y)
-	EXTRA_CFLAGS +=  -falign-functions=64
-	DUMMY := $(shell ${GH_PROG} ${HF} 'pi_system_call_address' '[^dD][\. ]{1}system_call$$')
-	DUMMY := $(shell ${GH_PROG} ${HF} 'pi_iret_label_address' '[^dD][\. ]{1}iret_label$$')
-
-        pitrace-objs += i386/pi_cpuinit.o x86_64/pi_patch.o  x86_64/pi_itrace.o  
-ifeq (${ITRACE_ONLY},)
-	pitrace-objs += pi_counters.o pi_ctrevent.o i386/pi_tprof.o x86_64/pi_tprof64.o
-endif
-
-
-ifneq ($(shell grep 'Intel' /proc/cpuinfo),)
-	EXTRA_CFLAGS +=  -DPI_INTEL
-endif   # end Intel x86_64
-
-else    # !CONFIG_X86_64 = y, i.e., 32-bit
-	EXTRA_CFLAGS +=  -falign-functions=32
-
-ifneq ($(shell grep 'GenuineIntel' /proc/cpuinfo),)
-	EXTRA_CFLAGS +=  -DPI_INTEL
-else
-ifneq ($(shell grep 'AuthenticAMD' /proc/cpuinfo),)
-else
-	echo "Platform not supported"
-endif
-endif   # end if Intel
-
-	pitrace-objs += i386/pi_cpuinit.o i386/pi_patch.o i386/pi_itrace.o
-
-ifeq (${ITRACE_ONLY},)
-	pitrace-objs += pi_counters.o pi_ctrevent.o i386/pi_tprof.o i386/pi_tprof32.o 
-endif
-
-	DUMMY := $(shell ${GH_PROG} ${HF} 'pi_sysenter_address' '[^dD][\. ]{1}sysenter_entry$$')
-	DUMMY := $(shell ${GH_PROG} ${HF} 'pi_do_debug_address' '[^dD][\. ]{1}do_debug$$')
-	DUMMY := $(shell ${GH_PROG} ${HF} 'pi_restore_address' '[^dD][\. ]{1}restore_all$$')
-	DUMMY := $(shell ${GH_PROG} ${HF} 'pi_send_sigtrap_address' '[^dD][\. ]{1}send_sigtrap$$')	
-endif   # !CONFIG_X86_64
-endif	# end CONFIG_X86, note CONFIG_X86_64 implies CONFIG_X86
-
-
-ifeq ($(CONFIG_PPC64),y)
-	pitrace-objs += ppc64/pi_cpuinit.o  ppc64/pi_msrtraps.o 
-ifeq (${ITRACE_ONLY},)
-	pitrace-objs += ppc64/pi_perfctr.o
-endif
-
-	DUMMY := $(shell ${GH_PROG} ${HF} 'ppc_tb_freq_location' ' ppc_tb_freq$$')
-ifneq ($(shell grep 'POWER3' /proc/cpuinfo),)
-        # ITrace does not work for POWER3
-	EXTRA_CFLAGS += -DPI_POWER3
-else
-	pitrace-objs += ppc64/pi_itrace.o ppc64/pi_patch.o
-	DUMMY := $(shell ${GH_PROG} ${HF} 'pi_DoSyscall' '[^dD] [.]{0,1}DoSyscall$$')
-	DUMMY := $(shell ${GH_PROG} ${HF} 'pi_system_call' '[^dD] [.]{0,1}system_call$$')
-	DUMMY := $(shell ${GH_PROG} ${HF} 'pi_page_fault' '[^dD] [.]{0,1}do_page_fault$$')
-	DUMMY := $(shell ${GH_PROG} ${HF} 'pi_force_sig' '[^dD] [.]{0,1}force_sig$$')
-	DUMMY := $(shell ${GH_PROG} ${HF} 'pi_do_syscall_trace_leave' '[^dD] [.]{0,1}do_syscall_trace_leave$$')
-	DUMMY := $(shell ${GH_PROG} ${HF} 'pi_restore_address' '[^dD] restore$$')
-	# HardwareInterrupt_entry was changed to hardware_interrupt_entry sometime
-	# before the 2.6.12 kernel
-	DUMMY := $(shell ${GH_PROG} ${HF} 'pi_irq' '(h|H)ardware_?(i|I)nterrupt_entry')
-	DUMMY := $(shell ${GH_PROG} ${HF} 'pi_exit' '\.do_exit')	
-endif
-endif
-
-#s390
-
-# Newer kernels have CONFIG_S390 for both s390, s390x
-ifeq ($(CONFIG_S390),y)
-        pitrace-objs += s390/pi_cpuinit.o s390/pi_perfctr.o
-endif
-
-ifeq ($(CONFIG_ARCH_S390X),y)
-        pitrace-objs += s390/pi_cpuinit.o s390/pi_perfctr.o
-endif
-
-ifeq ($(CONFIG_ARCH_S390),y)
-        pitrace-objs += s390/pi_cpuinit.o s390/pi_perfctr.o
-endif
-
-	DUMMY := $(shell ${GH_PROG} ${HF} 'generate_epilog')
-
-	pitrace-objs += pi_btrace.o pi_ioctl.o pi_entries.o pi_inspector.o
-ifeq (${ITRACE_ONLY},)
-	pitrace-objs += pi_ptt.o pi_inspector.o pi_rmss.o pi_ki.o
-	pitrace-objs += pi_scs.o
-endif
-
-
-else	# !KERNELRELEASE
-	KDIR	:= /lib/modules/$(shell uname -r)/build
-	export PI_INSPECTOR_DIR	:= $(shell pwd)
-	export PI_INCLUDE_DIR := ${PI_INSPECTOR_DIR}/../../include
-	export GH_PROG := ${PI_INSPECTOR_DIR}/generate_header.sh
-	export HF := ${PI_INSPECTOR_DIR}/hooks.h
-
-PROFILE_H := $(shell find /lib/modules/$$(uname -r) -follow -name profile.h | head -n1)
-export PROFILE_HOOK := $(shell grep -q "PROFILE_TASK_EXIT" "${PROFILE_H}"; echo $$?)
-export TIMER_HOOK := $(shell grep -q "register_profile_notifier" "${PROFILE_H}"; echo $$?)
-
-default:
-	$(shell ${GH_PROG} ${HF} 'generate_prolog' 'HOOKS_H')
-	$(shell ${GH_PROG} ${HF} 'pi_switch_to' '[^dD] [.]{0,1}__switch_to$$')
-	$(shell ${GH_PROG} ${HF} 'pi_schedule' '[^dD] [.]{0,1}schedule$$')
-	$(shell ${GH_PROG} ${HF} 'pi_schedule_end' '[^dD] [.]{0,1}io_schedule$$' )
-	$(shell ${GH_PROG} ${HF} 'pi_ret_from_fork_address' '[^dD] [.]{0,1}ret_from_fork$$')
-	$(shell ${GH_PROG} ${HF} 'pi_schedule2' '[^dD] [.]{0,1}__schedule$$')
-	$(MAKE) -C ${KDIR} M=${PI_INSPECTOR_DIR} modules
-
-
-install:
-	$(MAKE) -C ${KDIR} M=${PI_INSPECTOR_DIR} modules_install
-
-clean:
-	$(MAKE) -C ${KDIR} M=${PI_INSPECTOR_DIR} clean
-	-rm -f  ${HF}
-
-.PHONEY: pitags
-pitags:
-	ctags -RN --extra=+f --c-kinds=+px . ${PI_INCLUDE_DIR}
+obj-m := pitrace.o
+pitrace-objs := pi_init.o pi_hash.o pi_hooks.o
+pitrace-objs += ppc64/pi_cpuinit.o ppc64/pi_msrtraps.o
+pitrace-objs += ppc64/pi_perfctr.o
+pitrace-objs += ppc64/pi_itrace.o ppc64/pi_patch.o
+pitrace-objs += pi_btrace.o pi_ioctl.o pi_entries.o pi_inspector.o
+pitrace-objs += pi_ptt.o pi_inspector.o pi_rmss.o pi_ki.o
 
+PI_INSPECTOR_DIR := $(src)
+
+
+modules:
+	$(MAKE) -C $(KERNEL_SOURCE) SUBDIRS=$(shell pwd) $@
+
+
+install: modules_install
 
-endif	# !KERNELRELEASE
--- a/src/perfutil/Makefile.am
+++ b/src/perfutil/Makefile.am
@@ -1,17 +1,17 @@
 # Performance Inspector:  APIs for C and Java
 
 
-AM_CFLAGS = -I ${top_srcdir}/include -I ${java_dir}/include \
-            -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE \
-            -DAUTOMAKE  -fPIC -shared
+lib_LTLIBRARIES = libperfutil.la
 
-AM_LDFLAGS = -lpthread
+libperfutil_la_LDFLAGS = -version-info @lt_major@:@lt_revision@:@lt_age@ -lpthread -shared
 
-bin_PROGRAMS = libperfutil.so
+libperfutil_la_CFLAGS = -I ${top_srcdir}/include -I ${java_dir}/include \
+            -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE \
+            -DAUTOMAKE  -fPIC
 
 if enable_java
 
-libperfutil_so_SOURCES = \
+libperfutil_la_SOURCES = \
 	perfutil.c  \
         perfctr.c   \
 	perfptt.c   \
@@ -130,7 +130,7 @@ CLEANFILES = ../../bin/JPerf.jar  jperf/
 
 else
 
-libperfutil_so_SOURCES = \
+libperfutil_la_SOURCES = \
 	perfutil.c  \
         perfctr.c   \
 	perfptt.c   \
--- a/src/wbirlog/Makefile.am
+++ b/src/wbirlog/Makefile.am
@@ -3,10 +3,12 @@
 
 AM_CFLAGS = -I ${top_srcdir}/include \
             -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE \
-            -DIBM_LINUX -DAUTOMAKE  -fPIC -shared
+            -DIBM_LINUX -DAUTOMAKE -fPIC
 
-bin_PROGRAMS = libwbirlog.so
+lib_LTLIBRARIES = libwbirlog.la
 
-libwbirlog_so_SOURCES = \
+libwbirlog_la_LDFLAGS = -version-info @lt_major@:@lt_revision@:@lt_age@ -shared
+
+libwbirlog_la_SOURCES = \
 	wbirlog.c