> -----Original Message-----
> From: Iain Sandoe <iains....@gmail.com>
> Sent: Thursday, March 20, 2025 08:20
> To: rdub...@symas.com; gcc-patches@gcc.gnu.org
> Subject: [PATCH] libgcobol: Add configure checks for iconv.
> 
> Tested on x86_64 Linux, Darwin, OK for trunk?
> thanks
> Iain

I ran my full test suite, including EBCDIC tests.

Everything passes; I see no adverse affects.

LGTM

> 
> --- 8< ---
> 
> Some targets might need to add libraries to get iconv support.
> 
> libgcobol/ChangeLog:
> 
>       * Makefile.am: Use LIBICONV.
>       * Makefile.in: Regenerate.
>       * aclocal.m4: Regenerate.
>       * config.h.in: Regenerate.
>       * configure: Regenerate.
>       * configure.ac: Check for iconv support.
> 
> Signed-off-by: Iain Sandoe <i...@sandoe.co.uk>
> ---
>  libgcobol/Makefile.am  |   2 +-
>  libgcobol/Makefile.in  |   8 +-
>  libgcobol/aclocal.m4   |   4 +
>  libgcobol/config.h.in  |   6 +
>  libgcobol/configure    | 914 ++++++++++++++++++++++++++++++++++++++++-
>  libgcobol/configure.ac |   3 +
>  6 files changed, 933 insertions(+), 4 deletions(-)
> 
> diff --git a/libgcobol/Makefile.am b/libgcobol/Makefile.am
> index eddf209807e..888cbf2b0b0 100644
> --- a/libgcobol/Makefile.am
> +++ b/libgcobol/Makefile.am
> @@ -48,7 +48,7 @@ libgcobol_la_LINK = $(LIBTOOL) --mode=link --tag=CXX
> $(CXX)        \
>               -Wc,-shared-libgcc                              \
>               -version-info $(LIBGCOBOL_VERSION)              \
>               -lstdc++                                        \
> -             $(LTLDFLAGS)
> +             $(LTLDFLAGS) $(LTLIBICONV)
> 
>  WARN_CFLAGS = -W -Wall -Wwrite-strings
> 
> diff --git a/libgcobol/Makefile.in b/libgcobol/Makefile.in
> index a6096d2a64a..1a1e2ee39eb 100644
> --- a/libgcobol/Makefile.in
> +++ b/libgcobol/Makefile.in
> @@ -113,7 +113,11 @@ target_triplet = @target@
>  subdir = .
>  ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
>  am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
> +     $(top_srcdir)/../config/iconv.m4 \
>       $(top_srcdir)/../config/lead-dot.m4 \
> +     $(top_srcdir)/../config/lib-ld.m4 \
> +     $(top_srcdir)/../config/lib-link.m4 \
> +     $(top_srcdir)/../config/lib-prefix.m4 \
>       $(top_srcdir)/../config/multi.m4 \
>       $(top_srcdir)/../config/override.m4 \
>       $(top_srcdir)/../config/toolexeclibdir.m4 \
> @@ -300,11 +304,13 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
>  LD = @LD@
>  LDFLAGS = @LDFLAGS@
>  LIBGCOBOL_VERSION = @LIBGCOBOL_VERSION@
> +LIBICONV = @LIBICONV@
>  LIBOBJS = @LIBOBJS@
>  LIBS = @LIBS@
>  LIBTOOL = @LIBTOOL@
>  LIPO = @LIPO@
>  LN_S = @LN_S@
> +LTLIBICONV = @LTLIBICONV@
>  LTLIBOBJS = @LTLIBOBJS@
>  MAINT = @MAINT@
>  MAKEINFO = @MAKEINFO@
> @@ -422,7 +428,7 @@ libgcobol_la_LINK = $(LIBTOOL) --mode=link --tag=CXX
> $(CXX)        \
>               -Wc,-shared-libgcc                              \
>               -version-info $(LIBGCOBOL_VERSION)              \
>               -lstdc++                                        \
> -             $(LTLDFLAGS)
> +             $(LTLDFLAGS) $(LTLIBICONV)
> 
>  WARN_CFLAGS = -W -Wall -Wwrite-strings
> 
> diff --git a/libgcobol/aclocal.m4 b/libgcobol/aclocal.m4
> index 1d5125ec2f0..25c8b71df87 100644
> --- a/libgcobol/aclocal.m4
> +++ b/libgcobol/aclocal.m4
> @@ -1188,7 +1188,11 @@ AC_SUBST([am__untar])
>  ]) # _AM_PROG_TAR
> 
>  m4_include([../config/depstand.m4])
> +m4_include([../config/iconv.m4])
>  m4_include([../config/lead-dot.m4])
> +m4_include([../config/lib-ld.m4])
> +m4_include([../config/lib-link.m4])
> +m4_include([../config/lib-prefix.m4])
>  m4_include([../config/multi.m4])
>  m4_include([../config/override.m4])
>  m4_include([../config/toolexeclibdir.m4])
> diff --git a/libgcobol/config.h.in b/libgcobol/config.h.in
> index 39b20448078..a7e5675c43c 100644
> --- a/libgcobol/config.h.in
> +++ b/libgcobol/config.h.in
> @@ -6,6 +6,9 @@
>  /* Define to 1 if you have the <dlfcn.h> header file. */
>  #undef HAVE_DLFCN_H
> 
> +/* Define if you have the iconv() function and it works. */
> +#undef HAVE_ICONV
> +
>  /* Define to 1 if you have the <inttypes.h> header file. */
>  #undef HAVE_INTTYPES_H
> 
> @@ -36,6 +39,9 @@
>  /* Define to 1 if you have the <unistd.h> header file. */
>  #undef HAVE_UNISTD_H
> 
> +/* Define as const if the declaration of iconv() needs const. */
> +#undef ICONV_CONST
> +
>  /* Define to the sub-directory in which libtool stores uninstalled
> libraries.
>     */
>  #undef LT_OBJDIR
> diff --git a/libgcobol/configure b/libgcobol/configure
> index 73433ebb13d..1db4e792e03 100755
> --- a/libgcobol/configure
> +++ b/libgcobol/configure
> @@ -634,6 +634,8 @@ ac_subst_vars='am__EXEEXT_FALSE
>  am__EXEEXT_TRUE
>  LTLIBOBJS
>  LIBOBJS
> +LTLIBICONV
> +LIBICONV
>  extra_darwin_ldflags_libgcobol
>  VERSION_SUFFIX
>  LIBGCOBOL_VERSION
> @@ -804,6 +806,9 @@ enable_fast_install
>  with_gnu_ld
>  enable_libtool_lock
>  enable_darwin_at_rpath
> +enable_rpath
> +with_libiconv_prefix
> +with_libiconv_type
>  '
>        ac_precious_vars='build_alias
>  host_alias
> @@ -1456,6 +1461,7 @@ Optional Features:
>    --enable-darwin-at-rpath
>                            install libraries with @rpath/library-name,
> requires
>                            rpaths to be added to executables
> +  --disable-rpath         do not hardcode runtime library paths
> 
>  Optional Packages:
>    --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
> @@ -1471,6 +1477,10 @@ Optional Packages:
>    --with-pic              try to use only PIC/non-PIC objects
> [default=use
>                            both]
>    --with-gnu-ld           assume the C compiler uses GNU ld
[default=no]
> +  --with-gnu-ld           assume the C compiler uses GNU ld default=no
> +  --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and
> DIR/lib
> +  --without-libiconv-prefix     don't search for libiconv in includedir
> and libdir
> +  --with-libiconv-type=TYPE     type of library to search for
> (auto/static/shared)
> 
>  Some influential environment variables:
>    CC          C compiler command
> @@ -12891,7 +12901,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 12894 "configure"
> +#line 12904 "configure"
>  #include "confdefs.h"
> 
>  #if HAVE_DLFCN_H
> @@ -12997,7 +13007,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 13000 "configure"
> +#line 13010 "configure"
>  #include "confdefs.h"
> 
>  #if HAVE_DLFCN_H
> @@ -17183,6 +17193,906 @@ case $host in
>  esac
> 
> 
> +# For iconv support.
> +
> +      if test "X$prefix" = "XNONE"; then
> +    acl_final_prefix="$ac_default_prefix"
> +  else
> +    acl_final_prefix="$prefix"
> +  fi
> +  if test "X$exec_prefix" = "XNONE"; then
> +    acl_final_exec_prefix='${prefix}'
> +  else
> +    acl_final_exec_prefix="$exec_prefix"
> +  fi
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-gnu-ld was given.
> +if test "${with_gnu_ld+set}" = set; then :
> +  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
> +else
> +  with_gnu_ld=no
> +fi
> +
> +# Prepare PATH_SEPARATOR.
> +# The user is always right.
> +if test "${PATH_SEPARATOR+set}" != set; then
> +  echo "#! /bin/sh" >conf$$.sh
> +  echo  "exit 0"   >>conf$$.sh
> +  chmod +x conf$$.sh
> +  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
> +    PATH_SEPARATOR=';'
> +  else
> +    PATH_SEPARATOR=:
> +  fi
> +  rm -f conf$$.sh
> +fi
> +ac_prog=ld
> +if test "$GCC" = yes; then
> +  # Check if gcc -print-prog-name=ld gives a path.
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by GCC"
> >&5
> +$as_echo_n "checking for ld used by GCC... " >&6; }
> +  case $host in
> +  *-*-mingw*)
> +    # gcc leaves a trailing carriage return which upsets mingw
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
> +  *)
> +    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
> +  esac
> +  case $ac_prog in
> +    # Accept absolute paths.
> +    [\\/]* | [A-Za-z]:[\\/]*)
> +      re_direlt='/[^/][^/]*/\.\./'
> +      # Canonicalize the path of ld
> +      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
> +      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
> +     ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
> +      done
> +      test -z "$LD" && LD="$ac_prog"
> +      ;;
> +  "")
> +    # If it fails, then pretend we aren't using GCC.
> +    ac_prog=ld
> +    ;;
> +  *)
> +    # If it is relative, then search for the first ld in PATH.
> +    with_gnu_ld=unknown
> +    ;;
> +  esac
> +elif test "$with_gnu_ld" = yes; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
> +$as_echo_n "checking for GNU ld... " >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
> +$as_echo_n "checking for non-GNU ld... " >&6; }
> +fi
> +if ${acl_cv_path_LD+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  if test -z "$LD"; then
> +  IFS="${IFS=        }"; ac_save_ifs="$IFS";
IFS="${IFS}${PATH_SEPARATOR-:}"
> +  for ac_dir in $PATH; do
> +    test -z "$ac_dir" && ac_dir=.
> +    if test -f "$ac_dir/$ac_prog" || test -f
> "$ac_dir/$ac_prog$ac_exeext"; then
> +      acl_cv_path_LD="$ac_dir/$ac_prog"
> +      # Check to see if the program is GNU ld.  I'd rather use
--version,
> +      # but apparently some GNU ld's only accept -v.
> +      # Break only if it was the GNU/non-GNU ld that we prefer.
> +      if "$acl_cv_path_LD" -v 2>&1 < /dev/null | $EGREP '(GNU|with
BFD)'
> > /dev/null; then
> +     test "$with_gnu_ld" != no && break
> +      else
> +     test "$with_gnu_ld" != yes && break
> +      fi
> +    fi
> +  done
> +  IFS="$ac_save_ifs"
> +else
> +  acl_cv_path_LD="$LD" # Let the user override the test with a path.
> +fi
> +fi
> +
> +LD="$acl_cv_path_LD"
> +if test -n "$LD"; then
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
> +$as_echo "$LD" >&6; }
> +else
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
> +$as_echo "no" >&6; }
> +fi
> +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH"
> "$LINENO" 5
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD)
is
> GNU ld" >&5
> +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
> +if ${acl_cv_prog_gnu_ld+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  # I'd rather use --version here, but apparently some GNU ld's only
> accept -v.
> +if $LD -v 2>&1 </dev/null | $EGREP '(GNU|with BFD)' 1>&5; then
> +  acl_cv_prog_gnu_ld=yes
> +else
> +  acl_cv_prog_gnu_ld=no
> +fi
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_prog_gnu_ld"
>&5
> +$as_echo "$acl_cv_prog_gnu_ld" >&6; }
> +with_gnu_ld=$acl_cv_prog_gnu_ld
> +
> +
> +
> +                                                { $as_echo
> "$as_me:${as_lineno-$LINENO}: checking for shared library run path
origin"
> >&5
> +$as_echo_n "checking for shared library run path origin... " >&6; }
> +if ${acl_cv_rpath+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +
> +    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD"
> with_gnu_ld="$with_gnu_ld" \
> +    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" >
> conftest.sh
> +    . ./conftest.sh
> +    rm -f ./conftest.sh
> +    acl_cv_rpath=done
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5
> +$as_echo "$acl_cv_rpath" >&6; }
> +  wl="$acl_cv_wl"
> +  libext="$acl_cv_libext"
> +  shlibext="$acl_cv_shlibext"
> +  hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
> +  hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
> +  hardcode_direct="$acl_cv_hardcode_direct"
> +  hardcode_minus_L="$acl_cv_hardcode_minus_L"
> +    # Check whether --enable-rpath was given.
> +if test "${enable_rpath+set}" = set; then :
> +  enableval=$enable_rpath; :
> +else
> +  enable_rpath=yes
> +fi
> +
> +
> +
> +
> +
> +
> +
> +
> +    use_additional=yes
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +    eval additional_includedir=\"$includedir\"
> +    eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-libiconv-prefix was given.
> +if test "${with_libiconv_prefix+set}" = set; then :
> +  withval=$with_libiconv_prefix;
> +    if test "X$withval" = "Xno"; then
> +      use_additional=no
> +    else
> +      if test "X$withval" = "X"; then
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +          eval additional_includedir=\"$includedir\"
> +          eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      else
> +        additional_includedir="$withval/include"
> +        additional_libdir="$withval/lib"
> +      fi
> +    fi
> +
> +fi
> +
> +
> +# Check whether --with-libiconv-type was given.
> +if test "${with_libiconv_type+set}" = set; then :
> +  withval=$with_libiconv_type;  with_libiconv_type=$withval
> +else
> +   with_libiconv_type=auto
> +fi
> +
> +  lib_type=`eval echo \$with_libiconv_type`
> +
> +      LIBICONV=
> +  LTLIBICONV=
> +  INCICONV=
> +  rpathdirs=
> +  ltrpathdirs=
> +  names_already_handled=
> +  names_next_round='iconv '
> +  while test -n "$names_next_round"; do
> +    names_this_round="$names_next_round"
> +    names_next_round=
> +    for name in $names_this_round; do
> +      already_handled=
> +      for n in $names_already_handled; do
> +        if test "$n" = "$name"; then
> +          already_handled=yes
> +          break
> +        fi
> +      done
> +      if test -z "$already_handled"; then
> +        names_already_handled="$names_already_handled $name"
> +                        uppername=`echo "$name" | sed -e
> 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
> +        eval value=\"\$HAVE_LIB$uppername\"
> +        if test -n "$value"; then
> +          if test "$value" = yes; then
> +            eval value=\"\$LIB$uppername\"
> +            test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+
> }$value"
> +            eval value=\"\$LTLIB$uppername\"
> +            test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+
> }$value"
> +          else
> +                                    :
> +          fi
> +        else
> +                              found_dir=
> +          found_la=
> +          found_so=
> +          found_a=
> +          if test $use_additional = yes; then
> +            if test -n "$shlibext" && test -f
> "$additional_libdir/lib$name.$shlibext" && test x$lib_type != xstatic;
> then
> +              found_dir="$additional_libdir"
> +              found_so="$additional_libdir/lib$name.$shlibext"
> +              if test -f "$additional_libdir/lib$name.la"; then
> +                found_la="$additional_libdir/lib$name.la"
> +              fi
> +            elif test x$lib_type != xshared; then
> +              if test -f "$additional_libdir/lib$name.$libext"; then
> +                found_dir="$additional_libdir"
> +                found_a="$additional_libdir/lib$name.$libext"
> +                if test -f "$additional_libdir/lib$name.la"; then
> +                  found_la="$additional_libdir/lib$name.la"
> +                fi
> +              fi
> +            fi
> +          fi
> +          if test "X$found_dir" = "X"; then
> +            for x in $LDFLAGS $LTLIBICONV; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +              case "$x" in
> +                -L*)
> +                  dir=`echo "X$x" | sed -e 's/^X-L//'`
> +                  if test -n "$shlibext" && test -f
> "$dir/lib$name.$shlibext" && test x$lib_type != xstatic; then
> +                    found_dir="$dir"
> +                    found_so="$dir/lib$name.$shlibext"
> +                    if test -f "$dir/lib$name.la"; then
> +                      found_la="$dir/lib$name.la"
> +                    fi
> +                  elif test x$lib_type != xshared; then
> +                    if test -f "$dir/lib$name.$libext"; then
> +                      found_dir="$dir"
> +                      found_a="$dir/lib$name.$libext"
> +                      if test -f "$dir/lib$name.la"; then
> +                        found_la="$dir/lib$name.la"
> +                      fi
> +                    fi
> +                  fi
> +                  ;;
> +              esac
> +              if test "X$found_dir" != "X"; then
> +                break
> +              fi
> +            done
> +          fi
> +          if test "X$found_dir" != "X"; then
> +                        LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-
> L$found_dir -l$name"
> +            if test "X$found_so" != "X"; then
> +                                                        if test
> "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
> +                                LIBICONV="${LIBICONV}${LIBICONV:+
> }$found_so"
> +              else
> +
> haveit=
> +                for x in $ltrpathdirs; do
> +                  if test "X$x" = "X$found_dir"; then
> +                    haveit=yes
> +                    break
> +                  fi
> +                done
> +                if test -z "$haveit"; then
> +                  ltrpathdirs="$ltrpathdirs $found_dir"
> +                fi
> +                                if test "$hardcode_direct" = yes; then
> +
> LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
> +                else
> +                  if test -n "$hardcode_libdir_flag_spec" && test
> "$hardcode_minus_L" = no; then
> +
> LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
> +                                                            haveit=
> +                    for x in $rpathdirs; do
> +                      if test "X$x" = "X$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      rpathdirs="$rpathdirs $found_dir"
> +                    fi
> +                  else
> +
> haveit=
> +                    for x in $LDFLAGS $LIBICONV; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                      if test "X$x" = "X-L$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir"
> +                    fi
> +                    if test "$hardcode_minus_L" != no; then
> +
> LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so"
> +                    else
> +
> LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            else
> +              if test "X$found_a" != "X"; then
> +                                LIBICONV="${LIBICONV}${LIBICONV:+
> }$found_a"
> +              else
> +
> LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name"
> +              fi
> +            fi
> +                        additional_includedir=
> +            case "$found_dir" in
> +              */lib | */lib/)
> +                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e
> 's,/lib/*$,,'`
> +                additional_includedir="$basedir/include"
> +                ;;
> +            esac
> +            if test "X$additional_includedir" != "X"; then
> +
> if test "X$additional_includedir" != "X/usr/include"; then
> +                haveit=
> +                if test "X$additional_includedir" =
> "X/usr/local/include"; then
> +                  if test -n "$GCC"; then
> +                    case $host_os in
> +                      linux*) haveit=yes;;
> +                    esac
> +                  fi
> +                fi
> +                if test -z "$haveit"; then
> +                  for x in $CPPFLAGS $INCICONV; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                    if test "X$x" = "X-I$additional_includedir"; then
> +                      haveit=yes
> +                      break
> +                    fi
> +                  done
> +                  if test -z "$haveit"; then
> +                    if test -d "$additional_includedir"; then
> +
> INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            fi
> +                        if test -n "$found_la"; then
> +
> save_libdir="$libdir"
> +              case "$found_la" in
> +                */* | *\\*) . "$found_la" ;;
> +                *) . "./$found_la" ;;
> +              esac
> +              libdir="$save_libdir"
> +                            for dep in $dependency_libs; do
> +                case "$dep" in
> +                  -L*)
> +                    additional_libdir=`echo "X$dep" | sed -e
's/^X-L//'`
> +
> if test "X$additional_libdir" != "X/usr/lib"; then
> +                      haveit=
> +                      if test "X$additional_libdir" =
"X/usr/local/lib";
> then
> +                        if test -n "$GCC"; then
> +                          case $host_os in
> +                            linux*) haveit=yes;;
> +                          esac
> +                        fi
> +                      fi
> +                      if test -z "$haveit"; then
> +                        haveit=
> +                        for x in $LDFLAGS $LIBICONV; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +
> LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                        haveit=
> +                        for x in $LDFLAGS $LTLIBICONV; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +
> LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                      fi
> +                    fi
> +                    ;;
> +                  -R*)
> +                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
> +                    if test "$enable_rpath" != no; then
> +
haveit=
> +                      for x in $rpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        rpathdirs="$rpathdirs $dir"
> +                      fi
> +
haveit=
> +                      for x in $ltrpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        ltrpathdirs="$ltrpathdirs $dir"
> +                      fi
> +                    fi
> +                    ;;
> +                  -l*)
> +
> names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
> +                    ;;
> +                  *.la)
> +
> names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,'
-e
> 's,^lib,,' -e 's,\.la$,,'`
> +                    ;;
> +                  *)
> +
LIBICONV="${LIBICONV}${LIBICONV:+
> }$dep"
> +                    LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep"
> +                    ;;
> +                esac
> +              done
> +            fi
> +          else
> +                                                            if test
> "x$lib_type" = "xauto" || test "x$lib_type" = "xshared"; then
> +              LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name"
> +              LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name"
> +            else
> +              LIBICONV="${LIBICONV}${LIBICONV:+ }-l:lib$name.$libext"
> +              LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-
> l:lib$name.$libext"
> +            fi
> +          fi
> +        fi
> +      fi
> +    done
> +  done
> +  if test "X$rpathdirs" != "X"; then
> +    if test -n "$hardcode_libdir_separator"; then
> +                        alldirs=
> +      for found_dir in $rpathdirs; do
> +
> alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
> +      done
> +            acl_save_libdir="$libdir"
> +      libdir="$alldirs"
> +      eval flag=\"$hardcode_libdir_flag_spec\"
> +      libdir="$acl_save_libdir"
> +      LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
> +    else
> +            for found_dir in $rpathdirs; do
> +        acl_save_libdir="$libdir"
> +        libdir="$found_dir"
> +        eval flag=\"$hardcode_libdir_flag_spec\"
> +        libdir="$acl_save_libdir"
> +        LIBICONV="${LIBICONV}${LIBICONV:+ }$flag"
> +      done
> +    fi
> +  fi
> +  if test "X$ltrpathdirs" != "X"; then
> +            for found_dir in $ltrpathdirs; do
> +      LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir"
> +    done
> +  fi
> +
> +
> +
> +
> +
> +
> +
> +          am_save_CPPFLAGS="$CPPFLAGS"
> +
> +  for element in $INCICONV; do
> +    haveit=
> +    for x in $CPPFLAGS; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      if test "X$x" = "X$element"; then
> +        haveit=yes
> +        break
> +      fi
> +    done
> +    if test -z "$haveit"; then
> +      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
> +    fi
> +  done
> +
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5
> +$as_echo_n "checking for iconv... " >&6; }
> +if ${am_cv_func_iconv+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +
> +    am_cv_func_iconv="no, consider installing GNU libiconv"
> +    am_cv_lib_iconv=no
> +    if test x$gcc_no_link = xyes; then
> +  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES."
> "$LINENO" 5
> +fi
> +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +
> +#include <stdlib.h>
> +#include <iconv.h>
> +
> +int
> +main ()
> +{
> +iconv_t cd = iconv_open("","");
> +           iconv(cd,NULL,NULL,NULL,NULL);
> +           iconv_close(cd);
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_link "$LINENO"; then :
> +  am_cv_func_iconv=yes
> +fi
> +rm -f core conftest.err conftest.$ac_objext \
> +    conftest$ac_exeext conftest.$ac_ext
> +    if test "$am_cv_func_iconv" != yes; then
> +      am_save_LIBS="$LIBS"
> +      LIBS="$LIBS $LIBICONV"
> +      if test x$gcc_no_link = xyes; then
> +  as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES."
> "$LINENO" 5
> +fi
> +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +
> +#include <stdlib.h>
> +#include <iconv.h>
> +
> +int
> +main ()
> +{
> +iconv_t cd = iconv_open("","");
> +             iconv(cd,NULL,NULL,NULL,NULL);
> +             iconv_close(cd);
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_link "$LINENO"; then :
> +  am_cv_lib_iconv=yes
> +        am_cv_func_iconv=yes
> +fi
> +rm -f core conftest.err conftest.$ac_objext \
> +    conftest$ac_exeext conftest.$ac_ext
> +      LIBS="$am_save_LIBS"
> +    fi
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5
> +$as_echo "$am_cv_func_iconv" >&6; }
> +  if test "$am_cv_func_iconv" = yes; then
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working
iconv"
> >&5
> +$as_echo_n "checking for working iconv... " >&6; }
> +if ${am_cv_func_iconv_works+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +
> +                  am_save_LIBS="$LIBS"
> +      if test $am_cv_lib_iconv = yes; then
> +        LIBS="$LIBS $LIBICONV"
> +      fi
> +      am_cv_func_iconv_works=no
> +      for ac_iconv_const in '' 'const'; do
> +        if test "$cross_compiling" = yes; then :
> +  case "$host_os" in
> +             aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
> +             *)            am_cv_func_iconv_works="guessing yes" ;;
> +           esac
> +else
> +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +
> +#include <iconv.h>
> +#include <string.h>
> +
> +#ifndef ICONV_CONST
> +# define ICONV_CONST $ac_iconv_const
> +#endif
> +
> +int
> +main ()
> +{
> +int result = 0;
> +  /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable
> from
> +     successful returns.  This is even documented in
> +
>
<https://www.ibm.com/support/knowledgecenter/ssw_aix_72/i_bostechref/iconv
> .html> */
> +  {
> +    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
> +    if (cd_utf8_to_88591 != (iconv_t)(-1))
> +      {
> +        static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN
*/
> +        char buf[10];
> +        ICONV_CONST char *inptr = input;
> +        size_t inbytesleft = strlen (input);
> +        char *outptr = buf;
> +        size_t outbytesleft = sizeof (buf);
> +        size_t res = iconv (cd_utf8_to_88591,
> +                            &inptr, &inbytesleft,
> +                            &outptr, &outbytesleft);
> +        if (res == 0)
> +          result |= 1;
> +        iconv_close (cd_utf8_to_88591);
> +      }
> +  }
> +  /* Test against Solaris 10 bug: Failures are not distinguishable from
> +     successful returns.  */
> +  {
> +    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
> +    if (cd_ascii_to_88591 != (iconv_t)(-1))
> +      {
> +        static ICONV_CONST char input[] = "\263";
> +        char buf[10];
> +        ICONV_CONST char *inptr = input;
> +        size_t inbytesleft = strlen (input);
> +        char *outptr = buf;
> +        size_t outbytesleft = sizeof (buf);
> +        size_t res = iconv (cd_ascii_to_88591,
> +                            &inptr, &inbytesleft,
> +                            &outptr, &outbytesleft);
> +        if (res == 0)
> +          result |= 2;
> +        iconv_close (cd_ascii_to_88591);
> +      }
> +  }
> +  /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
> +  {
> +    iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
> +    if (cd_88591_to_utf8 != (iconv_t)(-1))
> +      {
> +        static ICONV_CONST char input[] = "\304";
> +        static char buf[2] = { (char)0xDE, (char)0xAD };
> +        ICONV_CONST char *inptr = input;
> +        size_t inbytesleft = 1;
> +        char *outptr = buf;
> +        size_t outbytesleft = 1;
> +        size_t res = iconv (cd_88591_to_utf8,
> +                            &inptr, &inbytesleft,
> +                            &outptr, &outbytesleft);
> +        if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] !=
> (char)0xAD)
> +          result |= 4;
> +        iconv_close (cd_88591_to_utf8);
> +      }
> +  }
> +#if 0 /* This bug could be worked around by the caller.  */
> +  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.
> */
> +  {
> +    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
> +    if (cd_88591_to_utf8 != (iconv_t)(-1))
> +      {
> +        static ICONV_CONST char input[] = "\304rger mit b\366sen
> B\374bchen ohne Augenma\337";
> +        char buf[50];
> +        ICONV_CONST char *inptr = input;
> +        size_t inbytesleft = strlen (input);
> +        char *outptr = buf;
> +        size_t outbytesleft = sizeof (buf);
> +        size_t res = iconv (cd_88591_to_utf8,
> +                            &inptr, &inbytesleft,
> +                            &outptr, &outbytesleft);
> +        if ((int)res > 0)
> +          result |= 8;
> +        iconv_close (cd_88591_to_utf8);
> +      }
> +  }
> +#endif
> +  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
> +     provided.  */
> +  {
> +    /* Try standardized names.  */
> +    iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP");
> +    /* Try IRIX, OSF/1 names.  */
> +    iconv_t cd2 = iconv_open ("UTF-8", "eucJP");
> +    /* Try AIX names.  */
> +    iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP");
> +    /* Try HP-UX names.  */
> +    iconv_t cd4 = iconv_open ("utf8", "eucJP");
> +    if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1)
> +        && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1))
> +      result |= 16;
> +    if (cd1 != (iconv_t)(-1))
> +      iconv_close (cd1);
> +    if (cd2 != (iconv_t)(-1))
> +      iconv_close (cd2);
> +    if (cd3 != (iconv_t)(-1))
> +      iconv_close (cd3);
> +    if (cd4 != (iconv_t)(-1))
> +      iconv_close (cd4);
> +  }
> +  return result;
> +
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_run "$LINENO"; then :
> +  am_cv_func_iconv_works=yes
> +fi
> +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
> +  conftest.$ac_objext conftest.beam conftest.$ac_ext
> +fi
> +
> +        test "$am_cv_func_iconv_works" = no || break
> +      done
> +      LIBS="$am_save_LIBS"
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result:
$am_cv_func_iconv_works"
> >&5
> +$as_echo "$am_cv_func_iconv_works" >&6; }
> +    case "$am_cv_func_iconv_works" in
> +      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
> +      *)   am_func_iconv=yes ;;
> +    esac
> +  else
> +    am_func_iconv=no am_cv_lib_iconv=no
> +  fi
> +  if test "$am_func_iconv" = yes; then
> +
> +$as_echo "#define HAVE_ICONV 1" >>confdefs.h
> +
> +  fi
> +  if test "$am_cv_lib_iconv" = yes; then
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with
> libiconv" >&5
> +$as_echo_n "checking how to link with libiconv... " >&6; }
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5
> +$as_echo "$LIBICONV" >&6; }
> +  else
> +            CPPFLAGS="$am_save_CPPFLAGS"
> +    LIBICONV=
> +    LTLIBICONV=
> +  fi
> +
> +
> +
> +  if test "$am_cv_func_iconv" = yes; then
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether iconv is
> compatible with its POSIX signature" >&5
> +$as_echo_n "checking whether iconv is compatible with its POSIX
> signature... " >&6; }
> +if ${gl_cv_iconv_nonconst+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +
> +#include <stdlib.h>
> +#include <iconv.h>
> +extern
> +#ifdef __cplusplus
> +"C"
> +#endif
> +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char *
> *outbuf, size_t *outbytesleft);
> +
> +int
> +main ()
> +{
> +
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_compile "$LINENO"; then :
> +  gl_cv_iconv_nonconst=yes
> +else
> +  gl_cv_iconv_nonconst=no
> +fi
> +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_iconv_nonconst"
> >&5
> +$as_echo "$gl_cv_iconv_nonconst" >&6; }
> +  else
> +            gl_cv_iconv_nonconst=yes
> +  fi
> +  if test $gl_cv_iconv_nonconst = yes; then
> +    iconv_arg1=""
> +  else
> +    iconv_arg1="const"
> +  fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define ICONV_CONST $iconv_arg1
> +_ACEOF
> +
> +
> +
> +      if test "$am_func_iconv" = yes; then
> +    if test -n "$LIBICONV"; then
> +      am_cv_func_iconv_summary='yes, in libiconv'
> +    else
> +      am_cv_func_iconv_summary='yes, in libc'
> +    fi
> +  else
> +    if test "$am_cv_func_iconv" = yes; then
> +      am_cv_func_iconv_summary='not working, consider installing GNU
> libiconv'
> +    else
> +      am_cv_func_iconv_summary='no, consider installing GNU libiconv'
> +    fi
> +  fi
> +
> +
> 
>  ac_config_files="$ac_config_files Makefile"
> 
> diff --git a/libgcobol/configure.ac b/libgcobol/configure.ac
> index 2e4a88ef77f..e27621d0368 100644
> --- a/libgcobol/configure.ac
> +++ b/libgcobol/configure.ac
> @@ -266,6 +266,9 @@ case $host in
>  esac
>  AC_SUBST(extra_darwin_ldflags_libgcobol)
> 
> +# For iconv support.
> +AM_ICONV
> +
>  AC_CONFIG_SRCDIR([Makefile.am])
>  AC_CONFIG_FILES([Makefile])
>  ####AC_CONFIG_FILES(libgcobol.spec)
> --
> 2.39.2 (Apple Git-143)


Reply via email to