diff --git a/Makefile.config.finish b/Makefile.config.finish new file mode 100644 index 0000000000..06080a3357 --- /dev/null +++ b/Makefile.config.finish @@ -0,0 +1,25 @@ +# -*-makefile-*- + +# This file is used at the end of the configure run. It handles +# setting up the runtime paths that will be embedded into the gnucash +# binary. It can't be done using AC_OUTPUT because we'd need to +# expand a variable that's defined in terms of ${prefix} before +# AC_OUTPUT, and prefix isn't guaranteed to be defined until AC_OUTPUT +# is called. + +# We use a makefile because it gives us the proper variable expansions +# for free. + +all: + perl -p \ + -e "s|\@GNC_RUNTIME_SHAREDIR\@|${GNC_SHAREDIR}|o;" \ + -e "s|\@GNC_RUNTIME_CONFIGDIR\@|${GNC_SHAREDIR}|o" \ + < src/scm/startup/init.scm.in > src/scm/startup/init.scm + perl -p \ + -e "s|\@GNC_RUNTIME_SHAREDIR\@|${GNC_SHAREDIR}|o;" \ + -e "s|\@GNC_RUNTIME_CONFIGDIR\@|${GNC_SHAREDIR}|o" \ + < src/guile/gnucash.h.in > src/guile/gnucash.h + +# Local Variables: +# tab-width: 2 +# End: diff --git a/configure b/configure index a300eec10e..56e647b2d2 100755 --- a/configure +++ b/configure @@ -2287,27 +2287,29 @@ fi # Set GUILELIBS according to the set of libraries needed to link # with guile. -echo $ac_n "checking for gh_enter in -lguile""... $ac_c" 1>&6 -echo "configure:2292: checking for gh_enter in -lguile" >&5 -ac_lib_var=`echo guile'_'gh_enter | sed 'y%./+-%__p_%'` + +# If readline exists, just assume that guile needs it. It probably does. +echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6 +echo "configure:2294: checking for readline in -lreadline" >&5 +ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" -LIBS="-lguile $LIBS" +LIBS="-lreadline $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2322,182 +2324,130 @@ LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - GUILELIBS="$GUILELIBS -lguile" + ac_tr_lib=HAVE_LIB`echo readline | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 -echo $ac_n "checking for gh_define in -lguile""... $ac_c" 1>&6 -echo "configure:2330: checking for gh_define in -lguile" >&5 -ac_lib_var=`echo guile'_'gh_define | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lguile $LIBS" -cat > conftest.$ac_ext <&6 +echo "configure:2345: checking for guile" >&5 + +GNC_LIBS_SAFE=${LIBS} + +GNC_TEST_LIBS="-lguile" +LIBS="${LIBS} ${GNC_LIBS_HELPER} ${GNC_TEST_LIBS}" +cat > conftest.$ac_ext < int main() { -gh_define() +gh_eval_file; ; return 0; } EOF -if { (eval echo configure:2349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + GUILELIBS="$GUILELIBS ${GNC_TEST_LIBS}" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - GUILELIBS="$GUILELIBS -lguile -ldl -lreadline" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for gh_eval_file in -lguile""... $ac_c" 1>&6 -echo "configure:2368: checking for gh_eval_file in -lguile" >&5 -ac_lib_var=`echo guile'_'gh_eval_file | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lguile $LIBS" -cat > conftest.$ac_ext < conftest.$ac_ext < int main() { -gh_eval_file() +gh_eval_file; ; return 0; } EOF -if { (eval echo configure:2387: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2381: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + GUILELIBS="$GUILELIBS ${GNC_TEST_LIBS}" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* -LIBS="$ac_save_LIBS" - + LIBS="${LIBS_SAFE}" fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - GUILELIBS="$GUILELIBS -lguile -ltermcap" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for gh_eval_file in -lguile""... $ac_c" 1>&6 -echo "configure:2406: checking for gh_eval_file in -lguile" >&5 -ac_lib_var=`echo guile'_'gh_eval_file | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lguile -ldl -lreadline -ltermcap $LIBS" -cat > conftest.$ac_ext < conftest.$ac_ext < int main() { -gh_eval_file() +gh_eval_file; ; return 0; } EOF -if { (eval echo configure:2425: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + GUILELIBS="$GUILELIBS ${GNC_TEST_LIBS}" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* -LIBS="$ac_save_LIBS" - + LIBS="${LIBS_SAFE}" fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - GUILELIBS="$GUILELIBS -lguile -ldl -lreadline -ltermcap" -else - echo "$ac_t""no" 1>&6 -echo $ac_n "checking for gh_eval_file in -lguile""... $ac_c" 1>&6 -echo "configure:2444: checking for gh_eval_file in -lguile" >&5 -ac_lib_var=`echo guile'_'gh_eval_file | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lguile -ldl -lreadline -ltermcap -lqthreads $LIBS" -cat > conftest.$ac_ext < conftest.$ac_ext < int main() { -gh_eval_file() +gh_eval_file; ; return 0; } EOF -if { (eval echo configure:2463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" + GUILELIBS="$GUILELIBS ${GNC_TEST_LIBS}" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - GUILELIBS="$GUILELIBS -lguile -ldl -lreadline -ltermcap -lqthreads" -else - echo "$ac_t""no" 1>&6 -{ echo "configure: error: cannot link with guile" 1>&2; exit 1; } + LIBS="${LIBS_SAFE}" fi -fi - - -ltermcap -fi - - -ldl -lreadline -fi - - +if test x"${GUILELIBS}" == x; +then + { echo "configure: error: Cannot link with guile. Do you have guile 1.3 installed?" 1>&2; exit 1; } fi +echo "$ac_t""yes" 1>&6 + ### Plotutils echo $ac_n "checking for openpl in -lplot""... $ac_c" 1>&6 -echo "configure:2501: checking for openpl in -lplot" >&5 +echo "configure:2451: checking for openpl in -lplot" >&5 ac_lib_var=`echo plot'_'openpl | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2505,7 +2455,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lplot $X_PRE_LIBS $MOTIF_LIBS $X_EXTRA_LIBS -lXaw $X_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2698,10 +2648,8 @@ trap 'rm -fr `echo "Makefile src/Makefile src/engine/Makefile src/guile/Makefile - src/guile/gnucash.h src/scm/Makefile src/scm/startup/Makefile - src/scm/startup/init.scm src/gnome/Makefile src/motif/Makefile src/qt/Makefile @@ -2812,10 +2760,8 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile src/Makefile src/engine/Makefile src/guile/Makefile - src/guile/gnucash.h src/scm/Makefile src/scm/startup/Makefile - src/scm/startup/init.scm src/gnome/Makefile src/motif/Makefile src/qt/Makefile @@ -3006,3 +2952,7 @@ test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 chmod +x gnucash + +make -f Makefile.config.finish prefix=${prefix} \ + GNC_SHAREDIR=${GNC_SHAREDIR} \ + GNC_CONFIGDIR=${GNC_SHAREDIR} diff --git a/configure.in b/configure.in index b8025ecc80..87a1c43a09 100644 --- a/configure.in +++ b/configure.in @@ -154,25 +154,60 @@ AC_SUBST(XMHTML_INC) # Set GUILELIBS according to the set of libraries needed to link # with guile. -AC_CHECK_LIB(guile, gh_enter, - GUILELIBS="$GUILELIBS -lguile", - AC_CHECK_LIB(guile, gh_define, - GUILELIBS="$GUILELIBS -lguile -ldl -lreadline", - AC_CHECK_LIB(guile, gh_eval_file, - GUILELIBS="$GUILELIBS -lguile -ltermcap", - AC_CHECK_LIB(guile, gh_eval_file, - GUILELIBS="$GUILELIBS -lguile -ldl -lreadline -ltermcap", - AC_CHECK_LIB(guile, gh_eval_file, - GUILELIBS="$GUILELIBS -lguile -ldl -lreadline -ltermcap -lqthreads", - AC_MSG_ERROR(cannot link with guile), - -ldl -lreadline -ltermcap -lqthreads), - -ldl -lreadline -ltermcap) - -ltermcap) - -ldl -lreadline) - ) + +# If readline exists, just assume that guile needs it. It probably does. +AC_CHECK_LIB(readline, readline) + +# Have to use AC_TRY_LINK here because AC_CHECK_LIB caches the +# results, so one failure makes all further attempts fail. + +AC_MSG_CHECKING([for guile]) + +GNC_LIBS_SAFE=${LIBS} + +GNC_TEST_LIBS="-lguile" +LIBS="${LIBS} ${GNC_LIBS_HELPER} ${GNC_TEST_LIBS}" +AC_TRY_LINK([#include], [gh_eval_file;], + GUILELIBS="$GUILELIBS ${GNC_TEST_LIBS}") +LIBS="${LIBS_SAFE}" + +if test x"${GUILELIBS}" == x; +then + GNC_TEST_LIBS="-lguile -lqthreads" + LIBS="${LIBS} ${GNC_LIBS_HELPER} ${GNC_TEST_LIBS}" + AC_TRY_LINK([#include], [gh_eval_file;], + GUILELIBS="$GUILELIBS ${GNC_TEST_LIBS}") + LIBS="${LIBS_SAFE}" +fi + +if test x"${GUILELIBS}" == x; +then + GNC_TEST_LIBS="-lguile -ltermcap" + LIBS="${LIBS} ${GNC_LIBS_HELPER} ${GNC_TEST_LIBS}" + AC_TRY_LINK([#include], [gh_eval_file;], + GUILELIBS="$GUILELIBS ${GNC_TEST_LIBS}") + LIBS="${LIBS_SAFE}" +fi + +if test x"${GUILELIBS}" == x; +then + GNC_TEST_LIBS="-lguile -lqthreads -ltermcap" + LIBS="${LIBS} ${GNC_LIBS_HELPER} ${GNC_TEST_LIBS}" + AC_TRY_LINK([#include], [gh_eval_file;], + GUILELIBS="$GUILELIBS ${GNC_TEST_LIBS}") + LIBS="${LIBS_SAFE}" +fi + +if test x"${GUILELIBS}" == x; +then + AC_MSG_ERROR(Cannot link with guile. Do you have guile 1.3 installed?) +fi + AC_SUBST(GUILE_INC) AC_SUBST(GUILELIBS) +AC_MSG_RESULT([yes]) + ### Plotutils AC_CHECK_LIB(plot, openpl, @@ -237,10 +272,8 @@ AC_OUTPUT(Makefile src/Makefile src/engine/Makefile src/guile/Makefile - src/guile/gnucash.h src/scm/Makefile src/scm/startup/Makefile - src/scm/startup/init.scm src/gnome/Makefile src/motif/Makefile src/qt/Makefile @@ -254,3 +287,7 @@ AC_OUTPUT(Makefile lib/ComboBox-1.33/Makefile) chmod +x gnucash + +make -f Makefile.config.finish prefix=${prefix} \ + GNC_SHAREDIR=${GNC_SHAREDIR} \ + GNC_CONFIGDIR=${GNC_SHAREDIR}