changeset 1913:b179f89c8a4f

Major update of the gprof profiling support
author bartv
date Mon, 21 Mar 2005 13:56:10 +0000
parents 1a27120cada4
children d485b9fe6131
files packages/services/profile/gprof/current/ChangeLog packages/services/profile/gprof/current/cdl/profile_gprof.cdl packages/services/profile/gprof/current/doc/cray.xbm packages/services/profile/gprof/current/doc/gprofrun.fig packages/services/profile/gprof/current/doc/gprofrun.png packages/services/profile/gprof/current/doc/profile.sgml packages/services/profile/gprof/current/host/Makefile.am packages/services/profile/gprof/current/host/Makefile.in packages/services/profile/gprof/current/host/acinclude.m4 packages/services/profile/gprof/current/host/aclocal.m4 packages/services/profile/gprof/current/host/configure packages/services/profile/gprof/current/host/configure.in packages/services/profile/gprof/current/host/gprof.gdb packages/services/profile/gprof/current/include/gmon_out.h packages/services/profile/gprof/current/include/profile.h packages/services/profile/gprof/current/src/profile.c
diffstat 16 files changed, 4644 insertions(+), 295 deletions(-) [+]
line wrap: on
line diff
--- a/packages/services/profile/gprof/current/ChangeLog
+++ b/packages/services/profile/gprof/current/ChangeLog
@@ -1,3 +1,25 @@
+2005-02-18  Bart Veer  <bartv@ecoscentric.com>
+
+	* doc/profile.sgml, misc/gprof.gdb, host/gprof.gdb,
+	  host/acinclude.m4, host/aclocal.m4, host/configure,
+	  host/configure.in, host/Makefile.am, host/Makefile.in:
+	  Move gprof.gdb to the host subdirectory, and autoconfiscate it.
+
+2003-09-29  Bart Veer  <bartv@ecoscentric.com>
+
+	* src/profile.c (profile_tftp_read_next): fix off-by-one error
+	which lost the first mcount record.
+
+	* doc/profile.sgml: fix typo
+
+	* cdl/profile_gprof.cdl: clarify description of the tftp port
+
+2003-09-26  Bart Veer  <bartv@ecoscentric.com>
+
+	* cdl/profile_gprof.cdl, include/gmon.out.h, include/profile.h,
+ 	src/profile.c, misc/gprof.gdb, doc/gprof.sgml
+	Major update, including adding call graph support.
+
 2003-04-27  Jonathan Larmour  <jifl@eCosCentric.com>
 
 	* src/profile.c (profile_on): Clear profile before use. Reported
@@ -34,6 +56,7 @@ 2002-11-14  Gary Thomas  <gthomas@ecosce
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2003, 2005 eCosCentric Limited
 // Copyright (C) 2002 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
--- a/packages/services/profile/gprof/current/cdl/profile_gprof.cdl
+++ b/packages/services/profile/gprof/current/cdl/profile_gprof.cdl
@@ -8,6 +8,7 @@
 #####ECOSGPLCOPYRIGHTBEGIN####
 ## -------------------------------------------
 ## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 2003 eCosCentric Ltd.
 ## Copyright (C) 2002 Gary Thomas
 ##
 ## eCos is free software; you can redistribute it and/or modify it under
@@ -42,7 +43,7 @@
 #
 # Author(s):      Gary Thomas
 # Original data:  Gary Thomas
-# Contributors:
+# Contributors:	  Bart Veer
 # Date:           2002-11-14
 #
 #####DESCRIPTIONEND####
