]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
autoconf: detect ctf-tools and add ctf to libafs
authorMarcio Barbosa <mbarbosa@sinenomine.net>
Mon, 5 Feb 2018 21:16:17 +0000 (21:16 +0000)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 9 Feb 2018 13:55:16 +0000 (08:55 -0500)
CTF is a reduced form of debug information similar to DWARF and stab. It
describes types and function prototypes. The principal objective of the
format is to shrink the data size as much as possible so that it could
be included in a production environment. MDB, DTrace, and other tools
use CTF debug information to read and display structures correctly.

This commit introduces a new configure option called --with-ctf-tools.
This option can be used to specify an alternative path where the tools
can be found. If the path is not provided, the tools will be searched
in a set of default directories (including $PATH). The CTF debugging
information will only be included if the corresponding --enable-debug /
--enable-debug-kernel is specified.

Note: at the moment, the Solaris kernel module is the only module
benefited by this commit.

Reviewed-on: https://gerrit.openafs.org/12680
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 88cb536f99dc58fdbeb9fa6c47c26774241a0cb6)

Change-Id: I174347370a83b31f68d2631c965e17d72b438cd1
Reviewed-on: https://gerrit.openafs.org/12902
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
INSTALL
acinclude.m4
src/cf/ctf-tools.m4 [new file with mode: 0644]
src/cf/summary.m4
src/config/Makefile.config.in
src/libafs/MakefileProto.SOLARIS.in

diff --git a/INSTALL b/INSTALL
index 665e306fd78e5f052a0d12b996499d5c8da8388d..3d802a72d3b413a06208af5b13a418dc6d64e653 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -499,6 +499,13 @@ I  Other configure options
        xsltproc.  By default, the user's path is searched for those
        programs in that order, and the first one found is used.
 
+   --with-ctf-tools[=DIR]
+       Location of ctfconvert and ctfmerge. Defaults to detect. These
+       tools create a reduced form of debug information that describes
+       types and function prototypes. This option is only relevant to
+       platforms that provide CTF tools and, at the moment, it is only
+       functional on Solaris (onbld package must be installed).
+
    There are also some environment variables that you can set to control
    aspects of the build.  They can be set either on the configure command
    line (preferred) or in the environment.
index 91006174f573013241d10d843b1d93424a9121c0..7b35bb122e5679e5b319015e09691997493cb895 100644 (file)
@@ -79,4 +79,5 @@ OPENAFS_C_STRUCT_LABEL_CHECK
 OPENAFS_DIRENT_CHECKS
 OPENAFS_SYS_RESOURCE_CHECKS
 OPENAFS_UUID_CHECKS
+OPENAFS_CTF_TOOLS_CHECKS
 ])
