1dnl Copyright (C) 1999-2006 Free Software Foundation, Inc.
2dnl This file is part of the GNU LIBICONV Library.
3dnl
4dnl The GNU LIBICONV Library is free software; you can redistribute it
5dnl and/or modify it under the terms of the GNU Library General Public
6dnl License as published by the Free Software Foundation; either version 2
7dnl of the License, or (at your option) any later version.
8dnl
9dnl The GNU LIBICONV Library is distributed in the hope that it will be
10dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
11dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12dnl Library General Public License for more details.
13dnl
14dnl You should have received a copy of the GNU Library General Public
15dnl License along with the GNU LIBICONV Library; see the file COPYING.LIB.
16dnl If not, write to the Free Software Foundation, Inc., 51 Franklin Street,
17dnl Fifth Floor, Boston, MA 02110-1301, USA.
18
19AC_PREREQ(2.52)
20AC_INIT
21AC_CONFIG_SRCDIR(lib/iconv.c)
22AC_CONFIG_AUX_DIR(build-aux)
23AM_INIT_AUTOMAKE(libiconv, 1.11)
24AC_CONFIG_HEADERS(config.h lib/config.h)
25AC_PROG_MAKE_SET
26
27dnl           checks for basic programs
28
29AC_PROG_CC
30AC_PROG_CPP
31AC_PROG_GCC_TRADITIONAL
32AC_PROG_INSTALL
33
34dnl           check for host type
35
36AC_CANONICAL_HOST
37
38dnl           hack
39
40dnl Hack to work around limitations of automake and error.m4 regarding LIBOBJS.
41dnl "srclib/Makefile.am:32: automatically discovered file `error.h' should not be explicitly mentioned"
42AC_DEFUN([my_SRCLIB_OBJ],[SRCLIBOBJS="$SRCLIBOBJS $1.$ac_objext"])
43AC_DEFUN([my_SRCLIB_REPLACE_FUNCS], [AC_CHECK_FUNCS([$1], , [my_SRCLIB_OBJ($ac_func)])])
44m4_pushdef([AC_LIBOBJ], m4_defn([my_SRCLIB_OBJ]))
45m4_pushdef([AC_REPLACE_FUNCS], m4_defn([my_SRCLIB_REPLACE_FUNCS]))
46
47dnl           checks for UNIX variants that set DEFS
48
49AC_GNU_SOURCE
50gl_USE_SYSTEM_EXTENSIONS
51AC_ISC_POSIX
52
53dnl           checks for installer options
54
55AC_RELOCATABLE
56
57AC_ARG_ENABLE([extra-encodings],
58  [AC_HELP_STRING([--enable-extra-encodings],
59                  [add support for a few rarely used encodings])],
60  [AC_DEFINE([ENABLE_EXTRA], 1,
61             [Define to 1 to enable a few rarely used encodings.])
62   USE_EXTRA_ENCODINGS=yes],
63  [USE_EXTRA_ENCODINGS=no])
64AC_SUBST([USE_EXTRA_ENCODINGS])
65
66dnl           checks for programs
67
68AC_PROG_RANLIB
69CL_PROG_CP
70CL_PROG_LN
71AC_PROG_LN_S
72
73dnl           checks for compiler output filename suffixes
74
75AC_OBJEXT
76AC_EXEEXT
77
78dnl           check for build configuration
79
80AC_DISABLE_STATIC
81AC_LIBTOOL_WIN32_DLL
82AC_PROG_LIBTOOL
83gl_VISIBILITY
84AM_ICONV
85AM_GNU_GETTEXT([external], [need-ngettext])
86
87dnl           checks for header files
88
89AC_HEADER_STDC
90AC_CHECK_HEADERS([locale.h stddef.h stdlib.h string.h])
91gl_HEADER_UNISTD
92
93dnl           checks for typedefs
94
95AC_TYPE_MBSTATE_T
96gl_STDINT_H
97gt_TYPE_WCHAR_T
98
99dnl           checks for functions and declarations
100
101if test "$am_cv_func_iconv" = yes -a -z "$am_cv_proto_iconv_arg1"; then
102  ICONV_CONST=""
103else
104  ICONV_CONST="const"
105fi
106AC_SUBST(ICONV_CONST)
107
108if test $gt_cv_c_wchar_t = yes; then
109  HAVE_WCHAR_T=1
110else
111  HAVE_WCHAR_T=0
112fi
113AC_SUBST(HAVE_WCHAR_T)
114
115AC_CHECK_FUNCS([getc_unlocked mbrtowc wcrtomb mbsinit setlocale])
116AC_REPLACE_FUNCS([memmove])
117
118AM_LANGINFO_CODESET
119
120AC_EILSEQ
121
122CL_WORDS_LITTLEENDIAN
123
124gl_FUNC_ALLOCA
125gl_ALLOCSA
126gl_CANONICALIZE
127gl_FUNC_GLIBC_UNLOCKED_IO
128gl_ERROR
129gl_PATHMAX
130gt_FUNC_SETENV
131AM_STDBOOL_H
132gl_FUNC_STRERROR
133gl_FUNC_READLINK
134gl_XREADLINK
135
136dnl           hack
137
138dnl End of hack to work around limitations of automake and error.m4.
139m4_popdef([AC_REPLACE_FUNCS])
140m4_popdef([AC_LIBOBJ])
141AC_SUBST([SRCLIBOBJS])
142
143dnl           check whether OS supports plug libraries
144
145OS=""
146case "$host_os" in
147  linux*)   OS="linux" ;;
148  solaris*) OS="solaris" ;;
149  osf*)     OS="osf" ;;
150esac
151if test -n "$OS"; then
152  AC_SUBST(OS)
153  AC_SUBST(GCC)
154  PLUGLIB="preloadable_libiconv.so"
155else
156  PLUGLIB=""
157fi
158AC_SUBST(PLUGLIB)
159
160dnl Compilation on mingw and Cygwin needs special Makefile rules, because
161dnl 1. when we install a shared library, we must arrange to export
162dnl    auxiliary pointer variables for every exported variable,
163dnl 2. when we install a shared library and a static library simultaneously,
164dnl    the include file specifies __declspec(dllimport) and therefore we
165dnl    must arrange to define the auxiliary pointer variables for the
166dnl    exported variables _also_ in the static library.
167if test "$enable_shared" = yes; then
168  case "$host_os" in
169    mingw* | cygwin*) is_woe32dll=yes ;;
170    *) is_woe32dll=no ;;
171  esac
172else
173  is_woe32dll=no
174fi
175WOE32DLL=$is_woe32dll
176AC_SUBST([WOE32DLL])
177if test $is_woe32dll = yes; then
178  DLL_VARIABLE='__declspec (dllimport)'
179else
180  DLL_VARIABLE=
181fi
182AC_SUBST([DLL_VARIABLE])
183
184AH_BOTTOM([
185/* On Windows, variables that may be in a DLL must be marked specially.  */
186#if defined _MSC_VER && defined _DLL
187# define DLL_VARIABLE __declspec (dllimport)
188#else
189# define DLL_VARIABLE
190#endif
191])
192
193AC_CONFIG_SUBDIRS(libcharset)
194AC_CONFIG_FILES([Makefile])
195AC_CONFIG_FILES([lib/Makefile])
196AC_CONFIG_FILES([srclib/Makefile])
197AC_CONFIG_FILES([src/Makefile])
198AC_CONFIG_FILES([po/Makefile.in])
199AC_CONFIG_FILES([man/Makefile])
200if test -d "${srcdir}/tests"; then
201  AC_CONFIG_FILES([tests/Makefile])
202fi
203AC_CONFIG_FILES([include/iconv.h:include/iconv.h.build.in])
204AC_CONFIG_FILES([include/iconv.h.inst:include/iconv.h.in])
205AC_OUTPUT
206