On Fri, Jan 18, 2002 at 01:31:29PM -0800, Ian Holsman wrote: > + apu_want_db=1 > + case "$withval" in > + *":"*) > + BDB_INC="-I`echo $withval |sed -e 's/:.*$//'`" > + BDB_LIB="-L`echo $withval |sed -e 's/^.*://'`" > + ;; > + *) > + BDB_INC="-I$withval/include" > + BDB_LIB="-L$withval/lib" > + ;; > + esac > + AC_MSG_RESULT(looking for berkeley-db includes with $BDB_INC) > + AC_MSG_RESULT(looking for berkeley-db libs with $BDB_LIB) > + fi > + CPPFLAGS=$BDB_INC > + LIBS=$BDB_LIB > + if test "$apu_want_db" != "0"; then > + APU_CHECK_BERKELEY_DB > + if test "$withval" != "yes"; then > + APR_ADDTO( APRUTIL_INCLUDES, [$BDB_INC]) > + APR_ADDTO( APRUTIL_EXPORT_LIBS, [$BDB_LIB]) > + fi > + fi > +],[ > + APU_CHECK_BERKELEY_DB > +])
You are adding a linker flag not a library, so I believe it belongs as BDB_LDFLAGS not BDB_LIBS. (Yes, this means that apu-config/export_vars.sh needs LDFLAGS now, but that's the right thing to do.) We want to save the original flags and restore them later. We will be storing the Berkeley-specific flags in the APRUTIL_* vars. So, something like: SAVE_CPPFLAGS="$CPPFLAGS" SAVE_LDFLAGS="$LDFLAGS" CPPFLAGS="$CPPFLAGS $BDB_INC" LDFLAGS="$LDFLAGS $BDB_LDFLAGS" If it is successful, then add BDB_INC and BDB_LDFLAGS to APRUTIL_INCLUDES and APRUTIL_EXPORT_LIBS and restore the CPPFLAGS and LIBS variables to their original value. Something like (pseudocode): if we found what we were looking for then APR_ADDTO(APRUTIL_INCLUDES, $BDB_INC) APR_ADDTO(APRUTIL_LDFLAGS, $BDB_LDFLAGS) else AC_ERROR(We didn't find it. Do not pass go. Fin.) end if CPPFLAGS="$SAVE_CPPFLAGS" LDFLAGS="$SAVE_LDFLAGS" APU_CHECK_DBM will add $apu_db_lib to into APRUTIL_EXPORT_LIBS for us. We just need to setup the compilation and linking flags. Oh, I think apu_db_ would be more consistent than BDB_. =) > @@ -256,6 +300,8 @@ > fi > ;; > db1) > + CPPFLAGS=$BDB_INC > + LIBS=$BDB_LIB > APU_CHECK_DB1 I don't really have an idea what you are trying to do here, but I don't think you need it per above. We may want to handle the specific requested version of DB in the new macro rather than doing the search again. It was a hack to do it twice - be better to do the search only once (i.e. handle $requested in the berkeley db detection pass rather than doing it again). -- justin
