another, more 'experimental' feature to get compiler optimization based on
* libxml.spec.in: another, more 'experimental' feature to
get compiler optimization based on gcc runtime profiling
diff --git a/libxml.spec.in b/libxml.spec.in
index 27d9752..4e011bf 100644
--- a/libxml.spec.in
+++ b/libxml.spec.in
@@ -60,8 +60,45 @@
%setup -q
%build
-%configure
-make
+#
+# try to use compiler profiling, based on Arjan van de Ven <arjanv@redhat.com>
+# initial test spec
+#
+GCC_VERSION=`gcc --version | grep "^gcc" | awk '{ print $3 }' | sed 's+\([0-9]\)\.\([0-9]\)\..*+\1\2+'`
+if [ $GCC_VERSION -eq 32 ]
+then
+ PROF_GEN='-fprofile-arcs'
+ PROF_USE='-fbranch-probabilities'
+else if [ $GCC_VERSION -eq 33 ]
+then
+ PROF_GEN='-fprofile-arcs'
+ PROF_USE='-fbranch-probabilities -ftracer'
+else if [ $GCC_VERSION -ge 34 ]
+then
+ PROF_GEN='-fprofile-generate'
+ PROF_USE='-fprofile-use'
+fi
+fi
+fi
+
+if [ "$PROF_GEN" != "" ]
+then
+ # First generate a profiling version
+ CFLAGS="${RPM_OPT_FLAGS} ${PROF_GEN}" %configure
+ make
+ # Run a few sampling
+ make dba100000.xml
+ ./xmllint --noout dba100000.xml
+ ./xmllint --stream dba100000.xml
+ ./xmllint --noout --valid test/valid/REC-xml-19980210.xml
+ ./xmllint --stream --valid test/valid/REC-xml-19980210.xml
+ # Then generate code based on profile
+ CFLAGS="${RPM_OPT_FLAGS} ${PROF_USE}" %configure
+ make
+else
+ %configure
+ make
+fi
(cd doc/examples ; make clean)
gzip -9 ChangeLog