configure.ac 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. dnl Copyright (C) 1999-2009 Free Software Foundation, Inc.
  2. dnl This file is part of the GNU LIBICONV Library.
  3. dnl
  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.
  8. dnl
  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.
  13. dnl
  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, write to the Free Software Foundation, Inc., 51 Franklin Street,
  17. dnl Fifth Floor, Boston, MA 02110-1301, USA.
  18. AC_PREREQ([2.60])
  19. AC_INIT
  20. AC_CONFIG_SRCDIR([lib/iconv.c])
  21. AC_CONFIG_AUX_DIR([build-aux])
  22. AM_INIT_AUTOMAKE([libiconv], [1.13.1])
  23. AC_CONFIG_HEADERS([config.h lib/config.h])
  24. AC_PROG_MAKE_SET
  25. dnl checks for basic programs
  26. AC_PROG_CC
  27. AC_PROG_CPP
  28. AC_PROG_INSTALL
  29. AC_PATH_PROG([STRIP], [strip], [:]) dnl sets STRIP
  30. AM_PROG_INSTALL_STRIP dnl overrides STRIP when cross-compiling,
  31. dnl sets INSTALL_STRIP_PROGRAM
  32. dnl check for host type
  33. AC_CANONICAL_HOST
  34. dnl hack
  35. dnl Hack to work around limitations of automake and error.m4 regarding LIBOBJS.
  36. dnl "srclib/Makefile.am:32: automatically discovered file `error.h' should not be explicitly mentioned"
  37. AC_DEFUN([my_SRCLIB_OBJ],[SRCLIBOBJS="$SRCLIBOBJS $1.$ac_objext"])
  38. AC_DEFUN([my_SRCLIB_REPLACE_FUNCS], [AC_CHECK_FUNCS([$1], , [my_SRCLIB_OBJ($ac_func)])])
  39. m4_pushdef([AC_LIBOBJ], m4_defn([my_SRCLIB_OBJ]))
  40. m4_pushdef([AC_REPLACE_FUNCS], m4_defn([my_SRCLIB_REPLACE_FUNCS]))
  41. dnl checks for UNIX variants that set DEFS
  42. gl_EARLY
  43. dnl checks for installer options
  44. gl_RELOCATABLE([srclib])
  45. AC_ARG_ENABLE([extra-encodings],
  46. [AC_HELP_STRING([--enable-extra-encodings],
  47. [add support for a few rarely used encodings])],
  48. [AC_DEFINE([ENABLE_EXTRA], 1,
  49. [Define to 1 to enable a few rarely used encodings.])
  50. USE_EXTRA_ENCODINGS=yes],
  51. [USE_EXTRA_ENCODINGS=no])
  52. AC_SUBST([USE_EXTRA_ENCODINGS])
  53. dnl checks for programs
  54. CL_PROG_CP
  55. CL_PROG_LN
  56. AC_PROG_LN_S
  57. dnl checks for compiler output filename suffixes
  58. AC_OBJEXT
  59. AC_EXEEXT
  60. dnl check for build configuration
  61. LT_INIT([disable-static win32-dll])
  62. dnl Prepares the libtool configuration for handling of Windows resources, and
  63. dnl sets the RC variable to a program that compiles Windows resource files.
  64. LT_LANG([Windows Resource])
  65. dnl On mingw and Cygwin, we can activate special Makefile rules which add
  66. dnl version information to the executables.
  67. case "$host_os" in
  68. mingw* | cygwin*) is_woe32=yes ;;
  69. *) is_woe32=no ;;
  70. esac
  71. WOE32=$is_woe32
  72. AC_SUBST([WOE32])
  73. if test $WOE32 = yes; then
  74. dnl Check for a program that compiles Windows resource files.
  75. AC_CHECK_TOOL([WINDRES], [windres])
  76. fi
  77. gl_VISIBILITY
  78. AM_ICONV
  79. AM_GNU_GETTEXT([external], [need-ngettext])
  80. dnl checks for typedefs
  81. AC_TYPE_MBSTATE_T
  82. gt_TYPE_WCHAR_T
  83. dnl checks for header files, functions and declarations
  84. if test "$am_cv_func_iconv" = yes -a -n "$am_cv_proto_iconv_arg1"; then
  85. ICONV_CONST="const"
  86. else
  87. ICONV_CONST=""
  88. fi
  89. AC_SUBST([ICONV_CONST])
  90. if test $gt_cv_c_wchar_t = yes; then
  91. HAVE_WCHAR_T=1
  92. else
  93. HAVE_WCHAR_T=0
  94. fi
  95. AC_SUBST([HAVE_WCHAR_T])
  96. AC_CHECK_FUNCS([getc_unlocked mbrtowc wcrtomb mbsinit setlocale])
  97. dnl mbstate_t is used if HAVE_WCRTOMB || HAVE_MBRTOWC, see lib/loop_wchar.h.
  98. if test $ac_cv_func_wcrtomb = yes || test $ac_cv_func_mbrtowc = yes; then
  99. USE_MBSTATE_T=1
  100. else
  101. USE_MBSTATE_T=0
  102. fi
  103. AC_SUBST([USE_MBSTATE_T])
  104. AC_CACHE_CHECK([whether <wchar.h> is standalone],
  105. [gl_cv_header_wchar_h_standalone],
  106. [AC_COMPILE_IFELSE([[#include <wchar.h>
  107. wchar_t w;]],
  108. [gl_cv_header_wchar_h_standalone=yes],
  109. [gl_cv_header_wchar_h_standalone=no])])
  110. if test $gl_cv_header_wchar_h_standalone = yes; then
  111. BROKEN_WCHAR_H=0
  112. else
  113. BROKEN_WCHAR_H=1
  114. fi
  115. AC_SUBST([BROKEN_WCHAR_H])
  116. AC_REPLACE_FUNCS([memmove])
  117. AM_LANGINFO_CODESET
  118. AC_EILSEQ
  119. CL_WORDS_LITTLEENDIAN
  120. gl_INIT
  121. dnl hack
  122. dnl End of hack to work around limitations of automake and error.m4.
  123. m4_popdef([AC_REPLACE_FUNCS])
  124. m4_popdef([AC_LIBOBJ])
  125. AC_SUBST([SRCLIBOBJS])
  126. dnl Compilation on mingw and Cygwin needs special Makefile rules, because
  127. dnl 1. when we install a shared library, we must arrange to export
  128. dnl auxiliary pointer variables for every exported variable,
  129. dnl 2. when we install a shared library and a static library simultaneously,
  130. dnl the include file specifies __declspec(dllimport) and therefore we
  131. dnl must arrange to define the auxiliary pointer variables for the
  132. dnl exported variables _also_ in the static library.
  133. if test "$enable_shared" = yes; then
  134. case "$host_os" in
  135. mingw* | cygwin*) is_woe32dll=yes ;;
  136. *) is_woe32dll=no ;;
  137. esac
  138. else
  139. is_woe32dll=no
  140. fi
  141. WOE32DLL=$is_woe32dll
  142. AC_SUBST([WOE32DLL])
  143. if test $is_woe32dll = yes; then
  144. DLL_VARIABLE='__declspec (dllimport)'
  145. else
  146. DLL_VARIABLE=
  147. fi
  148. AC_SUBST([DLL_VARIABLE])
  149. AH_BOTTOM([
  150. /* On Windows, variables that may be in a DLL must be marked specially. */
  151. #if defined _MSC_VER && defined _DLL
  152. # define DLL_VARIABLE __declspec (dllimport)
  153. #else
  154. # define DLL_VARIABLE
  155. #endif
  156. ])
  157. AC_CONFIG_SUBDIRS([libcharset])
  158. AC_CONFIG_SUBDIRS([preload])
  159. AC_CONFIG_FILES([Makefile])
  160. AC_CONFIG_FILES([lib/Makefile])
  161. AC_CONFIG_FILES([srclib/Makefile])
  162. AC_CONFIG_FILES([src/Makefile])
  163. AC_CONFIG_FILES([po/Makefile.in])
  164. AC_CONFIG_FILES([man/Makefile])
  165. if test -d "${srcdir}/tests"; then
  166. AC_CONFIG_FILES([tests/Makefile])
  167. fi
  168. AC_CONFIG_FILES([include/iconv.h:include/iconv.h.build.in])
  169. AC_CONFIG_FILES([include/iconv.h.inst:include/iconv.h.in])
  170. AC_OUTPUT