From: Dave Hart <hart@ntp.org>
Date: Sun, 13 Feb 2011 07:05:04 +0000 (-0500)
Subject: Add configure options to disable installation, regression tests
X-Git-Tag: release-2.0.11-stable~49
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=49e9bb7fb014a84de677f265cedac58f4d8a8ad5;p=libevent

Add configure options to disable installation, regression tests

The main reason for disabling installation is if you're building
libevent as a subpackage for embedding: you want to have your main
package's "make all" build libevent, but you don't want your main
package's "make install" to install libevent.
---

diff --git a/Makefile.am b/Makefile.am
index 46f6d34e..3a7bc2b8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -72,7 +72,7 @@ VERSION_INFO = 5:1:0
 dist_bin_SCRIPTS = event_rpcgen.py
 
 pkgconfigdir=$(libdir)/pkgconfig
-pkgconfig_DATA=libevent.pc
+LIBEVENT_PKGCONFIG=libevent.pc
 
 # These sources are conditionally added by configure.in or conditionally
 # included from other files.
@@ -89,14 +89,21 @@ EXTRA_DIST = \
 	Makefile.nmake test/Makefile.nmake \
 	$(PLATFORM_DEPENDENT_SRC)
 
-lib_LTLIBRARIES = libevent.la libevent_core.la libevent_extra.la
+LIBEVENT_LIBS_LA = libevent.la libevent_core.la libevent_extra.la
 if PTHREADS
-lib_LTLIBRARIES += libevent_pthreads.la
-pkgconfig_DATA += libevent_pthreads.pc
+LIBEVENT_LIBS_LA += libevent_pthreads.la
+LIBEVENT_PKGCONFIG += libevent_pthreads.pc
 endif
 if OPENSSL
-lib_LTLIBRARIES += libevent_openssl.la
-pkgconfig_DATA += libevent_openssl.pc
+LIBEVENT_LIBS_LA += libevent_openssl.la
+LIBEVENT_PKGCONFIG += libevent_openssl.pc
+endif
+
+if INSTALL_LIBEVENT
+lib_LTLIBRARIES = $(LIBEVENT_LIBS_LA)
+pkgconfig_DATA = $(LIBEVENT_PKGCONFIG)
+else
+noinst_LTLIBRARIES =  $(LIBEVENT_LIBS_LA)
 endif
 
 SUBDIRS = . include sample test
diff --git a/configure.in b/configure.in
index 3c76cfa3..d924016d 100644
--- a/configure.in
+++ b/configure.in
@@ -42,6 +42,9 @@ if test "$GCC" = "yes" ; then
 	CFLAGS="$CFLAGS -fno-strict-aliasing"
 fi
 
+enable_libevent_install_def=yes
+enable_libevent_regress_def=yes
+
 AC_ARG_ENABLE(gcc-warnings,
      AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings with GCC))
 AC_ARG_ENABLE(thread-support,
@@ -56,6 +59,12 @@ AC_ARG_ENABLE(openssl,
 AC_ARG_ENABLE(debug-mode,
      AS_HELP_STRING(--disable-debug-mode, disable support for running in debug mode),
         [], [enable_debug_mode=yes])
+AC_ARG_ENABLE([libevent-install],
+     AS_HELP_STRING([--disable-libevent-install, disable installation of libevent]),
+	[], [enable_libevent_install=$enable_libevent_install_def])
+AC_ARG_ENABLE([libevent-regress],
+     AS_HELP_STRING([--disable-libevent-regress, skip regress in  make check]),
+	[], [enable_libevent_regress=$enable_libevent_regress_def])
 
 AC_PROG_LIBTOOL
 
@@ -65,6 +74,14 @@ dnl   the command line with --enable-shared and --disable-shared.
 dnl AC_DISABLE_SHARED
 AC_SUBST(LIBTOOL_DEPS)
 
+AM_CONDITIONAL([BUILD_REGRESS], [test "$enable_libevent_regress" = "yes"])
+if test "$enable_libevent_regress" = "yes" ; then
+    CHECK_REGRESS=regress
+else
+    CHECK_REGRESS=
+fi
+AC_SUBST([CHECK_REGRESS])
+
 dnl Checks for libraries.
 AC_SEARCH_LIBS([inet_ntoa], [nsl])
 AC_SEARCH_LIBS([socket], [socket])
@@ -672,5 +689,7 @@ if test "$GCC" = yes ; then
 fi
 AC_SUBST([LIBEVENT_GC_SECTIONS])
 
+AM_CONDITIONAL([INSTALL_LIBEVENT], [test "$enable_libevent_install" = "yes"])
+
 AC_CONFIG_FILES( [libevent.pc libevent_openssl.pc libevent_pthreads.pc] )
 AC_OUTPUT(Makefile include/Makefile test/Makefile sample/Makefile)
diff --git a/test/Makefile.am b/test/Makefile.am
index b9fb8d04..6d8bf5e7 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -4,14 +4,19 @@ AM_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat -I$(top_srcdir)/include -I../
 
 EXTRA_DIST = regress.rpc regress.gen.h regress.gen.c test.sh
 
-noinst_PROGRAMS = test-init test-eof test-weof test-time regress \
+noinst_PROGRAMS = test-init test-eof test-weof test-time @CHECK_REGRESS@ \
 	bench bench_cascade bench_http bench_httpclient test-ratelim \
 	test-changelist
+EXTRA_PROGRAMS = regress
 noinst_HEADERS = tinytest.h tinytest_macros.h regress.h tinytest_local.h
 
 TESTS = $(top_srcdir)/test/test.sh
 
-BUILT_SOURCES = regress.gen.c regress.gen.h
+BUILT_SOURCES =
+if BUILD_REGRESS
+BUILT_SOURCES += regress.gen.c regress.gen.h
+endif
+
 test_init_SOURCES = test-init.c
 test_init_LDADD = ../libevent_core.la
 test_eof_SOURCES = test-eof.c
diff --git a/test/test.sh b/test/test.sh
index 0054faee..6460306f 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -97,6 +97,7 @@ run_tests () {
 		announce FAILED ;
 		FAILED=yes
 	fi
+	test -x $TEST_DIR/regress || return
 	announce_n " regress: "
 	if test "$TEST_OUTPUT_FILE" = "/dev/null" ;
 	then