From b8d0ccce79704f2a3817219771ed1588aec7b4a4 Mon Sep 17 00:00:00 2001 From: Sears Russell Date: Thu, 9 Nov 2006 23:00:50 +0000 Subject: [PATCH] Modularized the build; made berkeleydb and confuse optional. No longer build as many things by default. --- benchmarks/Makefile.am | 5 +-- benchmarks/berkeleyDB/Makefile.am | 7 +++-- configure.in | 51 ++++++++++++++++++++++++++++--- m4/db.m4 | 6 +++- src/2pc/Makefile.am | 3 +- src/Makefile.am | 9 +++++- src/apps/cht/Makefile.am | 4 ++- src/apps/cht/cht_server.c | 2 +- src/libdfa/Makefile.am | 6 +++- test/Makefile.am | 12 +++++++- utilities/Makefile.am | 5 +-- 11 files changed, 93 insertions(+), 17 deletions(-) diff --git a/benchmarks/Makefile.am b/benchmarks/Makefile.am index 396fb46..6f37dbb 100644 --- a/benchmarks/Makefile.am +++ b/benchmarks/Makefile.am @@ -1,6 +1,7 @@ -LDADD=$(top_builddir)/src/2pc/lib2pc.a $(top_builddir)/src/libdfa/libdfa.a \ - $(top_builddir)/src/lladd/liblladd.a \ +LDADD=$(top_builddir)/src/lladd/liblladd.a \ $(top_builddir)/src/libdfa/librw.a +#$(top_builddir)/src/2pc/lib2pc.a $(top_builddir)/src/libdfa/libdfa.a + bin_PROGRAMS=lhtableThreaded naiveHash logicalHash readLogicalHash naiveMultiThreaded logicalMultThreaded rawSet \ arrayListSet logicalMultiReaders linearHashNTA linkedListNTA pageOrientedListNTA \ linearHashNTAThreaded linearHashNTAMultiReader linearHashNTAWriteRequests transitiveClosure zeroCopy diff --git a/benchmarks/berkeleyDB/Makefile.am b/benchmarks/berkeleyDB/Makefile.am index bd6ea46..92f9abd 100644 --- a/benchmarks/berkeleyDB/Makefile.am +++ b/benchmarks/berkeleyDB/Makefile.am @@ -1,3 +1,6 @@ -LDADD=-lpthread +if BUILD_BENCHMARKS +if DB_ENABLED +LDADD=@DB_LIBS@ bin_PROGRAMS=transapp bdbRaw bdbHash bdbHashThreaded bdbHashWriteRequests -AM_CFLAGS=-g +endif +endif \ No newline at end of file diff --git a/configure.in b/configure.in index 06b479e..24a4208 100644 --- a/configure.in +++ b/configure.in @@ -67,15 +67,13 @@ if test "$db_cv_open_o_direct" = "yes"; then AH_TEMPLATE(HAVE_O_DIRECT, [Define to 1 if you have the O_DIRECT flag.]) fi -AC_CONFIG_DB - AC_CHECK_LIB([check], [suite_create], , AC_MSG_WARN([Check not found; cannot run unit tests!])) ## This perl script thing is a total hack, but we need to define HAVE_LIBCHECK ## inside of an AM_CONDITIONAL to get conditional compilation to work. AM_CONDITIONAL(HAVE_LIBCHECK, echo $LIBS | [ perl -ne 'if($_=~/-lcheck/) - { print qq(Check found, make check will run full test suite. + { print qq(Check found, make check will run test suites. --enable-confuse will enable extra tests of old code. ); exit 0; } else { print qq( -------------------------------- @@ -86,6 +84,8 @@ Check not found! Most tests will be skipped by make check! -------------------------------- ); exit 1; }']) + + #have_libcheck", "xyes") #AC_CHECK_LIB([check], # [suite_create], AC_MSG_WARN([Check not found; cannot run unit tests!] @@ -96,7 +96,47 @@ Check not found! Most tests will be skipped by make check! #AM_CONDITIONAL(HAVE_CHECK, test xyes, xyes) AC_CHECK_LIB([m], [sqrt]) AC_CHECK_LIB([pthread], [pthread_create]) -AC_CHECK_LIB([confuse], [cfg_set_validate_func]) +#AC_CHECK_LIB([confuse], [cfg_set_validate_func]) +## Repeat hack for LIBCONFUSE + +AC_ARG_ENABLE([deprecated-networking], + AC_HELP_STRING([--enable-network], + [Enables old networking code. Requires libconfuse]), + if test x$enableval = xno ; then + echo "Networking disabled; not checking for confuse" + else + AC_CHECK_LIB([confuse], [cfg_set_validate_func]) + fi, + echo "Networking disabled; not checking for confuse" +) + +# Repeat hack for LIBCONFUSE +AM_CONDITIONAL(HAVE_LIBCONFUSE, echo $LIBS | [ +perl -ne 'if($_=~/-lconfuse/) + { print qq(Confuse found, make check will run full test suite. +); exit 0; } else { print qq(Confuse not found; will skip networked stuff. +); exit 1; }']) + + +AC_ARG_ENABLE([pobj], + AC_HELP_STRING([--enable-pobj], [Build pobj]), + AM_CONDITIONAL(BUILD_POBJ, test x$enableval = xyes), + AM_CONDITIONAL(BUILD_POBJ, false) +) + +AC_ARG_ENABLE([benchmarks], + AC_HELP_STRING([--enable-benchmarks], + [Build benchmarks. Requires Berkeley DB >= 4.2]), + AM_CONDITIONAL(BUILD_BENCHMARKS, test x$enableval = xyes), +# AC_CONFIG_DB, + AM_CONDITIONAL(BUILD_BENCHMARKS, false) +) + +AC_CONFIG_DB + +AC_CHECK_LIB([intl], [bindtextdomain]) +AC_CHECK_LIB([c], [bindtextdomain]) + # Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC @@ -110,6 +150,9 @@ AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM +#enable largefile support. +AC_SYS_LARGEFILE + # Checks for library functions. AC_FUNC_ERROR_AT_LINE AC_FUNC_MALLOC diff --git a/m4/db.m4 b/m4/db.m4 index 22f3568..46a2c6d 100644 --- a/m4/db.m4 +++ b/m4/db.m4 @@ -69,11 +69,15 @@ AC_DEFUN([AC_CONFIG_DB], [ LDFLAGS="$LDFLAGS -L$dtn_cv_path_db_lib" fi - LIBS="$LIBS -l$dtn_cv_lib_db" + #LIBS="$LIBS -l$dtn_cv_lib_db" + DB_LIBS="-l$dtn_cv_lib_db" fi # DB_ENABLED AC_SUBST(DB_ENABLED) + AC_SUBST(DB_LIBS) + AM_CONDITIONAL(DB_ENABLED, test x$ac_dbdir != xno) + #AM_CONDITIONAL(DB_ENABLED, $DB_ENABLED) ]) dnl diff --git a/src/2pc/Makefile.am b/src/2pc/Makefile.am index e5928ed..807e95f 100644 --- a/src/2pc/Makefile.am +++ b/src/2pc/Makefile.am @@ -1,4 +1,5 @@ -#LDADD=$(top_builddir)/build/libdfa.a +if HAVE_LIBCONFUSE lib_LIBRARIES=lib2pc.a lib2pc_a_SOURCES=2pc.c AM_CFLAGS=${GLOBAL_CFLAGS} +endif \ No newline at end of file diff --git a/src/Makefile.am b/src/Makefile.am index 0111790..de87e93 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1 +1,8 @@ -SUBDIRS = lladd libdfa 2pc timing pobj apps +SUBDIRS = lladd libdfa 2pc timing + +if BUILD_POBJ +SUBDIRS += pobj +endif + +SUBDIRS += apps + diff --git a/src/apps/cht/Makefile.am b/src/apps/cht/Makefile.am index f4a1db4..8594262 100644 --- a/src/apps/cht/Makefile.am +++ b/src/apps/cht/Makefile.am @@ -1,5 +1,7 @@ +if HAVE_LIBCONFUSE LDADD=$(top_builddir)/src/libdfa/libdfa.a $(top_builddir)/src/2pc/lib2pc.a -SOURCES=cht.c +#SOURCES=cht.c lib_LIBRARIES=libcht.a libcht_a_SOURCES=cht.c cht_client.c cht_server.c cht_message.c AM_CFLAGS=${GLOBAL_CFLAGS} +endif \ No newline at end of file diff --git a/src/apps/cht/cht_server.c b/src/apps/cht/cht_server.c index 4ecec19..3a73006 100644 --- a/src/apps/cht/cht_server.c +++ b/src/apps/cht/cht_server.c @@ -231,7 +231,7 @@ state_name veto_or_prepare_cht(void * dfaSet, StateMachine * stateMachine, Messa return ret; } state_name eval_action_cht(void * dfaSet, StateMachine * stateMachine, Message * m, char * from) { - state_name ret; + state_name ret = -1; setup_vars; int xid = getXid(ht_xid, app_state_cht->xid_ht, stateMachine->machine_id); diff --git a/src/libdfa/Makefile.am b/src/libdfa/Makefile.am index 9da6a16..2b89e36 100644 --- a/src/libdfa/Makefile.am +++ b/src/libdfa/Makefile.am @@ -1,5 +1,9 @@ -#LDADD=$(top_builddir)/build/transactional.a $(top_builddir)/build/libpbl.a +if HAVE_LIBCONFUSE lib_LIBRARIES=libdfa.a librw.a +else +lib_LIBRARIES=librw.a +endif + libdfa_a_SOURCES=libdfa.c monotree.c smash.c callbacks.c messages.c networksetup.c librw_a_SOURCES=rw.c AM_CFLAGS=${GLOBAL_CFLAGS} diff --git a/test/Makefile.am b/test/Makefile.am index 5dbcd37..43a6082 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,6 +1,16 @@ -SUBDIRS = lladd monotree messages dfa 2pc cht pobj #INCLUDES = @CHECK_CFLAGS@ if HAVE_LIBCHECK + +SUBDIRS = lladd + +if HAVE_LIBCONFUSE +SUBDIRS += monotree messages dfa 2pc cht +endif + +if BUILD_POBJ +SUBDIRS += pobj +endif + TESTS = check_check else TESTS = diff --git a/utilities/Makefile.am b/utilities/Makefile.am index 16e1df0..797f896 100644 --- a/utilities/Makefile.am +++ b/utilities/Makefile.am @@ -1,5 +1,6 @@ -LDADD=$(top_builddir)/src/2pc/lib2pc.a $(top_builddir)/src/libdfa/libdfa.a \ - $(top_builddir)/src/lladd/liblladd.a \ +#LDADD=$(top_builddir)/src/2pc/lib2pc.a $(top_builddir)/src/libdfa/libdfa.a + +LDADD=$(top_builddir)/src/lladd/liblladd.a \ $(top_builddir)/src/libdfa/librw.a bin_PROGRAMS=logfile_dump run_recovery truncate_log AM_CFLAGS=${GLOBAL_CFLAGS}