This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Making sqlite optional for build


Hi,

I have been working to make the sqlite optional on the build. The attached patch shows the changes to make the sqlite optional. The systemtap.spec file has been modified to build with sqlite for newer distro, e.g. rhel5 and fc6/7. I have tried it out on rhel4 without the sqlite packages installed and allows building without the sqlite packages. Comments on the proposed patch?

-Will

Proposed ChangeLog entry

2007-07-11 William Cohen <wcohen@redhat.com>

	* coveragedb.cxx: Compile code only if SQLITEDB set.
	* coveragedb.h: Ditto.
	* main.cxx: Ditto.
	* systemtap.spec.in: Allow optional sqlite
	* configure.ac: Add --enable-sqlitedb option.
	* configure: Regenerated.
? .cvsignore
Index: configure
===================================================================
RCS file: /cvs/systemtap/src/configure,v
retrieving revision 1.77
diff -u -r1.77 configure
--- configure	3 Jul 2007 22:39:12 -0000	1.77
+++ configure	11 Jul 2007 18:24:26 -0000
@@ -1318,6 +1318,7 @@
   --enable-dependency-tracking   do not reject slow dependency extractors
   --enable-perfmon                 enable perfmon support (default is disabled)
   --enable-prologues      make -P prologue-searching default
+  --enable-sqlitedb               enable generation of database (default is disabled)
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -5921,7 +5922,16 @@
 
 
 
-SAVE_LIBS="$LIBS"
+# Check whether --enable-sqlitedb was given.
+if test "${enable_sqlitedb+set}" = set; then
+  enableval=$enable_sqlitedb; sqlitedb_support=$enableval
+else
+  sqlitredb_support=no
+fi
+
+
+if test $sqlitedb_support = yes; then
+  SAVE_LIBS="$LIBS"
 
 { echo "$as_me:$LINENO: checking for sqlite3_open in -lsqlite3" >&5
 echo $ECHO_N "checking for sqlite3_open in -lsqlite3... $ECHO_C" >&6; }
@@ -5993,14 +6003,18 @@
 
 else
 
-    { { echo "$as_me:$LINENO: error: missing sqlite development headers/libraries" >&5
-echo "$as_me: error: missing sqlite development headers/libraries" >&2;}
+    { { echo "$as_me:$LINENO: error: missing sqlite development headers/libraries required for " >&5
+echo "$as_me: error: missing sqlite development headers/libraries required for " >&2;}
    { (exit 1); exit 1; }; }
 fi
 
-sqlite3_LIBS="$LIBS"
+  sqlite3_LIBS="$LIBS"
 
-LIBS="$SAVE_LIBS"
+  LIBS="$SAVE_LIBS"
+  CFLAGS="$CFLAGS -DSQLITEDB"
+  CXXFLAGS="$CXXFLAGS -DSQLITEDB"
+  LDFLAGS="$LDFLAGS -DSQLITEDB"
+fi
 
 build_elfutils=no
 
Index: configure.ac
===================================================================
RCS file: /cvs/systemtap/src/configure.ac,v
retrieving revision 1.76
diff -u -r1.76 configure.ac
--- configure.ac	3 Jul 2007 22:39:12 -0000	1.76
+++ configure.ac	11 Jul 2007 18:24:26 -0000
@@ -74,12 +74,21 @@
 fi])
 
 
-SAVE_LIBS="$LIBS"
-AC_CHECK_LIB(sqlite3, sqlite3_open,,[
-    AC_MSG_ERROR([missing sqlite development headers/libraries])])
-sqlite3_LIBS="$LIBS"
-AC_SUBST(sqlite3_LIBS)
-LIBS="$SAVE_LIBS"
+AC_ARG_ENABLE(sqlitedb,
+	[  --enable-sqlitedb               enable generation of database (default is disabled)],
+	sqlitedb_support=$enableval, sqlitredb_support=no)
+
+if test $sqlitedb_support = yes; then
+  SAVE_LIBS="$LIBS"
+  AC_CHECK_LIB(sqlite3, sqlite3_open,,[
+    AC_MSG_ERROR([missing sqlite development headers/libraries required for ])])
+  sqlite3_LIBS="$LIBS"
+  AC_SUBST(sqlite3_LIBS)
+  LIBS="$SAVE_LIBS"
+  CFLAGS="$CFLAGS -DSQLITEDB"
+  CXXFLAGS="$CXXFLAGS -DSQLITEDB"
+  LDFLAGS="$LDFLAGS -DSQLITEDB"
+fi
 
 build_elfutils=no
 AC_ARG_WITH([elfutils],
Index: coveragedb.cxx
===================================================================
RCS file: /cvs/systemtap/src/coveragedb.cxx,v
retrieving revision 1.5
diff -u -r1.5 coveragedb.cxx
--- coveragedb.cxx	8 Jul 2007 20:09:14 -0000	1.5
+++ coveragedb.cxx	11 Jul 2007 18:24:26 -0000
@@ -6,6 +6,8 @@
 // Public License (GPL); either version 2, or (at your option) any
 // later version.
 
+#ifdef SQLITEDB
+
 #include "parse.h"
 #include "coveragedb.h"
 #include "config.h"
@@ -363,3 +365,5 @@
 
   sqlite3_close(db);
 }
