diff options
author | mathias <mathias> | 2005-04-21 19:09:10 (GMT) |
---|---|---|
committer | mathias <mathias> | 2005-04-21 19:09:10 (GMT) |
commit | b809abcfd0821d9595be4e036af6c140cae9b1fd (patch) | |
tree | 38dcae6139611e342df15e2f5c172ec7d602c7b8 /configure.in | |
parent | 1077cd1a77f373aae30a18b15fb129964b85c761 (diff) | |
download | fluxbox-b809abcfd0821d9595be4e036af6c140cae9b1fd.zip fluxbox-b809abcfd0821d9595be4e036af6c140cae9b1fd.tar.bz2 |
fix iconv-issues on *BSD and MacOSX
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 82 |
1 files changed, 47 insertions, 35 deletions
diff --git a/configure.in b/configure.in index ec6b858..c525f64 100644 --- a/configure.in +++ b/configure.in | |||
@@ -25,7 +25,12 @@ fi | |||
25 | 25 | ||
26 | dnl Check for system header files | 26 | dnl Check for system header files |
27 | AC_HEADER_STDC | 27 | AC_HEADER_STDC |
28 | 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) | 28 | AC_CHECK_HEADERS(errno.h ctype.h dirent.h fcntl.h libgen.h \ |
29 | locale.h nl_types.h process.h signal.h stdarg.h \ | ||
30 | stdio.h time.h unistd.h \ | ||
31 | sys/param.h sys/select.h sys/signal.h sys/stat.h \ | ||
32 | sys/time.h sys/types.h sys/wait.h \ | ||
33 | iconv.h) | ||
29 | 34 | ||
30 | AC_CHECK_HEADERS(sstream, , | 35 | AC_CHECK_HEADERS(sstream, , |
31 | [ AC_CHECK_HEADERS(strstream,, | 36 | [ AC_CHECK_HEADERS(strstream,, |
@@ -63,42 +68,49 @@ size_t x = strftime(s, 5, "%a", localtime(&t)); | |||
63 | ], | 68 | ], |
64 | [AC_MSG_RESULT(no)]) | 69 | [AC_MSG_RESULT(no)]) |
65 | 70 | ||
66 | AC_MSG_CHECKING([for iconv]) | 71 | |
67 | AC_TRY_COMPILE( | 72 | dnl --------------- |
68 | [#include <iconv.h>], | 73 | dnl CHECK FOR ICONV |
69 | [iconv_t cd = iconv_open("", "")], | 74 | dnl --------------- |
70 | HAVE_ICONV=yes, | 75 | |
71 | HAVE_ICONV=no) | 76 | dnl Find iconv. It may be in libiconv and may be iconv() or libiconv() |
72 | 77 | if test "x$ac_cv_header_iconv_h" = "xyes"; then | |
73 | if test x"$HAVE_ICONV" = x"yes"; then | 78 | AC_CHECK_FUNC(iconv, ac_found_iconv=yes, ac_found_iconv=no) |
74 | AC_DEFINE(HAVE_ICONV, 1, "iconv") | 79 | if test "x$ac_found_iconv" = "xno"; then |
75 | dnl now check for const char *msg argument in iconv(..) | 80 | AC_CHECK_LIB(iconv, iconv, ac_found_iconv=yes) |
76 | AC_TRY_COMPILE( | 81 | if test "x$ac_found_iconv" = "xno"; then |
77 | [#include <iconv.h>], | 82 | AC_CHECK_LIB(iconv, libiconv, ac_found_iconv=yes) |
78 | [ | 83 | fi |
79 | char **msg, **new_msg; | 84 | if test "x$ac_found_iconv" != "xno"; then |
80 | size_t result, inleft, outleft; | 85 | LIBS="-liconv $LIBS" |
81 | result = iconv((iconv_t)(-1), msg, &inleft, new_msg, &outleft); | 86 | fi |
82 | return 0; | 87 | fi |
83 | ], | 88 | fi |
84 | [ AC_MSG_RESULT([yes (non const msg)])], | 89 | if test "x$ac_found_iconv" = xyes; then |
85 | [ AC_DEFINE(HAVE_CONST_ICONV, 1, "iconv") | 90 | AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) |
86 | AC_MSG_RESULT([yes (const msg)])]) | ||
87 | |||
88 | dnl Check if iconv is part of libiconv | ||
89 | AC_CHECK_LIB(iconv, iconv_close, | ||
90 | AC_MSG_CHECKING([for iconv_close in libiconv]) | ||
91 | AC_TRY_LINK( | ||
92 | #include <iconv.h>, | ||
93 | [int main() { return iconv_close((iconv_t)(-1)); }], | ||
94 | AC_MSG_RESULT([yes]), | ||
95 | LIBS="$LIBS -liconv" | ||
96 | ) | ||
97 | ) | ||
98 | else | ||
99 | AC_MSG_RESULT([no]) | ||
100 | fi | 91 | fi |
101 | 92 | ||
93 | |||
94 | dnl Check if iconv uses const in prototype declaration | ||
95 | if test "x$ac_found_iconv" = "xyes"; then | ||
96 | AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const, | ||
97 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> | ||
98 | #include <iconv.h>]], | ||
99 | [[#ifdef __cplusplus | ||
100 | "C" | ||
101 | #endif | ||
102 | #if defined(__STDC__) || defined(__cplusplus) | ||
103 | size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); | ||
104 | #else | ||
105 | size_t iconv(); | ||
106 | #endif]])], | ||
107 | [ac_cv_iconv_const=], | ||
108 | [ac_cv_iconv_const=const])]) | ||
109 | AC_DEFINE_UNQUOTED([HAVE_CONST_ICONV], $ac_cv_iconv_const, | ||
110 | [Define as const if the declaration of iconv() needs const.]) | ||
111 | fi | ||
112 | |||
113 | |||
102 | AC_CHECK_LIB(nsl, t_open, LIBS="$LIBS -lnsl") | 114 | AC_CHECK_LIB(nsl, t_open, LIBS="$LIBS -lnsl") |
103 | AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket") | 115 | AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket") |
104 | 116 | ||