* Allow linking against an external Berkeley DB / ATerm library.

This commit is contained in:
Eelco Dolstra 2004-02-16 16:37:16 +00:00
parent f34de12140
commit 0dfdafdf6d
11 changed files with 47 additions and 18 deletions

View file

@ -1,5 +1,4 @@
SUBDIRS = externals src scripts corepkgs doc SUBDIRS = externals src scripts corepkgs doc
EXTRA_DIST = substitute.mk nix.spec nix.spec.in EXTRA_DIST = substitute.mk nix.spec nix.spec.in
include ./substitute.mk include ./substitute.mk

View file

@ -68,6 +68,34 @@ AC_ARG_WITH(store-dir, AC_HELP_STRING([--with-store-dir=PATH],
storedir=$withval, storedir='${prefix}/store') storedir=$withval, storedir='${prefix}/store')
AC_SUBST(storedir) AC_SUBST(storedir)
AC_ARG_WITH(bdb, AC_HELP_STRING([--with-bdb=PATH],
[prefix of Berkeley DB]),
bdb=$withval, bdb=)
AM_CONDITIONAL(HAVE_BDB, test -n "$bdb")
if test -z "$bdb"; then
bdb_lib='-L${top_builddir}/externals/inst-bdb/lib -ldb_cxx'
bdb_include='-I${top_builddir}/externals/inst-bdb/include'
else
bdb_lib="-L$bdb/lib -Wl,-rpath,$bdb/lib -ldb_cxx"
bdb_include="-I$bdb/include"
fi
AC_SUBST(bdb_lib)
AC_SUBST(bdb_include)
AC_ARG_WITH(aterm, AC_HELP_STRING([--with-aterm=PATH],
[prefix of CWI ATerm library]),
aterm=$withval, aterm=)
AM_CONDITIONAL(HAVE_ATERM, test -n "$aterm")
if test -z "$aterm"; then
aterm_lib='-L${top_builddir}/externals/inst-aterm/lib -lATerm'
aterm_include='-I${top_builddir}/externals/inst-aterm/include'
else
aterm_lib="-L$aterm/lib -Wl,-rpath,$aterm/lib -lATerm"
aterm_include="-I$aterm/include"
fi
AC_SUBST(aterm_lib)
AC_SUBST(aterm_include)
AC_CHECK_LIB(pthread, pthread_mutex_init) AC_CHECK_LIB(pthread, pthread_mutex_init)
AM_CONFIG_HEADER([config.h]) AM_CONFIG_HEADER([config.h])

View file

@ -16,16 +16,20 @@ have-db:
$(MAKE) $(DB) $(MAKE) $(DB)
touch have-db touch have-db
if HAVE_BDB
build-db:
else
build-db: have-db build-db: have-db
(pfx=`pwd` && \ (pfx=`pwd` && \
cd $(DB)/build_unix && \ cd $(DB)/build_unix && \
CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \ CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
../dist/configure --prefix=$$pfx/inst \ ../dist/configure --prefix=$$pfx/inst-bdb \
--enable-cxx --disable-shared --disable-cryptography \ --enable-cxx --disable-shared --disable-cryptography \
--disable-replication --disable-verify && \ --disable-replication --disable-verify && \
make && \ make && \
make install) make install)
touch build-db touch build-db
endif
# CWI ATerm # CWI ATerm
@ -49,7 +53,7 @@ have-aterm:
build-aterm: have-aterm build-aterm: have-aterm
(pfx=`pwd` && \ (pfx=`pwd` && \
cd $(ATERM) && \ cd $(ATERM) && \
CC="$(CC)" ./configure --prefix=$$pfx/inst \ CC="$(CC)" ./configure --prefix=$$pfx/inst-aterm \
--with-cflags="-DNDEBUG -DXGC_VERBOSE -DXHASHPEM -DWITH_STATS $(CFLAGS)" && \ --with-cflags="-DNDEBUG -DXGC_VERBOSE -DXHASHPEM -DWITH_STATS $(CFLAGS)" && \
make && \ make && \
make install) make install)

View file

@ -7,9 +7,9 @@ libexpr_a_SOURCES = nixexpr.cc nixexpr.hh parser.cc parser.hh \
EXTRA_DIST = lexer.l parser.y EXTRA_DIST = lexer.l parser.y
AM_CXXFLAGS = \ AM_CXXFLAGS = \
-I.. -I../../externals/inst/include -I../libutil -I../libstore -I.. ${bdb_include} ${aterm_include} -I../libutil -I../libstore
AM_CFLAGS = \ AM_CFLAGS = \
-I../../externals/inst/include ${aterm_include}
# Parser generation. # Parser generation.

View file

@ -8,4 +8,4 @@ AM_CXXFLAGS = \
-DNIX_STATE_DIR=\"$(localstatedir)/nix\" \ -DNIX_STATE_DIR=\"$(localstatedir)/nix\" \
-DNIX_LOG_DIR=\"$(localstatedir)/log/nix\" \ -DNIX_LOG_DIR=\"$(localstatedir)/log/nix\" \
-DNIX_VERSION=\"$(VERSION)\" \ -DNIX_VERSION=\"$(VERSION)\" \
-I.. -I../../externals/inst/include -I../libutil -I../libstore -I.. ${aterm_include} -I../libutil -I../libstore

View file

@ -7,4 +7,4 @@ libstore_a_SOURCES = \
references.cc references.hh pathlocks.cc pathlocks.hh references.cc references.hh pathlocks.cc pathlocks.hh
AM_CXXFLAGS = -Wall \ AM_CXXFLAGS = -Wall \
-I.. -I../../externals/inst/include -I../libutil -I.. ${bdb_include} ${aterm_include} -I../libutil

