comparison configure.in @ 153:0b1766da9be8

use AM_ICONV for better portability of the library location. structure renaming to be more specific.
author Carl Byington <carl@five-ten-sg.com>
date Thu, 12 Mar 2009 15:17:32 -0700
parents f9773b6368e0
children 59258d12bf77
comparison
equal deleted inserted replaced
152:edebaf0e87d2 153:0b1766da9be8
4 AC_CONFIG_HEADER([config.h]) 4 AC_CONFIG_HEADER([config.h])
5 AM_INIT_AUTOMAKE 5 AM_INIT_AUTOMAKE
6 AC_CANONICAL_HOST 6 AC_CANONICAL_HOST
7 7
8 8
9 # Check for win32 which needs iconv library specified on the link line 9 # Check for win32
10 AC_MSG_CHECKING([for Win32]) 10 AC_MSG_CHECKING([for Win32])
11 case "$host" in 11 case "$host" in
12 *-mingw*) 12 *-mingw*)
13 os_win32=yes 13 os_win32=yes
14 ;; 14 ;;
105 AM_CONDITIONAL(NEED_XGETOPT, [test yes = no]), 105 AM_CONDITIONAL(NEED_XGETOPT, [test yes = no]),
106 AM_CONDITIONAL(NEED_XGETOPT, [test yes = yes]) 106 AM_CONDITIONAL(NEED_XGETOPT, [test yes = yes])
107 ) 107 )
108 AC_HEADER_DIRENT 108 AC_HEADER_DIRENT
109 AC_HEADER_STDC 109 AC_HEADER_STDC
110 AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h iconv.h inttypes.h limits.h regex.h signal.h stdarg.h stdint.h stdio.h stdlib.h string.h sys/param.h sys/stat.h sys/types.h time.h unistd.h wchar.h]) 110 AC_CHECK_HEADERS([ctype.h dirent.h errno.h fcntl.h inttypes.h limits.h regex.h signal.h stdarg.h stdint.h stdio.h stdlib.h string.h sys/param.h sys/stat.h sys/types.h time.h unistd.h wchar.h])
111 111
112 112
113 # Checks for typedefs, structures, and compiler characteristics. 113 # Checks for typedefs, structures, and compiler characteristics.
114 AC_HEADER_STDBOOL 114 AC_HEADER_STDBOOL
115 AC_C_CONST 115 AC_C_CONST
128 AC_FUNC_REALLOC 128 AC_FUNC_REALLOC
129 fi 129 fi
130 AC_FUNC_STRFTIME 130 AC_FUNC_STRFTIME
131 AC_FUNC_VPRINTF 131 AC_FUNC_VPRINTF
132 AC_CHECK_FUNCS([memchr memmove memset regcomp strcasecmp strncasecmp strchr strdup strerror strpbrk strrchr strstr strtol]) 132 AC_CHECK_FUNCS([memchr memmove memset regcomp strcasecmp strncasecmp strchr strdup strerror strpbrk strrchr strstr strtol])
133 133 AM_ICONV
134 134 if test "$am_cv_func_iconv" != "yes"; then
135 # iconv on mac is a library 135 AC_MSG_ERROR([libpst requires iconv which is missing])
136 SAVELIBS="$LIBS" 136 fi
137 AC_SEARCH_LIBS([iconv_open], [iconv])
138 if test "$SAVELIBS" != "$LIBS"; then
139 all_libraries="-L/usr/lib $all_libraries"
140 AC_SUBST(all_libraries)
141 AC_MSG_WARN([This should be building on Mac OSX, adding /usr/lib to the library path])
142 fi
143
144 AC_MSG_CHECKING([if iconv uses const arguments])
145 AC_LANG_PUSH([C++])
146 AC_COMPILE_IFELSE([
147 #include <iconv.h>
148 #include <stddef.h>
149 int main(int argc, char* const* argv)
150 {
151 size_t inlen = 100;
152 char buffer[[inlen]];
153 char *p = buffer;
154 size_t utf8_len = 2 * inlen + 1;
155 char utf8_buffer[[utf8_len]];
156 char *utf8_p = utf8_buffer;
157 iconv_t cd = 0;
158 iconv(cd, (const char**)&p, &inlen, &utf8_p, &utf8_len);
159 }
160 ],
161 [AC_DEFINE(ICONV_CONST,const,[do we have const headers])
162 AC_MSG_RESULT([yes])
163 ],
164 [AC_DEFINE(ICONV_CONST,,[do we have const headers])
165 AC_MSG_RESULT([no])
166 ])
167 AC_LANG_POP([C++])
168 137
169 138
170 AC_CHECK_FUNCS(regexec,,[AC_CHECK_LIB(regex,regexec, 139 AC_CHECK_FUNCS(regexec,,[AC_CHECK_LIB(regex,regexec,
171 [REGEXLIB=-lregex 140 [REGEXLIB=-lregex
172 AC_DEFINE(HAVE_REGEXEC,1,[Define to 1 if you have the regexec function.])], 141 AC_DEFINE(HAVE_REGEXEC,1,[Define to 1 if you have the regexec function.])],