+
+#endif
Index: coveragedb.h
===================================================================
RCS file: /cvs/systemtap/src/coveragedb.h,v
retrieving revision 1.2
diff -u -r1.2 coveragedb.h
--- coveragedb.h	7 Jul 2007 21:46:31 -0000	1.2
+++ coveragedb.h	11 Jul 2007 18:24:26 -0000
@@ -9,6 +9,8 @@
 #ifndef COVERAGEDB_H
 #define COVERAGEDB_H
 
+#ifdef SQLITEDB
+
 #include "session.h"
 
 #include <string>
@@ -70,10 +72,17 @@
 	  compiled = 0; executed = 0; }
 };
 
-
-
 void print_coverage_info(systemtap_session &s);
 void update_coverage_db(systemtap_session &s);
+#else
+
+static inline void print_coverage_info(systemtap_session &s
+				       __attribute__ ((unused))) {}
+static inline void update_coverage_db(systemtap_session &s
+				       __attribute__ ((unused))) {}
+
+#endif
+
 
 #endif
 
Index: main.cxx
===================================================================
RCS file: /cvs/systemtap/src/main.cxx,v
retrieving revision 1.73
diff -u -r1.73 main.cxx
--- main.cxx	26 Jun 2007 19:36:26 -0000	1.73
+++ main.cxx	11 Jul 2007 18:24:26 -0000
@@ -100,7 +100,9 @@
     << endl
     << "   -x PID     sets target() to PID" << endl
     << "   -t         collect probe timing information" << endl
+#ifdef SQLITEDB
     << "   -q         generate information on tapset coverage"
+#endif
     << endl
     ;
   // -d: dump safety-related external references
@@ -800,10 +802,12 @@
 
  cleanup:
 
+#ifdef SQLITEDB
   // update the database information
   if (!rc && s.tapset_compile_coverage) {
     update_coverage_db(s);
   }
+#endif
 
   // Clean up temporary directory.  Obviously, be careful with this.
   if (s.tmpdir == "")
Index: systemtap.spec.in
===================================================================
RCS file: /cvs/systemtap/src/systemtap.spec.in,v
retrieving revision 1.63
diff -u -r1.63 systemtap.spec.in
--- systemtap.spec.in	3 Jul 2007 15:42:28 -0000	1.63
+++ systemtap.spec.in	11 Jul 2007 18:24:26 -0000
@@ -6,15 +6,19 @@
 # Set bundled_elfutils to 0 on systems that have %{elfutils_version} or newer.
 %if 0%{?fedora}
 %define bundled_elfutils 1
+%define sqlite 0
 %if "%fedora" >= "6"
 %define bundled_elfutils 0
+%define sqlite 1
 %endif
 %endif
 
 %if 0%{?rhel}
 %define bundled_elfutils 1
+%define sqlite 0
 %if "%rhel" >= "5"
 %define bundled_elfutils 0
+%define sqlite 1
 %endif
 %endif
 
@@ -24,6 +28,12 @@
 %define bundled_elfutils 1
 %endif
 
+%if 0%{!?sqlite:1}
+# Yo!  DO NOT TOUCH THE FOLLOWING LINE.
+# You can use rpmbuild --define "sqlite 1" for a build of your own.
+%define sqlite 0
+%endif
+
 Name: systemtap
 Version: @VERSION@
 Release: %{release}%{?dist}
@@ -39,7 +49,10 @@
 BuildRequires: glib2-devel >= 2.0.0
 # make check
 BuildRequires: dejagnu
+%if %{sqlite}
 BuildRequires: sqlite-devel
+Requires: sqlite
+%endif
 Requires: glib2 >= 2.0.0
 # Requires: kernel-devel
 # or is that kernel-smp-devel?  kernel-hugemem-devel?
@@ -47,7 +60,6 @@
 # Suggest: kernel-debuginfo
 Requires: systemtap-runtime = %{version}-%{release}
 Requires: sudo
-Requires: sqlite
 
 %if %{bundled_elfutils}
 Source1: elfutils-%{elfutils_version}.tar.gz
@@ -104,7 +116,12 @@
 %define elfutils_mflags LD_LIBRARY_PATH=`pwd`/lib-elfutils
 %endif
 
-%configure %{?elfutils_config}
+%if %{sqlite}
+# Include the coverage testing support
+%define sqlite_config --enable-sqlitedb
+%endif
+
+%configure %{?elfutils_config} %{?sqlite_config}
 make %{?_smp_mflags}
 
 # Fix paths in the example scripts

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]