@@ -50,45 +51,144 @@
 # ====================================================================
 
 cdl_package CYGPKG_PROFILE_GPROF {
-    display       "Gather runtime profile statistics"
-    requires      CYGPKG_NET
-    requires      CYGPKG_NET_TFTP
-    requires      CYGPKG_MEMALLOC   
-    requires      { CYGINT_PROFILE_HAL_TIMER != 0 }
-    doc           ref/services-profile-gprof.html
+    display     "Runtime profile statistics"
+    requires    CYGPKG_MEMALLOC   
+    requires    { CYGINT_PROFILE_HAL_TIMER != 0 }
 
-    include_dir   cyg/profile
-    
-    compile profile.c
+    # The profiling package itself must be built without -pg.
+    # Otherwise you can end up with infinite recursion in
+    # mcount().
+    requires	{ is_substr(CYGPKG_PROFILE_GPROF_CFLAGS_REMOVE, " -pg ") }
+    doc         ref/services-profile-gprof.html
+
+    include_dir cyg/profile
+    compile	profile.c
 
     description "
         This package enables runtime profiling of an application.
     The actual profile collection must be turned on by the application,
-    once it has been initialized.  The data collected is exported via
-    a TFTP connection to the target."
+    once it has been initialized.  The data collected on the target can
+    be extracted using either a gdb macro or tftp."
 
-    cdl_interface     CYGINT_PROFILE_HAL_TIMER {
+    cdl_interface CYGINT_PROFILE_HAL_TIMER {
         display   "High resolution timer, implemented by platform"
         description "
 	  Profiling requires access to a high resolution timer which
           is platform dependent."
     }
 
-    cdl_option CYGNUM_PROFILE_TFTP_PORT {
-        display       "Port used by TFTP server for profile data"
-        flavor        data
-        default_value 0
-        description   "
-            This option sets the port number to use for the TFTP server
-            which exports the profiling data.  A value of 0 will set
-            the port to be the IETF standard port of 69/udp."
+    cdl_interface CYGINT_PROFILE_HAL_MCOUNT {
+	display   "HAL supports call-graph profiling"
+	description "
+          On some platforms the HAL may support an mcount() call. This
+          allows the profiling package to gather additional information,
+          used by gprof to determine a call graph."
     }
 
-    cdl_option CYGPKG_PROFILE_TESTS {
-        display "Profiling tests"
-        flavor  data   
-        no_define      
-        calculated { "tests/profile.c" }
+    cdl_component CYGPKG_PROFILE_CALLGRAPH {
+	display   	"Collect call-graph profiling data"
+	active_if 	CYGINT_PROFILE_HAL_MCOUNT
+	default_value	1
+	description "
+          There are several different types of profiling information
+          that can be gathered. One type is used by gprof to determine
+          the application callgraph. This is not required but can be used
+          to gain additional insight in the application's behaviour,
+          at the cost of increased overheads in gathering the data. It
+          requires that application code be compiled with the -pg flag,
+          and it also requires HAL support that may not be available
+          on all targets."
+
+	cdl_option CYGNUM_PROFILE_CALLGRAPH_HASH_SHIFT {
+	    display		"Control size of call-graph hash table"
+	    flavor		data
+	    default_value	8
+	    legal_values	1 to 16
+	    description "
+              The call graph code uses a hash table to map program counter
+              addresses into an array index. The hash function is a simple
+              shift operation, so the size of the hash table depends on
+              the amount of code being profiled and the shift size. With
+              a default value of 8 the hash table needs one 32-bit integer
+              for every 256 bytes of code. Increasing the shift size reduces
+              memory requirements at the cost of extra run-time processing
+              to handle hash collisions."
+	}
+
+	cdl_option CYGNUM_PROFILE_CALLGRAPH_ARC_PERCENTAGE {
+	    display		"Control size of arc table"
+	    flavor		data
+	    default_value	5
+	    legal_values	1 to 100
+	    description "
+              Determining the call graph requires keeping track of where
+              every function is called from, in an arc table. The size of
+              this table is calculated as a percentage of the amount of
+              code being profiled. The default value of 5% is appropriate
+              for typical applications."
+	}
+    }
+    
+    cdl_component CYGPKG_PROFILE_TFTP {
+	display	    	"Allow the profile data to be collected by tftp"
+	default_value	1
+	active_if	CYGPKG_NET
+	requires    	CYGPKG_NET
+	requires    	CYGPKG_NET_TFTP
+	description "
+          There are two supported ways of transferring the profile data
+          from the target to the host. The first is to use a gdb macro
+          inside a gdb session, dumping the data directly from memory
+          to a file gmon.out. Usually this is the most convenient
+          approach. However it does require a gdb session and it can
+          be slow when debugging over e.g. a serial line. Alternatively
+          the profile package can provide a tftp daemon, allowing other
+          machines to retrieve the data over ethernet."
+	
+	cdl_option CYGNUM_PROFILE_TFTP_PORT {
+	    display       "Port used by TFTP server for profile data"
+	    flavor        data
+	    default_value 69
+	    description   "
+                By default the profiling package will create a tftp daemon
+                that listens on port 69, the standard port for this service.
+                If there are other packages that start a tftp daemon, or
+                if application code wants to provide this service, then
+                there is a conflict: each daemon requires a unique port.
+                This configuration option can be used to change the port
+                used by the profiling tftp daemon."
+        }
+    }
+    
+    cdl_component CYGPKG_PROFILE_GPROF_OPTIONS {
+        display "Profiling build options"
+        flavor  none
+        description   "
+	    Package specific build options including control over
+	    compiler flags used only in building this package,
+	    and details of which tests are built."
+
+
+        cdl_option CYGPKG_PROFILE_GPROF_CFLAGS_ADD {
+            display "Additional compiler flags"
+            flavor  data
+            no_define
+            default_value { "" }
+            description   "
+                This option modifies the set of compiler flags for
+                building this package. These flags are used in addition
+                to the set of global flags."
+        }
+
+        cdl_option CYGPKG_PROFILE_GPROF_CFLAGS_REMOVE {
+            display "Suppressed compiler flags"
+            flavor  data
+            no_define
+            default_value { "-pg" }
+            description   "
+                This option modifies the set of compiler flags for
+                building this package. These flags are removed from
+                the set of global flags if present."
+        }
     }
 }
-
new file mode 100644
--- /dev/null
+++ b/packages/services/profile/gprof/current/doc/cray.xbm
@@ -0,0 +1,38 @@
+#define noname_width 64
+#define noname_height 64
+static char noname_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xe7,0xe3,0x1c,
+ 0x00,0x00,0x00,0x00,0xbc,0xff,0xff,0x1f,0x00,0x00,0x00,0x00,0xfc,0xff,0xff,
+ 0xff,0x03,0x00,0x00,0x00,0xbc,0x61,0x30,0xf8,0x03,0x00,0x00,0x00,0xb4,0x61,
+ 0x30,0x18,0x02,0x00,0x00,0x00,0xb4,0x61,0x30,0x18,0x02,0x00,0x00,0x00,0xb4,
+ 0x61,0x30,0x18,0x02,0x00,0x00,0x00,0xb4,0x61,0x30,0x18,0x02,0x00,0x00,0x00,
+ 0xb4,0x61,0x30,0x18,0x02,0x00,0x00,0x00,0xb4,0x61,0x30,0x18,0x02,0x00,0x00,
+ 0x00,0xb4,0x61,0x30,0x18,0x02,0x00,0x00,0x00,0xb4,0x61,0x30,0x18,0x02,0x00,
+ 0x00,0x00,0xb4,0x61,0x30,0x18,0x02,0x00,0x00,0x00,0xb4,0x61,0x30,0x18,0x02,
+ 0x00,0x00,0x00,0xb4,0x61,0x30,0x18,0x02,0x00,0x00,0x00,0xb4,0x61,0x30,0x18,
+ 0x02,0x00,0x00,0x00,0xb4,0x61,0x30,0x18,0x02,0x00,0x00,0x00,0xb4,0x61,0x30,
+ 0x18,0x02,0x00,0x00,0x00,0xb4,0x61,0x30,0x18,0x02,0x00,0x00,0x00,0xb4,0x61,
+ 0x30,0x18,0x02,0x00,0x00,0x00,0xb4,0x61,0x30,0x18,0x02,0x00,0x00,0x00,0xb4,
+ 0x61,0x30,0x18,0x02,0x00,0x00,0x00,0xb4,0x61,0x30,0x18,0x02,0x00,0x00,0x00,
+ 0xb4,0x61,0x30,0x18,0x02,0x00,0x00,0x00,0xb4,0x61,0x30,0x18,0x02,0x00,0x00,
+ 0x00,0xb4,0x61,0x30,0x18,0x02,0x00,0x00,0x00,0xb4,0x61,0x30,0x18,0x02,0x00,
+ 0x00,0x00,0xb4,0x61,0x30,0x18,0x02,0x00,0x00,0x00,0xb4,0x61,0x30,0x18,0x02,
+ 0x00,0x00,0xe0,0xb7,0x61,0x30,0x18,0x02,0x00,0x00,0xfc,0xb7,0x61,0x30,0x18,
+ 0x0e,0x00,0x80,0xff,0xb7,0x61,0x30,0x18,0x7e,0x00,0xe0,0xff,0xb7,0x61,0x30,
+ 0x18,0xfe,0x03,0xf0,0xff,0xbf,0x61,0x30,0xf8,0xff,0x0f,0xf8,0xff,0xbf,0x61,
+ 0x30,0xf8,0xff,0x3f,0xfc,0xff,0xff,0x63,0x30,0x18,0x00,0x20,0xfc,0xff,0xff,
+ 0xff,0x30,0x1e,0x00,0x20,0xfc,0xff,0xff,0xff,0xff,0x3f,0x00,0x20,0xf4,0xff,
+ 0xff,0xff,0xff,0x7f,0x00,0x20,0xe4,0xff,0xff,0xff,0xff,0xff,0x00,0x20,0x44,
+ 0xff,0xff,0xff,0xff,0xff,0x01,0x20,0x44,0xfc,0xff,0xff,0xff,0xff,0x03,0x20,
+ 0x44,0xf8,0xff,0xff,0xff,0xff,0x07,0x20,0x44,0x10,0xff,0xff,0xff,0xff,0x0f,
+ 0x20,0x44,0x10,0xe0,0xff,0xff,0x07,0x08,0x20,0x44,0x10,0x20,0x00,0x02,0x00,
+ 0x08,0x20,0x44,0x10,0x20,0x00,0x02,0x00,0xf8,0x3f,0x44,0x10,0x20,0x00,0x02,
+ 0x00,0xf8,0x3f,0x4c,0x10,0x20,0x00,0x02,0x00,0x08,0x00,0x58,0x10,0x20,0x00,
+ 0x02,0x00,0x08,0x00,0x70,0x10,0x20,0x00,0x02,0x00,0x08,0x00,0xe0,0x10,0x20,
+ 0x00,0x02,0x00,0x08,0x00,0xc0,0x13,0x20,0x00,0x02,0x00,0x08,0x00,0x80,0x1f,
+ 0x20,0x00,0x02,0x00,0x08,0x00,0x00,0xfe,0x21,0x00,0x02,0x00,0x08,0x00,0x00,
+ 0xf0,0xff,0x00,0x02,0xe0,0x0f,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x0f,0x00,
+ 0x00,0x00,0x80,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00};
new file mode 100644
--- /dev/null
+++ b/packages/services/profile/gprof/current/doc/gprofrun.fig
@@ -0,0 +1,66 @@
+#FIG 3.2
+Landscape
+Center
+Inches
+Letter  
+100.00
+Single
+-2
+1200 2
+0 32 #c6b797
+0 33 #eff8ff
+0 34 #dccba6
+0 35 #404040
+0 36 #808080
+0 37 #c0c0c0
+0 38 #e0e0e0
+0 39 #8e8f8e
+0 40 #aaaaaa
+0 41 #555555
+0 42 #bebebe
+0 43 #515151
+0 44 #e7e3e7
+0 45 #000049
+0 46 #797979
+0 47 #303430
+0 48 #414141
+0 49 #c7b696
+0 50 #8e8e8e
+0 51 #414541
+0 52 #8e8e8e
+6 300 1500 1500 2475
+2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 0 0 4
+	 300 2303 300 1500 1500 1500 1500 2188
+3 2 0 1 -1 -1 0 0 -1 0.000 0 0 0 4
+	 1500 2188 1200 2131 700 2418 300 2303
+	 0.000 -1.000 -1.000 0.000
+-6
+6 4800 1500 6000 2475
+2 1 0 1 -1 -1 0 0 -1 0.000 0 0 -1 0 0 4
+	 4800 2303 4800 1500 6000 1500 6000 2188
+3 2 0 1 -1 -1 0 0 -1 0.000 0 0 0 4
+	 6000 2188 5700 2131 5200 2418 4800 2303
+	 0.000 -1.000 -1.000 0.000
+-6
+6 6600 1500 7800 2400
+2 3 0 1 0 0 0 0 -1 0.000 0 0 -1 0 0 5
+	 6600 1500 7800 1500 7800 2400 6600 2400 6600 1500
+-6
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
+	1 1 1.00 60.00 120.00
+	 1500 1950 2100 1950
+2 5 0 2 0 -1 50 0 -1 0.000 0 0 -1 0 0 5
+	0 cray.xbm
+	 2100 1200 3956 1200 3956 2850 2100 2850 2100 1200
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
+	1 1 1.00 60.00 120.00
+	 4200 1950 4800 1950
+2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2
+	1 1 1.00 60.00 120.00
+	 6000 1950 6600 1950
+4 0 0 50 0 0 16 0.0000 4 165 495 600 1950 hello\001
+4 0 0 50 0 0 14 0.0000 4 180 795 4950 1950 gmon.out\001
+4 0 0 50 0 0 16 0.0000 4 225 540 6825 1950 gprof\001
+4 0 0 50 0 0 16 0.0000 4 165 915 2625 3225 hardware\001
+4 0 0 50 0 0 16 0.0000 4 165 1035 375 3225 executable\001
+4 0 0 50 0 0 16 0.0000 4 225 1350 4725 3225 profiling data\001
new file mode 100644
index 0000000000000000000000000000000000000000..1b3d4e96daaecacf54f082cd38461957d403f8c4
GIT binary patch
literal 2171
zc$}@4dpsLh7RRF$lay3xRMn$wJ!*tfY)L3ZszGVBMX4IZBMC-QTJKJ)>NVS)^_U7(
zgcxt4v|g!t%xEUGQbL+Y(FzSBEkYu(Z1=N&?PvemKkm8rbM86kcR%-Y&-Zh)ygU&~
zz@tC_0HEY{-uV&$AhWT%&QaXAYmYg7e|C5JF7~`14gfgdu{UJKMjAYKomzMoU;O15
z6h0w1E)0P1yrPSUh{54;A#sthcwHN)xs?<D+&BQBDCg$v=ySVdnf<=F(nw9-iyqXo
zV-gN6i9hBDQv*gbIzL+v`5sGE$=gb%aAeXSO53Jo0F8RHGOrE^0Kr+e)0<QM`G5{l
zvi;PjuXQVE9ubYY290_BDdjmGQIumycpKtUG$)p4YO;o%mCpLQ3S_KwYRf8(oo>1A
z7I?uDK^6nHnKgGtZN=9#wUe&O$Q&7zy&tBgGa(c&$8L6W-^tVr8foi(uL3?;_)tL+
zIUsxg#J}Yw-K!|8pnQ^v=mUJ(Z^WUWs>jb5ci&m-OX_Ye@puRLPvqV~ondEv_5ORI
z|FK<rP>`8g&HK9L&KuoPT0L1tflBhb5Q489&*X8w(LQ(kvQeS9=eX>y+-cmc*ExGv
z5`~Q@_Ab`RpQpPgDPKh}6pD{@eb%&%w7n*kq^g5RapzU*n?F9WsD}vX(|^Oc_j87;
zgN5spk&?mqbhsn=_AS8>=77?Rhko5*Pn>gn65R{~<@`I7rDH$j5>QO$1oYCK3e?+N
zh;X!IQrUcz)q?(0Hmo=H$Ne#XH>Q8V(_UQ%cAUS@CnYIY*n!Hg_yyXj??@;}2T+A5
zg>$B5zgE1Wx8k@#)RF1aj>Fy*jOJWhu6+Aqwq7E>CFro=a!!EV9M#q~g=46m=ZEXW
z;w^ZR{Ga{mz$?ZZagR@rw%MwbNi65*em<U%a;9hLAB|}lc2v;=hfM$ImHP+>sOI$?
zP~u|17PBEb$BN|WJ7c<7co7^!SnE?&X2UFl>;tuiQB3@AanJ2Fw3GM6jZ{^ZV?sJ9
zw@KAxE~N2UM-gL+!jyvZ*vcSm$PPz)POjyO4ovW3?s{uxhm@Mea>EIV7AT^~Ppn@P
zQuS$<QAlR(qyi}1Qlcuba*LnXuEwfWgM4dlSmc<AV2vMLV6c~Sznpk57%EyAdA!C^
z6#(kS4)Pr)xX#=9@Mx!l5l#aRFOmD;L(6(^4ue(Y6{$wOc4ivnqN<FW0bs+uSGm6A
zy*-~UG(P8`FZ38%PXW>uDicEo_-U(D{guETBaRq`@nM-1g=+#Q6l9Yw4V2v`GRnCD
z`@%#Y=3u(BX*<nBbnx*`|1#NSLyHQE&j<S>HyA2GLbvY4d-mxTDXWXNd7C+&JW*t@
zknbwW@)#*KlRWo4Y4cz;W%Wd2?j~|{zQpjAL5g|qirzGaO|wob#4Jd|Q)-Ypxx}W2
zjCN7mV}@9kU3$2bu5fR0;e7)W(pCi?q9X?=WGq~O2(3MzhPpdHJ*Cjk)0=%}8nK&L
zn=+tD>uE=8P!pU?<u<}2{QIE2dGnUmF@zqKwR`q|gh_MnjuA5=ubXefYk2npW;g_c
z-y!kg9t5!oL48D1{snV4>aeuSEcGZNAdn}o{HO|iiM`V+!mo!o@a)GH;PdN;er0K_
zIYv>FyVkQ^tA(#pMY_-G?O#5<pl=ykQxl*cJhb^sL<RV&dNpCGLy%jH&wk4Cf}E(i
z!mjpuM<cA4quwOPBvpbZzKm2%t{-WYBqVf`56(o1bh*b;$B6Q4UX-T4UN$QA+P}n*
z%E$u(h)vwV{y%bIKEZ0=TAJ$YfrQ>{^fvIy@ZM|o-n^}IGlBkc&^?@4sB^~F*m&7H
zAAqicWmBl>h2*D@Jr-mYLx~qvSv#SQ=~jEl(ilt#T~^q3r^#}^k&06acaS!>v+CjI
zhO=GqYc~F%ruaC?1X1-H@^nZWr{pxX(1qV*T?PEHnVUhN`@Dy{sBr(kK<ZyGY@5Ct
zIHXfBBK;FHQ)MGg{=9v%X?B@4E1Vz|7hhw!6x3j0uPj{!87N{#;03`32KFeNx9}jF
zZmnHj<el8$ZP@Mgf`59+Pjm|xm^-U(NH_}+-2z|TW!>kkR0=(fG}W`!cc&#T81!|x
zZ?KU2o<;71clB&AdIl;cAfQa5Z7UKI<4#IY$F(9lc9>BoFIJAKLkit9C_9PcOm4MV
zn9Xwt3!Qap9bGW(Y(Go)e=H@m6ETNT`nqi9BXlX+k20BunKSvzJ5bf&vpdJM+7Fel
zI*L1*iVda=N=+NLq9U;);%g$6jQ-&Yld#`ozm{smVf7n?c%OtC7jGo00#%=GOw05u
zsMi{!n&`lPh*7oy=9zUFnia)=2(F9u4C;H&>WwP4V<Kw7snm0u5^=L1|4UE7cvkVb
zyv1yB%TW32xAHS`vGm2(QVLumEMKmxRxXV`R7p$R3G1IL2`ReHKQnm4&h4YHHXnQZ
z(>R;nK>I1Ww{9DvR9WCYKw{vmGef2d$l<dD5;sX%dul!|qJtBeb{F#`8q6cdht(R_
z1t<#LqdY2?XwB0Barpg><irS%rUKK(3ZfaUNUh!6)NS;;2~U;RjGWgxBF`L?!2aG=
zb~n%h<MFO!Qi`tojYT9QfgrNhaV#L|#svp7uET~0?{ez=u@<)>hh4KyIJGkRB%kY;
zxD{{m=ANo>@(mf<%LcC9Jhd33sB<=ml)ZW=<wo8Du4ywb4d8R&Ey>~y^62iz0pRB1
L>D=ga^QV6TssJ-1
--- a/packages/services/profile/gprof/current/doc/profile.sgml
+++ b/packages/services/profile/gprof/current/doc/profile.sgml
@@ -1,98 +1,561 @@
-<PART ID="services-profile-gprof">
-<TITLE>Application profiling</TITLE>
-<PARTINTRO>
-<PARA>
-The profile_gprof package provides a mechanism to measure the
-runtime performance of an application.  This is done by gathering
-an execution histogram.
-</PARA>
-<para>
-When profiling is started on the target device, a 
-<function>TFTP</function> 
-server will be started
-which exports the single file
-<filename>PROFILE.DAT</filename>
-This analysis data can then be fetched
-by connecting to the target with a <function>TFTP</function> 
-client program
-and then be processed by the 
-<function>gprof</function>
-utility program.
-<note><title>NOTE</title>
-<para>
-Be sure and specify binary mode transfers for this data file,
-which may not be the default with on some <function>TFTP</function>
-client programs.
-</para>
-</note>
-<note><title>NOTE</title>
-<para>
-The port used for this <function>TFTP</function> server is
-configurable.  The default will be the IETF standard port
-of 69/UDP, but it may be changed to any UDP port via the
-<literal>CYGNUM_PROFILE_TFTP_PORT</literal> CDL option.
-</para>
-</note>
-</para>
-</PARTINTRO>
-<CHAPTER id="profile-functions">
-<TITLE>Profiling functions</TITLE>
-<SECT1 id="services-profile-api">
-<title> API </title>
-<para>
-In order for profile data to be gathered for an application, the
-program has to initiate the process.
-Once started, execution histogram data will be collected in a
-dynamic memory buffer.
-This data can be uploaded to a host using <emphasis>TFTP</emphasis>.
-A side effect of the upload of the data is that the histogram
-is reset.
-This is useful, especially for high resolution histograms, since
-the histogram data are collected as 16-bit counters which can be quickly
-saturated.
-For example, if the histogram is being collected at a rate of 10,000
-samples per second, a hot spot in the program could saturate after
-only 6.5 seconds.
-</para>
-<para> The API for the application profiling functions can be
-found in the file <filename>&lt;cyg/profile/profile.h&gt;</filename>.
-</para>
-<sect2 id="services-profile-api-profile-on">
-<title>profile_on</title>
-<para>
-This function is used to initiate the gathering of the
-runtime execution histogram data.
-</para>
-<programlisting>
-void profile_on(void *start, void *end, int bucket_size, int resolution);
-</programlisting>
-<para>
-Calling this function will initiate execution profiling.
-An execution histogram is collected at the rate of
-<parameter>resolution</parameter> times per second.
-The area between <parameter>start</parameter> and <parameter>end</parameter>
-will be divided up into a number of buckets, each representing 
-<parameter>bucket_size</parameter> 
-program bytes in length.  Using statistical sampling (via a high speed timer), when
-the program counter is found to be within the range 
-<parameter>start</parameter>..<parameter>end</parameter>, the appropriate
-bucket (histogram entry) will be incremented.
-</para>
-<para>
-The choice of <parameter>resolution</parameter> and <parameter>bucket_size</parameter>
-control how large the data gathered will be, as well as how much overhead is 
-encumbered for gathering the histogram.
-Smaller values for <parameter>bucket_size</parameter> will garner better
-results (<function>gprof</function> can more closely align the data with
-actual function names) at the expense of a larger data buffer.
-</para>
-<note><title>NOTE</title>
-<para>
-The value of <parameter>bucket_size</parameter> will be rounded up to a power of two.
-</para>
-</note>
-</sect2>
-</SECT1>
-</CHAPTER>
-</PART>
+<!-- DOCTYPE part  PUBLIC "-//OASIS//DTD DocBook V3.1//EN" -->
+
+<!-- {{{ Banner                         -->
+
+<!-- =============================================================== -->
+<!--                                                                 -->
+<!--     profile.sgml                                                -->
+<!--                                                                 -->
+<!--     gprof profiling documentation.                              -->
+<!--                                                                 -->
+<!-- =============================================================== -->
+<!-- ####COPYRIGHTBEGIN####                                          -->
+<!--                                                                 -->
+<!-- =============================================================== -->
+<!-- Copyright (C) 2003, 2005 eCosCentric Ltd.                       -->
+<!-- This material may be distributed only subject to the terms      -->
+<!-- and conditions set forth in the Open Publication License, v1.0  -->
+<!-- or later (the latest version is presently available at          -->
+<!-- http://www.opencontent.org/openpub/)                            -->
+<!-- Distribution of the work or derivative of the work in any       -->
+<!-- standard (paper) book form is prohibited unless prior           -->
+<!-- permission obtained from the copyright holder                   -->
+<!-- =============================================================== -->
+<!--                                                                 -->      
+<!-- ####COPYRIGHTEND####                                            -->
+<!-- =============================================================== -->
+<!-- =============================================================== -->
+<!-- #####DESCRIPTIONBEGIN####                                       -->
+<!--                                                                 -->
+<!-- Author(s):   bartv                                              -->
+<!-- Date:        2003/09/01                                         -->
+<!-- Version:     0.01                                               -->
+<!--                                                                 -->
+<!-- ####DESCRIPTIONEND####                                          -->
+<!-- =============================================================== -->
+
+<!-- }}} -->
+
+<part id="services-profile-gprof"><title>gprof Profiling Support</title> 
+
+<refentry id="gprof">
+  <refmeta>
+    <refentrytitle>Profiling</refentrytitle>
+  </refmeta>
+  <refnamediv>
+    <refname><varname>CYGPKG_PROFILE_GPROF</varname></refname>
+    <refpurpose>eCos Support for the gprof profiling tool</refpurpose>
+  </refnamediv>
+
+  <refsect1 id="gprof-description"><title>Description</title>
+    <para>
+The GNU gprof tool provides profiling support. After a test run it can
+be used to find where the application spent most of its time, and that
+information can then be used to guide optimization effort. Typical
+gprof output will look something like this:
+    </para>
+    <screen>
+Each sample counts as 0.003003 seconds.
+  %   cumulative   self              self     total           
+ time   seconds   seconds    calls  us/call  us/call  name    
+ 14.15      1.45     1.45   120000    12.05    12.05  Proc_7
+ 11.55      2.63     1.18   120000     9.84     9.84  Func_1
+  8.04      3.45     0.82                             main
+  7.60      4.22     0.78    40000    19.41    86.75  Proc_1
+  6.89      4.93     0.70    40000    17.60    28.99  Proc_6
+  6.77      5.62     0.69    40000    17.31    27.14  Func_2
+  6.62      6.30     0.68    40000    16.92    16.92  Proc_8
+  5.94      6.90     0.61                             strcmp
+  5.58      7.47     0.57    40000    14.26    26.31  Proc_3
+  5.01      7.99     0.51    40000    12.79    12.79  Proc_4
+  4.46      8.44     0.46    40000    11.39    11.39  Func_3
+  3.68      8.82     0.38    40000     9.40     9.40  Proc_5
+  3.32      9.16     0.34    40000     8.48     8.48  Proc_2
+&hellip;
+    </screen>
+    <para>
+This output is known as the flat profile. The data is obtained by
+having a hardware timer generate regular interrupts. The interrupt
+handler stores the program counter of the interrupted code. gprof
+performs a statistical analysis of the resulting data and works out
+where the time was spent.
+    </para>
+    <para>
+gprof can also provide information about the call graph, for example:
+    </para>
+    <screen>
+index % time    self  children    called     name
+&hellip;
+                0.78    2.69   40000/40000       main [1]
+[2]     34.0    0.78    2.69   40000         Proc_1 [2]
+                0.70    0.46   40000/40000       Proc_6 [5]
+                0.57    0.48   40000/40000       Proc_3 [7]
+                0.48    0.00   40000/120000      Proc_7 [3]
+    </screen>
+    <para>
+This shows that function <function>Proc_1</function> was called only
+from <function>main</function>, and <function>Proc_1</function> in
+turn called three other functions. Callgraph information is obtained
+only if the application code is compiled with the <option>-pg</option>
+option. This causes the compiler to insert extra code into each
+compiled function, specifically a call to <function>mcount</function>,
+and the implementation of <function>mcount</function> stores away the
+data for subsequent processing by gprof.
+    </para>
+    <caution><para>
+There are a number of reasons why the output will not be 100%
+accurate. Collecting the flat profile typically involves timer
+interrupts so any code that runs with interrupts disabled will not
+appear. The current host-side gprof implementation maps program
+counter values onto symbols using a bin mechanism. When a bin spans
+the end of one function and the start of the next gprof may report the
+wrong function. This is especially likely on architectures with
+single-byte instructions such as an x86. When examining gprof output
+it may prove useful to look at a linker map or program disassembly.
+    </para></caution>
+    <para>
+The eCos profiling package requires some additional support from the
+HAL packages, and this may not be available on all platforms:
+    </para>
+    <orderedlist>
+      <listitem><para>
+There must be an implementation of the profiling timer. Typically this
+is provided by the variant or platform HAL using one of the hardware
+timers. If there is no implementation then the configuration tools
+will report an unresolved conflict related to
+<varname>CYGINT_PROFILE_HAL_TIMER</varname> and profiling is not
+possible. Some implementations overload the system clock, which means
+that profiling is only possible in configurations containing the eCos
+kernel and <varname>CYGVAR_KERNEL_COUNTERS_CLOCK</varname>.
+      </para></listitem>
+      <listitem><para>
+There should be a hardware-specific implementation of
+<function>mcount</function>, which in turn will call the generic
+functionality provided by this package. It is still possible to do
+some profiling without <function>mcount</function> but the resulting
+data will be less useful. To check whether or not
+<function>mcount</function> is available, look at the current value of
+the CDL interface <varname>CYGINT_PROFILE_HAL_MCOUNT</varname> in the
+graphical configuration tool or in an <filename>ecos.ecc</filename>
+save file.
+      </para></listitem>
+    </orderedlist>
+    <para>
+This document only describes the eCos profiling support. Full details
+of gprof functionality and output formats can be found in the gprof
+documentation. However it should be noted that that documentation
+describes some functionality which cannot be implemented using current
+versions of the gcc compiler: the section on annotated source listings
+is not relevant, and neither are associated command line options like
+<option>-A</option> and <option>-y</option>.
+    </para>
+  </refsect1>
 
+  <refsect1 id="gprof-process"><title>Building Applications for Profiling</title>
+    <para>
+To perform application profiling the gprof package
+<varname>CYGPKG_PROFILE_GPROF</varname> must first be added to the
+eCos configuration. On the command line this can be achieved using:
+    </para>
+    <screen>
+$ ecosconfig add profile_gprof
+$ ecosconfig tree
+$ make
+    </screen>
+    <para>
+Alternatively the same steps can be performed using the graphical
+configuration tool.
+    </para>
+    <para>
+If the HAL packages implement <function>mcount</function> for the
+target platform then usually application code should be compiled with
+<option>-pg</option>. Optionally eCos itself can also be compiled with
+this option by modifying the configuration option
+<varname>CYGBLD_GLOBAL_CFLAGS</varname>. Compiling with
+<option>-pg</option> is optional but gives more complete profiling
+data.
+    </para>
+    <note><para>
+The profiling package itself must not be compiled with
+<option>-pg</option> because that could lead to infinite recursion
+when doing <function>mcount</function> processing. This is handled
+automatically by the package's CDL.
+    </para></note>
+    <para>
+Profiling does not happen automatically. Instead it must be started
+explicitly by the application, using a call to
+<function>profile_on</function>. A typical example would be:
+    </para>
+    <programlisting>
+#include &lt;pkgconf/system.h&gt;
+#ifdef CYGPKG_PROFILE_GPROF
+# include &lt;cyg/profile/profile.h&gt;
+#endif
+&hellip;
+int
+main(int argc, char** argv)
+{
+    &hellip;
+#ifdef CYGPKG_PROFILE_GPROF
+    {
+        extern char _stext[], _etext[];
+        profile_on(_stext, _etext, 16, 3500);
+    }
+#endif
+    &hellip;
+}
+    </programlisting>
+    <para>
+The <function>profile_on</function> takes four arguments:
+    </para>
+    <variablelist>
+      <varlistentry>
+        <term><literal>start address</literal></term>
+        <term><literal>end address</literal></term>
+        <listitem><para>
+These specify the range of addresses that will be profiled. Usually
+profiling should cover the entire application. On most targets the
+linker script will export symbols <varname>_stext</varname> and
+<varname>_etext</varname> corresponding to the beginning and end of
+code, so these can be used as the addresses. It is possible to
+perform profiling on a subset of the code if that code is
+located contiguously in memory.
+        </para></listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><literal>bucket size</literal></term>
+        <listitem><para>
+<function>profile_on</function> divides the range of addresses into a
+number of buckets of this size. It then allocates a single array of
+16-bit counters with one entry for each bucket. When the profiling
+timer interrupts the interrupt handler will examine the program
+counter of the interrupted code and, assuming it is within the range
+of valid addresses, find the containing bucket and increment the
+appropriate counter.
+        </para>
+        <para>
+The size of the array counters is determined by the range of addresses
+being profiled and by the bucket size. For a bucket size of 16, one
+counter is needed for every 16 bytes of code. For an application with
+say 512K of code that means dynamically allocating a 64K array. If the
+target hardware is low on memory then this may be unacceptable, and
+the requirements can be reduced by increasing the bucket size. However
+this will affect the accuracy of the results and gprof is more likely
+to report the wrong function. It also increases the risk of a counter
+overflow.
+        </para>
+        <para>
+For the sake of run-time efficiency the bucket size must be a power of
+2, and it will be adjusted if necessary.
+        </para></listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><literal>time interval</literal></term>
+        <listitem><para>
+The final argument specifies the interval between profile timer
+interrupts, in units of microseconds. Increasing the interrupt
+frequency gives more accurate profiling results, but at the cost of
+higher run-time overheads and a greater risk of a counter overflow.
+The HAL package may modify this interval because of hardware
+restrictions, and the generated profile data will contain the actual
+interval that was used. Usually it is a good idea to use an interval
+that is not a simple fraction of the system clock, typically 10000
+microseconds. Otherwise there is a risk that the profiling timer will
+disproportionally sample code that runs only in response to the system
+clock.
+        </para></listitem>
+      </varlistentry>
+    </variablelist>
+    <para>
+If the eCos configuration includes a TCP/IP stack and if a tftp daemon
+will be used to <link linkend="gprof-extract">extract</link> the data
+from the target then the call to <function>profile_on</function>
+should happen after the network is up. <filename>profile_on</filename>
+will attempt to start a tftp daemon thread, and this will fail if
+networking has not yet been enabled.
+    </para>
+    <programlisting>
+int
+main(int argc, char** argv)
+{
+    &hellip;
+    init_all_network_interfaces();
+    &hellip;
+#ifdef CYGPKG_PROFILE_GPROF
+    {
+        extern char _stext[], _etext[];
+        profile_on(_stext, _etext, 16, 3000);
+    }
+#endif
+    &hellip;
+}
+    </programlisting>
+    <para>
+The application can then be linked and run as usual.
+    </para>
+    <informalfigure PgWide=1>
+      <mediaobject>
+        <imageobject>
+          <imagedata fileref="gprofrun.png" Scalefit=1 Align="Center">
+        </imageobject>
+      </mediaobject>
+    </informalfigure>
+    <para>
+When gprof is used for native development rather than for embedded
+targets the profiling data will automatically be written out to a file
+<filename>gmon.out</filename> when the program exits. This is not
+possible on an embedded target because the code has no direct access
+to the host's file system. Instead the <filename>gmon.out</filename>
+file has to be <link linkend="gprof-extract">extracted</link> from
+the target as described below. gprof can then be invoked normally:
+    </para>
+    <screen>
+$ gprof dhrystone
+Flat profile:
+ 
+Each sample counts as 0.003003 seconds.
+  %   cumulative   self              self     total
+ time   seconds   seconds    calls  us/call  us/call  name
+ 14.15      1.45     1.45   120000    12.05    12.05  Proc_7
+ 11.55      2.63     1.18   120000     9.84     9.84  Func_1
+  8.04      3.45     0.82                             main
+&hellip;
+    </screen>
+    <para>
+If <filename>gmon.out</filename> does not contain call graph data,
+either because <function>mcount</function> is not supported or because
+this functionality was explicitly disabled, then the
+<option>-no-graph</option> must be used.
+    </para>
+    <screen>
+$ gprof --no-graph dhrystone
+Flat profile:
+ 
+Each sample counts as 0.003003 seconds.
+  %   cumulative   self              self     total
+ time   seconds   seconds    calls  us/call  us/call  name
+ 14.15      1.45     1.45                             Proc_7
+ 11.55      2.63     1.18                             Func_1
+  8.04      3.45     0.82                             main
+&hellip;
+    </screen>
+  </refsect1>
+
+  <refsect1 id="gprof-extract"><title>Extracting the Data</title>
+    <para>
+By default gprof expects to find the profiling data in a file
+<function>gmon.out</function> in the current directory. This package
+provides two ways of extracting data: a gdb macro or tftp transfers.
+Using tftp is faster but requires a TCP/IP stack on the target. It
+also consumes some additional target-side resources, including an
+extra tftp daemon thread and its stack. The gdb macro can be used even
+when the eCos configuration does not include a TCP/IP stack. However
+it is much slower, typically taking tens of seconds to retrieve all
+the data for a non-trivial application.
+    </para>
+    <para>
+The gdb macro is called <command>gprof_dump</command>, and can be
+found in the file <filename>gprof.gdb</filename> in the <filename
+class="directory">host</filename> subdirectory of this package. A
+typical way of using this macro is:
+    </para>
+    <screen>
+(gdb) source &lt;repo&gt;/services/profile/gprof/&lt;version&gt;/host/gprof.gdb
+(gdb) gprof_dump
+    </screen>
+    <para>
+This macro can be used any time after the call to
+<function>profile_on</function>. It will store the profiling data
+accumulated so far to the file <filename>gmon.out</filename> in the
+current directory, and then reset all counts. gprof uses only a 16 bit
+counter for every bucket of code. These counters can easily saturate
+if the profiling run goes on for a long time, or if the application
+code spends nearly all its time in just a few tight inner loops. The
+counters will not actually wrap around back to zero, instead they will
+stick at 0xFFFF, but this will still affect the accuracy of the gprof
+output. Hence it is desirable to reset the counters once the profiling
+data has been extracted.
+    </para>
+    <para>
+The file <filename>gprof.gdb</filename> contains two other macros
+which may prove useful. <command>gprof_fetch</command> extracts the
+profiling data and generates the file <filename>gmon.out</filename>,
+but does not reset the counters. <command>gprof_reset</command> only
+resets the counters, without extracting the data or overwriting
+<filename>gmon.out</filename>.
+    </para>
+    <para>
+If the configuration includes a TCP/IP stack then the profiling data
+can be extracted using tftp instead. There are two relevant
+configuration options. <varname>CYGPKG_PROFILE_TFTP</varname>
+controls whether or not tftp is supported. It is enabled by default if
+the configuration includes a TCP/IP stack, but can be disabled to save
+target-side resources.
+<varname>CYGNUM_PROFILE_TFTP_PORT</varname> controls the UDP
+port which will be used. This port cannot be shared with other tftp
+daemons. If neither application code nor any other package (for
+example the gcov test coverage package) provides a tftp service then
+the default port can be used. Otherwise it will be necessary to assign
+unique ports to each daemon.
+    </para>
+    <para>
+If enabled the tftp daemon will be started automatically by
+<function>profile_on</function>. This should only happen once the
+network is up and running, typically after the call to
+<function>init_all_network_interfaces</function>.
+    </para>
+    <para>
+The data can then be retrieved using a standard tftp client. There are
+a number of such clients available with very different interfaces, but
+a typical session might look something like this:
+    </para>
+    <screen>
+$ tftp
+tftp&gt; connect 10.1.1.134
+tftp&gt; binary
+tftp&gt; get gmon.out
+Received 64712 bytes in 0.9 seconds
+tftp&gt; quit
+    </screen>
+    <para>
+The address <literal>10.1.1.134</literal> should be replaced with the
+target's IP address. Extracting the profiling data by tftp will
+automatically reset the counters.
+    </para>
+  </refsect1>
+
+  <refsect1 id="gprof-configuration"><title>Configuration Options</title>
+    <para>
+This package contains a number of configuration options. Two of these,
+<varname>CYGPKG_PROFILE_TFTP</varname> and
+<varname>CYGNUM_PROFILE_TFTP_PORT</varname>, related to support for
+<link linkend="gprof-extract">tftp transfers</link> and have already
+been described.
+    </para>
+    <para>
+Support for collecting the call graph data via
+<function>mcount</function> is optional and can be controlled via
+<varname>CYGPKG_PROFILE_CALLGRAPH</varname>. This option will only be
+active if the HAL provides the underlying <function>mcount</function>
+support and implements <varname>CYGINT_PROFILE_HAL_MCOUNT</varname>.
+The call graph data allows gprof to produce more useful output, but at
+the cost of extra run-time and memory overheads. If this option is
+disabled then the <option>-pg</option> compiler flag should not be used.
+    </para>
+    <para>
+If <varname>CYGPKG_PROFILE_CALLGRAPH</varname> is enabled then there
+are two further options which can be used to control memory
+requirements. Collecting the data requires two blocks of memory, a
+simple hash table and an array of arc records. The
+<function>mcount</function> code uses the program counter address to
+index into the hash table, giving the first element of a singly linked
+list. The array of arc records contains the various linked lists for
+each hash slot. The required number of arc records depends on the
+number of function calls in the application. For example if a function
+<function>Proc_7</function> is called from three different places in
+the application then three arc records will be needed.
+    </para>
+    <para>
+<varname>CYGNUM_PROFILE_CALLGRAPH_HASH_SHIFT</varname> controls the
+size of the hash table. The default value of 8 means that the program
+counter is shifted right by eight places to give a hash table index.
+Hence each hash table slot corresponds to 256 bytes of code, and for
+an application with say 512K of code <filename>profile_on</filename>
+will dynamically allocate an 8K hash table. Increasing the shift size
+reduces the memory requirement, but means that each hash table slot
+will correspond to more code and hence <function>mcount</function>
+will need to traverse a longer linked list of arc records.
+    </para>
+    <para>
+<varname>CYGNUM_PROFILE_CALLGRAPH_ARC_PERCENTAGE</varname> controls
+how much memory <function>profile_on</function> will allocate for the
+arc records. This uses a simple heuristic, a percentage of the overall
+code size. By default the amount of arc record space allocated will be
+5% of the code size, so for a 512K executable that requires
+approximately 26K. This default should suffice for most applications.
+In exceptional cases it may be insufficient and a diagnostic will be
+generated when the profiling data is extracted.
+    </para>
+  </refsect1>
+
+  <refsect1 id="gprof-hal"><title>Implementing the HAL Support</title>
+    <para>
+The profiling package requires two lots of HAL support: a function
+<function>hal_enable_profile_timer</function> and an implementation
+of <function>mcount</function>. The profile timer is required.
+Typically it will be implemented by the variant or platform HAL
+using a spare hardware timer, and that HAL package will also
+implement the CDL interface
+<varname>CYGINT_PROFILE_HAL_TIMER</varname>. Support for
+<function>mcount</function> is optional but very desirable. Typically
+it will be implemented by the architectural HAL, which will also
+implement the CDL interface
+<varname>CYGINT_PROFILE_HAL_MCOUNT</varname>. 
+    </para>
+    <programlisting>
+#include &lt;pkgconf/system.h&gt;
+#ifdef CYGPKG_PROFILE_GPROF
+# include &lt;cyg/profile/profile.h&gt;
+#endif
+
+int
+hal_enable_profile_timer(int resolution)
+{
+    &hellip;
+    return actual_resolution;
+}
+    </programlisting>
+    <para>
+This function takes a single argument, a time interval in
+microseconds. It should arrange for a timer interrupt to go off
+after every interval. The timer VSR or ISR should then determine the
+program counter of the interrupted code and register this with the
+profiling package:
+    </para>
+    <programlisting>
+    &hellip;
+    __profile_hit(interrupted_pc);
+    &hellip;
+    </programlisting>
+    <para>
+The exact details of how this is achieved, especially obtaining the
+interrupted PC, are left to the HAL implementor. The HAL is allowed to
+modify the requested time interval because of hardware constraints,
+and should return the interval that is actually used.
+    </para>
+    <para>
+<function>mcount</function> can be more difficult. The calls to
+<function>mcount</function> are generated internally by the compiler
+and the details depend on the target architecture. In fact
+<function>mcount</function> may not use the standard calling
+conventions at all. Typically implementing <function>mcount</function>
+requires looking at the code that is actually generated, and possibly
+at the sources of the appropriate compiler back end.
+    </para>
+    <para>
+The HAL <function>mcount</function> function should call into the
+profiling package using standard calling conventions:
+    </para>
+    <programlisting>
+    &hellip;
+    __profile_mcount((CYG_ADDRWORD) caller_pc, (CYG_ADDRWORD) callee_pc);
+    &hellip;
+    </programlisting>
+    <para>
+If <function>mcount</function> was invoked because
+<function>main</function> called <function>Proc_1</function> then the
+caller pc should be an address inside <function>main</function>,
+typically corresponding to the return location, and the callee pc
+should be an address inside <function>Proc_1</function>, usually near
+the start of the function.
+    </para>
+    <para>
+For some targets the compiler does additional work, for example
+automatically allocating a per-function word of memory to eliminate
+the need for the hash table. This is too target-specific and hence
+cannot easily be used by the generic profiling package.
+    </para>
+  </refsect1>
+
+</refentry>
+</part>
new file mode 100644
--- /dev/null
+++ b/packages/services/profile/gprof/current/host/Makefile.am
@@ -0,0 +1,48 @@
+## Process this file with automake to produce Makefile.in
+## =====================================================================
+##
+##     Makefile.am
+##
+##     Build/install the host-side of the gprof support package
+##
+## =====================================================================
+######COPYRIGHTBEGIN####
+#                                                                          
+# ----------------------------------------------------------------------------
+# Copyright (C) 2003, 2005 eCosCentric Limited
+#
+# This file is part of the eCos gcov support.
+#
+# This program is free software; you can redistribute it and/or modify it 
+# under the terms of the GNU General Public License as published by the Free 
+# Software Foundation; either version 2 of the License, or (at your option) 
+# any later version.
+# 
+# This program is distributed in the hope that it will be useful, but WITHOUT 
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
+# more details.
+# 
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 
+# 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# ----------------------------------------------------------------------------
+#                                                                          
+######COPYRIGHTEND####
+## =====================================================================
+#######DESCRIPTIONBEGIN####
+##
+## Author(s):	bartv
+## Date:	2003/09/01
+## Version:	0.01
+##
+######DESCRIPTIONEND####
+## =====================================================================
+
+AUTOMAKE_OPTIONS = 1.3 foreign
+
+## There is just a set of gdb macros
+gdbdir			= @datadir@/ecos/gdbscripts
+dist_gdb_DATA		= gprof.gdb
+
+
new file mode 100644
--- /dev/null
+++ b/packages/services/profile/gprof/current/host/Makefile.in
@@ -0,0 +1,317 @@
+# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+######COPYRIGHTBEGIN####
+#                                                                          
+# ----------------------------------------------------------------------------
+# Copyright (C) 2003, 2005 eCosCentric Limited
+#
+# This file is part of the eCos gcov support.
+#
+# This program is free software; you can redistribute it and/or modify it 
+# under the terms of the GNU General Public License as published by the Free 
+# Software Foundation; either version 2 of the License, or (at your option) 
+# any later version.
+# 
+# This program is distributed in the hope that it will be useful, but WITHOUT 
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
+# more details.
+# 
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 
+# 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# ----------------------------------------------------------------------------
+#                                                                          
+######COPYRIGHTEND####
+#######DESCRIPTIONBEGIN####
+######DESCRIPTIONEND####
+
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+CC = @CC@
+CXX = @CXX@
+ECOS_REPOSITORY = @ECOS_REPOSITORY@
+MAINT = @MAINT@
+MSVC_SRCDIR = @MSVC_SRCDIR@
+PACKAGE = @PACKAGE@
+PACKAGE_DIR = @PACKAGE_DIR@
+PACKAGE_INSTALL = @PACKAGE_INSTALL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+VERSION = @VERSION@
+ecos_CFLAGS = @ecos_CFLAGS@
+ecos_CXXFLAGS = @ecos_CXXFLAGS@
+ecos_INCLUDES = @ecos_INCLUDES@
+ecos_LDADD = @ecos_LDADD@
+ecos_LIBS = @ecos_LIBS@
+ecos_infra_incdir = @ecos_infra_incdir@
+ecos_infra_libdir = @ecos_infra_libdir@
+ecos_libcdl_incdir = @ecos_libcdl_incdir@
+ecos_libcdl_libdir = @ecos_libcdl_libdir@
+ecos_tk_includes = @ecos_tk_includes@
+ecos_tk_libs = @ecos_tk_libs@
+
+AUTOMAKE_OPTIONS = 1.3 foreign
+
+gdbdir = @datadir@/ecos/gdbscripts
+dist_gdb_DATA = gprof.gdb
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) \
+	$(top_srcdir)/../../../../../../acsupport/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+DATA = $(dist_gdb_DATA)
+
+DIST_COMMON = $(dist_gdb_DATA) ../../../../../../acsupport/ChangeLog \
+	../../../../../../acsupport/acinclude.m4 \
+	../../../../../../acsupport/config.guess \
+	../../../../../../acsupport/config.sub \
+	../../../../../../acsupport/install-sh \
+	../../../../../../acsupport/ltconfig \
+	../../../../../../acsupport/ltmain.sh \
+	../../../../../../acsupport/missing \
+	../../../../../../acsupport/mkinstalldirs Makefile.am \
+	Makefile.in acinclude.m4 aclocal.m4 configure configure.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --foreign  Makefile
+Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && \
+	  CONFIG_HEADERS= CONFIG_LINKS= \
+	  CONFIG_FILES=$@ $(SHELL) ./config.status
+
+$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	$(SHELL) ./config.status --recheck
+$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+	cd $(srcdir) && $(AUTOCONF)
+
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4
+	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+uninstall-info-am:
+install-dist_gdbDATA: $(dist_gdb_DATA)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(gdbdir)
+	@list='$(dist_gdb_DATA)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(gdbdir)/$$f"; \
+	  $(INSTALL_DATA) $$d$$p $(DESTDIR)$(gdbdir)/$$f; \
+	done
+
+uninstall-dist_gdbDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(dist_gdb_DATA)'; for p in $$list; do \
+	  f="`echo $$p | sed -e 's|^.*/||'`"; \
+	  echo " rm -f $(DESTDIR)$(gdbdir)/$$f"; \
+	  rm -f $(DESTDIR)$(gdbdir)/$$f; \
+	done
+tags: TAGS
+TAGS:
+
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = .
+# Avoid unsightly `./'.
+distdir = $(PACKAGE)-$(VERSION)
+
+GZIP_ENV = --best
+
+distdir: $(DISTFILES)
+	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+	mkdir $(distdir)
+	$(mkinstalldirs) $(distdir)/../../../../../../acsupport
+	@for file in $(DISTFILES); do \
+	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    $(mkinstalldirs) "$(distdir)/$$dir"; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    cp -pR $$d/$$file $(distdir) \
+	    || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+	|| chmod -R a+r $(distdir)
+dist: distdir
+	$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+	-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+	GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
+	chmod -R a-w $(distdir); chmod a+w $(distdir)
+	mkdir $(distdir)/=build
+	mkdir $(distdir)/=inst
+	chmod a-w $(distdir)
+	dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \
+	  && cd $(distdir)/=build \
+	  && ../configure --srcdir=.. --prefix=$$dc_install_base \
+	  && $(MAKE) $(AM_MAKEFLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+	  && $(MAKE) $(AM_MAKEFLAGS) check \
+	  && $(MAKE) $(AM_MAKEFLAGS) install \
+	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+	  && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \
+	     || (echo "Error: files left after uninstall" 1>&2; \
+	         exit 1) ) \
+	  && $(MAKE) $(AM_MAKEFLAGS) dist \
+	  && $(MAKE) $(AM_MAKEFLAGS) distclean \
+	  && rm -f $(distdir).tar.gz \
+	  && (test `find . -type f -print | wc -l` -eq 0 \
+	     || (echo "Error: files left after distclean" 1>&2; \
+	         exit 1) )
+	-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
+	@echo "$(distdir).tar.gz is ready for distribution" | \
+	  sed 'h;s/./=/g;p;x;p;x'
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+
+installdirs:
+	$(mkinstalldirs) $(DESTDIR)$(gdbdir)
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+dist-all: distdir
+	$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
+distclean: distclean-am
+	-rm -f config.status config.cache config.log
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_gdbDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+uninstall-am: uninstall-dist_gdbDATA uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic dist dist-all \
+	distcheck distclean distclean-generic distdir dvi dvi-am info \
+	info-am install install-am install-data install-data-am \
+	install-dist_gdbDATA install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	uninstall uninstall-am uninstall-dist_gdbDATA uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
new file mode 100644
--- /dev/null
+++ b/packages/services/profile/gprof/current/host/acinclude.m4
@@ -0,0 +1,44 @@
+dnl Process this file with aclocal to get an aclocal.m4 file. Then
+dnl process that with autoconf.
+dnl ====================================================================
+dnl
+dnl     acinclude.m4
+dnl
+dnl ====================================================================
+dnl####COPYRIGHTBEGIN####
+dnl                                                                         
+dnl ----------------------------------------------------------------------------
+dnl Copyright (C) 2003 eCosCentric Ltd
+dnl
+dnl This file is part of the eCos host tools.
+dnl
+dnl This program is free software; you can redistribute it and/or modify it 
+dnl under the terms of the GNU General Public License as published by the Free 
+dnl Software Foundation; either version 2 of the License, or (at your option) 
+dnl any later version.
+dnl 
+dnl This program is distributed in the hope that it will be useful, but WITHOUT 
+dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+dnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
+dnl more details.
+dnl 
+dnl You should have received a copy of the GNU General Public License along with
+dnl this program; if not, write to the Free Software Foundation, Inc., 
+dnl 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+dnl ----------------------------------------------------------------------------
+dnl                                                                          
+dnl####COPYRIGHTEND####
+dnl ====================================================================
+dnl#####DESCRIPTIONBEGIN####
+dnl
+dnl Author(s):	bartv
+dnl Date:	2003/09/01
+dnl Version:	0.01
+dnl
+dnl####DESCRIPTIONEND####
+dnl ====================================================================
+
+dnl Access shared macros.
+dnl AM_CONDITIONAL needs to be mentioned here or else aclocal does not
+dnl incorporate the macro into aclocal.m4
+sinclude(../../../../../../acsupport/acinclude.m4)
new file mode 100644
--- /dev/null
+++ b/packages/services/profile/gprof/current/host/aclocal.m4
@@ -0,0 +1,212 @@
+dnl aclocal.m4 generated automatically by aclocal 1.4-p6
+
+dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+dnl PARTICULAR PURPOSE.
+
+dnl Process this file with aclocal to get an aclocal.m4 file. Then
+dnl process that with autoconf.
+dnl ====================================================================
+dnl
+dnl     acinclude.m4
+dnl
+dnl ====================================================================
+dnl####COPYRIGHTBEGIN####
+dnl                                                                         
+dnl ----------------------------------------------------------------------------
+dnl Copyright (C) 2003 eCosCentric Ltd
+dnl
+dnl This file is part of the eCos host tools.
+dnl
+dnl This program is free software; you can redistribute it and/or modify it 
+dnl under the terms of the GNU General Public License as published by the Free 
+dnl Software Foundation; either version 2 of the License, or (at your option) 
+dnl any later version.
+dnl 
+dnl This program is distributed in the hope that it will be useful, but WITHOUT 
+dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+dnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
+dnl more details.
+dnl 
+dnl You should have received a copy of the GNU General Public License along with
+dnl this program; if not, write to the Free Software Foundation, Inc., 
+dnl 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+dnl ----------------------------------------------------------------------------
+dnl                                                                          
+dnl####COPYRIGHTEND####
+dnl ====================================================================
+dnl#####DESCRIPTIONBEGIN####
+dnl
+dnl Author(s):	bartv
+dnl Date:	2003/09/01
+dnl Version:	0.01
+dnl
+dnl####DESCRIPTIONEND####
+dnl ====================================================================
+
+dnl Access shared macros.
+dnl AM_CONDITIONAL needs to be mentioned here or else aclocal does not
+dnl incorporate the macro into aclocal.m4
+sinclude(../../../../../../acsupport/acinclude.m4)
+
+# Define a conditional.
+
+AC_DEFUN([AM_CONDITIONAL],
+[AC_SUBST($1_TRUE)
+AC_SUBST($1_FALSE)
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi])
+
+# Do all the work for Automake.  This macro actually does too much --
+# some checks are only needed if your package does certain things.
+# But this isn't really a big deal.
+
+# serial 1
+
+dnl Usage:
+dnl AM_INIT_AUTOMAKE(package,version, [no-define])
+
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])
+PACKAGE=[$1]
+AC_SUBST(PACKAGE)
+VERSION=[$2]
+AC_SUBST(VERSION)
+dnl test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+ifelse([$3],,
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
+AC_REQUIRE([AM_SANITY_CHECK])
+AC_REQUIRE([AC_ARG_PROGRAM])
+dnl FIXME This is truly gross.
+missing_dir=`cd $ac_aux_dir && pwd`
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}, $missing_dir)
+AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}, $missing_dir)
+AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
+AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
+AC_REQUIRE([AC_PROG_MAKE_SET])])
+
+# Copyright 2002  Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.4"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+	 [AM_AUTOMAKE_VERSION([1.4-p6])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+   if test "[$]*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftestfile`
+   fi
+   if test "[$]*" != "X $srcdir/configure conftestfile" \
+      && test "[$]*" != "X conftestfile $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "[$]2" = conftestfile
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+rm -f conftest*
+AC_MSG_RESULT(yes)])
+
+dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
+dnl The program must properly implement --version.
+AC_DEFUN([AM_MISSING_PROG],
+[AC_MSG_CHECKING(for working $2)
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if ($2 --version) < /dev/null > /dev/null 2>&1; then
+   $1=$2
+   AC_MSG_RESULT(found)
+else
+   $1="$3/missing $2"
+   AC_MSG_RESULT(missing)
+fi
+AC_SUBST($1)])
+
+# Add --enable-maintainer-mode option to configure.
+# From Jim Meyering
+
+# serial 1
+
+AC_DEFUN([AM_MAINTAINER_MODE],
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+  dnl maintainer-mode is disabled by default
+  AC_ARG_ENABLE(maintainer-mode,
+[  --enable-maintainer-mode enable make rules and dependencies not useful
+                          (and sometimes confusing) to the casual installer],
+      USE_MAINTAINER_MODE=$enableval,
+      USE_MAINTAINER_MODE=no)
+  AC_MSG_RESULT($USE_MAINTAINER_MODE)
+  AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
+  MAINT=$MAINTAINER_MODE_TRUE
+  AC_SUBST(MAINT)dnl
+]
+)
+
new file mode 100644
--- /dev/null
+++ b/packages/services/profile/gprof/current/host/configure
@@ -0,0 +1,2540 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)$' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\/\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+	 case $as_dir in
+	 /*)
+	   if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     CONFIG_SHELL=$as_dir/$as_base
+	     export CONFIG_SHELL
+	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+	   fi;;
+	 esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='	' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" 	$as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete.  It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="gprof.gdb"
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO SET_MAKE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_option in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval "enable_$ac_feature=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_$ac_feature='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_$ac_package='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
+    eval "with_$ac_package=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+    eval "$ac_envvar='$ac_optarg'"
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+	      localstatedir libdir includedir oldincludedir infodir mandir
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$0" : 'X\(//\)[^/]' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+   { (exit 1); exit 1; }; }
+  else
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+  fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+   { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+  cat <<_ACEOF
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+			  [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+			  [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-maintainer-mode enable make rules and dependencies not useful
+                          (and sometimes confusing) to the casual installer
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  ac_popdir=`pwd`
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d $ac_dir || continue
+    ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+    cd $ac_dir
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_srcdir/configure.gnu; then
+      echo
+      $SHELL $ac_srcdir/configure.gnu  --help=recursive
+    elif test -f $ac_srcdir/configure; then
+      echo
+      $SHELL $ac_srcdir/configure  --help=recursive
+    elif test -f $ac_srcdir/configure.ac ||
+	   test -f $ac_srcdir/configure.in; then
+      echo
+      $ac_configure --help
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi
+    cd $ac_popdir
+  done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+  cat <<\_ACEOF
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+{
+  (set) 2>&1 |
+    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      sed -n \
+	"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+      ;;
+    *)
+      sed -n \
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+}
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=$`echo $ac_var`
+	echo "$ac_var='"'"'$ac_val'"'"'"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h | sort
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core &&
+  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+     ' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . $cache_file;;
+      *)                      . ./$cache_file;;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+	       sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+  eval ac_new_val="\$ac_env_${ac_var}_value"
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+	ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_aux_dir=
+for ac_dir in ../../../../../../acsupport $srcdir/../../../../../../acsupport; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f $ac_dir/shtool; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ../../../../../../acsupport $srcdir/../../../../../../acsupport" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in ../../../../../../acsupport $srcdir/../../../../../../acsupport" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+
+
+    echo "$as_me:$LINENO: checking that a separate build tree is being used" >&5
+echo $ECHO_N "checking that a separate build tree is being used... $ECHO_C" >&6
+    ecos_cwd=`/bin/pwd`
+    if test "${srcdir}" = "." ; then
+        srcdir=${ecos_cwd}
+    fi
+    if test "${ecos_cwd}" = "${srcdir}" ; then
+        echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+        { { echo "$as_me:$LINENO: error: This configure script should not be run inside the source tree. Instead please use a separate build tree" >&5
+echo "$as_me: error: This configure script should not be run inside the source tree. Instead please use a separate build tree" >&2;}
+   { (exit 1); exit 1; }; }
+    else
+        echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+    fi
+
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+  ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+  ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+am__api_version="1.4"
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	    break 3
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+done
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
+# Just in case
+sleep 1
+echo timestamp > conftestfile
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftestfile`
+   fi
+   if test "$*" != "X $srcdir/configure conftestfile" \
+      && test "$*" != "X conftestfile $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftestfile
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+rm -f conftest*
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,$program_prefix,;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+all:
+	@echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+  SET_MAKE=
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+PACKAGE=eCos_gprof
+
+VERSION=0.1
+
+if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
+  { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+
+missing_dir=`cd $ac_aux_dir && pwd`
+echo "$as_me:$LINENO: checking for working aclocal-${am__api_version}" >&5
+echo $ECHO_N "checking for working aclocal-${am__api_version}... $ECHO_C" >&6
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if (aclocal-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then
+   ACLOCAL=aclocal-${am__api_version}
+   echo "$as_me:$LINENO: result: found" >&5
+echo "${ECHO_T}found" >&6
+else
+   ACLOCAL="$missing_dir/missing aclocal-${am__api_version}"
+   echo "$as_me:$LINENO: result: missing" >&5
+echo "${ECHO_T}missing" >&6
+fi
+
+echo "$as_me:$LINENO: checking for working autoconf" >&5
+echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if (autoconf --version) < /dev/null > /dev/null 2>&1; then
+   AUTOCONF=autoconf
+   echo "$as_me:$LINENO: result: found" >&5
+echo "${ECHO_T}found" >&6
+else
+   AUTOCONF="$missing_dir/missing autoconf"
+   echo "$as_me:$LINENO: result: missing" >&5
+echo "${ECHO_T}missing" >&6
+fi
+
+echo "$as_me:$LINENO: checking for working automake-${am__api_version}" >&5
+echo $ECHO_N "checking for working automake-${am__api_version}... $ECHO_C" >&6
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if (automake-${am__api_version} --version) < /dev/null > /dev/null 2>&1; then
+   AUTOMAKE=automake-${am__api_version}
+   echo "$as_me:$LINENO: result: found" >&5
+echo "${ECHO_T}found" >&6
+else
+   AUTOMAKE="$missing_dir/missing automake-${am__api_version}"
+   echo "$as_me:$LINENO: result: missing" >&5
+echo "${ECHO_T}missing" >&6
+fi
+
+echo "$as_me:$LINENO: checking for working autoheader" >&5
+echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if (autoheader --version) < /dev/null > /dev/null 2>&1; then
+   AUTOHEADER=autoheader
+   echo "$as_me:$LINENO: result: found" >&5
+echo "${ECHO_T}found" >&6
+else
+   AUTOHEADER="$missing_dir/missing autoheader"
+   echo "$as_me:$LINENO: result: missing" >&5
+echo "${ECHO_T}missing" >&6
+fi
+
+echo "$as_me:$LINENO: checking for working makeinfo" >&5
+echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6
+# Run test in a subshell; some versions of sh will print an error if
+# an executable is not found, even if stderr is redirected.
+# Redirect stdin to placate older versions of autoconf.  Sigh.
+if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
+   MAKEINFO=makeinfo
+   echo "$as_me:$LINENO: result: found" >&5
+echo "${ECHO_T}found" >&6
+else
+   MAKEINFO="$missing_dir/missing makeinfo"
+   echo "$as_me:$LINENO: result: missing" >&5
+echo "${ECHO_T}missing" >&6
+fi
+
+
+echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6
+    # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+  enableval="$enable_maintainer_mode"
+  USE_MAINTAINER_MODE=$enableval
+else
+  USE_MAINTAINER_MODE=no
+fi;
+  echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
+echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6
+
+
+if test $USE_MAINTAINER_MODE = yes; then
+  MAINTAINER_MODE_TRUE=
+  MAINTAINER_MODE_FALSE='#'
+else
+  MAINTAINER_MODE_TRUE='#'
+  MAINTAINER_MODE_FALSE=
+fi
+  MAINT=$MAINTAINER_MODE_TRUE
+
+
+
+          ac_config_files="$ac_config_files Makefile:Makefile.in"
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+  (set) 2>&1 |
+    case `(ac_space=' '; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;;
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n \
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+  if test -w $cache_file; then
+    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+    cat confcache >$cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[	 ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[	 ]*$//;
+}'
+fi
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section.  Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\_ACEOF
+t clear
+: clear
+s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*([^)]*)\)[	 ]*\(.*\),-D\1=\2,g
+t quote
+s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\),-D\1=\2,g
+t quote
+d
+: quote
+s,[	 `~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output.  A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+	 sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)$' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\/\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+	 case $as_dir in
+	 /*)
+	   if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     CONFIG_SHELL=$as_dir/$as_base
+	     export CONFIG_SHELL
+	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+	   fi;;
+	 esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='	' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" 	$as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+		   instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.59,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "x$1" : 'x\([^=]*\)='`
+    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  -*)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1" ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile:Makefile.in" ;;
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./confstat$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t
+s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t
+s,@MAINT@,$MAINT,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # Split the substitutions into bite-sized pieces for seds with
+  # small command number limits, like on Digital OSF/1 and HP-UX.
+  ac_max_sed_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # Line after last line for current file.
+  ac_more_lines=:
+  ac_sed_cmds=
+  while $ac_more_lines; do
+    if test $ac_beg -gt 1; then
+      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
+    else
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+	ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+	ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
+    fi
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
+  fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+	cat >$tmp/stdin
+	ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  esac
+
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+				     sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+	 # Absolute (can't be DOS-style, as IFS=:)
+	 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 echo "$f";;
+      *) # Relative
+	 if test -f "$f"; then
+	   # Build tree
+	   echo "$f"
+	 elif test -f "$srcdir/$f"; then
+	   # Source tree
+	   echo "$srcdir/$f"
+	 else
+	   # /dev/null tree
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
+
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
new file mode 100644
--- /dev/null
+++ b/packages/services/profile/gprof/current/host/configure.in
@@ -0,0 +1,53 @@
+dnl Process this file with autoconf to produce a configure script.
+dnl ====================================================================
+dnl
+dnl     configure.in
+dnl
+dnl     configure script for gprof host-side support
+dnl
+dnl ====================================================================
+dnl####COPYRIGHTBEGIN####
+dnl                                                                         
+dnl ----------------------------------------------------------------------------
+dnl Copyright (C) 2003 eCosCentric Ltd
+dnl
+dnl This file is part of the eCos gcov support
+dnl
+dnl This program is free software; you can redistribute it and/or modify it 
+dnl under the terms of the GNU General Public License as published by the Free 
+dnl Software Foundation; either version 2 of the License, or (at your option) 
+dnl any later version.
+dnl 
+dnl This program is distributed in the hope that it will be useful, but WITHOUT 
+dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+dnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
+dnl more details.
+dnl 
+dnl You should have received a copy of the GNU General Public License along with
+dnl this program; if not, write to the Free Software Foundation, Inc., 
+dnl 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+dnl ----------------------------------------------------------------------------
+dnl                                                                          
+dnl####COPYRIGHTEND####
+dnl ====================================================================
+dnl#####DESCRIPTIONBEGIN####
+dnl
+dnl Author(s):	bartv
+dnl Date:	2003/09/01
+dnl Version:	0.01
+dnl
+dnl####DESCRIPTIONEND####
+dnl ====================================================================
+
+
+AC_INIT(gprof.gdb)
+
+dnl Pick up the support files from the top-level acsupport directory.
+AC_CONFIG_AUX_DIR(../../../../../../acsupport)
+
+ECOS_CHECK_BUILD_ne_SRC
+AC_CANONICAL_HOST
+AM_INIT_AUTOMAKE(eCos_gprof,0.1,0)
+AM_MAINTAINER_MODE
+
+AC_OUTPUT(Makefile:Makefile.in)
new file mode 100644
--- /dev/null
+++ b/packages/services/profile/gprof/current/host/gprof.gdb
@@ -0,0 +1,115 @@
+# =====================================================================
+#
+#     gprof.gdb
+#
+# =====================================================================
+######ECOSHOSTGPLCOPYRIGHTBEGIN####
+# ----------------------------------------------------------------------------
+# Copyright (C) 2003 eCosCentric Ltd.
+#
+# This file is part of the eCos host tools.
+#
+# This program is free software; you can redistribute it and/or modify it 
+# under the terms of the GNU General Public License as published by the Free 
+# Software Foundation; either version 2 of the License, or (at your option) 
+# any later version.
+# 
+# This program is distributed in the hope that it will be useful, but WITHOUT 
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
+# more details.
+# 
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 
+# 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# ----------------------------------------------------------------------------
+######ECOSHOSTGPLCOPYRIGHTEND####
+# =====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s):	bartv
+# Date:		2003-09-01
+# Purpose:	extract gprof data from the target
+#
+#####DESCRIPTIONEND####
+# =====================================================================
+
+define gprof_fetch
+  if 0 == profile_hist_data
+    echo Target-side profiling has not been initialized.\n
+  else
+    if 0 != profile_reset_pending
+      echo No profiling data has accumulated since the last reset.\n
+    else
+      dump   binary memory gmon.out &profile_gmon_hdr ((char*)&profile_gmon_hdr + sizeof(struct gmon_hdr))
+      append binary memory gmon.out &profile_tags[0] &profile_tags[1]
+      append binary memory gmon.out &profile_hist_hdr ((char*)&profile_hist_hdr + sizeof(struct gmon_hist_hdr))
+      append binary memory gmon.out profile_hist_data (profile_hist_data + profile_hist_hdr.hist_size)
+      if 0 != profile_arc_records
+        if 0 != profile_arc_overflow
+          echo Warning: the table of callgraph arcs has overflowed\n
+          echo   This can be avoided by increasing CYGNUM_PROFILE_CALLGRAPH_ARC_PERCENTAGE\n
+        end
+        # This loop is slow, but there is not much that can be done about it.
+        # The gmon.out file should contain 13 bytes per arc record. Keeping
+        # all the data in a packed array would involve non-aligned data,
+        # which would add significantly to the run-time overheads.
+        set $profile_i = 1
+        set $profile_count = profile_arc_next
+        while $profile_i != $profile_count
+          append binary memory gmon.out &(profile_arc_records[$profile_i].tags[3]) &(profile_arc_records[$profile_i + 1])
+          set $profile_i = $profile_i + 1
+        end
+      end
+    end
+  end
+end
+
+define gprof_reset
+  if 0 == profile_hist_data
+    echo Target-side profiling has not been initialized.\n
+  else
+    # An initial attempt to implement this by modifying profile_hist_data
+    # and profile_arc_hashtable was not satisfactory. gdb does not have
+    # commands to clear whole arrays, and doing it a slot at a time proved
+    # too slow. An alternative approach is to call a target-side reset
+    # function but that only works if the target is in a sensible state.
+    # The final implementation is to just set a flag and let the target
+    # sort things out.
+    set profile_reset_pending = 1
+    set profile_enabled = 0
+  end
+end
+
+define gprof_dump
+  if 0 == profile_hist_data
+    echo Target-side profiling has not been initialized.\n
+  else
+    gprof_fetch
+    gprof_reset
+  end
+end
+
+document gprof_fetch
+Extract gprof profiling data from the target and write it to a file
+gmon.out in the current directory. This macro should only be used
+with eCos configurations that contain the profiling package, and
+only after the target has called the profile_on() initialization
+routine.
+end
+
+document gprof_reset
+Reset all gprof profiling data in the target. This macro should only
+be used with eCos configurations that contain the profiling package,
+and only after the target has called the profile_on() initialization
+routine.
+end
+
+document gprof_dump
+Extract gprof profiling data from the target and write it to a file
+gmon.out in the current directory. The profiling data is then reset.
+This macro should only be used with eCos configurations that contain
+the profiling package, and only after the target has called the
+profile_on() initialization routine.
+end
--- a/packages/services/profile/gprof/current/include/gmon_out.h
+++ b/packages/services/profile/gprof/current/include/gmon_out.h
@@ -14,6 +14,8 @@
 #ifndef gmon_out_h
 #define gmon_out_h
 
+#include <cyg/infra/cyg_type.h>
+
 #define	GMON_MAGIC	"gmon"	/* magic cookie */
 #define GMON_VERSION	1	/* version number */
 
@@ -21,34 +23,57 @@
  * Raw header as it appears on file (without padding):
  */
 struct gmon_hdr
-  {
+{
     char cookie[4];
-    char version[4];
+    char version[4];    // a cyg_uint32, target-side endianness
     char spare[3 * 4];
-  };
+};
 
 /* types of records in this file: */
 typedef enum
-  {
+{
     GMON_TAG_TIME_HIST = 0, GMON_TAG_CG_ARC = 1, GMON_TAG_BB_COUNT = 2
-  }
+}
 GMON_Record_Tag;
 
+/* The histogram tag is followed by this header, and then an array of       */
+/* cyg_uint16's for the actual counts.                                      */
+
 struct gmon_hist_hdr
-  {
-    char low_pc[sizeof (char*)];	/* base pc address of sample buffer */
-    char high_pc[sizeof (char*)];	/* max pc address of sampled buffer */
-    char hist_size[4];			/* size of sample buffer */
-    char prof_rate[4];			/* profiling clock rate */
-    char dimen[15];			/* phys. dim., usually "seconds" */
-    char dimen_abbrev;			/* usually 's' for "seconds" */
-  };
+{
+    /* host-side gprof adapts to sizeof(void*) and endianness.              */
+    /* It is assumed that the compiler does not insert padding around the   */
+    /* cyg_uint32's or the char arrays.                                     */
+    void*       low_pc;             /* base pc address of sample buffer     */
+    void*       high_pc;            /* max pc address of sampled buffer     */
+    cyg_uint32  hist_size;          /* size of sample buffer                */
+    cyg_uint32  prof_rate;          /* profiling clock rate                 */
+    char        dimen[15];			/* phys. dim., usually "seconds"        */
+    char        dimen_abbrev;		/* usually 's' for "seconds"            */
+};
+
+/* An arc tag is followed by a single arc record. self_pc corresponds to    */
+/* the location of an mcount() call, at the start of a function. from_pc    */
+/* corresponds to the return address, i.e. where the function was called    */
+/* from. count is the number of calls.                                      */
 
 struct gmon_cg_arc_record
-  {
-    char from_pc[sizeof (char*)];	/* address within caller's body */
-    char self_pc[sizeof (char*)];	/* address within callee's body */
-    char count[4];			/* number of arc traversals */
-  };
+{
+    void*       from_pc;            /* address within caller's body         */
+    void*       self_pc;        	/* address within callee's body         */
+    cyg_uint32  count;              /* number of arc traversals             */
+};
+
+/* In theory gprof can also process basic block counts, as per the          */
+/* compiler's -fprofile-arcs flag. The compiler-generated basic block       */
+/* structure should contain a table of addresses and a table of counts,     */
+/* and the compiled code updates those counts. Current versions of the      */
+/* compiler (~3.2.1) do not output the table of addresses, and without      */
+/* that table gprof cannot process the counts. Possibly gprof should read   */
+/* in the .bb and .bbg files generated for gcov processing, but that does   */
+/* not happen at the moment.                                                */
+/*                                                                          */
+/* So for now gmon.out does not contain basic block counts and gprof        */
+/* operations that depend on it, e.g. --annotated-source, won't work.       */
 
 #endif /* gmon_out_h */
--- a/packages/services/profile/gprof/current/include/profile.h
+++ b/packages/services/profile/gprof/current/include/profile.h
@@ -11,6 +11,7 @@
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2003 eCosCentric Limited
 // Copyright (C) 2002 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
@@ -44,7 +45,7 @@
 //#####DESCRIPTIONBEGIN####
 //
 // Author(s):    gthomas
-// Contributors: 
+// Contributors: bartv
 // Date:         2002-11-14
 // Purpose:      Define profiling support
 // Description:  
@@ -65,9 +66,12 @@
                           int bucket_size, int sample_resolution);
 
 // Callback used by timer routine
-__externC void __profile_hit(unsigned long pc);
+__externC void __profile_hit(CYG_ADDRWORD pc);
+
+// Callgraph support
+__externC void __profile_mcount(CYG_ADDRWORD /* caller_pc */, CYG_ADDRWORD /* callee_pc */);
 
 // Timer setup routine, used when enabling profiling
-__externC void hal_enable_profile_timer(int resolution);
+__externC int hal_enable_profile_timer(int resolution);
 
 #endif // CYGONCE_PROFILE_H
--- a/packages/services/profile/gprof/current/src/profile.c
+++ b/packages/services/profile/gprof/current/src/profile.c
@@ -8,6 +8,7 @@
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2003 eCosCentric Ltd.
 // Copyright (C) 2002 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
@@ -41,7 +42,7 @@
 //#####DESCRIPTIONBEGIN####
 //
 // Author(s):    Gary Thomas
-// Contributors: 
+// Contributors: Bart Veer
 // Date:         2002-11-14
 // Purpose:      Application profiling support
 // Description:  
@@ -49,198 +50,498 @@
 //####DESCRIPTIONEND####
 //
 //===========================================================================
+
+#include <pkgconf/system.h>
 #include <pkgconf/profile_gprof.h>
 
 #include <stdlib.h>
 #include <string.h>
+#include <cyg/infra/cyg_type.h>
 #include <cyg/infra/diag.h>
-#include <network.h>
-#include <tftp_support.h>
 #include <cyg/profile/profile.h>
 #include <cyg/profile/gmon_out.h>
 
-static int num_buckets;
-static unsigned short *profile;
-static int bucket_size, bucket_shift;
-static unsigned long start_addr, end_addr;
-static int enabled;
-static int tftp_server_id;
-static int prof_rate;
+#ifdef CYGPKG_PROFILE_TFTP
+# include <network.h>
+# include <tftp_support.h>
+#endif
+
+// ----------------------------------------------------------------------------
+// A gmon.out file starts with a struct gmon_hdr containing a cookie
+// "gmon", a format version number, and some spare bytes. The structure
+// is initialized by the profile_on() entry point so that it does not
+// get garbage collected by the collector and hence a gdb script can
+// always access it.
+static struct gmon_hdr  profile_gmon_hdr;
+
+// The header is followed by data blocks. Each data block consists of a
+// one-byte tag (HIST, ARC, or BB_COUNT), followed by data in a specific
+// format.
+static unsigned char    profile_tags[3];
+
+// The profiling data always contains histogram data. Typically an
+// extra hardware timer is made to interrupt at the desired rate
+// and stores the interrupted pc.
+static struct gmon_hist_hdr    profile_hist_hdr;
 
-static int profile_open(const char *, int);
-static int profile_close(int);
-static int profile_write(int, const void *, int);
-static int profile_read(int, void *, int);
+// The actual histogram counts. The file format only allows for 16-bit
+// counts, which means overflow is a real possibility.
+static cyg_uint16*      profile_hist_data;
+
+// Each slot in the histogram data covers a range of pc addresses,
+// allowing a trade off between memory requirements and precision.
+static int              bucket_shift;
+
+// Profiling is disabled on start-up and while a tftp transfer takes place.
+static int              profile_enabled;
 
-struct tftpd_fileops profile_fileops = {
-    profile_open, profile_close, profile_write, profile_read
+// This is used by the gdb script to reset the profile data.
+static int              profile_reset_pending;
+
+// The callgraph data. There is no header for this. Instead each non-zero
+// entry is output separately, prefixed by an ARC tag. The data is accessed
+// via a hash table/linked list combination. The tag is part of the
+// structure to reduce the number of I/O operations needed for writing
+// gmon.out.
+struct profile_arc {
+    cyg_uint32                  next;
+    unsigned char               tags[4];
+    struct gmon_cg_arc_record   record;
 };
 
-struct _file {
-    unsigned char      *pos, *eof, *data;
-    int                 flags;
-    int                 mode;
-};
-#define FILE_OPEN 0x0001
+static struct profile_arc*  profile_arc_records;
+
+// The next free slot in the arc_records table.
+static int                  profile_arc_next    = 1;
+
+#ifdef CYGPKG_PROFILE_CALLGRAPH
+// The callgraph is accessed via a hash table. The hashing function is
+// trivial, it just involves shifting an address an appropriate number
+// of places.
+static int*         profile_arc_hashtable;
+
+// The sizes of these tables
+static int          profile_arc_hash_count;
+static int          profile_arc_records_count;
+
+// Is the hashtable too small? Used for diagnostics.
+static int          profile_arc_overflow;
+#endif
+
+// Reset current profiling data.
+static void
+profile_reset(void)
+{
+    memset(profile_hist_data, 0, profile_hist_hdr.hist_size * sizeof(cyg_uint16));
+
+#ifdef CYGPKG_PROFILE_CALLGRAPH
+    // Zeroing the callgraph can be achieved by zeroing the hash
+    // table and resetting the next field used for indexing into
+    // the arc data itself. Whenever an arc data slot is allocated
+    // the count and addresses are reset.
+    memset(profile_arc_hashtable, 0, profile_arc_hash_count * sizeof(int));
+    profile_arc_next     = 1;
+    profile_arc_overflow = 0;
+#endif
+}
+
+// ----------------------------------------------------------------------------
+// Accumulate profiling data.
+
+// __profile_hit() will be called by HAL-specific code, typically in an ISR
+// associated with a timer.
+
+void
+__profile_hit(CYG_ADDRWORD pc)
+{
+    int bucket;
+    if (! profile_enabled ) {
+        if (! profile_reset_pending) {
+            return;
+        }
+        // reset_pending can be set by the gdb script to request resetting
+        // the data. It avoids having to do lots of memory updates via the
+        // gdb protocol, which is too slow.
+        profile_reset_pending   = 0;
+        profile_reset();
+        profile_enabled         = 1;
+    }
+    
+    if ((pc >= (CYG_ADDRWORD)profile_hist_hdr.low_pc) && (pc <= (CYG_ADDRWORD)profile_hist_hdr.high_pc)) {
+        bucket = (pc - (CYG_ADDRWORD)profile_hist_hdr.low_pc) >> bucket_shift;
+        if (profile_hist_data[bucket] < (unsigned short)0xFFFF) {
+            profile_hist_data[bucket]++;
+        }
+    }
+}
+
+#ifdef CYGPKG_PROFILE_CALLGRAPH
+// __profile_mcount() will be called by the HAL-specific mcount() routine.
+// When code is compiled with -pg the compiler inserts calls to mcount()
+// at the start of each function. Typically mcount() will not use standard
+// calling conventions so it has to be provided by the HAL.
+//
+// The from_pc/to_pc data should end up in profile_arc_records. A hash table
+// maps a PC into a list chained through the records array. The hash function
+// is a simple shift, so a range of PC addresses (usually 256 bytes) map
+// onto a single linked list of arc records.
+//
+// We can hash on either the caller_pc, the callee_pc, or some combination.
+// The caller PC will typically be in the middle of some function. The
+// number of arcs that hash into the same list will depend on the number of
+// function calls within a 256-byte region of code, multiplied by the
+// number of different functions called at each location. The latter will
+// be 1 unless the code uses changing function pointers. The callee pc
+// is near the start of a function, and the number of hash collisions will
+// depend on the number of places that function is called from. Usually this
+// will be small, but some utility functions may be called from many different
+// places.
+//
+// Hashing on the caller PC should give more deterministic results.
+//
+// On some targets the compiler does additional work. For example on
+// the 68K in theory there is no need for a hash table because the
+// compiler provides a word with each callee for the head of the
+// linked list. It is not easy to cope with that in generic code, so
+// for now this code ignores such compiler assistance.
+//
+// It is assumed that __profile_mcount() will be called with interrupts
+// disabled. 
+
+void
+__profile_mcount(CYG_ADDRWORD caller_pc, CYG_ADDRWORD callee_pc)
+{
+    int                 hash_index;
+    struct profile_arc* current;
 
-#define NUM_FILES 1
-static struct _file files[NUM_FILES];
+    // mcount() may be called at any time, even before profile_arc_records
+    // is enabled. There is an assumption here that .bss has been zeroed
+    // before the first call into C code, i.e. by the initial assembler
+    // start-up.
+    if (!profile_enabled) {
+        if (! profile_reset_pending) {
+            return;
+        }
+        profile_reset_pending   = 0;
+        profile_reset();
+        profile_enabled         = 1;
+    }
+
+    // Check the caller_pc because that is what is used to index the
+    // hash table. Checking the callee_pc is optional and depends on
+    // exactly how you interpret the start and end addresses passed to
+    // profile_on().
+    if ((caller_pc < (CYG_ADDRWORD)profile_hist_hdr.low_pc) ||
+        (caller_pc > (CYG_ADDRWORD)profile_hist_hdr.high_pc)) {
+        return;
+    }
 
-static inline struct _file *
-profile_fp(int fd)
+    hash_index = (int) ((caller_pc - (CYG_ADDRWORD)profile_hist_hdr.low_pc) >> CYGNUM_PROFILE_CALLGRAPH_HASH_SHIFT);
+    if (0 == profile_arc_hashtable[hash_index]) {
+        if (profile_arc_next == profile_arc_records_count) {
+            profile_arc_overflow = 1;
+        } else {
+            profile_arc_hashtable[hash_index]   = profile_arc_next;
+            current = &(profile_arc_records[profile_arc_next]);
+            profile_arc_next++;
+            current->next   = 0;
+            current->record.from_pc = (void*) caller_pc;
+            current->record.self_pc = (void*) callee_pc;
+            current->record.count   = 1;
+        }
+    } else {
+        current = &(profile_arc_records[profile_arc_hashtable[hash_index]]);
+        while (1) {
+            if ((current->record.from_pc == (void*) caller_pc) && (current->record.self_pc == (void*) callee_pc)) {
+                current->record.count++;
+                break;
+            } else if (0 == current->next) {
+                if (profile_arc_next == profile_arc_records_count) {
+                    profile_arc_overflow = 1;
+                } else {
+                    current->next   = profile_arc_next;
+                    current         = &(profile_arc_records[profile_arc_next]);
+                    profile_arc_next++;
+                    current->next   = 0;
+                    current->record.from_pc = (void*) caller_pc;
+                    current->record.self_pc = (void*) callee_pc;
+                    current->record.count   = 1;
+                }
+                break;
+            } else {
+                current = &(profile_arc_records[current->next]);
+            }
+        }
+    }
+}
+#endif
+
+#ifdef CYGPKG_PROFILE_TFTP
+// ----------------------------------------------------------------------------
+// TFTP support
+//
+// To keep things simple this code only supports one open file at a time,
+// and only gmon.out is supported.
+
+static int              profile_tftp_next_index     = 0;
+static unsigned char*   profile_tftp_current_block  = (unsigned char*) 0;
+static int              profile_tftp_current_len    = 0;
+static int              profile_tftp_is_open        = 0;
+
+static int
+profile_tftp_open(const char *filename, int flags)
 {
-    struct _file *fp;
-    if ((fd < 0) || (fd >= NUM_FILES)) return (struct _file *)0;
-    fp = &files[fd];
-    if (!(fp->flags & FILE_OPEN)) return (struct _file *)0;
-    return fp;
+    // Only allow one open file for now.
+    if (profile_tftp_is_open) {
+        return -1;
+    }
+    // Only read-only access is supported.
+    if ((0 != (flags & ~O_RDONLY)) || (0 == (flags & O_RDONLY))) {
+        return -1;
+    }
+    // Only gmon.out can be retrieved using this tftp daemon
+    if (0 != strcmp(filename, "gmon.out")) {
+        return -1;
+    }
+    // Everything is in order. Prepare for the first read. Profiling
+    // is suspended while the tftp transfer is in progress to avoid
+    // inconsistent results.
+    profile_enabled             = 0;
+    profile_tftp_is_open        = 1;
+    profile_tftp_next_index     = 0;
+    profile_tftp_current_len    = 0;
+
+    // Report any callgraph overflows. This is best done when retrieving
+    // the results, either in the gdb script or at tftp open time.
+#ifdef CYGPKG_PROFILE_CALLGRAPH
+    if (profile_arc_overflow) {
+        diag_printf("Profiling: warning, the table of callgraph arcs has overflowed\n");
+        diag_printf("This can be avoided by increasing CYGNUM_PROFILE_CALLGRAPH_ARC_PERCENTAGE\n");
+    }
+#endif
+    
+    return 1;
 }
 
 static int
-profile_open(const char *fn, int flags)
+profile_tftp_close(int fd)
 {
-    int fd = 0;
-    struct _file *fp;
-    int len = sizeof(struct gmon_hdr) + sizeof(struct gmon_hist_hdr) + (num_buckets*2) + 1;
-    struct gmon_hdr _hdr;
-    struct gmon_hist_hdr _hist_hdr;
-    unsigned char *bp;
-    int version = GMON_VERSION;
-    int hist_size = num_buckets;
-    int file_type = -1;
-
-    fp = files;
-    if (fp->flags & FILE_OPEN) {
-        // File already open
-        return -1;
-    }
-    if (!(flags & O_RDONLY)) {
-        // Only read supported
-        return -1;
-    }
-    if (strcmp(fn, "PROFILE.DAT") == 0) {
-        file_type = 0;
-    }
-    if (file_type < 0) {
-        // No supported file
+    if (! profile_tftp_is_open) {
         return -1;
     }
-    // Set up file info
-    enabled = 0;
-    switch (file_type) { // In case another type ever supported
-    case 0: // profile data
-        fp->data = malloc(len);
-        if (!fp->data) {
-            diag_printf("Can't allocate buffer for profile data!\n");
-            return -1;
-        }
-        fp->flags = FILE_OPEN;
-        fp->mode = flags;
-        fp->pos = fp->data;
-        fp->eof = fp->pos + len;
-        // Fill in profile data
-        bp = fp->data;
-        memset(&_hdr, 0, sizeof(_hdr));
-        strcpy(_hdr.cookie, GMON_MAGIC);
-        memcpy(_hdr.version, &version, sizeof(version));
-        memcpy(bp, &_hdr, sizeof(_hdr));
-        bp += sizeof(_hdr);
-        memcpy(&_hist_hdr.low_pc, &start_addr, sizeof(start_addr));
-        memcpy(&_hist_hdr.high_pc, &end_addr, sizeof(end_addr));    
-        memcpy(&_hist_hdr.hist_size, &hist_size, sizeof(hist_size));    
-        memcpy(&_hist_hdr.prof_rate, &prof_rate, sizeof(prof_rate));    
-        strcpy(_hist_hdr.dimen, "seconds");
-        _hist_hdr.dimen_abbrev = 's';
-        *bp++ = GMON_TAG_TIME_HIST;
-        memcpy(bp, &_hist_hdr, sizeof(_hist_hdr));
-        bp += sizeof(_hist_hdr);
-        memcpy(bp, profile, (num_buckets*2));
-        memset(profile, 0, (num_buckets*2));
-        break;    
-    }
-    return fd;
-}
+    profile_tftp_is_open = 0;
 
-static int
-profile_close(int fd)
-{
-    struct _file *fp = profile_fp(fd);
-    if (!fp) return -1;
-    if (fp->data) free(fp->data);
-    fp->flags = 0;  // No longer open
-    enabled = 1;
+    // The histogram counters are only 16 bits, so can easily overflow
+    // during a long run. Resetting the counters here makes it possible
+    // to examine profile data during different parts of the run with
+    // a reduced risk of overflow.
+    profile_reset();
+
+    // Profiling was disabled in the open() call
+    profile_enabled     = 1;
     return 0;
 }
 
+// gmon.out can only be read, not written.
 static int 
-profile_write(int fd, const void *buf, int len)
+profile_tftp_write(int fd, const void *buf, int len)
 {
     return -1;
 }
 
-static int
-profile_read(int fd, void *buf, int len)
+// The data that should go into gmon.out is spread all over memory.
+// This utility is used to move from one block to the next.
+static void
+profile_tftp_read_next(void)
 {
-    struct _file *fp = profile_fp(fd);
-    int res;
-    if (!fp) return -1;
-    res = fp->eof - fp->pos;  // Number of bytes left in "file"
-    if (res > len) res = len;
-    if (res <= 0) return 0;  // End of file
-    bcopy(fp->pos, buf, res);
-    fp->pos += res;
-    return res;
+    switch (profile_tftp_next_index) {
+      case 0 :      // The current block is the gmon hdr
+        profile_tftp_current_block  = (unsigned char*) &profile_gmon_hdr;
+        profile_tftp_current_len    = sizeof(struct gmon_hdr);
+        break;
+      case 1 :      // The histogram tag
+        profile_tftp_current_block  = &(profile_tags[0]);
+        profile_tftp_current_len    = 1;
+        break;
+      case 2 :      // The histogram header
+        profile_tftp_current_block  = (unsigned char*) &profile_hist_hdr;
+        profile_tftp_current_len    = sizeof(struct gmon_hist_hdr);
+        break;
+      case 3 :      // The histogram data
+        profile_tftp_current_block  = (unsigned char*) profile_hist_data;
+        profile_tftp_current_len    = profile_hist_hdr.hist_size * sizeof(cyg_uint16);
+        break;
+      default :     // One of the arc records. These start at array offset 1.
+        {
+            int arc_index    = profile_tftp_next_index - 3;
+            if (arc_index >= profile_arc_next) {
+                profile_tftp_current_block  = (unsigned char*) 0;
+                profile_tftp_current_len    = 0;
+            } else {
+                // gmon.out should contain a 1 byte tag followed by each
+                // arc record.
+                profile_tftp_current_block  = (unsigned char*) &(profile_arc_records[arc_index].tags[3]);
+                profile_tftp_current_len    = sizeof(struct gmon_cg_arc_record) + 1;
+            }
+            break;
+        }
+    }
+    profile_tftp_next_index++;
+}
+    
+// Read the next block of data. There is no seek operation so no need
+// to worry about the current position. State from the previous reads
+// is held in profile_tftp_current_block and profile_tftp_current_len
+static int
+profile_tftp_read(int fd, void *buf_arg, int len)
+{
+    unsigned char*  buf     = (unsigned char*) buf_arg;
+    int             read    = 0;
+    
+    if ( ! profile_tftp_is_open ) {
+        return -1;
+    }
+
+    while (len > 0) {
+        if (0 == profile_tftp_current_len) {
+            profile_tftp_read_next();
+            if (0 == profile_tftp_current_len) {
+                break;
+            }
+        }
+        if (profile_tftp_current_len >= len) {
+            // The request can be satisfied by the current block
+            memcpy(&(buf[read]), profile_tftp_current_block, len);
+            profile_tftp_current_block += len;
+            profile_tftp_current_len   -= len;
+            read += len;
+            break;
+        } else {
+            memcpy(&(buf[read]), profile_tftp_current_block, profile_tftp_current_len);
+            len  -= profile_tftp_current_len;
+            read += profile_tftp_current_len;
+            profile_tftp_current_len = 0;
+        }
+    }
+    return read;
 }
 
-void
-__profile_hit(unsigned long pc)
-{
-    int bucket;
-    if (enabled) {
-        if ((pc >= start_addr) && (pc <= end_addr)) {
-            bucket = (pc - start_addr) >> bucket_shift;
-            if (profile[bucket] < (unsigned short)0xFFFF) {
-                profile[bucket]++;
-            }
-        }
-    }
-}
+static struct tftpd_fileops profile_tftp_fileops = {
+    &profile_tftp_open,
+    &profile_tftp_close,
+    &profile_tftp_write,
+    &profile_tftp_read
+};
+#endif
+
+// ----------------------------------------------------------------------------
+// profile_on() has to be called by application code to start profiling.
+// Application code will determine the start and end addresses, usually
+// _stext and _etext, but it is possible to limit profiling to only
+// some of the code. The bucket size controls how many PC addresses
+// will be treated as a single hit: a smaller bucket increases precision
+// but requires more memory. The resolution is used to initialize the
+// profiling timer: more frequent interrupts means more accurate results
+// but increases the risk of an overflow.
 
 void 
 profile_on(void *_start, void *_end, int _bucket_size, int resolution)
-{    
-    start_addr = (unsigned long)_start;
-    end_addr = (unsigned long)_end;
-    // Adjust bucket size to be a power of 2
-    bucket_size = 1;
-    bucket_shift = 0;
+{
+    int             bucket_size;
+    cyg_uint32      version     = GMON_VERSION;
+    CYG_ADDRWORD    text_size   = (CYG_ADDRWORD)_end - (CYG_ADDRWORD)_start;
+
+    // Initialize statics. This also ensures that they won't be
+    // garbage collected by the linker so a gdb script can safely
+    // reference them.
+    memcpy(profile_gmon_hdr.cookie, GMON_MAGIC, 4);
+    memcpy(profile_gmon_hdr.version, &version, 4);
+    profile_tags[0] = GMON_TAG_TIME_HIST;
+    profile_tags[1] = GMON_TAG_CG_ARC;
+    profile_tags[2] = GMON_TAG_BB_COUNT;
+    strcpy(profile_hist_hdr.dimen, "seconds");
+    profile_hist_hdr.dimen_abbrev   = 's';
+
+    // The actual bucket size. For efficiency this should be a power of 2.
+    bucket_size             = 1;
+    bucket_shift            = 0;
     while (bucket_size < _bucket_size) {
-        bucket_size <<= 1;
-        bucket_shift++;
+        bucket_size     <<= 1;
+        bucket_shift    += 1;
     }
-    if (bucket_size != _bucket_size) {
-        bucket_size <<= 1;
-        bucket_shift++;
-    }
-    // Calculate number of buckets
-    num_buckets = ((end_addr - start_addr) + (bucket_size - 1)) / bucket_size;
-    // Adjust end address so calculations come out
-    end_addr = start_addr + (bucket_size * num_buckets);
-    prof_rate = 1000000 / resolution;
-    // Allocate buffer for profile data
-    if (!(profile = malloc(num_buckets*2))) {
-        diag_printf("Can't allocate profile buffer - ignored\n");
+
+    // The gprof documentation claims that this should be the size in
+    // bytes. The implementation treats it as a count.
+    profile_hist_hdr.hist_size  = (cyg_uint32) ((text_size + bucket_size - 1) / bucket_size);
+    profile_hist_hdr.low_pc     = _start;
+    profile_hist_hdr.high_pc    = (void*)((cyg_uint8*)_end - 1);
+    // The prof_rate is the frequency in hz. The resolution argument is
+    // an interval in microseconds.
+    profile_hist_hdr.prof_rate  = 1000000 / resolution;
+        
+    // Now allocate a buffer for the histogram data.
+    profile_hist_data = (cyg_uint16*) malloc(profile_hist_hdr.hist_size * sizeof(cyg_uint16));
+    if ((cyg_uint16*)0 == profile_hist_data) {
+        diag_printf("profile_on(): cannot allocate histogram buffer - ignored\n");
         return;
     }
-    memset(profile, 0, (num_buckets*2));
-    enabled = 1;
-    diag_printf("Profile from %p..%p[%p], in %d buckets of size %d\n", 
-                start_addr, end_addr, _end, num_buckets, bucket_size);
+    memset(profile_hist_data, 0, profile_hist_hdr.hist_size * sizeof(cyg_uint16));
+
+#ifdef CYGPKG_PROFILE_CALLGRAPH
+    // Two arrays are needed for keeping track of the callgraph. The
+    // first is a hash table. The second holds the arc data. The
+    // latter array contains an extra 50 slots to cope with degenerate
+    // programs (including testcases).
+    {
+        int i;
+        
+        profile_arc_hash_count  = (int) ((text_size + (0x01 << CYGNUM_PROFILE_CALLGRAPH_HASH_SHIFT) - 1)
+                                         >> CYGNUM_PROFILE_CALLGRAPH_HASH_SHIFT);
+        profile_arc_records_count = (int)
+            (CYGNUM_PROFILE_CALLGRAPH_ARC_PERCENTAGE * (text_size / 100)) /
+            sizeof(struct profile_arc)
+            + 50;
 
-    hal_enable_profile_timer(resolution);
+        profile_arc_hashtable = (int*) malloc(profile_arc_hash_count * sizeof(int));
+        if ((int*)0 == profile_arc_hashtable) {
+            diag_printf("profile_on(): cannot allocate call graph hash table\n  call graph profiling disabled\n");
+        } else {
+            memset(profile_arc_hashtable, 0, profile_arc_hash_count * sizeof(int));
+            profile_arc_records = (struct profile_arc*) malloc(profile_arc_records_count * sizeof(struct profile_arc));
+            if ((struct profile_arc*)0 == profile_arc_records) {
+                diag_printf("profile_on(): cannot allocate call graph arc table\n  call graph profiling disabled\n");
+                free(profile_arc_hashtable);
+                profile_arc_hashtable = (int*) 0;
+            } else {
+                memset(profile_arc_records, 0, profile_arc_records_count * sizeof(struct profile_arc));
+                for (i = 0; i < profile_arc_records_count; i++) {
+                    profile_arc_records[i].tags[3] = GMON_TAG_CG_ARC;
+                }
+                profile_arc_next    = 1;    // slot 0 cannot be used because 0 marks an unused hash slot.
+            }
+        }
+    }
+#else
+    profile_arc_records     = (struct profile_arc*) 0;
+#endif
+    
+    diag_printf("Profile from %p..%p in %d buckets of size %d\n",
+                profile_hist_hdr.low_pc, profile_hist_hdr.high_pc,
+                profile_hist_hdr.hist_size, bucket_size);
 
+    // Activate the profiling timer, which is usually provided by the
+    // variant or target HAL. The requested resolution may not be
+    // possible on the current hardware, so the HAL is allowed to
+    // tweak it.
+    resolution = hal_enable_profile_timer(resolution);
+    profile_hist_hdr.prof_rate = 1000000 / resolution;
+
+    profile_enabled = 1;
+
+#ifdef CYGPKG_PROFILE_TFTP    
     // Create a TFTP server to provide the data
-    tftp_server_id = tftpd_start(CYGNUM_PROFILE_TFTP_PORT, &profile_fileops);
+    (void) tftpd_start(CYGNUM_PROFILE_TFTP_PORT, &profile_tftp_fileops);
+#endif    
 }
 
 // EOF profile.c