gnucash/configure.in

327 lines
11 KiB
Plaintext
Raw Normal View History

AC_INIT(src/guile/gnucash.h.in)
### check for various programs, and stuff (do this first because later
### commands depend on them):
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_CC
AC_ISC_POSIX
AC_C_BIGENDIAN
AC_PROG_MAKE_SET
# Check for 'swig'
AC_PATH_PROG(SWIG,swig,no) # Sets @SWIG@
if test x"$SWIG" = xno; then
AC_MSG_ERROR(Can't find swig.)
fi
## Check for Perl
AC_CHECK_PROGS(PERL,perl5 perl) # Sets @PERL@
# Make sure Perl was found
if test x"$PERL" = x; then
AC_MSG_ERROR(Can't find Perl.)
fi
# Make sure it's version 5 or later
if "$PERL" -e 'exit 1 if $] < 5.0'; then
:
else
AC_MSG_ERROR(You need Perl version 5 or later.)
fi
### Set up all the initial variable values...
CFLAGS="${CFLAGS} -O2 -Wall"
# some plything option lists
# CFLAGS="-g -Wall -ansi -pedantic -Wwrite-strings -Wid-clash-31 -Wpointer-arith -Wcast-qual -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wshadow -Woverloaded-virtual -Winline -felide-constructors -fnonnull-objects"
# CFLAGS="-g -Wall -ansi -pedantic -Wwrite-strings -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wshadow -Winline"
# CFLAGS="-g -Wall -ansi -pedantic"
LIBS="$LIBS -lm"
# We're going to set up our own X configure variables. These are only
# used in side configure. At the end, we use them to set X_LIBS.
# This allows us to be careful about libarary ordering, in case that's
# important.
AC_PATH_X
AC_PATH_XTRA
# This is how to use the variables set by AC_PATH_XTRA:
# cc @X_CFLAGS@ -c -o foo.o foo.c
# cc @X_LIBS@ (-lfoo...) @X_PRE_LIBS@ -lX11 @X_EXTRA_LIBS@
# (But see also the test for Motif libraries, below.)
# (Perhaps X_LIBS should have been called X_LDFLAGS.)
# XXX - Not all programs need all of these, surely.
X_LIBS="$X_LIBS -lXext -lXmu -lXt -lX11"
# XXX - Ask Motif what it wants
MOTIF_LIBS="-lXm"
# Let the user specify gnome paths:
GNOME_CONFIG_BIN="gnome-config"
AC_ARG_WITH( gnome-config,
[ --with-gnome-config=executable which gnome-config to use to find gnome ],
GNOME_CONFIG_BIN="$with_gnome_config")
AC_SUBST(GNOME_CONFIG_BIN)
# Let the user specify imlib paths:
AC_ARG_WITH( imlib,
[ --with-imlib=PATH specify where to look for imlib includes and libs],
X_LIBS="${X_LIBS} -L$with_imlib/lib" X_CFLAGS="$X_CFLAGS -I$with_imlib/include" )
# Let the user specify a guile-config executable.
# XXX My guile-1.3 doesn't have a guile-config, but maybe I'm
# downlevel... are there guile 1.3 .rpms or .debs that have
# guilec-config in them? if so we need to publish them.
# AC_ARG_WITH( guile-config,
# [ --with-guile-config=executable
# which guile-config to use to find guile ],
# GUILE_CONFIG="$with_guile_config")
# AC_PATH_PROG(GUILE_CONFIG,guile-config,no)
# if test x"$GUILE_CONFIG" = xno; then
# AC_MSG_ERROR([Can't find guile-config.
# Install Guile 1.3, then specify the path to guile-config with
# --with-guile-config=...])
# fi
# *******************************************
# * figure out the configure options:
AC_ARG_ENABLE( debug,
[ --enable-debug compile with debugging flags set],
CFLAGS="${CFLAGS} -g -Wall"
LDFLAGS="${LDFLAGS} -g -Wall"
AC_DEFINE(DEBUG_MEMORY,1) AC_DEFINE(USE_DEBUG,1),
AC_DEFINE(DEBUG_MEMORY,0) AC_DEFINE(USE_DEBUG,0) )
AC_ARG_ENABLE( warnings,
[ --enable-warnings compile with lots of warnings generated],
CFLAGS="${CFLAGS} -g -Wall -ansi -pedantic -Wwrite-strings -Wid-clash-31 -Wpointer-arith -Wcast-qual -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wshadow -Woverloaded-virtual -Winline -felide-constructors -fnonnull-objects"
LDFLAGS="${LDFLAGS} -g -Wall"
AC_DEFINE(DEBUG_MEMORY,1) AC_DEFINE(USE_DEBUG,1) )
# USE_QUICKFILL:
AC_DEFINE(USE_QUICKFILL,1)
# Should we uses color (red/black) balances?
AC_ARG_ENABLE( color,
[ --disable-color don't use color (red/black) balances],
AC_DEFINE(USE_NO_COLOR,1),
AC_DEFINE(USE_NO_COLOR,0) )
# Let the user specify motif paths:
AC_ARG_WITH( motif,
[ --with-motif=PATH specify where to look for motif includes and libs],
X_LIBS="${X_LIBS} -L$with_motif/lib" X_CFLAGS="$X_CFLAGS -I$with_motif/include" )
AC_ARG_WITH( motif-includes,
[ --with-motif-includes=DIR specify where to look for motif includes],
X_CFLAGS="${X_CFLAGS} -I$with_motif_includes" )
AC_ARG_WITH( motif-libraries,
[ --with-motif-libraries=DIR specify where to look for motif libs],
X_LIBS="${X_LIBS} -L$with_motif_libraries" )
AC_ARG_WITH( xmhtml-includes,
[ --with-xmhtml-includes=DIR specify where to look for xmhtml headers],
X_CFLAGS="${X_CFLAGS} -I$with_xmhtml_includes" )
AC_ARG_WITH( xmhtml-libraries,
[ --with-xmhtml-libraries=DIR specify where to look for xmhtml libs],
X_LIBS="${X_LIBS} -L$with_xmhtml_libraries" )
# Let the user specify gnome paths:
# -I...libgnomesupport is to fix bug in gnome-1.3 release
AC_ARG_WITH( gnome,
[ --with-gnome=PATH specify where to look for gnome includes and libs],
X_LIBS="${X_LIBS} -L$with_gnome/lib" X_CFLAGS="$X_CFLAGS -I$with_gnome/include -I$with_gnome/lib/gnome-libs/include" )
AC_ARG_WITH( gnome-includes,
[ --with-gnome-includes=DIR specify where to look for gnome includes],
X_CFLAGS="${X_CFLAGS} -I$with_gnome_includes -I$with_gnome_includes/libgnomesupport" )
AC_ARG_WITH( gnome-libraries,
[ --with-gnome-libraries=DIR specify where to look for gnome libs],
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)
AC_SUBST(OPT_STYLE_INSTALL)
# This appears to be what Perl's ExtUtils::MakeMaker module does, so
# I'm reasonably sure it's correct.
# PERLINCL="-I/usr/lib/perl5/i386-linux/5.00404/CORE"
# XXX - However, 'configure' should still find the proper version of Perl.
#
PERLINCL=-I`perl -MConfig -e 'print $Config{"archlibexp"},"/CORE"'`
AC_ARG_WITH( perl-includes,
[ --with-perl-includes=DIR specify where to look for perl CORE includes],
PERLINCL="-I$with_perl_includes -I$with_perl_includes/CORE" )
AC_SUBST(PERLINCL)
# *******************************************
# the XmHTML widget needs libz, libjpeg, libpng and libm
# it also uses #ifdef's not #if's so DONT #def to zero.
AC_CHECK_LIB(z, deflateEnd,
AC_DEFINE(HAVE_ZLIB,1) LIBS="-lz $LIBS")
AC_CHECK_LIB(jpeg, jpeg_read_scanlines,
AC_DEFINE(HAVE_JPEG,1) LIBS="-ljpeg $LIBS")
AC_CHECK_LIB(png, png_read_image,
AC_DEFINE(HAVE_PNG,1) LIBS="-lpng $LIBS")
## Nana
# XXX - There should probably be a --without-nana option (e.g., for
# someone who happens to have it installed on his local machine, but
# is building GnuCash for people who might not have it).
# See if the <nana.h> header file can be found.
AC_CHECK_HEADERS(nana.h)
AC_CHECK_LIB(nana,L_buffer_create,
LIBNANA="-lnana")
AC_SUBST(LIBNANA)
# This should be done in the OTHER_LIBRARIES argument to AC_CHECK_LIB
# if it's actually needed and Makefile.in's should be using
# X_PRE_LIBS, X_LIBS, and X_EXTRA_LIBS, rather than relying on LIBS.
# LIBS="-lXmu -lXt -lXext $X_PRE_LIBS -lX11 $X_LIBS $X_EXTRA_LIBS $LIBS"
AC_CHECK_LIB(Xpm, XpmReadFileToXpmImage,
AC_DEFINE(HAVE_XPM,1) X_LIBS="-lXpm $X_LIBS",
AC_DEFINE(HAVE_XPM,0), -L$x_libraries -lX11)
# 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 ...
AC_CHECK_LIB(XmHTML, XmHTMLTextScrollToLine,
MOTIF_LIBS="-lXmHTML $MOTIF_LIBS",
,
$X_PRE_LIBS $MOTIF_LIBS $X_EXTRA_LIBS $X_LIBS)
AC_SUBST(XMHTML_TARGET)
AC_SUBST(XMHTML_INC)
# If readline exists, just assume that guile needs it. It probably does.
AC_CHECK_LIB(readline, readline)
### Guile
# Set GUILELIBS according to the set of libraries needed to link
# with guile.
# 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}
for GNC_TEST_LIBS in "-lguile" "-lguile -ldl" "-lguile -lqthreads" \
"-lguile -ltermcap" "-lguile -lqthreads -ltermcap"; do
if test x"${GUILELIBS}" != x; then
AC_MSG_RESULT([found in ${GUILELIBS}])
break
else
LIBS="${GNC_TEST_LIBS} ${GNC_LIBS_SAFE}"
AC_TRY_LINK([#include<guile/gh.h>], [gh_eval_file;],
GUILELIBS="${GNC_TEST_LIBS}")
fi
done
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)
### Plotutils
AC_CHECK_LIB(plot, openpl,
AC_DEFINE(HAVE_PLOTUTILS,1)
HAVE_PLOTUTILS=1
LIBS="-lplot $LIBS"
X_LIBS="-lXaw $X_LIBS",
,
$X_PRE_LIBS $MOTIF_LIBS $X_EXTRA_LIBS -lXaw $X_LIBS)
# We need this in at least one of the Makefile.in's
AC_SUBST(HAVE_PLOTUTILS)
AC_SUBST(MOTIF_LIBS)
#############################################################
### Set up the install style and all the default paths... ###
# some confusion due to FSSTND stuff --
# the readme's and miscellaneous docs are in /usr/doc (or equivalent)
# the online help system is in /usr/share/gnucash/Doc and various subdirs
# the parsed-html report supsystem is in /usr/share/gnucash/Reports
if test ${OPT_STYLE_INSTALL} = 1
then
GNC_DOCDIR='${prefix}/doc'
GNC_BINDIR='${prefix}/bin'
GNC_LIBDIR='${prefix}/lib'
GNC_CONFIGDIR=${sysconfdir}
GNC_SHAREDIR=${datadir}
else
GNC_DOCDIR='${prefix}/doc/gnucash'
GNC_BINDIR='${prefix}/bin'
GNC_LIBDIR='${prefix}/lib/gnucash'
GNC_CONFIGDIR=${sysconfdir}/gnucash
GNC_SHAREDIR=${datadir}/gnucash
fi
AC_SUBST(GNC_DOCDIR)
AC_SUBST(GNC_BINDIR)
AC_SUBST(GNC_LIBDIR)
AC_SUBST(GNC_CONFIGDIR)
AC_SUBST(GNC_SHAREDIR)
# We have to handle these here 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_RUNTIME_SHAREDIR=`eval echo ${GNC_SHAREDIR}`
GNC_RUNTIME_CONFIGDIR=`eval echo ${GNC_CONFIGDIR}`
AC_SUBST(GNC_RUNTIME_SHAREDIR)
AC_SUBST(GNC_RUNTIME_CONFIGDIR)
# *******************************************
AC_CONFIG_HEADER(config.h)
AC_OUTPUT(Makefile
Makefile.init
src/Makefile
src/engine/Makefile
src/guile/Makefile
src/scm/Makefile
src/scm/startup/Makefile
src/gnome/Makefile
src/motif/Makefile
src/qt/Makefile
src/register/Makefile
src/reports/Makefile
src/swig/Makefile
src/swig/guile/Makefile
src/swig/perl5/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
make -f Makefile.config.finish prefix=${prefix} \
GNC_SHAREDIR=${GNC_SHAREDIR} \
GNC_CONFIGDIR=${GNC_SHAREDIR}