## -*-m4-*- dnl Process this file with autoconf to produce a configure script. # FILE: # configure.in # # FUNCTION: # implements checks vfor a variety of system-specific functions # # Contents: # Headers - Autoconf header stuff # Variables - Hardcoded variables # Programs - Check for programs binaries # Functions - Check for functions # With - Check for --with/without options # Enable - Check for --enable/disable options # Libraries - Check for libraries # Footer - Autoconf footer stuff ### -------------------------------------------------------------------------- ### Headers ### check for various programs, and stuff (do this first because later ### commands depend on them): AC_INIT(src/guile/gnucash.h) AM_INIT_AUTOMAKE(gnucash,1.5.98) AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST AM_MAINTAINER_MODE AM_ACLOCAL_INCLUDE(macros) AC_PROG_INSTALL AC_PROG_CC AM_PROG_LIBTOOL AC_ARG_PROGRAM AC_ISC_POSIX AC_C_BIGENDIAN AC_PROG_MAKE_SET AC_HEADER_STDC AC_CHECK_HEADERS(limits.h) AC_CHECK_FUNCS(stpcpy memcpy timegm) STRUCT_TM_GMTOFF_CHECK SCANF_LLD_CHECK AM_PATH_GLIB if test ${no_glib}x = yesx then AC_MSG_ERROR([Cannot find glib.]) fi AC_CHECK_HEADERS(dlfcn.h dl.h utmp.h locale.h mcheck.h unistd.h) DL_LIB= AC_CHECK_FUNCS(dlopen,,[ AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl",[ AC_CHECK_LIB(dld, shl_load, DL_LIB="-ldld",[ AC_CHECK_FUNCS(dlopen, DL_LIB="", AC_MSG_ERROR(Dynamic linking is not available on this platform. Some apps, like panel, will not run properly.)) ]) ]) ]) oLIBS="$LIBS" LIBS="$LIBS $DL_LIB" AC_CHECK_FUNCS(dlerror,,) LIBS="$oLIBS" AC_SUBST(DL_LIB) GNOME_INIT GNOME_COMPILE_WARNINGS GNOME_CHECK_GDK_PIXBUF GNOME_CHECK_GUILE GNOME_PRINT_CHECK GNOME_XML_CHECK #AC_CHECK_HEADER(libxml/xmlversion.h, [ # HAVE_XML_VERSION_HEADER=1 # AC_DEFINE(HAVE_XML_VERSION_HEADER) #]) dnl Set of available languages. ALL_LINGUAS="da de en_GB es fr it ja no pt_PT ru sv" AM_GNU_GETTEXT ### -------------------------------------------------------------------------- ### Variables ### Set up all the initial variable values... AC_ARG_ENABLE(opt-style-install, [ --enable-opt-style-install install everything in subdirs of --prefix], [case "${enableval}" in yes) gnc_opt_style_install=true ;; no) gnc_opt_style_install=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-opt-style-install) ;; esac], [gnc_opt_style_install=false]) if test x${gnc_opt_style_install} = xtrue then GNC_CONFIGDIR='${sysconfdir}' GNC_LIBDIR='${libdir}' GNC_SHAREDIR='${datadir}' GNC_SCM_INSTALL_DIR='${datadir}/scm' GNC_DOC_INSTALL_DIR='${datadir}/doc' else GNC_CONFIGDIR='${sysconfdir}/gnucash' GNC_LIBDIR='${pkglibdir}' GNC_SHAREDIR='${pkgdatadir}' GNC_SCM_INSTALL_DIR='${pkgdatadir}/scm' GNC_DOC_INSTALL_DIR='${pkgdatadir}/doc' fi GNC_ACCOUNTS_DIR=${GNC_SHAREDIR}/accounts GNC_PIXMAP_DIR='${datadir}/pixmaps/gnucash' AC_SUBST(GNC_CONFIGDIR) AC_SUBST(GNC_LIBDIR) AC_SUBST(GNC_SHAREDIR) AC_SUBST(GNC_SCM_INSTALL_DIR) AC_SUBST(GNC_DOC_INSTALL_DIR) AC_SUBST(GNC_ACCOUNTS_DIR) AC_SUBST(GNC_PIXMAP_DIR) # We should always see these errors... CFLAGS="${CFLAGS} -Wall" AC_ARG_ENABLE(error-on-warning, [ --enable-error-on-warning treat compile warnings as errors], [case "${enableval}" in yes) CFLAGS="${CFLAGS} -Werror"; enable_compile_warnings=no ;; no) ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-error-on-warning) ;; esac]) # This has to come after AC_PROG_CC if test ${GCC}x = yesx then CFLAGS="${CFLAGS} -Wno-unused" CFLAGS="${CFLAGS} -Werror-implicit-function-declaration" fi AC_ARG_ENABLE( debug, [ --enable-debug compile with debugging flags set], CFLAGS="${CFLAGS} -g" LDFLAGS="${LDFLAGS} -g" AC_DEFINE(DEBUG_MEMORY,1), AC_DEFINE(DEBUG_MEMORY,0) ) AC_ARG_ENABLE( profile, [ --enable-profile compile with profiling set], CFLAGS="${CFLAGS} -pg" LDFLAGS="${LDFLAGS} -pg") ### -------------------------------------------------------------------------- ### SQL # Check to see if the user wants to have Postgres support AC_ARG_ENABLE( sql, [ --enable-sql compile with sql support], [ if test "x$enableval" != "xno" ; then AC_CHECK_HEADERS(pgsql/libpq-fe.h postgresql/libpq-fe.h) if test "x$ac_cv_header_pgsql_libpq_fe_h$ac_cv_header_postgresql_libpq_fe_h" == xnono; then AC_MSG_ERROR([Cannot find PosgreSQL headers; won't build sql backend]) else if test "x$ac_cv_header_pgsql_libpq_fe_h" != xno; then CFLAGS="${CFLAGS} -I/usr/include/pgsql" fi if test "x$ac_cv_header_postgresql_libpq_fe_h" != xno; then CFLAGS="${CFLAGS} -I/usr/include/postgresql" fi saved_LIBS="$LIBS" LIBS="-lpq $LIBS" AC_MSG_CHECKING(for libpq) AC_TRY_LINK( [ #include ], [ PQconnectdb("asdf"); ], [ AC_MSG_RESULT(yes) SQL_DIR=sql ], [ AC_MSG_ERROR([Cannot find PosgreSQL libraries; won't build sql backend]) ] ) fi fi ] ) AC_SUBST(SQL_DIR) ### -------------------------------------------------------------------------- ### RPC AC_ARG_ENABLE( rpc, [ --enable-rpc compile with rpc support], RPC_DIR=rpc) AC_SUBST(RPC_DIR) ### -------------------------------------------------------------------------- ### i18n AC_ARG_WITH( locale-dir, [ --with-locale-dir=PATH specify where to look for locale-specific information], LOCALE_DIR="$with_locale_dir", LOCALE_DIR="\${prefix}/share/locale") AC_SUBST(LOCALE_DIR) dnl check for nl_langinfo(D_FMT) which is missing on FreeBSD LANGINFO_D_FMT_CHECK ### -------------------------------------------------------------------------- ### help files AC_ARG_WITH( help-prefix, [ --with-help-prefix=PATH specify where to store the help files], GNC_HELPDIR="$with_help_prefix/gnome/help/gnucash", GNC_HELPDIR="\${datadir}/gnome/help/gnucash") AC_SUBST(GNC_HELPDIR) ### -------------------------------------------------------------------------- ### Check for etags AC_ARG_ENABLE( etags, [ --enable-etags enable automatic create of TAGS file], if test $enableval = yes; then USE_ETAGS=1 fi, USE_ETAGS=0) if test ${USE_ETAGS} = 1; then AC_CHECK_PROG(GNC_TAGS_FILE, etags, TAGS) fi AM_CONDITIONAL(GNC_TAGS_FILE, test x${GNC_TAGS_FILE} = xTAGS) ### -------------------------------------------------------------------------- ### Check for glade AC_ARG_WITH(glade, [ --with-glade=FILE which glade executable to use ], GLADE="${with_glade}") # If the user didn't specify a glade, then go fetch. if test x"$GLADE" = x; then AC_PATH_PROG(GLADE, glade) fi # Make sure glade was found #if test x"$GLADE" = x; then # AC_MSG_ERROR([Cannot find Glade.]) #fi AC_SUBST(GLADE) ### -------------------------------------------------------------------------- ### Check for perl # Check for perl, force version 5 AC_ARG_WITH(perl, [ --with-perl=FILE which perl executable to use ], PERL="${with_perl}") # If the user didn't specify a perl, then go fetch. if test x"$PERL" = x; then AC_PATH_PROG(PERL, perl) fi # Make sure Perl was found if test x"$PERL" = x; then AC_MSG_ERROR([Cannot find Perl. Try using the --with-perl flag.]) fi # Make sure it's version 5 or later if "$PERL" -e 'exit 1 if $] < 5.0'; then : else AC_MSG_ERROR([Found ${PERL} reports version ] [`${PERL} -e 'print $]'`, need version 5.*]) fi AC_SUBST(PERL) # Now check for perl headers # This appears to be what Perl's ExtUtils::MakeMaker module does, so # I'm reasonably sure it's correct. # PERLINCL="/usr/lib/perl5/i386-linux/5.00404" # PERLINCL=`$PERL -MConfig -e 'print $Config{"archlibexp"}'` AC_ARG_WITH( perl-includes, [ --with-perl-includes=DIR specify where to look for perl includes], PERLINCL="$with_perl_includes" ) AC_SUBST(PERLINCL) ### -------------------------------------------------------------------------- ### Libraries LIBS="$LIBS -lm" ### -------------------------------------------------------------------------- ### Berkeley db AC_ARG_ENABLE(prefer-db1, [ --enable-prefer-db1 Prefer Berkeley DB 1.x],[prefer_db1="$enableval"],[prefer_db1=yes]) DB_LIBS= AC_CHECK_FUNC(dbopen, [], if test "$prefer_db1" = "yes"; then AC_CHECK_LIB(db1, dbopen, DB_LIBS="-ldb1", AC_CHECK_LIB(db, dbopen, DB_LIBS="-ldb", AC_MSG_ERROR([Your db library is missing db 1.85 compatibility mode]) ) ) else AC_CHECK_LIB(db, dbopen, DB_LIBS="-ldb", AC_CHECK_LIB(db1, dbopen, DB_LIBS="-ldb1", AC_MSG_ERROR([Your db library is missing db 1.85 compatibility mode]) ) ) fi ) dnl look for db headers if test "$prefer_db1" = "yes"; then AC_CHECK_HEADERS(db_185.h db1/db.h) if test "$ac_cv_header_db_185_h$ac_cv_header_db1_db_h" = nono; then AC_MSG_ERROR([Berkeley db library required for GnuCash]) fi AC_DEFINE(PREFER_DB1) else AC_CHECK_HEADERS(db.h db_185.h db1/db.h) if test "$ac_cv_header_db_h$ac_cv_header_db_185_h$ac_cv_header_db1_db_h" = nonono; then AC_MSG_ERROR([Berkeley db library required for GnuCash]) fi fi AC_SUBST(DB_LIBS) ### -------------------------------------------------------------------------- ### Gnome XML -- GNOME_XML_LIB is define by GNOME_XML_CHECK GNOME_XML_CFLAGS=`$GNOME_CONFIG --cflags xml` AC_SUBST(GNOME_XML_CFLAGS) ### -------------------------------------------------------------------------- GTKHTML_LIBS=`$GNOME_CONFIG --libs gtkhtml` GTKHTML_CFLAGS=`$GNOME_CONFIG --cflags gtkhtml` AC_CHECK_LIB(gal, main, true, [AC_MSG_ERROR([gal library not found])], `$GNOME_CONFIG --libs gal`) # check for gtkhtml and enable it via HAVE_LIBGTKHTML # if found AC_CHECK_LIB(gtkhtml, gtk_html_new, GNOMEBUILDLIBS="${GNOMEBUILDLIBS} gtkhtml" AC_DEFINE(HAVE_LIBGTKHTML), AC_MSG_ERROR([Cannot find gtkhtml. See the README for more info.]), $GTKHTML_LIBS) GHTTP_LIBS=`$GNOME_CONFIG --libs ghttp` GHTTP_CFLAGS=`$GNOME_CONFIG --cflags ghttp` # Note: this doesn't croak if GHTTP_LIBS is empty! (e.g. on RH6.2) AC_CHECK_LIB(ghttp, ghttp_request_new, GNOMEBUILDLIBS="${GNOMEBUILDLIBS} ghttp" AC_DEFINE(HAVE_LIBGHTTP) if test "x$GHTTP_LIBS" = "x" ; then GHTTP_LIBS=-lghttp fi, AC_MSG_ERROR([Cannot find ghttp. See the README for more info.]), $GHTTP_LIBS) AC_CHECK_LIB(ghttp, ghttp_enable_ssl, AC_DEFINE(HAVE_OPENSSL), AC_MSG_WARN([****** ghttp does not have SSL support.]), $GHTTP_LIBS) AC_SUBST(GTKHTML_LIBS) AC_SUBST(GTKHTML_CFLAGS) AC_SUBST(GHTTP_LIBS) AC_SUBST(GHTTP_CFLAGS) ### -------------------------------------------------------------------------- ### guppi AC_ARG_ENABLE( guppi, [ --disable-guppi compile without guppi support], if test $enableval = no; then USE_GUPPI=0 else USE_GUPPI=1 fi, USE_GUPPI=1 ) if test ${USE_GUPPI} = 0; then AC_MSG_WARN([Compiling without guppi support]) else AC_DEFINE(USE_GUPPI) AC_ARG_ENABLE( efence, [ --enable-efence link using efence], if test $enableval = yes; then EFENCE_LIBS="-lefence" USE_EFENCE=1 fi, USE_EFENCE=0 EFENCE_LIBS="") AC_DEFINE(USE_EFENCE) AC_SUBST(EFENCE_LIBS) ## Things guppi needs (actually are these guppi dependencies or gtkhtml's?) # LAME: if you ask gnome-config for the zvt libs, it doesn't include # imlib, though it needs it so we'll just steal gtkhtml's which does. AC_CHECK_LIB(zvt, main, true, [AC_MSG_ERROR([libzvt development files not found. Guppi requires them.])], `$GNOME_CONFIG --libs zvt gtkhtml`) AC_CHECK_LIB(bonobo, main, true, [AC_MSG_ERROR([libbonobo development files not found. Guppi requires them.]) ], `$GNOME_CONFIG --libs bonobo`) AC_CHECK_LIB(oaf, main, true, [AC_MSG_ERROR([liboaf development files not found. Guppi requires them.])], `$GNOME_CONFIG --libs oaf`) AC_CHECK_LIB(glade, main, true, [AC_MSG_ERROR([libglade development files not found. Guppi requires them.])] , `$GNOME_CONFIG --libs libglade`) ## guppi itself. GUPPI_LIBS=`$GNOME_CONFIG --libs libguppi` GUPPI_CFLAGS=`$GNOME_CONFIG --cflags libguppi` LIBGUPPI_CHECK AC_SUBST(GUPPI_LIBS) AC_SUBST(GUPPI_CFLAGS) fi ### -------------------------------------------------------------------------- ### XIM AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=yes]], , enable_xim="yes") if test "x$enable_xim" = "xyes"; then GTK_XIM_FLAGS="-DUSE_XIM" fi AC_SUBST(GTK_XIM_FLAGS) ### -------------------------------------------------------------------------- ### popt AC_CHECK_LIB(popt, poptStrippedArgv,, [AC_MSG_ERROR([ popt 1.5 or newer is required to build gnucash. You can download the latest version from ftp://people.redhat.com/sopwith/popt/, or if you're running Debian, install the libpopt-dev pacakge. ])]) ### -------------------------------------------------------------------------- ## For now, we just presume you're using the GNOME version. The other ## UI's haven't been carried over during the automake transition. At ## some point, if it's deemed worthwhile, they can be resurrected... GNOME=1 AC_DEFINE(GNOME) ### -------------------------------------------------------------------------- ### G-wrap (libraries and executable) G_WRAP_COMPILE_ARGS="" G_WRAP_LINK_ARGS="" AM_PATH_GWRAP(1.1.5, , [AC_MSG_ERROR([ g-wrap does not appear to be installed correctly, or is not new enough. Right now gnucash requires at least version 1.1.5 to build. If you need to install g-wrap, you can find it at ftp://ftp.gnucash.org/pub/g-wrap. ])]) # Find out what the g-wrap compile and link flags are. AC_MSG_CHECKING(for g-wrap compile args) G_WRAP_COMPILE_ARGS=`${G_WRAP_CONFIG} --c-compile-args guile` AC_MSG_RESULT($G_WRAP_COMPILE_ARGS) AC_MSG_CHECKING(for g-wrap link args) G_WRAP_LINK_ARGS=`${G_WRAP_CONFIG} --c-link-args guile` AC_MSG_RESULT($G_WRAP_LINK_ARGS) AC_MSG_CHECKING(for g-wrap module directory) G_WRAP_MODULE_DIR=`${G_WRAP_CONFIG} --guile-module-directory` AC_MSG_RESULT($G_WRAP_MODULE_DIR) AC_GWRAP_CHECK_GUILE AC_SUBST(G_WRAP_CONFIG) AC_SUBST(G_WRAP_COMPILE_ARGS) AC_SUBST(G_WRAP_LINK_ARGS) AC_SUBST(G_WRAP_MODULE_DIR) ### -------------------------------------------------------------------------- ### Check size of long_long - some guile's are broken. AC_MSG_CHECKING(if guile long_long is at least as big as gint64) GNC_OLDCFLAGS="$CFLAGS" CFLAGS="${GNOME_INCLUDEDIR} ${GUILE_INCS} ${CFLAGS} ${GLIB_CFLAGS}" AC_TRY_RUN([ #include #include int main(int argc, char *argv[]) { return(!(sizeof(long_long) >= sizeof(gint64))); } ],[ AC_MSG_RESULT(yes) AC_DEFINE(GUILE_LONG_LONG_OK,1,is sizeof(long_long) >= sizeof(gint64)) ],[ AC_MSG_RESULT(no) ]) CFLAGS="$GNC_OLDCFLAGS" # One of the places this is critical is in gnc_scm_to_gint64 and inverse. # However, I'm sure we require this elsewhere, so don't remove this test # unless you've done sufficient code review/testing. AC_MSG_CHECKING(if unsigned long is at least as big as guint32) GNC_OLDCFLAGS="$CFLAGS" CFLAGS="${GNOME_INCLUDEDIR} ${GUILE_INCS} ${CFLAGS} ${GLIB_CFLAGS}" AC_TRY_RUN([ #include int main(int argc, char *argv[]) { return(!(sizeof(unsigned long) >= sizeof(guint32))); } ],[ AC_MSG_RESULT(yes) ],[ AC_MSG_RESULT(no) AC_MSG_ERROR(cannot continue, size of unsigned long too small.) ]) CFLAGS="$GNC_OLDCFLAGS" ### -------------------------------------------------------------------------- ### Makefile creation AC_OUTPUT( dnl # Makefiles Makefile accounts/Makefile accounts/C/Makefile debian/Makefile doc/Makefile doc/examples/Makefile doc/html/Makefile doc/html/fr/Makefile doc/html/fr/image/Makefile doc/sgml/Makefile doc/sgml/C/Makefile doc/sgml/C/image/Makefile doc/sgml/es/Makefile doc/sgml/pt_PT/Makefile doc-tools/Makefile intl/Makefile lib/Makefile lib/guile-www/Makefile lib/srfi/Makefile macros/Makefile po/Makefile.in po/Makefile rpm/Makefile src/Makefile src/calculation/Makefile src/doc/Makefile src/doc/design/Makefile src/engine/Makefile src/engine/sql/Makefile src/engine/rpc/Makefile src/experimental/Makefile src/experimental/cbb/Makefile src/experimental/cbb/cbb-engine/Makefile src/experimental/cgi-bin/Makefile src/experimental/gg/Makefile src/experimental/ofx/Makefile src/experimental/ofx/dtd/Makefile src/experimental/ofx/explore/Makefile src/experimental/ofx/parser/Makefile src/gnome/Makefile src/guile/Makefile src/optional/Makefile src/pixmaps/Makefile src/quotes/Makefile src/register/Makefile src/register/gnome/Makefile src/scm/Makefile src/scm/gnumeric/Makefile src/scm/printing/Makefile src/scm/qif-import/Makefile src/scm/report/Makefile src/test/Makefile dnl # non-makefiles dnl # Please read doc/build-system before adding *anything* here , dnl # commands go here, but we don't have any right now )