svn commit: samba r13421 - in trunk/source: .
jpeach at samba.org
jpeach at samba.org
Thu Feb 9 23:59:23 GMT 2006
Author: jpeach
Date: 2006-02-09 23:59:22 +0000 (Thu, 09 Feb 2006)
New Revision: 13421
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=13421
Log:
svn merge -r 13419:13420 ../branches/SAMBA_3_0
Support profile-guided optimisation in the build system. This is
implemented for gcc 3.x, gcc 4.x and MIPSPro compilers.
Modified:
trunk/source/Makefile.in
trunk/source/configure.in
Changeset:
Modified: trunk/source/Makefile.in
===================================================================
--- trunk/source/Makefile.in 2006-02-09 23:55:01 UTC (rev 13420)
+++ trunk/source/Makefile.in 2006-02-09 23:59:22 UTC (rev 13421)
@@ -17,6 +17,13 @@
CPPFLAGS=@CPPFLAGS@
EXEEXT=@EXEEXT@
LDFLAGS=@LDFLAGS@
+
+PGO_GENERATE_CFLAGS=@PGO_GENERATE_CFLAGS@
+PGO_USE_CFLAGS=@PGO_USE_CFLAGS@
+PGO_EXPERIMENT_SCRIPT=@PGO_EXPERIMENT_SCRIPT@
+PGO_LIBS=@PGO_LIBS@
+PGO_TARGET=bin/smbd
+
AR=@AR@
LDSHFLAGS=@LDSHFLAGS@ @LDFLAGS@
WINBIND_NSS_LDSHFLAGS=@WINBIND_NSS_LDSHFLAGS@ @LDFLAGS@
@@ -802,6 +809,24 @@
everything: all libsmbclient debug2html smbfilter talloctort modules torture \
$(EVERYTHING_PROGS)
+# Top level target to build $(PGO_TARGET) with profiling data. Use sub-makes to
+# make sure that parallel make does not perturb this sequence.
+ at ifPGO@pgo:
+ at ifPGO@ $(MAKE) pgo-generate
+ at ifPGO@ $(MAKE) pgo-workload
+ at ifPGO@ $(MAKE) clean
+ at ifPGO@ $(MAKE) headers
+ at ifPGO@ $(MAKE) pgo-use
+
+ at ifPGO@pgo-generate:
+ at ifPGO@ $(MAKE) CFLAGS="$(CFLAGS) $(PGO_GENERATE_CFLAGS)" "LIBS=$(LIBS) $(PGO_LIBS)" $(PGO_TARGET)
+
+ at ifPGO@pgo-workload:
+ at ifPGO@ $(SHELL) $(PGO_EXPERIMENT_SCRIPT)
+
+ at ifPGO@pgo-use:
+ at ifPGO@ $(MAKE) CFLAGS="$(CFLAGS) $(PGO_USE_CFLAGS)" $(PGO_TARGET)
+
.SUFFIXES:
.SUFFIXES: .c .o . at PICSUFFIX@ .lo
@@ -812,6 +837,8 @@
@echo " LDFLAGS = $(LDFLAGS)"
@echo " PIE_CFLAGS = @PIE_CFLAGS@"
@echo " PIE_LDFLAGS = @PIE_LDFLAGS@"
+ at ifPGO@ @echo " PGO_GENERATE_CFLAGS = $(PGO_GENERATE_CFLAGS)"
+ at ifPGO@ @echo " PGO_USE_CFLAGS = $(PGO_USE_CFLAGS)"
MAKEDIR = || exec false; \
if test -d "$$dir"; then :; else \
@@ -1633,6 +1660,7 @@
realclean: clean delheaders
-rm -f config.log bin/.dummy script/findsmb
+ at ifPGO@ -rm -f *.gcno *.gcda *.da */*.gcno */*.gcda */*.da
distclean: realclean
-rm -f include/stamp-h
Modified: trunk/source/configure.in
===================================================================
--- trunk/source/configure.in 2006-02-09 23:55:01 UTC (rev 13420)
+++ trunk/source/configure.in 2006-02-09 23:59:22 UTC (rev 13421)
@@ -14,6 +14,27 @@
fi
#################################################
+# Figure out what type of system we are building on.
+
+UNAME_S=`(uname -s) 2>/dev/null` || UNAME_S="unknown"
+AC_MSG_CHECKING(uname -s)
+AC_MSG_RESULT(${UNAME_S})
+
+UNAME_R=`(uname -r) 2>/dev/null` || UNAME_R="unknown"
+AC_MSG_CHECKING(uname -r)
+AC_MSG_RESULT(${UNAME_R})
+
+UNAME_M=`(uname -m) 2>/dev/null` || UNAME_M="unknown"
+AC_MSG_CHECKING(uname -m)
+AC_MSG_RESULT(${UNAME_M})
+
+UNAME_P=`(uname -p) 2>/dev/null` || UNAME_P="unknown"
+AC_MSG_CHECKING(uname -p)
+AC_MSG_RESULT(${UNAME_P})
+
+AC_CANONICAL_SYSTEM
+
+#################################################
# Detect the compiler early so we know how to run
# feature tests correctly.
@@ -309,7 +330,14 @@
# if it has no value. This prevent *very* large debug binaries from occurring
# by default.
if test "x$CFLAGS" = x; then
- CFLAGS="-O"
+ AX_CFLAGS_GCC_OPTION(-O2, CFLAGS)
+ AX_CFLAGS_IRIX_OPTION(-O2, CFLAGS)
+ # Make sure the MIPSPro compiler will never decide functions are too
+ # big to optimise
+ AX_CFLAGS_IRIX_OPTION(-OPT:Olimit=0, CFLAGS)
+ AX_CFLAGS_HPUX_OPTION(-O2, CFLAGS)
+ AX_CFLAGS_SUN_OPTION(-O2, CFLAGS)
+ AX_CFLAGS_AIX_OPTION(-O2, CFLAGS)
fi
CPPFLAGS="${CPPFLAGS} -D_SAMBA_BUILD_"
@@ -352,6 +380,88 @@
LIBS="$LIBS -ldmalloc"
fi
+# Check for profile guided optimisation (PGO) support.
+
+AC_ARG_ENABLE(pgo,
+[ --enable-pgo=SCRIPT Compile with PGO (default=no)],
+[
+ case $enableval in
+ yes|no)
+ AC_MSG_ERROR(the argument to --enable-pgo must be an executable script)
+ esac
+
+ samba_cv_have_pgo=no
+
+ # Test for IRIX PGO first. Unfortunately, some of the later GCC option
+ # tests can spuriously succeed with the MIPSPro compilers. Despite the
+ # test succeeding, the GCC options don't work.
+ if test "x$samba_cv_have_pgo" = "xno" ; then
+ samba_cv_have_pgo=yes
+ # The backslash below is horrible but necessary -- jpeach
+ AX_CFLAGS_IRIX_OPTION("-fb_create\ samba.feedback",
+ PGO_GENERATE_CFLAGS, [], [samba_cv_have_pgo=no])
+ AX_CFLAGS_IRIX_OPTION("-fb_opt\ samba.feedback",
+ PGO_USE_CFLAGS, [], [samba_cv_have_pgo=no])
+ fi
+
+ # Test GCC 4.x style profile flags.
+ if test "x$samba_cv_have_pgo" = "xno" ; then
+ samba_cv_have_pgo=yes
+ AX_CFLAGS_GCC_OPTION(-fprofile-generate, PGO_GENERATE_CFLAGS,
+ [], [samba_cv_have_pgo=no])
+ AX_CFLAGS_GCC_OPTION(-fprofile-use, PGO_USE_CFLAGS,
+ [], [samba_cv_have_pgo=no])
+ fi
+
+ # Test GCC 3.x style profile flags. This is rather more complicated so
+ # we only require a minimal set of options to enable PGO.
+ if test "x$samba_cv_have_pgo" = "xno" ; then
+ samba_cv_have_pgo=yes
+ AX_CFLAGS_GCC_OPTION(-fprofile-arcs, PGO_GENERATE_CFLAGS,
+ [], [samba_cv_have_pgo=no])
+ AX_CFLAGS_GCC_OPTION(-fvpt, PGO_GENERATE_CFLAGS, [], [])
+ AX_CFLAGS_GCC_OPTION(-fspeculative-prefetching, PGO_GENERATE_CFLAGS,
+ [], [])
+ AX_CFLAGS_GCC_OPTION(-fprofile-values, PGO_GENERATE_CFLAGS, [], [])
+ AX_CFLAGS_GCC_OPTION(-fbranch-probabilities, PGO_USE_CFLAGS,
+ [], [samba_cv_have_pgo=no])
+ AX_CFLAGS_GCC_OPTION(-fvpt, PGO_USE_CFLAGS, [], [])
+ AX_CFLAGS_GCC_OPTION(-freorder-functions, PGO_USE_CFLAGS, [], [])
+ AX_CFLAGS_GCC_OPTION(-fprofile-values, PGO_USE_CFLAGS, [], [])
+ AX_CFLAGS_GCC_OPTION(-fspeculative-prefetching, PGO_USE_CFLAGS, [], [])
+ AX_CFLAGS_GCC_OPTION(-funroll-loops, PGO_USE_CFLAGS, [], [])
+ AX_CFLAGS_GCC_OPTION(-fpeel-loops, PGO_USE_CFLAGS, [], [])
+ AX_CFLAGS_GCC_OPTION(-ftracer, PGO_USE_CFLAGS, [], [])
+ fi
+
+ if test -r "$enableval" ; then
+ PGO_EXPERIMENT_SCRIPT="$enableval"
+ else
+ AC_MSG_ERROR(cannot find PGO experiment script $enableval)
+ fi
+
+ if test "x$samba_cv_have_pgo" = "xno" ; then
+ ifPGO="#"
+ else
+ # Enable PGO targets in Makefile
+ ifPGO=""
+ # System-specific profiling tweaks
+ case "$host_os" in
+ *irix*) PGO_LIBS="$PGO_LIBS -linstr" ;;
+ esac
+ fi
+],
+[
+ ifPGO="#"
+]
+)
+
+AC_SUBST(ifPGO)
+AC_SUBST(PGO_GENERATE_CFLAGS)
+AC_SUBST(PGO_USE_CFLAGS)
+AC_SUBST(PGO_EXPERIMENT_SCRIPT)
+AC_SUBST(PGO_LIBS)
+
dnl Checks for programs.
AC_PROG_INSTALL
@@ -421,24 +531,6 @@
AC_DEFINE(HAVE_VOLATILE, 1, [Whether the C compiler understands volatile])
fi
-UNAME_S=`(uname -s) 2>/dev/null` || UNAME_S="unknown"
-AC_MSG_CHECKING(uname -s)
-AC_MSG_RESULT(${UNAME_S})
-
-UNAME_R=`(uname -r) 2>/dev/null` || UNAME_R="unknown"
-AC_MSG_CHECKING(uname -r)
-AC_MSG_RESULT(${UNAME_R})
-
-UNAME_M=`(uname -m) 2>/dev/null` || UNAME_M="unknown"
-AC_MSG_CHECKING(uname -m)
-AC_MSG_RESULT(${UNAME_M})
-
-UNAME_P=`(uname -p) 2>/dev/null` || UNAME_P="unknown"
-AC_MSG_CHECKING(uname -p)
-AC_MSG_RESULT(${UNAME_P})
-
-AC_CANONICAL_SYSTEM
-
dnl Add #include for broken IRIX header files
case "$host_os" in
*irix6*) AC_ADD_INCLUDE(<standards.h>)
More information about the samba-cvs
mailing list