[Xcb] profiling option for xcb
Vincent Torri
Vincent.Torri at iecn.u-nancy.fr
Fri Feb 17 10:05:49 PST 2006
Hello,
I have added a profile option for configure, so that we can use gprof if
we want to profile an xcb program.
patched attached for configure.ac and Makefile.am
is it worth a commit ? (also, if you want me to change the names of the
variables, please tell me)
Vincent
-------------- next part --------------
--- Makefile.am.~1.28.~ 2006-02-11 12:33:32.000000000 +0100
+++ Makefile.am 2006-02-17 18:39:40.015454842 +0100
@@ -50,6 +50,7 @@
CFLAGS =
AM_CFLAGS = -include config.h $(CDEBUGFLAGS) $(XCBPROTO_CFLAGS) $(XPROTO_CFLAGS) $(XAU_CFLAGS)
+libXCB_la_LDFLAGS = $(OPTLDFLAGS)
libXCB_la_LIBADD = $(XCBPROTO_LIBS) $(XPROTO_LIBS) $(XAU_LIBS)
libXCB_la_SOURCES = \
xcb_conn.c xcb_out.c xcb_in.c xcb_ext.c xcb_xid.c \
-------------- next part --------------
--- configure.ac.~1.14.~ 2005-12-28 20:34:52.000000000 +0100
+++ configure.ac 2006-02-17 19:14:59.180746531 +0100
@@ -51,32 +51,40 @@
xcbincludedir='${includedir}/X11/XCB'
AC_SUBST(xcbincludedir)
+optldflags=""
AC_ARG_WITH(opt,
-AC_HELP_STRING([--with-opt], [compile with reasonable optimizations])
-AC_HELP_STRING([--with-opt=FLAGS], [compile with specified FLAGS])
-AC_HELP_STRING([--with-opt=small], [compile for smallest code])
-AC_HELP_STRING([--with-opt=debug], [compile for debugging (default)]),
+AC_HELP_STRING([--with-opt], [compile with reasonable optimizations])
+AC_HELP_STRING([--with-opt=FLAGS], [compile with specified FLAGS])
+AC_HELP_STRING([--with-opt=small], [compile for smallest code])
+AC_HELP_STRING([--with-opt=profile], [compile for profiling code])
+AC_HELP_STRING([--with-opt=debug], [compile for debugging (default)]),
[
case "$withval" in
yes)
- optflags="-O3"
+ optcflags="-O3"
;;
small)
- optflags="-Os -fomit-frame-pointer -DNDEBUG"
+ optcflags="-Os -fomit-frame-pointer -DNDEBUG"
+ ;;
+ profile)
+ optcflags="-pg -fprofile-arcs -ftest-coverage -DNDEBUG"
+ optldflags="-pg"
;;
no|debug)
- optflags="-g"
+ optcflags="-g"
;;
*)
- optflags="$withval"
+ optcflags="$withval"
;;
esac
])
-AC_CACHE_CHECK([what compiler optimizations to apply], [optflags], [optflags="-g"])
+AC_CACHE_CHECK([what compiler optimizations to apply], [optcflags], [optcflags="-g"])
AC_DEFINE(_XOPEN_SOURCE, 500, [Conform to Single Unix Specification.])
-CDEBUGFLAGS="$optflags -Wall -pedantic -Wpointer-arith \
+CDEBUGFLAGS="$optcflags -Wall -pedantic -Wpointer-arith \
-Wstrict-prototypes -Wmissing-declarations -Wnested-externs"
+OPTLDFLAGS=$optldflags
AC_SUBST(CDEBUGFLAGS)
+AC_SUBST(OPTLDFLAGS)
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile])
AC_CONFIG_FILES([xcb.pc])
More information about the Xcb
mailing list