From b3781c16d0d84be66bdd4b4a507ca5803f394f57 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Thu, 29 Jan 2015 13:39:23 -0800 Subject: [PATCH] Bug 731889 - guile 2 exports different autoconf macros than what is expected Replace the autogen-sh time configuration which doesn't really work correctly by making a local interpreter which links whichever library pkg-config finds. Also makes Guile-2.0 the default by looking for it first. --- Makefile.am | 5 ++++ configure.ac | 31 ++++++----------------- util/guile.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 23 deletions(-) create mode 100644 util/guile.c diff --git a/Makefile.am b/Makefile.am index 432800fb4f..443be45de1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,6 +6,11 @@ GNC_ETAGS_FILE = @GNC_ETAGS_FILE@ noinst_DATA = make-gnucash-potfiles +noinst_PROGRAMS = gnc-guile +gnc_guile_SOURCES = util/guile.c +gnc_guile_CFLAGS = ${GUILE_CFLAGS} +gnc_guile_LDADD = ${GUILE_LIBS} + dist_doc_DATA = \ AUTHORS \ COPYING \ diff --git a/configure.ac b/configure.ac index dd504a634f..e09df33b9c 100644 --- a/configure.ac +++ b/configure.ac @@ -452,31 +452,16 @@ AC_CHECK_FUNCS(gethostid link) # - check minimum version # - determine GUILE_CFLAGS and GUILE_LIBS -# Note: systems that install both guile 1.8 and guile 2 use different -# names for the 1.8 and 2.0 autoconf macros to avoid conflicts. -# So the tests below will check for known macro names in the order -# that we assume will always result in the proper macros being called -# for the guile version that has been detected. gnc_have_guile_2=no gnc_have_guile_www=no PKG_CHECK_MODULES(GUILE, - [guile-1.8 >= 1.8.5], - [m4_ifdef([GUILE1_8_PROGS], - [ GUILE1_8_PROGS ], - [ m4_ifdef([GUILE1_PROGS], - [ GUILE1_PROGS ], - [ GUILE_PROGS ])]) - ], [ - PKG_CHECK_MODULES(GUILE, [guile-2.0 >= 2.0.0], - [m4_ifdef([GUILE_PROGS], - [ GUILE_PROGS - gnc_have_guile_2=yes ], - [ AC_MSG_ERROR([ guile 2 is found on your system, but we did - find the right autoconf macros. Please rerun autogen.sh first. If this - does not solve the problem, please report this as a bug - in GnuCash, so we can fix this for your platform.]) ]) - ], + [gnc_have_guile_2=yes + GUILE_EFFECTIVE_VERSION=2.0 + AC_PATH_PROG([GUILD], guild)], + [PKG_CHECK_MODULES(GUILE, + [guile-1.8 >= 1.8.5], + [GUILE_EFFECTIVE_VERSION=1.8], [AC_MSG_ERROR([ guile does not appear to be installed correctly, or is not in the correct version range. Perhaps you have not installed the guile @@ -484,9 +469,9 @@ PKG_CHECK_MODULES(GUILE, ])]) ]) -AM_CONDITIONAL(GNC_HAVE_GUILE_2, test "${gnc_have_guile_2}" = yes) +AM_CONDITIONAL(GNC_HAVE_GUILE_2, test "x${gnc_have_guile_2}" = xyes) AC_SUBST(GUILE_EFFECTIVE_VERSION) - +AC_SUBST(GUILE, [`pwd`/gnc-guile]) ### -------------------------------------------------------------------------- ### SWIG version checks (only when building from SCM) diff --git a/util/guile.c b/util/guile.c new file mode 100644 index 0000000000..3e01b57d23 --- /dev/null +++ b/util/guile.c @@ -0,0 +1,71 @@ +/* Copyright (C) 1996,1997,2000,2001, 2006, 2008 Free Software Foundation, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* This is the 'main' function for the `guile' executable. It is not + included in libguile.a. + + Eventually, we hope this file will be automatically generated, + based on the list of installed, statically linked libraries on the + system. For now, please don't put interesting code in here. */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef __MINGW32__ +# define SCM_IMPORT 1 +#endif +#include + +#ifdef HAVE_CONFIG_H +#include +#endif +#include + +#ifdef HAVE_WINSOCK2_H +#include +#endif + +static void +inner_main (void *closure SCM_UNUSED, int argc, char **argv) +{ +#ifdef __MINGW32__ + /* This is necessary to startup the Winsock API under Win32. */ + WSADATA WSAData; + WSAStartup (0x0202, &WSAData); +#endif /* __MINGW32__ */ + + /* module initializations would go here */ + scm_shell (argc, argv); + +#ifdef __MINGW32__ + WSACleanup (); +#endif /* __MINGW32__ */ +} + +int +main (int argc, char **argv) +{ + scm_boot_guile (argc, argv, inner_main, 0); + return 0; /* never reached */ +} + +/* + Local Variables: + c-file-style: "gnu" + End: +*/