View file

@ -3,11 +3,11 @@ noinst_LIBRARIES = libutil.a
libutil_a_SOURCES = util.cc util.hh hash.cc hash.hh \ libutil_a_SOURCES = util.cc util.hh hash.cc hash.hh \
archive.cc archive.hh md5.c md5.h aterm.cc aterm.hh archive.cc archive.hh md5.c md5.h aterm.cc aterm.hh
AM_CXXFLAGS = -DSYSTEM=\"@system@\" -Wall -I.. -I../../externals/inst/include AM_CXXFLAGS = -DSYSTEM=\"@system@\" -Wall -I.. ${aterm_include}
check_PROGRAMS = test-aterm check_PROGRAMS = test-aterm
test_aterm_SOURCES = test-aterm.cc test_aterm_SOURCES = test-aterm.cc
test_aterm_LDADD = ./libutil.a ../boost/format/libformat.a \ test_aterm_LDADD = ./libutil.a ../boost/format/libformat.a \
-L../../externals/inst/lib -ldb_cxx -lATerm ${aterm_lib}

View file

@ -4,8 +4,7 @@ nix_env_SOURCES = main.cc names.cc names.hh \
profiles.cc profiles.hh help.txt profiles.cc profiles.hh help.txt
nix_env_LDADD = ../libmain/libmain.a ../libexpr/libexpr.a \ nix_env_LDADD = ../libmain/libmain.a ../libexpr/libexpr.a \
../libstore/libstore.a ../libutil/libutil.a \ ../libstore/libstore.a ../libutil/libutil.a \
../boost/format/libformat.a -L../../externals/inst/lib -ldb_cxx \ ../boost/format/libformat.a ${bdb_lib} ${aterm_lib}
-lATerm
main.o: help.txt.hh main.o: help.txt.hh
@ -13,7 +12,7 @@ main.o: help.txt.hh
../bin2c/bin2c helpText < $< > $@ || (rm $@ && exit 1) ../bin2c/bin2c helpText < $< > $@ || (rm $@ && exit 1)
AM_CXXFLAGS = \ AM_CXXFLAGS = \
-I.. -I../../externals/inst/include -I../libutil -I../libstore \ -I.. ${bdb_include} ${aterm_include} -I../libutil -I../libstore \
-I../libexpr -I../libmain -I../libexpr -I../libmain
install-data-local: install-data-local:

View file

@ -2,7 +2,7 @@ bin_PROGRAMS = nix-hash
nix_hash_SOURCES = nix-hash.cc help.txt nix_hash_SOURCES = nix-hash.cc help.txt
nix_hash_LDADD = ../libmain/libmain.a ../libstore/libstore.a ../libutil/libutil.a \ nix_hash_LDADD = ../libmain/libmain.a ../libstore/libstore.a ../libutil/libutil.a \
../boost/format/libformat.a -L../../externals/inst/lib -ldb_cxx -lATerm ../boost/format/libformat.a ${bdb_lib} ${aterm_lib}
nix-hash.o: help.txt.hh nix-hash.o: help.txt.hh

View file

@ -3,8 +3,7 @@ bin_PROGRAMS = nix-instantiate
nix_instantiate_SOURCES = main.cc help.txt nix_instantiate_SOURCES = main.cc help.txt
nix_instantiate_LDADD = ../libmain/libmain.a ../libexpr/libexpr.a \ nix_instantiate_LDADD = ../libmain/libmain.a ../libexpr/libexpr.a \
../libstore/libstore.a ../libutil/libutil.a \ ../libstore/libstore.a ../libutil/libutil.a \
../boost/format/libformat.a -L../../externals/inst/lib -ldb_cxx \ ../boost/format/libformat.a ${bdb_lib} ${aterm_lib}
-lATerm
main.o: help.txt.hh main.o: help.txt.hh
@ -12,5 +11,5 @@ main.o: help.txt.hh
../bin2c/bin2c helpText < $< > $@ || (rm $@ && exit 1) ../bin2c/bin2c helpText < $< > $@ || (rm $@ && exit 1)
AM_CXXFLAGS = \ AM_CXXFLAGS = \
-I.. -I../../externals/inst/include -I../libutil -I../libstore \ -I.. ${bdb_include} ${aterm_include} -I../libutil -I../libstore \
-I../libexpr -I../libmain -I../libexpr -I../libmain

View file

@ -2,7 +2,7 @@ bin_PROGRAMS = nix-store
nix_store_SOURCES = main.cc dotgraph.cc dotgraph.hh help.txt nix_store_SOURCES = main.cc dotgraph.cc dotgraph.hh help.txt
nix_store_LDADD = ../libmain/libmain.a ../libstore/libstore.a ../libutil/libutil.a \ nix_store_LDADD = ../libmain/libmain.a ../libstore/libstore.a ../libutil/libutil.a \
../boost/format/libformat.a -L../../externals/inst/lib -ldb_cxx -lATerm ../boost/format/libformat.a ${bdb_lib} ${aterm_lib}
main.o: help.txt.hh main.o: help.txt.hh
@ -10,7 +10,7 @@ main.o: help.txt.hh
../bin2c/bin2c helpText < $< > $@ || (rm $@ && exit 1) ../bin2c/bin2c helpText < $< > $@ || (rm $@ && exit 1)
AM_CXXFLAGS = \ AM_CXXFLAGS = \
-I.. -I../../externals/inst/include -I../libutil -I../libstore -I../libmain -I.. ${bdb_include} $(aterm_include) -I../libutil -I../libstore -I../libmain
init-state-local: init-state-local:
$(INSTALL) -d $(DESTDIR)$(localstatedir)/nix $(INSTALL) -d $(DESTDIR)$(localstatedir)/nix