mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
merge from branch rlb-patch1
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1357 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
fe8d099c14
commit
a678543959
16
Makefile.in
16
Makefile.in
@ -41,18 +41,10 @@ CPU = @target_cpu@
|
||||
|
||||
LIBS=@LIBS@
|
||||
|
||||
OPT_STYLE_INSTALL=@OPT_STYLE_INSTALL@
|
||||
ifeq (${OPT_STYLE_INSTALL},0)
|
||||
export GNC_DOCDIR=${prefix}/doc/gnucash
|
||||
export GNC_BINDIR=${prefix}/bin
|
||||
export GNC_CONFIGDIR=${sysconfdir}/gnucash
|
||||
export GNC_SHAREDIR=${datadir}/gnucash
|
||||
else
|
||||
export GNC_DOCDIR=${prefix}/doc
|
||||
export GNC_BINDIR=${prefix}/bin
|
||||
export GNC_CONFIGDIR=${sysconfdir}
|
||||
export GNC_SHAREDIR=${datadir}
|
||||
endif
|
||||
GNC_DOCDIR := @GNC_DOCDIR@
|
||||
GNC_BINDIR := @GNC_BINDIR@
|
||||
GNC_CONFIGDIR := @GNC_CONFIGDIR@
|
||||
GNC_SHAREDIR := @GNC_SHAREDIR@
|
||||
|
||||
######################################################################
|
||||
# Description of targets:
|
||||
|
23
README
23
README
@ -190,6 +190,29 @@ Examples of other funny configure options:
|
||||
--with-xmhtml-libraries=/home/rlb/XmHTML-1.1.5/src
|
||||
|
||||
|
||||
|
||||
Flag --with-gtk-config. The way gtk phiolosphy goes,
|
||||
you should *only* specify the config program location and
|
||||
rely on it to tell you the right CFLAGS and XLIBS values.
|
||||
|
||||
Runtime and install destinations are separate. The --prefix
|
||||
you specify to configure determines where the resulting binary
|
||||
will look for things at runtime. The prefix you give to make
|
||||
install (i.e. make prefix=foo install) only determines where the
|
||||
files are placed. If this location is different from the
|
||||
configure --prefix value, then gnucash won't work until it's moved
|
||||
to that location. This feature is mostly useful for package
|
||||
builders, but it shouldn't hurt anyone else.
|
||||
|
||||
Only the location of startup.scm is hardcoded into the
|
||||
binary, and even that can be overriden with --startup-file on the
|
||||
command line. The other defaults are now in startup.scm.
|
||||
path-defaults.h is now gone. The startup file setting is in
|
||||
gnucash.h, generated from gnucash.h.in.
|
||||
|
||||
|
||||
|
||||
|
||||
Status:
|
||||
-------
|
||||
As of version 1.0.18:
|
||||
|
123
configure
vendored
123
configure
vendored
@ -14,7 +14,7 @@ ac_default_prefix=/usr/local
|
||||
ac_help="$ac_help
|
||||
--with-x use the X Window System"
|
||||
ac_help="$ac_help
|
||||
--with-gtk=PATH specify where to look for gtk includes and libs"
|
||||
--with-gtk-config=executable which gtk-config to use to find gtk "
|
||||
ac_help="$ac_help
|
||||
--with-imlib=PATH specify where to look for imlib includes and libs"
|
||||
ac_help="$ac_help
|
||||
@ -482,7 +482,7 @@ echo > confdefs.h
|
||||
|
||||
# A filename unique to this package, relative to the directory that
|
||||
# configure is in, which we can look for to find out if srcdir is correct.
|
||||
ac_unique_file=src/guile/gnucash.h
|
||||
ac_unique_file=src/guile/gnucash.h.in
|
||||
|
||||
# Find the source files, if location was not specified.
|
||||
if test -z "$srcdir"; then
|
||||
@ -1886,12 +1886,10 @@ X_LIBS="$X_LIBS -lXext -lXmu -lXt -lX11"
|
||||
MOTIF_LIBS="-lXm"
|
||||
|
||||
# Let the user specify gtk paths:
|
||||
# Check whether --with-gtk or --without-gtk was given.
|
||||
if test "${with_gtk+set}" = set; then
|
||||
withval="$with_gtk"
|
||||
GTK_BIN="$with_gtk/bin/"
|
||||
X_LIBS="${X_LIBS} -L$with_gtk/lib"
|
||||
X_CFLAGS="$X_CFLAGS -I$with_gtk/include"
|
||||
# Check whether --with-gtk-config or --without-gtk-config was given.
|
||||
if test "${with_gtk_config+set}" = set; then
|
||||
withval="$with_gtk_config"
|
||||
GTK_CONFIG_BIN="$with_gtk/bin/"
|
||||
fi
|
||||
|
||||
|
||||
@ -2053,7 +2051,7 @@ fi
|
||||
# the XmHTML widget needs libz, libjpeg, libpng and libm
|
||||
# it also uses #ifdef's not #if's so DONT #def to zero.
|
||||
echo $ac_n "checking for deflateEnd in -lz""... $ac_c" 1>&6
|
||||
echo "configure:2057: checking for deflateEnd in -lz" >&5
|
||||
echo "configure:2055: checking for deflateEnd in -lz" >&5
|
||||
ac_lib_var=`echo z'_'deflateEnd | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@ -2061,7 +2059,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lz $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2065 "configure"
|
||||
#line 2063 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@ -2072,7 +2070,7 @@ int main() {
|
||||
deflateEnd()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:2074: \"$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
|
||||
@ -2096,7 +2094,7 @@ else
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for jpeg_read_scanlines in -ljpeg""... $ac_c" 1>&6
|
||||
echo "configure:2100: checking for jpeg_read_scanlines in -ljpeg" >&5
|
||||
echo "configure:2098: checking for jpeg_read_scanlines in -ljpeg" >&5
|
||||
ac_lib_var=`echo jpeg'_'jpeg_read_scanlines | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@ -2104,7 +2102,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-ljpeg $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2108 "configure"
|
||||
#line 2106 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@ -2115,7 +2113,7 @@ int main() {
|
||||
jpeg_read_scanlines()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:2117: \"$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
|
||||
@ -2139,7 +2137,7 @@ else
|
||||
fi
|
||||
|
||||
echo $ac_n "checking for png_read_image in -lpng""... $ac_c" 1>&6
|
||||
echo "configure:2143: checking for png_read_image in -lpng" >&5
|
||||
echo "configure:2141: checking for png_read_image in -lpng" >&5
|
||||
ac_lib_var=`echo png'_'png_read_image | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@ -2147,7 +2145,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lpng $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2151 "configure"
|
||||
#line 2149 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@ -2158,7 +2156,7 @@ int main() {
|
||||
png_read_image()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:2160: \"$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
|
||||
@ -2188,7 +2186,7 @@ fi
|
||||
# LIBS="-lXmu -lXt -lXext $X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS $LIBS"
|
||||
|
||||
echo $ac_n "checking for XpmReadFileToXpmImage in -lXpm""... $ac_c" 1>&6
|
||||
echo "configure:2192: checking for XpmReadFileToXpmImage in -lXpm" >&5
|
||||
echo "configure:2190: checking for XpmReadFileToXpmImage in -lXpm" >&5
|
||||
ac_lib_var=`echo Xpm'_'XpmReadFileToXpmImage | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@ -2196,7 +2194,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lXpm -L $x_libraries -lX11 $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2200 "configure"
|
||||
#line 2198 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@ -2207,7 +2205,7 @@ int main() {
|
||||
XpmReadFileToXpmImage()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:2209: \"$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
|
||||
@ -2238,7 +2236,7 @@ fi
|
||||
# Don't build the xmhtml source if user already has it installed...
|
||||
# this is ugly, there must be a nicer way of setting this up ...
|
||||
echo $ac_n "checking for XmHTMLTextScrollToLine in -lXmHTML""... $ac_c" 1>&6
|
||||
echo "configure:2242: checking for XmHTMLTextScrollToLine in -lXmHTML" >&5
|
||||
echo "configure:2240: checking for XmHTMLTextScrollToLine in -lXmHTML" >&5
|
||||
ac_lib_var=`echo XmHTML'_'XmHTMLTextScrollToLine | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@ -2246,7 +2244,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lXmHTML $X_PRE_LIBS $MOTIF_LIBS $X_EXTRA_LIBS $X_LIBS $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2250 "configure"
|
||||
#line 2248 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@ -2257,7 +2255,7 @@ int main() {
|
||||
XmHTMLTextScrollToLine()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2261: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:2259: \"$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
|
||||
@ -2290,7 +2288,7 @@ 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:2294: checking for gh_enter in -lguile" >&5
|
||||
echo "configure:2292: checking for gh_enter in -lguile" >&5
|
||||
ac_lib_var=`echo guile'_'gh_enter | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
@ -2298,7 +2296,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lguile $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2302 "configure"
|
||||
#line 2300 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@ -2309,7 +2307,7 @@ int main() {
|
||||
gh_enter()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:2311: \"$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
|
||||
@ -2328,7 +2326,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
echo $ac_n "checking for gh_define in -lguile""... $ac_c" 1>&6
|
||||
echo "configure:2332: checking for gh_define in -lguile" >&5
|
||||
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
|
||||
@ -2336,7 +2334,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lguile -ldl -lreadline $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2340 "configure"
|
||||
#line 2338 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@ -2347,7 +2345,7 @@ int main() {
|
||||
gh_define()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2351: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:2349: \"$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
|
||||
@ -2366,7 +2364,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||
else
|
||||
echo "$ac_t""no" 1>&6
|
||||
echo $ac_n "checking for gh_eval_file in -lguile""... $ac_c" 1>&6
|
||||
echo "configure:2370: checking for gh_eval_file in -lguile" >&5
|
||||
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
|
||||
@ -2374,7 +2372,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lguile -ldl -lreadline -lqthreads $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2378 "configure"
|
||||
#line 2376 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@ -2385,7 +2383,7 @@ int main() {
|
||||
gh_eval_file()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:2387: \"$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
|
||||
@ -2417,7 +2415,7 @@ fi
|
||||
### Plotutils
|
||||
|
||||
echo $ac_n "checking for openpl in -lplot""... $ac_c" 1>&6
|
||||
echo "configure:2421: checking for openpl in -lplot" >&5
|
||||
echo "configure:2419: 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
|
||||
@ -2425,7 +2423,7 @@ else
|
||||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-lplot $X_PRE_LIBS $MOTIF_LIBS $X_EXTRA_LIBS -lXaw $X_LIBS $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 2429 "configure"
|
||||
#line 2427 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
@ -2436,7 +2434,7 @@ int main() {
|
||||
openpl()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:2440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo configure:2438: \"$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
|
||||
@ -2468,6 +2466,47 @@ fi
|
||||
|
||||
|
||||
|
||||
#############################################################
|
||||
### Set up the install style and all the default paths... ###
|
||||
|
||||
if test ${OPT_STYLE_INSTALL} = 1
|
||||
then
|
||||
GNC_DOCDIR=${prefix}/doc
|
||||
GNC_BINDIR=${prefix}/bin
|
||||
GNC_CONFIGDIR=${sysconfdir}
|
||||
GNC_SHAREDIR=${datadir}
|
||||
else
|
||||
GNC_DOCDIR=${prefix}/doc/gnucash
|
||||
GNC_BINDIR=${prefix}/bin
|
||||
GNC_CONFIGDIR=${sysconfdir}/gnucash
|
||||
GNC_SHAREDIR=${datadir}/gnucash
|
||||
GNC_STARTUP_FILE=`eval echo ${datadir}/startup.scm`
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# We have to eval these because they are the *runtime* (not install
|
||||
# time) defaults, and they're substituted into startup.scm and gnucash.h
|
||||
# directly, so:
|
||||
# 1) We don't want them to change if you do
|
||||
# make prefix=foo install
|
||||
# 2) They are normally defined in terms of $prefix so we need to expand
|
||||
# that before substituting into those source files. I wish I knew how
|
||||
# to force a recursive expansion...
|
||||
#
|
||||
GNC_STARTUP_FILE=`eval echo ${GNC_SHAREDIR}/scm/startup.scm`
|
||||
GNC_DOC_DIR_DEFAULT=`eval echo ${GNC_DOCDIR}`
|
||||
GNC_SHARE_DIR_DEFAULT=`eval echo ${GNC_SHAREDIR}`
|
||||
GNC_CONFIG_DIR_DEFAULT=`eval echo ${GNC_CONFIGDIR}`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# *******************************************
|
||||
|
||||
|
||||
@ -2572,7 +2611,7 @@ done
|
||||
ac_given_srcdir=$srcdir
|
||||
ac_given_INSTALL="$INSTALL"
|
||||
|
||||
trap 'rm -fr `echo "Makefile src/Makefile src/engine/Makefile src/guile/Makefile src/gnome/Makefile src/motif/Makefile src/qt/Makefile src/register/Makefile src/reports/Makefile src/swig/Makefile src/swig/guile/Makefile lib/Makefile lib/Xbae-4.6.2-linas/Makefile lib/Xbae-4.6.2-linas/src/Makefile lib/ComboBox-1.33/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
||||
trap 'rm -fr `echo "Makefile src/Makefile src/engine/Makefile src/guile/Makefile src/guile/gnucash.h src/scm/startup.scm src/gnome/Makefile src/motif/Makefile src/qt/Makefile src/register/Makefile src/reports/Makefile src/swig/Makefile src/swig/guile/Makefile lib/Makefile lib/Xbae-4.6.2-linas/Makefile lib/Xbae-4.6.2-linas/src/Makefile lib/ComboBox-1.33/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
@ -2612,7 +2651,7 @@ s%@X_CFLAGS@%$X_CFLAGS%g
|
||||
s%@X_PRE_LIBS@%$X_PRE_LIBS%g
|
||||
s%@X_LIBS@%$X_LIBS%g
|
||||
s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g
|
||||
s%@GTK_BIN@%$GTK_BIN%g
|
||||
s%@GTK_CONFIG_BIN@%$GTK_CONFIG_BIN%g
|
||||
s%@OPT_STYLE_INSTALL@%$OPT_STYLE_INSTALL%g
|
||||
s%@XMHTML_TARGET@%$XMHTML_TARGET%g
|
||||
s%@XMHTML_INC@%$XMHTML_INC%g
|
||||
@ -2620,6 +2659,14 @@ s%@GUILE_INC@%$GUILE_INC%g
|
||||
s%@GUILELIBS@%$GUILELIBS%g
|
||||
s%@HAVE_PLOTUTILS@%$HAVE_PLOTUTILS%g
|
||||
s%@MOTIF_LIBS@%$MOTIF_LIBS%g
|
||||
s%@GNC_DOCDIR@%$GNC_DOCDIR%g
|
||||
s%@GNC_BINDIR@%$GNC_BINDIR%g
|
||||
s%@GNC_CONFIGDIR@%$GNC_CONFIGDIR%g
|
||||
s%@GNC_SHAREDIR@%$GNC_SHAREDIR%g
|
||||
s%@GNC_STARTUP_FILE@%$GNC_STARTUP_FILE%g
|
||||
s%@GNC_DOC_DIR_DEFAULT@%$GNC_DOC_DIR_DEFAULT%g
|
||||
s%@GNC_SHARE_DIR_DEFAULT@%$GNC_SHARE_DIR_DEFAULT%g
|
||||
s%@GNC_CONFIG_DIR_DEFAULT@%$GNC_CONFIG_DIR_DEFAULT%g
|
||||
|
||||
CEOF
|
||||
EOF
|
||||
@ -2661,7 +2708,7 @@ EOF
|
||||
|
||||
cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
CONFIG_FILES=\${CONFIG_FILES-"Makefile src/Makefile src/engine/Makefile src/guile/Makefile src/gnome/Makefile src/motif/Makefile src/qt/Makefile src/register/Makefile src/reports/Makefile src/swig/Makefile src/swig/guile/Makefile lib/Makefile lib/Xbae-4.6.2-linas/Makefile lib/Xbae-4.6.2-linas/src/Makefile lib/ComboBox-1.33/Makefile"}
|
||||
CONFIG_FILES=\${CONFIG_FILES-"Makefile src/Makefile src/engine/Makefile src/guile/Makefile src/guile/gnucash.h src/scm/startup.scm src/gnome/Makefile src/motif/Makefile src/qt/Makefile src/register/Makefile src/reports/Makefile src/swig/Makefile src/swig/guile/Makefile lib/Makefile lib/Xbae-4.6.2-linas/Makefile lib/Xbae-4.6.2-linas/src/Makefile lib/ComboBox-1.33/Makefile"}
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
|
||||
|
61
configure.in
61
configure.in
@ -1,4 +1,4 @@
|
||||
AC_INIT(src/guile/gnucash.h)
|
||||
AC_INIT(src/guile/gnucash.h.in)
|
||||
|
||||
### check for various programs, and stuff (do this first because later
|
||||
### commands depend on them):
|
||||
@ -32,12 +32,10 @@ X_LIBS="$X_LIBS -lXext -lXmu -lXt -lX11"
|
||||
MOTIF_LIBS="-lXm"
|
||||
|
||||
# Let the user specify gtk paths:
|
||||
AC_ARG_WITH( gtk,
|
||||
[ --with-gtk=PATH specify where to look for gtk includes and libs],
|
||||
GTK_BIN="$with_gtk/bin/"
|
||||
X_LIBS="${X_LIBS} -L$with_gtk/lib"
|
||||
X_CFLAGS="$X_CFLAGS -I$with_gtk/include" )
|
||||
AC_SUBST(GTK_BIN)
|
||||
AC_ARG_WITH( gtk-config,
|
||||
[ --with-gtk-config=executable which gtk-config to use to find gtk ],
|
||||
GTK_CONFIG_BIN="$with_gtk/bin/")
|
||||
AC_SUBST(GTK_CONFIG_BIN)
|
||||
|
||||
# Let the user specify imlib paths:
|
||||
AC_ARG_WITH( imlib,
|
||||
@ -114,9 +112,9 @@ AC_ARG_WITH( gnome-libraries,
|
||||
X_LIBS="${X_LIBS} -L$with_gnome_libraries" )
|
||||
|
||||
AC_ARG_WITH( opt-style-install,
|
||||
[ --with-opt-style-install install everything in subdirs of --prefix],
|
||||
OPT_STYLE_INSTALL=1,
|
||||
OPT_STYLE_INSTALL=0)
|
||||
[ --with-opt-style-install install everything in subdirs of --prefix],
|
||||
OPT_STYLE_INSTALL=1,
|
||||
OPT_STYLE_INSTALL=0)
|
||||
AC_SUBST(OPT_STYLE_INSTALL)
|
||||
|
||||
# *******************************************
|
||||
@ -184,9 +182,50 @@ AC_SUBST(HAVE_PLOTUTILS)
|
||||
|
||||
AC_SUBST(MOTIF_LIBS)
|
||||
|
||||
#############################################################
|
||||
### Set up the install style and all the default paths... ###
|
||||
|
||||
if test ${OPT_STYLE_INSTALL} = 1
|
||||
then
|
||||
GNC_DOCDIR=${prefix}/doc
|
||||
GNC_BINDIR=${prefix}/bin
|
||||
GNC_CONFIGDIR=${sysconfdir}
|
||||
GNC_SHAREDIR=${datadir}
|
||||
else
|
||||
GNC_DOCDIR=${prefix}/doc/gnucash
|
||||
GNC_BINDIR=${prefix}/bin
|
||||
GNC_CONFIGDIR=${sysconfdir}/gnucash
|
||||
GNC_SHAREDIR=${datadir}/gnucash
|
||||
GNC_STARTUP_FILE=`eval echo ${datadir}/startup.scm`
|
||||
fi
|
||||
|
||||
AC_SUBST(GNC_DOCDIR)
|
||||
AC_SUBST(GNC_BINDIR)
|
||||
AC_SUBST(GNC_CONFIGDIR)
|
||||
AC_SUBST(GNC_SHAREDIR)
|
||||
|
||||
# We have to eval these because they are the *runtime* (not install
|
||||
# time) defaults, and they're substituted into startup.scm and gnucash.h
|
||||
# directly, so:
|
||||
# 1) We don't want them to change if you do
|
||||
# make prefix=foo install
|
||||
# 2) They are normally defined in terms of $prefix so we need to expand
|
||||
# that before substituting into those source files. I wish I knew how
|
||||
# to force a recursive expansion...
|
||||
#
|
||||
GNC_STARTUP_FILE=`eval echo ${GNC_SHAREDIR}/scm/startup.scm`
|
||||
GNC_DOC_DIR_DEFAULT=`eval echo ${GNC_DOCDIR}`
|
||||
GNC_SHARE_DIR_DEFAULT=`eval echo ${GNC_SHAREDIR}`
|
||||
GNC_CONFIG_DIR_DEFAULT=`eval echo ${GNC_CONFIGDIR}`
|
||||
|
||||
AC_SUBST(GNC_STARTUP_FILE)
|
||||
AC_SUBST(GNC_DOC_DIR_DEFAULT)
|
||||
AC_SUBST(GNC_SHARE_DIR_DEFAULT)
|
||||
AC_SUBST(GNC_CONFIG_DIR_DEFAULT)
|
||||
|
||||
# *******************************************
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_OUTPUT(Makefile src/Makefile src/engine/Makefile src/guile/Makefile src/gnome/Makefile src/motif/Makefile src/qt/Makefile src/register/Makefile src/reports/Makefile src/swig/Makefile src/swig/guile/Makefile lib/Makefile lib/Xbae-4.6.2-linas/Makefile lib/Xbae-4.6.2-linas/src/Makefile lib/ComboBox-1.33/Makefile)
|
||||
AC_OUTPUT(Makefile src/Makefile src/engine/Makefile src/guile/Makefile src/guile/gnucash.h src/scm/startup.scm src/gnome/Makefile src/motif/Makefile src/qt/Makefile src/register/Makefile src/reports/Makefile src/swig/Makefile src/swig/guile/Makefile lib/Makefile lib/Xbae-4.6.2-linas/Makefile lib/Xbae-4.6.2-linas/src/Makefile lib/ComboBox-1.33/Makefile)
|
||||
|
||||
chmod +x gnucash
|
||||
|
@ -49,7 +49,6 @@ motif: ${MOTIF_OBJS}
|
||||
@cd engine; $(MAKE) default
|
||||
@cd register; $(MAKE) motif
|
||||
@cd reports; $(MAKE) default
|
||||
@cd guile; $(MAKE) path-defaults.h
|
||||
@cd swig; $(MAKE) guile
|
||||
@cd guile; $(MAKE) default
|
||||
@cd motif; $(MAKE) motif
|
||||
@ -58,16 +57,15 @@ gnome: ${GNOME_OBJS}
|
||||
@cd engine; $(MAKE) default
|
||||
@cd register; $(MAKE) gnome
|
||||
@cd reports; $(MAKE) default
|
||||
@cd guile; $(MAKE) path-defaults.h
|
||||
@cd swig; $(MAKE) guile
|
||||
@cd swig; $(MAKE) guile
|
||||
@cd guile; $(MAKE) default
|
||||
@cd gnome; $(MAKE) gnome
|
||||
|
||||
qt: $(QT_OBJS)
|
||||
@cd engine; $(MAKE) default
|
||||
@cd register; $(MAKE) qt
|
||||
@cd engine; $(MAKE) default
|
||||
@cd register; $(MAKE) qt
|
||||
@cd reports; $(MAKE) default
|
||||
@cd qt; $(MAKE) qt
|
||||
@cd qt; $(MAKE) qt
|
||||
|
||||
.PHONY: default qt gnome motif all
|
||||
|
||||
|
@ -36,12 +36,12 @@ INCLPATH = -I.. -I../.. -I../engine -I../register -I../guile \
|
||||
-I@srcdir@/../../include \
|
||||
-I$(includedir)
|
||||
|
||||
CFLAGS = @CFLAGS@ @X_CFLAGS@ ${INCLPATH}
|
||||
CFLAGS = @CFLAGS@ @X_CFLAGS@ ${INCLPATH} $(shell @GTK_CONFIG_BIN@ --cflags)
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
GUILELIBS = @GUILELIBS@
|
||||
LIBS = -L$(prefix)/lib @LIBS@ @X_PRE_LIBS@ @X_LIBS@ \
|
||||
$(shell @GTK_BIN@gtk-config --libs) @X_EXTRA_LIBS@ -lgnomeui \
|
||||
$(shell @GTK_CONFIG_BIN@ --libs) @X_EXTRA_LIBS@ -lgnomeui \
|
||||
-lgnome -lgnomesupport -lgdk_imlib -ltiff \
|
||||
$(GUILELIBS) -lintl
|
||||
|
||||
|
@ -35,11 +35,8 @@
|
||||
#include "util.h"
|
||||
#include "MainWindow.h"
|
||||
|
||||
#include "../guile/path-defaults.h"
|
||||
|
||||
/** HELP STUFF: *****************************************************/
|
||||
#define HELP_VAR "XACC_HELP"
|
||||
#define HELP_ROOT GNC_DOC_DIR_DEFAULT
|
||||
#define HH_ABOUT "xacc-about.html"
|
||||
#define HH_ACC "xacc-accwin.html"
|
||||
#define HH_REGWIN "xacc-regwin.html"
|
||||
|
@ -31,7 +31,7 @@ INCLPATH = -I@srcdir@/../.. \
|
||||
-I@srcdir@/../../lib/ComboBox-1.33 \
|
||||
-I@srcdir@/../../lib/Xbae-4.6.2-linas \
|
||||
-I@prefix@/include
|
||||
|
||||
|
||||
|
||||
CFLAGS := @CFLAGS@ @X_CFLAGS@ -DCELL_WIDGETS=1 ${INCLPATH}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
;;;; startup.scm
|
||||
;;;; startup.scm -*-scheme-*-
|
||||
;;
|
||||
;; Minimal startup code. This file should just contain enough code to
|
||||
;; get the arguments parsed and things like gnc:*load-path* set up.
|
||||
@ -15,6 +15,11 @@
|
||||
"/usr/share/guile/1.3a/ice-9/boot-9.scm")))
|
||||
(primitive-load boot-file))
|
||||
|
||||
;; Automatically generated defaults...
|
||||
(define gnc:_config-dir-default_ "NONE/etc/gnucash")
|
||||
(define gnc:_share-dir-default_ "NONE/share/gnucash")
|
||||
(define gnc:_doc-dir-default_ "NONE/doc/gnucash")
|
||||
|
||||
(define gnc:*command-line-files* #f)
|
||||
|
||||
;;;; Warning functions...
|
||||
@ -29,6 +34,11 @@
|
||||
(for-each (lambda (i) (display i)) items)
|
||||
(newline))
|
||||
|
||||
(define (gnc:msg . items)
|
||||
(display "gnucash: [M] ")
|
||||
(for-each (lambda (i) (display i)) items)
|
||||
(newline))
|
||||
|
||||
(define (gnc:debug . items)
|
||||
(if (gnc:config-var-value-get gnc:*debugging?*)
|
||||
(begin
|
||||
@ -90,7 +100,7 @@
|
||||
|
||||
(define (directory? path)
|
||||
;; This follows symlinks normally.
|
||||
(let* ((status (stat path))
|
||||
(let* ((status (false-if-exception (stat path)))
|
||||
(type (if status (stat:type status) #f)))
|
||||
(eq? type 'directory)))
|
||||
|
||||
@ -143,33 +153,36 @@
|
||||
(rest (gnc:_path-expand_ other-items default-items)))
|
||||
(cons current-dir (append subdirs rest)))
|
||||
(begin
|
||||
(gnc:warn "Non-directory " current-dir
|
||||
"in gnc:_path-expand_ item."
|
||||
"Ignoring.")
|
||||
'())))
|
||||
(gnc:warn "Ignoring non-directory " current-dir
|
||||
" in gnc:_path-expand_ item.")
|
||||
(gnc:_path-expand_ other-items default-items))))
|
||||
(if (directory? item)
|
||||
(begin
|
||||
(gnc:warn "Non-directory " item "in gnc:_path-expand_ item."
|
||||
"Ignoring.")
|
||||
'())
|
||||
(gnc:warn "Ignoring non-directory " item
|
||||
" in gnc:_path-expand_ item.")
|
||||
(gnc:_path-expand_ other-items default-items))
|
||||
(cons item (gnc:_path-expand_ other-items default-items)))))
|
||||
(else (gnc:warn "Invalid item " item " in gnc:_path-expand_. Ignoring")
|
||||
(else (gnc:warn "Ignoring invalid item " item " in gnc:_path-expand_.")
|
||||
(gnc:_path-expand_ other-items default-items))))))
|
||||
|
||||
(define (gnc:_load-path-update_ items)
|
||||
(define (gnc:_load-path-update_ var items)
|
||||
(gnc:msg "Updating load path from " items)
|
||||
(let ((result (gnc:_path-expand_
|
||||
items
|
||||
(gnc:config-var-default-value-get gnc:*load-path*))))
|
||||
(gnc:config-var-default-value-get var))))
|
||||
(if result
|
||||
(begin
|
||||
(set! gnc:_load-path-directories_ result)
|
||||
(gnc:msg " Setting path to " result)
|
||||
result)
|
||||
#f)))
|
||||
(begin
|
||||
(gnc:msg " No path... " result)
|
||||
#f))))
|
||||
|
||||
(define (gnc:_doc-path-update_ items)
|
||||
(define (gnc:_doc-path-update_ var items)
|
||||
(let ((result (gnc:_path-expand_
|
||||
items
|
||||
(gnc:config-var-default-value-get gnc:*doc-path*))))
|
||||
(gnc:config-var-default-value-get var))))
|
||||
(if result
|
||||
(begin
|
||||
(set! gnc:_doc-path-directories_ result)
|
||||
@ -237,7 +250,10 @@ file in all of the directories specified by gnc:*load-path*."
|
||||
set-action-func
|
||||
equality-func
|
||||
default)
|
||||
(vector description set-action-func equality-func #f default default))
|
||||
(let ((var
|
||||
(vector description set-action-func equality-func #f default default)))
|
||||
(gnc:config-var-value-set! var #f default)
|
||||
var))
|
||||
|
||||
(define (gnc:config-var-description-get var) (vector-ref var 0))
|
||||
|
||||
@ -254,7 +270,7 @@ file in all of the directories specified by gnc:*load-path*."
|
||||
(define (gnc:config-var-value-get var) (vector-ref var 5))
|
||||
(define (gnc:config-var-value-set! var is-config-mod? value)
|
||||
(let ((set-action (gnc:config-var-action-func-get var))
|
||||
(result '(value)))
|
||||
(result (list value)))
|
||||
(if set-action (set! result (set-action var value)))
|
||||
(if result
|
||||
(begin
|
||||
@ -326,7 +342,7 @@ variable is modified. The symbol element default will expand to the default dir
|
||||
(lambda (var value)
|
||||
(if (not (list? value))
|
||||
#f
|
||||
(let ((result (gnc:_load-path-update_ value)))
|
||||
(let ((result (gnc:_load-path-update_ var value)))
|
||||
(if (list? result)
|
||||
(list result)
|
||||
#f))))
|
||||
@ -346,7 +362,7 @@ default directory. i.e. (gnc:config-var-value-set! gnc:*doc-path*
|
||||
(lambda (var value)
|
||||
(if (not (list? value))
|
||||
#f
|
||||
(let ((result (gnc:_doc-path-update_ value)))
|
||||
(let ((result (gnc:_doc-path-update_ var value)))
|
||||
(if (list? result)
|
||||
(list result)
|
||||
#f))))
|
||||
|
573
src/scm/startup.scm.in
Normal file
573
src/scm/startup.scm.in
Normal file
@ -0,0 +1,573 @@
|
||||
;;;; startup.scm -*-scheme-*-
|
||||
;;
|
||||
;; Minimal startup code. This file should just contain enough code to
|
||||
;; get the arguments parsed and things like gnc:*load-path* set up.
|
||||
;; After that *everything* should be loaded via gnc:load.
|
||||
|
||||
;; This load should go away when guile gets fixed. as of guile1.3,
|
||||
;; it's not. You have to do this manually, unless you call scm_shell,
|
||||
;; which we can't.
|
||||
(let ((boot-file (if (assoc 'prefix %guile-build-info)
|
||||
(string-append (cdr (assoc 'prefix %guile-build-info))
|
||||
"/share/guile/"
|
||||
(version)
|
||||
"/ice-9/boot-9.scm")
|
||||
"/usr/share/guile/1.3a/ice-9/boot-9.scm")))
|
||||
(primitive-load boot-file))
|
||||
|
||||
;; Automatically generated defaults...
|
||||
(define gnc:_config-dir-default_ "@GNC_CONFIG_DIR_DEFAULT@")
|
||||
(define gnc:_share-dir-default_ "@GNC_SHARE_DIR_DEFAULT@")
|
||||
(define gnc:_doc-dir-default_ "@GNC_DOC_DIR_DEFAULT@")
|
||||
|
||||
(define gnc:*command-line-files* #f)
|
||||
|
||||
;;;; Warning functions...
|
||||
|
||||
(define (gnc:warn . items)
|
||||
(display "gnucash: [W] ")
|
||||
(for-each (lambda (i) (display i)) items)
|
||||
(newline))
|
||||
|
||||
(define (gnc:error . items)
|
||||
(display "gnucash: [E] ")
|
||||
(for-each (lambda (i) (display i)) items)
|
||||
(newline))
|
||||
|
||||
(define (gnc:msg . items)
|
||||
(display "gnucash: [M] ")
|
||||
(for-each (lambda (i) (display i)) items)
|
||||
(newline))
|
||||
|
||||
(define (gnc:debug . items)
|
||||
(if (gnc:config-var-value-get gnc:*debugging?*)
|
||||
(begin
|
||||
(display "gnucash: [D] ")
|
||||
(for-each (lambda (i) (display i)) items)
|
||||
(newline))))
|
||||
|
||||
(define (gnc:startup)
|
||||
(gnc:debug "starting up.")
|
||||
#t)
|
||||
|
||||
(define (gnc:shutdown exit-status)
|
||||
(gnc:debug "Shutdown -- exit-status: " exit-status)
|
||||
|
||||
(gnc:hook-run-danglers gnc:*shutdown-hook*)
|
||||
(_gnc_shutdown_ exit-status)
|
||||
(exit exit-status))
|
||||
|
||||
(define gnc:*user-config-loaded?* #f)
|
||||
|
||||
(define (gnc:load-user-config)
|
||||
(gnc:debug "loading user configuration")
|
||||
|
||||
(let ((user-file
|
||||
(string-append (getenv "HOME") "/.gnucash/config.user"))
|
||||
(auto-file
|
||||
(string-append (getenv "HOME") "/.gnucash/config.auto")))
|
||||
|
||||
(if (access? user-file F_OK)
|
||||
(if (false-if-exception (primitive-load user-file))
|
||||
(set! gnc:user-config-loaded #t)
|
||||
(begin
|
||||
(gnc:warn "failure loading " user-file)
|
||||
#f))
|
||||
(if (access? auto-file F_OK)
|
||||
(if (false-if-exception (primitive-load auto-file))
|
||||
(set! gnc:*user-config-loaded?* #t)
|
||||
(begin
|
||||
(gnc:warn "failure loading " auto-file)
|
||||
#f))))))
|
||||
|
||||
(define gnc:*system-config-loaded?* #f)
|
||||
|
||||
(define (gnc:load-system-config)
|
||||
(gnc:debug "loading system configuration")
|
||||
|
||||
(let ((system-config (string-append
|
||||
(gnc:config-var-value-get gnc:*config-dir*)
|
||||
"/config")))
|
||||
|
||||
(if (false-if-exception (primitive-load system-config))
|
||||
(set! gnc:*system-config-loaded?* #t)
|
||||
(begin
|
||||
(gnc:warn "failure loading " system-config)
|
||||
#f))))
|
||||
|
||||
(define gnc:_load-path-directories_ #f)
|
||||
(define gnc:_doc-path-directories_ #f)
|
||||
|
||||
(define (directory? path)
|
||||
;; This follows symlinks normally.
|
||||
(let* ((status (false-if-exception (stat path)))
|
||||
(type (if status (stat:type status) #f)))
|
||||
(eq? type 'directory)))
|
||||
|
||||
|
||||
(define (gnc:directory-subdirectories dir-name)
|
||||
;; Return a recursive list of the subdirs of dir-name, including
|
||||
;; dir-name. Follow symlinks.
|
||||
|
||||
(let ((dir-port (opendir dir-name)))
|
||||
(if (not dir-port)
|
||||
#f
|
||||
(do ((item (readdir dir-port) (readdir dir-port))
|
||||
(dirs '()))
|
||||
((eof-object? item) (reverse dirs))
|
||||
|
||||
(if (not (or (string=? item ".")
|
||||
(string=? item "..")))
|
||||
(let* ((full-path (string-append dir-name "/" item)))
|
||||
;; ignore symlinks, etc.
|
||||
(if (access? full-path F_OK)
|
||||
(let* ((status (lstat full-path))
|
||||
(type (if status (stat:type status) #f)))
|
||||
(if (and (eq? type 'directory))
|
||||
(set! dirs
|
||||
(cons full-path
|
||||
(append
|
||||
(gnc:directory-subdirectories full-path)
|
||||
dirs))))))))))))
|
||||
|
||||
(define (gnc:_path-expand_ items default-items)
|
||||
(if
|
||||
(null? items)
|
||||
'()
|
||||
(let ((item (car items))
|
||||
(other-items (cdr items)))
|
||||
(cond
|
||||
((eq? item 'default)
|
||||
(append
|
||||
(gnc:_path-expand_ default-items))
|
||||
(gnc:_path-expand_ other-items default-items))
|
||||
((string? item)
|
||||
(if (and (char=? #\( (string-ref item 0))
|
||||
(char=? #\) (string-ref item (- (string-length item) 1))))
|
||||
|
||||
(let ((current-dir
|
||||
(make-shared-substring item 1 (- (string-length item) 1))))
|
||||
|
||||
(if (directory? current-dir)
|
||||
(let ((subdirs (gnc:directory-subdirectories current-dir))
|
||||
(rest (gnc:_path-expand_ other-items default-items)))
|
||||
(cons current-dir (append subdirs rest)))
|
||||
(begin
|
||||
(gnc:warn "Ignoring non-directory " current-dir
|
||||
" in gnc:_path-expand_ item.")
|
||||
(gnc:_path-expand_ other-items default-items))))
|
||||
(if (directory? item)
|
||||
(begin
|
||||
(gnc:warn "Ignoring non-directory " item
|
||||
" in gnc:_path-expand_ item.")
|
||||
(gnc:_path-expand_ other-items default-items))
|
||||
(cons item (gnc:_path-expand_ other-items default-items)))))
|
||||
(else (gnc:warn "Ignoring invalid item " item " in gnc:_path-expand_.")
|
||||
(gnc:_path-expand_ other-items default-items))))))
|
||||
|
||||
(define (gnc:_load-path-update_ var items)
|
||||
(gnc:msg "Updating load path from " items)
|
||||
(let ((result (gnc:_path-expand_
|
||||
items
|
||||
(gnc:config-var-default-value-get var))))
|
||||
(if result
|
||||
(begin
|
||||
(set! gnc:_load-path-directories_ result)
|
||||
(gnc:msg " Setting path to " result)
|
||||
result)
|
||||
(begin
|
||||
(gnc:msg " No path... " result)
|
||||
#f))))
|
||||
|
||||
(define (gnc:_doc-path-update_ var items)
|
||||
(let ((result (gnc:_path-expand_
|
||||
items
|
||||
(gnc:config-var-default-value-get var))))
|
||||
(if result
|
||||
(begin
|
||||
(set! gnc:_doc-path-directories_ result)
|
||||
result)
|
||||
#f)))
|
||||
|
||||
(define (gnc:find-in-directories file directories)
|
||||
"Find file named 'file' anywhere in 'directories'. 'file' must be a
|
||||
string and 'directories' must be a list of strings."
|
||||
|
||||
(gnc:debug "gnc:find-in-directories looking for " file " in " directories)
|
||||
|
||||
(do ((rest directories (cdr rest))
|
||||
(finished? #f)
|
||||
(result #f))
|
||||
((or (null? rest) finished?) result)
|
||||
|
||||
(let ((file-name (string-append (car rest) "/" file)))
|
||||
(gnc:debug " checking for " file-name)
|
||||
(if (access? file-name F_OK)
|
||||
(begin
|
||||
(gnc:debug "found file " file-name)
|
||||
(set! finished? #t)
|
||||
(set! result file-name))))))
|
||||
|
||||
;; It may make sense to dump this in favor of guile's load-path later,
|
||||
;; but for now this works, and having gnc things separate may be less
|
||||
;; confusing and avoids shadowing problems.
|
||||
|
||||
(define (gnc:load name)
|
||||
"Name must be a string. The system attempts to locate the file of
|
||||
the given name and load it. The system will attempt to locate the
|
||||
file in all of the directories specified by gnc:*load-path*."
|
||||
|
||||
(let ((file-name (gnc:find-in-directories name gnc:_load-path-directories_)))
|
||||
(if (not file-name)
|
||||
#f
|
||||
(if (false-if-exception (primitive-load file-name))
|
||||
(begin
|
||||
(gnc:debug "loaded file " file-name)
|
||||
#t)
|
||||
(begin
|
||||
(gnc:warn "failure loading " file-name)
|
||||
#f)))))
|
||||
|
||||
;;; config-var: You can create them, set values, find out of the value
|
||||
;;; is different from the default, and you can get a description. You
|
||||
;;; can also specify an action function which will be called whenever
|
||||
;;; the value is changed. The action function receives the special
|
||||
;;; var and the new value as arguments and should return either #f if
|
||||
;;; the modification should be rejected, or a list containing the
|
||||
;;; result otherwise.
|
||||
|
||||
;;; Finally, a config var has two states, "officially" modified, and
|
||||
;;; unofficially modified. You control what kind of modification
|
||||
;;; you're making with the second argument to
|
||||
;;; gnc:config-var-value-set! The idea is that options specified on
|
||||
;;; the command line will set the value of these config vars, but that
|
||||
;;; setting is considered transient. Other settings (like from the UI
|
||||
;;; preferences panel, or normal user code) should be considered
|
||||
;;; permanent, and if they leave the variable value different from the
|
||||
;;; default, should be saved to ~/.gnucash/config.auto.
|
||||
|
||||
(define (gnc:make-config-var description
|
||||
set-action-func
|
||||
equality-func
|
||||
default)
|
||||
(let ((var
|
||||
(vector description set-action-func equality-func #f default default)))
|
||||
(gnc:config-var-value-set! var #f default)
|
||||
var))
|
||||
|
||||
(define (gnc:config-var-description-get var) (vector-ref var 0))
|
||||
|
||||
(define (gnc:config-var-action-func-get var) (vector-ref var 1))
|
||||
|
||||
(define (gnc:config-var-equality-func-get var) (vector-ref var 2))
|
||||
|
||||
(define (gnc:config-var-modified? var) (vector-ref var 3))
|
||||
(define (gnc:config-var-modified?-set! var value) (vector-set! var 3 value))
|
||||
|
||||
(define (gnc:config-var-default-value-get var) (vector-ref var 4))
|
||||
(define (gnc:config-var-default-value-set! var value) (vector-set! var 4 value))
|
||||
|
||||
(define (gnc:config-var-value-get var) (vector-ref var 5))
|
||||
(define (gnc:config-var-value-set! var is-config-mod? value)
|
||||
(let ((set-action (gnc:config-var-action-func-get var))
|
||||
(result (list value)))
|
||||
(if set-action (set! result (set-action var value)))
|
||||
(if result
|
||||
(begin
|
||||
(if is-config-mod? (gnc:config-var-modified?-set var #t))
|
||||
(vector-set! var 5 (car result))))))
|
||||
|
||||
(define (gnc:config-var-value-is-default? var)
|
||||
(if (not (gnc:config-var-modified? var))
|
||||
#t
|
||||
(let (equal-values? gnc:config-var-equality-func-get var)
|
||||
(equal-values?
|
||||
(gnc:config-var-default-value-get var)
|
||||
(gnc:config-var-value-get var)))))
|
||||
|
||||
|
||||
;;;; Preferences
|
||||
|
||||
(define gnc:*arg-show-usage*
|
||||
(gnc:make-config-var
|
||||
"Generate an argument summary."
|
||||
(lambda (var value) (if (boolean? value) (list value) #f))
|
||||
eq?
|
||||
#f))
|
||||
|
||||
(define gnc:*arg-show-help*
|
||||
(gnc:make-config-var
|
||||
"Generate an argument summary."
|
||||
(lambda (var value) (if (boolean? value) (list value) #f))
|
||||
eq?
|
||||
#f))
|
||||
|
||||
(define gnc:*debugging?*
|
||||
(gnc:make-config-var
|
||||
"Enable debugging code."
|
||||
(lambda (var value) (if (boolean? value) (list value) #f))
|
||||
eq?
|
||||
#f))
|
||||
|
||||
(define gnc:*startup-file*
|
||||
(gnc:make-config-var
|
||||
"Initial lowest level scheme startup file."
|
||||
(lambda (var value)
|
||||
;; You can't change the startup file from here since this is the
|
||||
;; startup file...
|
||||
#f)
|
||||
string=?
|
||||
gnc:_startup-file-default_))
|
||||
|
||||
(define gnc:*config-dir*
|
||||
(gnc:make-config-var
|
||||
"Configuration directory."
|
||||
(lambda (var value) (if (string? value) (list value) #f))
|
||||
string=?
|
||||
gnc:_config-dir-default_))
|
||||
|
||||
(define gnc:*share-dir*
|
||||
(gnc:make-config-var
|
||||
"Shared files directory."
|
||||
(lambda (var value) (if (string? value) (list value) #f))
|
||||
string=?
|
||||
gnc:_share-dir-default_))
|
||||
|
||||
(define gnc:*load-path*
|
||||
(gnc:make-config-var
|
||||
"A list of strings indicating the load path for (gnc:load name).
|
||||
Any path element enclosed in parentheses will automatically be
|
||||
expanded to that directory and all its subdirectories whenever this
|
||||
variable is modified. The symbol element default will expand to the default directory. i.e. (gnc:config-var-value-set! gnc:*load-path* '(\"/my/dir/\" default))"
|
||||
(lambda (var value)
|
||||
(if (not (list? value))
|
||||
#f
|
||||
(let ((result (gnc:_load-path-update_ var value)))
|
||||
(if (list? result)
|
||||
(list result)
|
||||
#f))))
|
||||
equal?
|
||||
(list
|
||||
(string-append "(" (getenv "HOME") "/.gnucash/scm)")
|
||||
(string-append "(" gnc:_share-dir-default_ "/scm)"))))
|
||||
|
||||
(define gnc:*doc-path*
|
||||
(gnc:make-config-var
|
||||
"A list of strings indicating where to look for documentation files
|
||||
Any path element enclosed in parentheses will automatically be
|
||||
expanded to that directory and all its subdirectories whenever this
|
||||
variable is modified. The symbol element default will expand to the
|
||||
default directory. i.e. (gnc:config-var-value-set! gnc:*doc-path*
|
||||
'(\"/my/dir/\" default))"
|
||||
(lambda (var value)
|
||||
(if (not (list? value))
|
||||
#f
|
||||
(let ((result (gnc:_doc-path-update_ var value)))
|
||||
(if (list? result)
|
||||
(list result)
|
||||
#f))))
|
||||
equal?
|
||||
(list
|
||||
(string-append "(" (getenv "HOME") "/.gnucash/doc)")
|
||||
(string-append "(" gnc:_doc-dir-default_ ")"))))
|
||||
|
||||
|
||||
(define gnc:*prefs*
|
||||
(list
|
||||
|
||||
(cons
|
||||
"usage"
|
||||
(cons 'boolean
|
||||
(lambda (val)
|
||||
(gnc:config-var-value-set! gnc:*arg-show-usage* #f val))))
|
||||
(cons
|
||||
"help"
|
||||
(cons 'boolean
|
||||
(lambda (val)
|
||||
(gnc:config-var-value-set! gnc:*arg-show-help* #f val))))
|
||||
(cons
|
||||
"debug"
|
||||
(cons 'boolean
|
||||
(lambda (val)
|
||||
(gnc:config-var-value-set! gnc:*debugging?* #f val))))
|
||||
|
||||
(cons
|
||||
"startup-file"
|
||||
(cons 'string
|
||||
(lambda (val)
|
||||
(gnc:config-var-value-set! gnc:*startup-file* #f val))))
|
||||
|
||||
(cons
|
||||
"config-dir"
|
||||
(cons 'string
|
||||
(lambda (val)
|
||||
(gnc:config-var-value-set! gnc:*config-dir* #f val))))
|
||||
|
||||
(cons
|
||||
"share-dir"
|
||||
(cons 'string
|
||||
(lambda (val)
|
||||
(gnc:config-var-value-set! gnc:*share-dir* #f val))))
|
||||
|
||||
|
||||
(cons
|
||||
"load-path"
|
||||
(cons 'string
|
||||
(lambda (val)
|
||||
(let ((path-list
|
||||
(call-with-input-string val (lambda (port) (read port)))))
|
||||
(if (list? path-list)
|
||||
(gnc:config-var-value-set! gnc:*load-path* #f path-list)
|
||||
(begin
|
||||
(gnc:error "non-list given for --load-path: " val)
|
||||
(gnc:shutdown 1)))))))
|
||||
|
||||
(cons
|
||||
"doc-path"
|
||||
(cons 'string
|
||||
(lambda (val)
|
||||
(let ((path-list
|
||||
(call-with-input-string val (lambda (port) (read port)))))
|
||||
(if (list? path-list)
|
||||
(gnc:config-var-value-set! gnc:*doc-path* #f path-list)
|
||||
(begin
|
||||
(gnc:error "non-list given for --doc-path: " val)
|
||||
(gnc:shutdown 1)))))))
|
||||
|
||||
(cons "load-user-config" (cons 'boolean gnc:load-user-config))
|
||||
(cons "load-system-config" (cons 'boolean gnc:load-system-config))))
|
||||
|
||||
|
||||
;; also "-c"
|
||||
|
||||
|
||||
(define (gnc:cmd-line-get-boolean-arg args)
|
||||
;; --arg means #t
|
||||
;; --arg true means #t
|
||||
;; --arg false means #f
|
||||
|
||||
(if (not (pair? args))
|
||||
;; Special case of end of list
|
||||
(list #t args)
|
||||
(let ((arg (car args)))
|
||||
(if (string=? arg "false")
|
||||
(list #f (cdr args))
|
||||
(list #t
|
||||
(if (string=? arg "true")
|
||||
(cdr args)
|
||||
args))))))
|
||||
|
||||
(define (gnc:cmd-line-get-integer-arg args)
|
||||
(let ((arg (car args)))
|
||||
(let ((value (string->number arg)))
|
||||
(if (not value)
|
||||
#f
|
||||
(if (not (exact? value))
|
||||
#f
|
||||
(list value (cdr args)))))))
|
||||
|
||||
(define (gnc:cmd-line-get-string-arg args)
|
||||
(list (car args) (cdr args)))
|
||||
|
||||
(define (gnc:prefs-show-usage)
|
||||
(display "usage: gnucash [ option ... ] [ datafile ]") (newline))
|
||||
|
||||
|
||||
(define (gnc:handle-command-line-args)
|
||||
(gnc:debug "handling command line arguments")
|
||||
|
||||
(let ((files-to-open '())
|
||||
(result #t))
|
||||
|
||||
(do ((rest (cdr (program-arguments))) ; initial cdr skips argv[0]
|
||||
(quit? #f)
|
||||
(item #f))
|
||||
((or quit? (null? rest)))
|
||||
|
||||
(set! item (car rest))
|
||||
|
||||
(gnc:debug "handling arg " item)
|
||||
|
||||
(if (not (string=? "--" (make-shared-substring item 0 2)))
|
||||
(begin
|
||||
(gnc:debug "non-option " item ", assuming file")
|
||||
(set! rest (cdr rest))
|
||||
(set! files-to-open (cons item files-to-open)))
|
||||
|
||||
;; Got something that looks like an option...
|
||||
(let* ((arg-string (make-shared-substring item 2))
|
||||
(arg-def (assoc-ref gnc:*prefs* arg-string)))
|
||||
|
||||
(if (not arg-def)
|
||||
(begin
|
||||
(gnc:prefs-show-usage)
|
||||
(set! result #f)
|
||||
(set! quit? #t))
|
||||
|
||||
(let* ((arg-type (car arg-def))
|
||||
(arg-parse-result
|
||||
(case arg-type
|
||||
((boolean) (gnc:cmd-line-get-boolean-arg (cdr rest)))
|
||||
((string) (gnc:cmd-line-get-string-arg (cdr rest)))
|
||||
((integer)
|
||||
(gnc:cmd-line-get-integer-arg (cdr rest)))
|
||||
(else
|
||||
(gnc:error "bad argument type " arg-type ".")
|
||||
(gnc:shutdown 1)))))
|
||||
|
||||
(if (not arg-parse-result)
|
||||
(begin
|
||||
(set result #f)
|
||||
(set! quit? #t))
|
||||
(let ((parsed-value (car arg-parse-result))
|
||||
(remaining-args (cadr arg-parse-result)))
|
||||
((cdr arg-def) parsed-value)
|
||||
(set! rest remaining-args))))))))
|
||||
(if result
|
||||
(gnc:debug "files to open: " files-to-open))
|
||||
|
||||
(set! gnc:*command-line-files* files-to-open)
|
||||
|
||||
result))
|
||||
|
||||
;;;; Now the fun begins.
|
||||
|
||||
(gnc:startup)
|
||||
|
||||
(if (not (gnc:handle-command-line-args))
|
||||
(gnc:shutdown 1))
|
||||
|
||||
;;; Now we can load a bunch of files.
|
||||
|
||||
(gnc:load "hooks.scm")
|
||||
(gnc:load "doc.scm")
|
||||
|
||||
;;; Load the system and user configs
|
||||
|
||||
(if (not gnc:*user-config-loaded?*)
|
||||
(if (not (gnc:load-system-config))
|
||||
(gnc:shutdown 1)))
|
||||
|
||||
(if (not gnc:*system-config-loaded?*)
|
||||
(if (not (gnc:load-user-config))
|
||||
(gnc:shutdown 1)))
|
||||
|
||||
(gnc:hook-run-danglers gnc:*startup-hook*)
|
||||
|
||||
(if (or (gnc:config-var-value-get gnc:*arg-show-usage*)
|
||||
(gnc:config-var-value-get gnc:*arg-show-help*))
|
||||
(begin
|
||||
(gnc:prefs-show-usage)
|
||||
(gnc:shutdown 0)))
|
||||
|
||||
(if (not (= (gnucash_lowlev_app_init) 0))
|
||||
(gnc:shutdown 0))
|
||||
|
||||
(if (pair? gnc:*command-line-files*)
|
||||
;; You can only open single files right now...
|
||||
(gnucash_ui_open_file (car gnc:*command-line-files*))
|
||||
(gnucash_ui_select_file))
|
||||
|
||||
(gnucash_lowlev_app_main)
|
||||
|
||||
(gnc:shutdown 0)
|
Loading…
Reference in New Issue
Block a user