diff --git a/src/cf/ctf-tools.m4 b/src/cf/ctf-tools.m4
new file mode 100644 (file)
index 0000000..3880a88
--- /dev/null
@@ -0,0 +1,30 @@
+AC_DEFUN([OPENAFS_CTF_TOOLS_CHECKS],[
+
+CTF_DEFAULT_PATH="$PATH:/usr/bin:/opt/onbld/bin/$HOST_CPU"
+
+AC_ARG_WITH([ctf-tools],
+        AS_HELP_STRING([--with-ctf-tools@<:@=DIR@:>@],
+        [Location of the CTF tools]),
+        [CTF_TOOLS="$withval"],
+        [CTF_TOOLS="check"])
+
+AS_CASE([$CTF_TOOLS],
+        [check], [AC_PATH_PROG([CTFCONVERT], [ctfconvert], [], [$CTF_DEFAULT_PATH])
+                  AC_PATH_PROG([CTFMERGE], [ctfmerge], [], [$CTF_DEFAULT_PATH])],
+
+        [yes],   [AC_PATH_PROG([CTFCONVERT], [ctfconvert], [], [$CTF_DEFAULT_PATH])
+                  AC_PATH_PROG([CTFMERGE], [ctfmerge], [], [$CTF_DEFAULT_PATH])
+                  AS_IF([test "x$CTFCONVERT" = "x"], [AC_ERROR("ctfconvert not found")])
+                  AS_IF([test "x$CTFMERGE" = "x"], [AC_ERROR("ctfmerge not found")])],
+
+        [no],    [],
+
+        [AC_PATH_PROG([CTFCONVERT], [ctfconvert], [], [$CTF_TOOLS])
+         AC_PATH_PROG([CTFMERGE], [ctfmerge], [], [$CTF_TOOLS])
+         AS_IF([test "x$CTFCONVERT" = "x"], [AC_ERROR("ctfconvert not found")])
+         AS_IF([test "x$CTFMERGE" = "x"], [AC_ERROR("ctfmerge not found")])]
+)
+
+AC_ARG_VAR([CTFCONVERT], [Path to ctfconvert])
+AC_ARG_VAR([CTFMERGE], [Path to ctfmerge])
+])
index 0ac9fc0287471e88ea16063d6faa26836a3ff353..1b969326baa8a055be8b550a6b6733e53de861ac 100644 (file)
@@ -51,6 +51,9 @@ AC_DEFUN([OPENAFS_SUMMARY],[
   AS_IF([test "${summary_doxygen}" = "yes" -a "${HAVE_DOT}" = "yes"],
     [summary_doxygen_graphs="yes"],
     [summary_doxygen_graphs="no"])
+  AS_IF([test "x$CTFCONVERT" != "x" -a "x$CTFMERGE" != "x"],
+    [summary_ctf_tools="yes"],
+    [summary_ctf_tools="no"])
 
   cat <<EOF
 ***************************************************************
@@ -62,6 +65,7 @@ OpenAFS configure summary
 debug:
   userspace              : ${enable_debug}
   kernel                 : ${enable_debug_kernel}
+  ctf-tools              : ${summary_ctf_tools}
 options:
   transarc paths         : ${enable_transarc_paths}
   namei fileserver       : ${openafs_cv_summary_check_namei}
index e4535314720873b763b80ebb71fb6508deb3c976..af51d6ecc38e2f97bc8a7d55a82442f0d08a9ffa 100644 (file)
@@ -51,6 +51,8 @@ FSINCLUDES = @FSINCLUDES@
 GENCAT = @GENCAT@
 INCLUDE_LIBINTL = @INCLUDE_libintl@
 KERN_DBG = @KERN_DBG@
+CTFCONVERT = @CTFCONVERT@
+CTFMERGE = @CTFMERGE@
 KERN_OPTMZ = @KERN_OPTMZ@
 LD = @LD@
 LDFLAGS_roken = @LDFLAGS_roken@
@@ -316,3 +318,33 @@ LT_CLEAN=$(RM) -rf .lwp .libs *.la *.lo
 AFS_LDRULE         =$(RUN_LD) $(CC) $(AFS_LDFLAGS) $(AFS_CFLAGS) $(LDFLAGS_$(@)) -o $@
 AFS_LDRULE_NOQ =$(RUN_LD_NOQ) $(CC) $(AFS_LDFLAGS) $(AFS_CFLAGS) $(LDFLAGS_$(@)) -o $@
 
+RUN_CTFCONVERT=@RUN_CTFCONVERT() { \
+    CTFLABEL=$$1 ; \
+    CTFDBG=$$2 ; \
+    shift ; shift ; \
+    if test "x$${CTFDBG}" = "x" ; then exit 0; fi; \
+    if test "x${CTFCONVERT}" = "x" ; then exit 0; fi; \
+    if test "x${CTFMERGE}" = "x" ; then \
+        echo "refusing to run ctfconvert; missing ctfmerge"; \
+        exit 1; \
+    fi; \
+    for t in $$@ ; do \
+        echo "${CTFCONVERT} -g -l $${CTFLABEL} $$t"; \
+        ${CTFCONVERT} -g -l $${CTFLABEL} $$t; \
+    done ; \
+} ; RUN_CTFCONVERT
+
+RUN_CTFMERGE=@RUN_CTFMERGE () { \
+    CTFLABEL=$$1 ; \
+    CTFDBG=$$2 ; \
+    shift ; shift ; \
+    if test "x$${CTFDBG}" = "x" ; then exit 0; fi; \
+    if test "x${CTFMERGE}" = "x" ; then exit 0; fi; \
+    if test "x${CTFCONVERT}" = "x" ; then \
+        echo "refusing to run ctfmerge; missing ctfconvert"; \
+        exit 1; \
+    fi; \
+    echo "$(CTFMERGE) -g -l $${CTFLABEL} -o $$@"; \
+    $(CTFMERGE) -g -l $${CTFLABEL} -o $$@; \
+} ; RUN_CTFMERGE
+
index 01f86a5fa76c2b55dff728765976de91e7b28caf..9eecd975182737b0cb0e0642b7549b6726f3d54e 100644 (file)
@@ -146,9 +146,13 @@ dest_libafs: $(LIBAFS) $(LIBAFSNONFS)
 
 ${LIBAFS}: $(AFSAOBJS) $(AFSNFSOBJS)
        $(RM) -f $@
+       $(RUN_CTFCONVERT) libafs "${KERN_DBG}" ${AFSAOBJS} ${AFSNFSOBJS}
        $(LD) $(LDFLAGS) -o $@ $(AFSAOBJS) ${AFSNFSOBJS}
+       $(RUN_CTFMERGE) libafs "${KERN_DBG}" $@ $(AFSAOBJS) ${AFSNFSOBJS}
 
 ${LIBAFSNONFS}:  $(AFSAOBJS) $(AFSNONFSOBJS)
        $(RM) -f $@
+       $(RUN_CTFCONVERT) libafs "${KERN_DBG}" ${AFSAOBJS} ${AFSNONFSOBJS}
        $(LD) $(LDFLAGS) -o $@ $(AFSAOBJS) ${AFSNONFSOBJS}
+       $(RUN_CTFMERGE) libafs "${KERN_DBG}" $@ $(AFSAOBJS) ${AFSNONFSOBJS}