delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/06/21/10:45:41

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
Cc: <geotz AT hotmail DOT com>
References: <BAY102-W4996FE58370FA0BEC60992BAA50 AT phx DOT gbl> <485A2293 DOT 4090103 AT sbcglobal DOT net> <BAY102-W332E4B68F129D6F27B6CCBBAA50 AT phx DOT gbl>
Subject: RE: cannot find iconv() function
Date: Sat, 21 Jun 2008 15:45:08 +0100
Message-ID: <006301c8d3ad$66c4b6f0$2708a8c0@CAM.ARTIMI.COM>
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <BAY102-W332E4B68F129D6F27B6CCBBAA50@phx.gbl>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

------=_NextPart_000_0064_01C8D3B5.C8891EF0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

[  Cc added: gtmess maintainer. ]

 Hi George, I've got a patch for you.  It fixes a gtmess configure script
problem on cygwin.  See http://cygwin.com/ml/cygwin/2008-06/msg00395.html
and thread for background.

David Collin wrote on 20 June 2008 05:21:

> The compiler I am using here shouldn't really matter for now as I only
> tried to run a configure script that 
> generated an error in no way linked to a compiler. 

  Actually, that's a misunderstanding.  The way configure scripts work
involves using the system's compiler to implicitly check for the presence or
absence of various headers, libraries and functions in those libraries.

  What's happening here, however, is that the iconv test is getting tricked.
In cygwin, the iconv function is actually called 'libiconv', and a #define
in the iconv.h header file translates calls to iconv into calls to libiconv.

  The standard autoconf library function detection test, for the sake of
simplicity, declares the function prototype itself rather than including the
header, so the name doesn't get translated and the function isn't found at
link time.

  A patch such as the attached makes the configure test check if it's
running on cygwin and look for libiconv() rather than iconv() in that case.
It made gtmess build for me.


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

------=_NextPart_000_0064_01C8D3B5.C8891EF0
Content-Type: application/octet-stream;
	name="gtmess.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="gtmess.patch"

--- gtmess-0.94.orig/configure.ac	2007-12-26 12:13:26.000000000 +0000
+++ gtmess-0.94/configure.ac	2008-06-21 15:30:28.609375000 +0100
@@ -70,8 +70,14 @@ dnl AC_FUNC_VPRINTF
 AC_CHECK_FUNCS([gettimeofday localtime_r memmove memset mkdir mkfifo selec=
t strchr strdup strerror strrchr strstr setlocale], ,
                [AC_MSG_ERROR([required function is missing])])
=20
+AC_CANONICAL_HOST
+if test "$host_os" =3D cygwin; then
+dnl cygwin iconv() is really libiconv()
+AC_CHECK_LIB(iconv, libiconv)
+else
 AC_SEARCH_LIBS([iconv], [iconv], ,
                [AC_MSG_ERROR([cannot find iconv() function])])
+fi
=20
 AC_CHECK_FUNCS([wcwidth mbsrtowcs])
=20
--- gtmess-0.94.orig/configure	2007-12-26 12:16:33.000000000 +0000
+++ gtmess-0.94/configure	2008-06-21 15:30:34.656250000 +0100
@@ -692,6 +692,14 @@ RANLIB
 CPP
 GREP
 EGREP
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
 WISHPROG
 TCLDATADIR
 LIBOBJS
@@ -1269,6 +1277,10 @@ Program names:
   --program-prefix=3DPREFIX            prepend PREFIX to installed program=
 names
   --program-suffix=3DSUFFIX            append SUFFIX to installed program =
names
   --program-transform-name=3DPROGRAM   run sed PROGRAM on installed progra=
m names
+
+System types:
+  --build=3DBUILD     configure for building on BUILD [guessed]
+  --host=3DHOST       cross-compile to build programs to run on HOST [BUIL=
D]
 _ACEOF
 fi
=20
@@ -5462,6 +5474,162 @@ fi
 done
=20
=20
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.su=
b" >&5
+echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+{ echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
+if test "${ac_cv_build+set}" =3D set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_build_alias=3D$build_alias
+test "x$ac_build_alias" =3D x &&
+  ac_build_alias=3D`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" =3D x &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must speci=
fy one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=3D`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build=
_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed"=
 >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+echo "$as_me: error: invalid value of canonical build" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+build=3D$ac_cv_build
+ac_save_IFS=3D$IFS; IFS=3D'-'
+set x $ac_cv_build
+shift
+build_cpu=3D$1
+build_vendor=3D$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=3D$*
+IFS=3D$ac_save_IFS
+case $build_os in *\ *) build_os=3D`echo "$build_os" | sed 's/ /-/g'`;; es=
ac
+
+
+{ echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
+if test "${ac_cv_host+set}" =3D set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "x$host_alias" =3D x; then
+  ac_cv_host=3D$ac_cv_build
+else
+  ac_cv_host=3D`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_a=
lias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2=
;}
+   { (exit 1); exit 1; }; }
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+echo "$as_me: error: invalid value of canonical host" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
+host=3D$ac_cv_host
+ac_save_IFS=3D$IFS; IFS=3D'-'
+set x $ac_cv_host
+shift
+host_cpu=3D$1
+host_vendor=3D$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=3D$*
+IFS=3D$ac_save_IFS
+case $host_os in *\ *) host_os=3D`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+if test "$host_os" =3D cygwin; then
+
+{ echo "$as_me:$LINENO: checking for libiconv in -liconv" >&5
+echo $ECHO_N "checking for libiconv in -liconv... $ECHO_C" >&6; }
+if test "${ac_cv_lib_iconv_libiconv+set}" =3D set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=3D$LIBS
+LIBS=3D"-liconv  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char libiconv ();
+int
+main ()
+{
+return libiconv ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try=3D"$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=3D\$ac_try;;
+  *) ac_try_echo=3D$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=3D$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? =3D $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_iconv_libiconv=3Dyes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_iconv_libiconv=3Dno
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=3D$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_libiconv" >&5
+echo "${ECHO_T}$ac_cv_lib_iconv_libiconv" >&6; }
+if test $ac_cv_lib_iconv_libiconv =3D yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBICONV 1
+_ACEOF
+
+  LIBS=3D"-liconv $LIBS"
+
+fi
+
+else
 { echo "$as_me:$LINENO: checking for library containing iconv" >&5
 echo $ECHO_N "checking for library containing iconv... $ECHO_C" >&6; }
 if test "${ac_cv_search_iconv+set}" =3D set; then
@@ -5549,6 +5717,7 @@ echo "$as_me: error: cannot find iconv()
    { (exit 1); exit 1; }; }
 fi
=20
+fi
=20
=20
=20
@@ -7150,13 +7319,21 @@ RANLIB!$RANLIB$ac_delim
 CPP!$CPP$ac_delim
 GREP!$GREP$ac_delim
 EGREP!$EGREP$ac_delim
+build!$build$ac_delim
+build_cpu!$build_cpu$ac_delim
+build_vendor!$build_vendor$ac_delim
+build_os!$build_os$ac_delim
+host!$host$ac_delim
+host_cpu!$host_cpu$ac_delim
+host_vendor!$host_vendor$ac_delim
+host_os!$host_os$ac_delim
 WISHPROG!$WISHPROG$ac_delim
 TCLDATADIR!$TCLDATADIR$ac_delim
 LIBOBJS!$LIBOBJS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
=20
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` =3D 83=
; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` =3D 91=
; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5


------=_NextPart_000_0064_01C8D3B5.C8891EF0
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
------=_NextPart_000_0064_01C8D3B5.C8891EF0--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019