1 dnl Copyright (C) 1999-2011 Free Software Foundation, Inc.
2 dnl This file is part of the GNU LIBICONV Library.
4 dnl The GNU LIBICONV Library is free software; you can redistribute it
5 dnl and/or modify it under the terms of the GNU Library General Public
6 dnl License as published by the Free Software Foundation; either version 2
7 dnl of the License, or (at your option) any later version.
9 dnl The GNU LIBICONV Library is distributed in the hope that it will be
10 dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 dnl Library General Public License for more details.
14 dnl You should have received a copy of the GNU Library General Public
15 dnl License along with the GNU LIBICONV Library; see the file COPYING.LIB.
16 dnl If not, see <http://www.gnu.org/licenses/>.
20 AC_CONFIG_SRCDIR([lib/iconv.c])
21 AC_CONFIG_AUX_DIR([build-aux])
22 AM_INIT_AUTOMAKE([libiconv], [1.14])
23 AC_CONFIG_HEADERS([config.h lib/config.h])
26 dnl checks for basic programs
32 AC_PATH_PROG([STRIP], [strip], [:]) dnl sets STRIP
33 AM_PROG_INSTALL_STRIP dnl overrides STRIP when cross-compiling,
34 dnl sets INSTALL_STRIP_PROGRAM
36 dnl check for host type
42 dnl Hack to work around limitations of automake and error.m4 regarding LIBOBJS.
43 dnl "srclib/Makefile.am:32: automatically discovered file `error.h' should not be explicitly mentioned"
44 AC_DEFUN([my_SRCLIB_OBJ],[SRCLIBOBJS="$SRCLIBOBJS $1.$ac_objext"])
45 AC_DEFUN([my_SRCLIB_REPLACE_FUNCS], [AC_CHECK_FUNCS([$1], , [my_SRCLIB_OBJ($ac_func)])])
46 m4_pushdef([AC_LIBOBJ], m4_defn([my_SRCLIB_OBJ]))
47 m4_pushdef([AC_REPLACE_FUNCS], m4_defn([my_SRCLIB_REPLACE_FUNCS]))
49 dnl checks for UNIX variants that set DEFS
53 dnl checks for installer options
55 gl_RELOCATABLE([srclib])
57 AC_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])
64 AC_SUBST([USE_EXTRA_ENCODINGS])
66 dnl checks for programs
72 dnl checks for compiler output filename suffixes
77 dnl check for build configuration
79 LT_INIT([disable-static win32-dll])
81 dnl Prepares the libtool configuration for handling of Windows resources, and
82 dnl sets the RC variable to a program that compiles Windows resource files.
83 LT_LANG([Windows Resource])
85 dnl On mingw and Cygwin, we can activate special Makefile rules which add
86 dnl version information to the executables.
88 mingw* | cygwin*) is_woe32=yes ;;
93 if test $WOE32 = yes; then
94 dnl Check for a program that compiles Windows resource files.
95 AC_CHECK_TOOL([WINDRES], [windres])
100 AM_GNU_GETTEXT([external], [need-ngettext])
102 dnl checks for typedefs
107 dnl checks for header files, functions and declarations
109 if test "$am_cv_func_iconv" = yes -a -n "$am_cv_proto_iconv_arg1"; then
114 AC_SUBST([ICONV_CONST])
116 if test $gt_cv_c_wchar_t = yes; then
121 AC_SUBST([HAVE_WCHAR_T])
123 AC_CHECK_FUNCS([getc_unlocked mbrtowc wcrtomb mbsinit setlocale])
125 dnl mbstate_t is used if HAVE_WCRTOMB || HAVE_MBRTOWC, see lib/loop_wchar.h.
126 if test $ac_cv_func_wcrtomb = yes || test $ac_cv_func_mbrtowc = yes; then
131 AC_SUBST([USE_MBSTATE_T])
133 AC_CACHE_CHECK([whether <wchar.h> is standalone],
134 [gl_cv_header_wchar_h_standalone],
140 [gl_cv_header_wchar_h_standalone=yes],
141 [gl_cv_header_wchar_h_standalone=no])])
142 if test $gl_cv_header_wchar_h_standalone = yes; then
147 AC_SUBST([BROKEN_WCHAR_H])
149 AC_REPLACE_FUNCS([memmove])
156 CL_WORDS_LITTLEENDIAN
162 dnl End of hack to work around limitations of automake and error.m4.
163 m4_popdef([AC_REPLACE_FUNCS])
164 m4_popdef([AC_LIBOBJ])
165 AC_SUBST([SRCLIBOBJS])
167 dnl Compilation on mingw and Cygwin needs special Makefile rules, because
168 dnl 1. when we install a shared library, we must arrange to export
169 dnl auxiliary pointer variables for every exported variable,
170 dnl 2. when we install a shared library and a static library simultaneously,
171 dnl the include file specifies __declspec(dllimport) and therefore we
172 dnl must arrange to define the auxiliary pointer variables for the
173 dnl exported variables _also_ in the static library.
174 if test "$enable_shared" = yes; then
176 mingw* | cygwin*) is_woe32dll=yes ;;
182 WOE32DLL=$is_woe32dll
184 if test $is_woe32dll = yes; then
185 DLL_VARIABLE='__declspec (dllimport)'
189 AC_SUBST([DLL_VARIABLE])
192 /* On Windows, variables that may be in a DLL must be marked specially. */
193 #if defined _MSC_VER && defined _DLL
194 # define DLL_VARIABLE __declspec (dllimport)
196 # define DLL_VARIABLE
200 AC_CONFIG_SUBDIRS([libcharset])
201 AC_CONFIG_SUBDIRS([preload])
202 AC_CONFIG_FILES([Makefile])
203 AC_CONFIG_FILES([lib/Makefile])
204 AC_CONFIG_FILES([srclib/Makefile])
205 AC_CONFIG_FILES([src/Makefile])
206 AC_CONFIG_FILES([po/Makefile.in])
207 AC_CONFIG_FILES([man/Makefile])
208 if test -d "${srcdir}/tests"; then
209 AC_CONFIG_FILES([tests/Makefile])
211 AC_CONFIG_FILES([include/iconv.h:include/iconv.h.build.in])
212 AC_CONFIG_FILES([include/iconv.h.inst:include/iconv.h.in])