all repos — fluxbox @ b809abcfd0821d9595be4e036af6c140cae9b1fd

custom fork of the fluxbox windowmanager

fix iconv-issues on *BSD and MacOSX
mathias mathias
commit

b809abcfd0821d9595be4e036af6c140cae9b1fd

parent

1077cd1a77f373aae30a18b15fb129964b85c761

2 files changed, 47 insertions(+), 33 deletions(-)

jump to
M ChangeLogChangeLog

@@ -1,6 +1,8 @@

(Format: Year/Month/Day) Changes for 0.9.13 *05/04/21: + * Fixed iconv-issues on *BSD/MacOSX (Mathias) + configure.in * Fixed #1133809, ArrangeWindows covers Toolbar/Slit (Mathias) WorkspaceCmd.cc *05/04/20:
M configure.inconfigure.in

@@ -25,7 +25,12 @@ fi

dnl Check for system header files AC_HEADER_STDC -AC_CHECK_HEADERS(errno.h ctype.h dirent.h fcntl.h libgen.h locale.h nl_types.h process.h signal.h stdarg.h stdio.h time.h unistd.h sys/param.h sys/select.h sys/signal.h sys/stat.h sys/time.h sys/types.h sys/wait.h) +AC_CHECK_HEADERS(errno.h ctype.h dirent.h fcntl.h libgen.h \ + locale.h nl_types.h process.h signal.h stdarg.h \ + stdio.h time.h unistd.h \ + sys/param.h sys/select.h sys/signal.h sys/stat.h \ + sys/time.h sys/types.h sys/wait.h \ + iconv.h) AC_CHECK_HEADERS(sstream, , [ AC_CHECK_HEADERS(strstream,,

@@ -63,41 +68,48 @@ AC_MSG_RESULT(yes)

], [AC_MSG_RESULT(no)]) -AC_MSG_CHECKING([for iconv]) -AC_TRY_COMPILE( -[#include <iconv.h>], -[iconv_t cd = iconv_open("", "")], -HAVE_ICONV=yes, -HAVE_ICONV=no) -if test x"$HAVE_ICONV" = x"yes"; then - AC_DEFINE(HAVE_ICONV, 1, "iconv") -dnl now check for const char *msg argument in iconv(..) - AC_TRY_COMPILE( - [#include <iconv.h>], - [ - char **msg, **new_msg; - size_t result, inleft, outleft; - result = iconv((iconv_t)(-1), msg, &inleft, new_msg, &outleft); - return 0; - ], - [ AC_MSG_RESULT([yes (non const msg)])], - [ AC_DEFINE(HAVE_CONST_ICONV, 1, "iconv") - AC_MSG_RESULT([yes (const msg)])]) +dnl --------------- +dnl CHECK FOR ICONV +dnl --------------- -dnl Check if iconv is part of libiconv - AC_CHECK_LIB(iconv, iconv_close, - AC_MSG_CHECKING([for iconv_close in libiconv]) - AC_TRY_LINK( - #include <iconv.h>, - [int main() { return iconv_close((iconv_t)(-1)); }], - AC_MSG_RESULT([yes]), - LIBS="$LIBS -liconv" - ) - ) -else - AC_MSG_RESULT([no]) +dnl Find iconv. It may be in libiconv and may be iconv() or libiconv() +if test "x$ac_cv_header_iconv_h" = "xyes"; then + AC_CHECK_FUNC(iconv, ac_found_iconv=yes, ac_found_iconv=no) + if test "x$ac_found_iconv" = "xno"; then + AC_CHECK_LIB(iconv, iconv, ac_found_iconv=yes) + if test "x$ac_found_iconv" = "xno"; then + AC_CHECK_LIB(iconv, libiconv, ac_found_iconv=yes) + fi + if test "x$ac_found_iconv" != "xno"; then + LIBS="-liconv $LIBS" + fi + fi +fi +if test "x$ac_found_iconv" = xyes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) +fi + + +dnl Check if iconv uses const in prototype declaration +if test "x$ac_found_iconv" = "xyes"; then + AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const, + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> + #include <iconv.h>]], + [[#ifdef __cplusplus + "C" + #endif + #if defined(__STDC__) || defined(__cplusplus) + size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); + #else + size_t iconv(); + #endif]])], + [ac_cv_iconv_const=], + [ac_cv_iconv_const=const])]) + AC_DEFINE_UNQUOTED([HAVE_CONST_ICONV], $ac_cv_iconv_const, + [Define as const if the declaration of iconv() needs const.]) fi + AC_CHECK_LIB(nsl, t_open, LIBS="$LIBS -lnsl") AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")