Hi, Andy Wingo <wi...@pobox.com> writes:
> From b03f8337ea62091208680fab901606c9af360a5d Mon Sep 17 00:00:00 2001 > From: Andy Wingo <wi...@pobox.com> > Date: Tue, 12 Apr 2011 13:12:56 +0200 > Subject: [PATCH] check for iconveh values at configure-time > > * configure.ac: Check for the iconveh values here, instead of relying on > gen-scmconfig to know them. That doesn't work in general because > gen-scmconfig runs on the build machine, not the target machine. > > * libguile/Makefile.am (gen-scmconfig.$(OBJEXT)): Revert rule to the > revision before 533d8212. > > * libguile/gen-scmconfig.h.in (SCM_I_GSC_ICONVEH_ERROR): > (SCM_I_GSC_ICONVEH_QUESTION_MARK): > (SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE): > * libguile/gen-scmconfig.c: Use configure-time substitutions to set > SCM_ICONVEH_ERROR_HANDLER et al. Nice! > #-------------------------------------------------------------------- > # > +# What values do the iconv error handlers have? > +# > +# The only place that we need iconv in our public interfaces is for > +# the error handlers, which are just ints. So we weaken our > +# dependency by looking up those values at configure-time. > +#-------------------------------------------------------------------- > +SCM_I_GSC_ICONVEH_ERROR=0 > +SCM_I_GSC_ICONVEH_QUESTION_MARK=1 > +SCM_I_GSC_ICONVEH_ESCAPE_SEQUENCE=2 > +AC_MSG_CHECKING([for iconveh_error]) > +AC_RUN_IFELSE([AC_LANG_SOURCE( > +[AC_INCLUDES_DEFAULT > +#include <uniconv.h> > +int > +main (int argc, char *argv[]) > +{ > + if (argc > 1) > + printf ("%d\n", (int)iconveh_error); > + return 0; > +}])], > + [SCM_I_GSC_ICONVEH_ERROR=`./conftest$EXEEXT pretty-please` > + AC_MSG_RESULT([$SCM_I_GSC_ICONVEH_ERROR])], > + [AC_MSG_FAILURE([failed to get iconveh_error])], > + [AC_MSG_WARN([assuming $SCM_I_GSC_ICONVEH_ERROR for > cross-compilation])]) > + > +AC_MSG_CHECKING([for iconveh_question_mark]) > +AC_RUN_IFELSE([AC_LANG_SOURCE( > +[AC_INCLUDES_DEFAULT > +#include <uniconv.h> > +int > +main (int argc, char *argv[]) > +{ > + if (argc > 1) > + printf ("%d\n", (int)iconveh_question_mark); > + return 0; > +}])], > + [SCM_I_GSC_ICONVEH_QUESTION_MARK=`./conftest$EXEEXT > pretty-please` > + AC_MSG_RESULT([$SCM_I_GSC_ICONVEH_QUESTION_MARK])], > + [AC_MSG_FAILURE([failed to get iconveh_question_mark])], > + [AC_MSG_WARN([assuming $SCM_I_GSC_ICONVEH_QUESTION_MARK for > cross-compilation])]) Looks good to me. Could you factor it into an M4 macro, use AC_CACHE_CHECK, and move that to acinclude.m4? Thanks! Ludo’.