diff options
-rw-r--r-- | configure.in | 95 |
1 files changed, 64 insertions, 31 deletions
diff --git a/configure.in b/configure.in index 1f3fa71..043992a 100644 --- a/configure.in +++ b/configure.in | |||
@@ -72,44 +72,77 @@ size_t x = strftime(s, 5, "%a", localtime(&t)); | |||
72 | dnl --------------- | 72 | dnl --------------- |
73 | dnl CHECK FOR ICONV | 73 | dnl CHECK FOR ICONV |
74 | dnl --------------- | 74 | dnl --------------- |
75 | |||
76 | dnl Find iconv. It may be in libiconv and may be iconv() or libiconv() | 75 | dnl Find iconv. It may be in libiconv and may be iconv() or libiconv() |
77 | if test "x$ac_cv_header_iconv_h" = "xyes"; then | 76 | if test "x$ac_cv_header_iconv_h" = "xyes"; then |
78 | AC_CHECK_FUNC(iconv, ac_found_iconv=yes, ac_found_iconv=no) | 77 | ac_found_iconv=no |
79 | if test "x$ac_found_iconv" = "xno"; then | 78 | AC_COMPILE_IFELSE( |
80 | AC_CHECK_LIB(iconv, iconv, ac_found_iconv=yes) | 79 | [AC_LANG_PROGRAM( |
81 | if test "x$ac_found_iconv" = "xno"; then | 80 | [[#include <stdlib.h> |
82 | AC_CHECK_LIB(iconv, libiconv, ac_found_iconv=yes) | 81 | #include <iconv.h>]], |
83 | fi | 82 | [[ |
84 | if test "x$ac_found_iconv" != "xno"; then | 83 | iconv_open(NULL, NULL); |
85 | LIBS="-liconv $LIBS" | 84 | return 0; |
86 | fi | 85 | ]] |
87 | fi | 86 | )], |
88 | fi | 87 | [ |
89 | if test "x$ac_found_iconv" = xyes; then | 88 | ac_found_iconv=yes |
90 | AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) | 89 | ], |
91 | fi | 90 | [ ]) |
92 | 91 | ||
92 | AC_COMPILE_IFELSE( | ||
93 | [AC_LANG_PROGRAM( | ||
94 | [[#include <stdlib.h> | ||
95 | #include <iconv.h>]], | ||
96 | [[ | ||
97 | libiconv_open(NULL, NULL); | ||
98 | return 0; | ||
99 | ]] | ||
100 | )], | ||
101 | [ | ||
102 | ac_found_iconv=yes | ||
103 | ], | ||
104 | [ ]) | ||
105 | |||
106 | if test "x$ac_found_iconv" = xyes; then | ||
107 | AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) | ||
108 | AC_CHECK_LIB([iconv], | ||
109 | [iconv_open], | ||
110 | [ | ||
111 | LIBS="$LIBS -liconv" | ||
112 | ], | ||
113 | []) | ||
114 | AC_CHECK_LIB([iconv], | ||
115 | [libiconv_open], | ||
116 | [ | ||
117 | LIBS="$LIBS -liconv" | ||
118 | ], | ||
119 | []) | ||
93 | 120 | ||
94 | dnl Check if iconv uses const in prototype declaration | 121 | dnl Check if iconv uses const in prototype declaration |
95 | if test "x$ac_found_iconv" = "xyes"; then | 122 | AC_CACHE_CHECK(for iconv declaration, |
96 | AC_CACHE_CHECK(for iconv declaration, ac_cv_iconv_const, | 123 | ac_cv_iconv_const, |
97 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h> | 124 | [AC_COMPILE_IFELSE( |
98 | #include <iconv.h>]], | 125 | [AC_LANG_PROGRAM( |
99 | [[ | 126 | [[#include <stdlib.h> |
100 | char **msg, **new_msg; | 127 | #include <iconv.h>]], |
101 | size_t result, inleft, outleft; | 128 | [[ |
102 | result = iconv((iconv_t)(-1), msg, &inleft, new_msg, &outleft); | 129 | char **msg, **new_msg; |
103 | return 0; | 130 | size_t result, inleft, outleft; |
104 | ]])], | 131 | result = iconv((iconv_t)(-1), msg, &inleft, new_msg, &outleft); |
105 | [ac_cv_iconv_const=no], | 132 | return 0; |
106 | [ac_cv_iconv_const=yes])]) | 133 | ]] |
107 | if test "x$ac_cv_iconv_const" = xyes; then | 134 | )], |
108 | AC_DEFINE(HAVE_CONST_ICONV, 1, [Define if you have the iconv() function.]) | 135 | [ac_cv_iconv_const=no], |
109 | fi | 136 | [ac_cv_iconv_const=yes]) |
137 | ]) | ||
138 | if test "x$ac_cv_iconv_const" = xyes; then | ||
139 | AC_DEFINE(HAVE_CONST_ICONV, 1, [Define if you have the iconv() function.]) | ||
140 | fi | ||
141 | fi | ||
110 | fi | 142 | fi |
111 | 143 | ||
112 | 144 | ||
145 | |||
113 | AC_CHECK_LIB(nsl, t_open, LIBS="$LIBS -lnsl") | 146 | AC_CHECK_LIB(nsl, t_open, LIBS="$LIBS -lnsl") |
114 | AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket") | 147 | AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket") |
115 | 148 | ||