1 dnl Id: configure.in,v 1.1 2003/06/04 00:25:25 marka Exp
2 dnl Process this file with autoconf to produce a configure script.
4 dnl Copyright (c) 2000 Japan Network Information Center. All rights reserved.
6 dnl By using this file, you agree to the terms and conditions set forth bellow.
8 dnl LICENSE TERMS AND CONDITIONS
10 dnl The following License Terms and Conditions apply, unless a different
11 dnl license is obtained from Japan Network Information Center ("JPNIC"),
12 dnl a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
13 dnl Chiyoda-ku, Tokyo 101-0047, Japan.
15 dnl 1. Use, Modification and Redistribution (including distribution of any
16 dnl modified or derived work) in source and/or binary forms is permitted
17 dnl under this License Terms and Conditions.
19 dnl 2. Redistribution of source code must retain the copyright notices as they
20 dnl appear in each source code file, this License Terms and Conditions.
22 dnl 3. Redistribution in binary form must reproduce the Copyright Notice,
23 dnl this License Terms and Conditions, in the documentation and/or other
24 dnl materials provided with the distribution. For the purposes of binary
25 dnl distribution the "Copyright Notice" refers to the following language:
26 dnl "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
28 dnl 4. The name of JPNIC may not be used to endorse or promote products
29 dnl derived from this Software without specific prior written approval of
32 dnl 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
33 dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
35 dnl PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
36 dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37 dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38 dnl SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
39 dnl BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40 dnl WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
41 dnl OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
42 dnl ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
44 AC_INIT(include/idn/converter.h)
50 [ --enable-debug enable debug codes [default=no]],
54 CFLAGS="$CFLAGS -DDEBUG"
61 AC_ARG_ENABLE(mdnkit-compat,
62 [ --enable-mdnkit-compat enable mDNkit compatibility mode [default=no]],
63 mdnkit_compat=$enableval)
64 case "$mdnkit_compat" in
68 AC_DEFINE(ENABLE_MDNKIT_COMPAT, 1,
69 [Define if --enable-mdnkit-compat is specified])
74 AC_MSG_ERROR([You must specify yes or no to --enable-runidn option.])
78 AC_SUBST(COMPAT_FALSE)
81 AC_ARG_ENABLE(extra-ace,
82 [ --enable-extra-ace enable additional ACE converters. [default=no]],
88 AC_DEFINE(IDN_EXTRA_ACE, 1,
89 [Define if you want additional ACE converters compiled in.])
92 AC_MSG_ERROR([You must specify yes or no to --enable-extra-ace option.])
98 [ --with-utf8=NAME codeset name for UTF-8 encoding [UTF-8]],
105 AC_MSG_ERROR([You must specify NAME to --with-utf8 option.])
108 AC_DEFINE_UNQUOTED(IDN_UTF8_ENCODING_NAME, "$UTF8_NAME",
109 [Define if your iconv() does not accept "UTF-8" as the codeset name for utf-8.])
117 AC_ARG_ENABLE(liteonly,
118 [ --enable-liteonly compile and install lite library only [default=no]],
124 if test "$install_runidn" = yes ; then
125 AC_MSG_ERROR([you can't set value \"yes\" to --enable-runidn and --enable-liteonly simultaneously, because runidn requires iconv support of generic libidnkit.])
131 AC_MSG_ERROR([You must specify yes or no to --enable-liteonly option.])
134 AC_SUBST(LITEONLY_TRUE)
135 AC_SUBST(LITEONLY_FALSE)
140 AC_ARG_ENABLE(runidn,
141 [ --enable-runidn compile and install runidn [default=no]],
142 install_runidn=$enableval)
143 case "$install_runidn" in
147 if test "$liteonly" = yes ; then
148 AC_MSG_ERROR([you can't set value \"yes\" to --enable-runidn and --enable-liteonly simultaneously, because runidn requires iconv support of generic libidnkit.])
154 AC_MSG_ERROR([You must specify yes or no to --enable-runidn option.])
157 AC_SUBST(RUNIDN_TRUE)
158 AC_SUBST(RUNIDN_FALSE)
164 AC_ARG_WITH(libiconv,
165 [ --with-libiconv=IPREFIX GNU libiconv are installed in IPREFIX [PREFIX]],
175 if test "$liteonly" = yes ; then
176 AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
178 if test X$prefix = XNONE ; then
179 libiconv=$ac_default_prefix
183 ICONVINC="-I$libiconv/include"
184 ICONVLIB="-L$libiconv/lib -R$libiconv/lib -liconv"
187 if test "$liteonly" = yes ; then
188 AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
190 ICONVINC="-I$libiconv/include"
191 ICONVLIB="-L$libiconv/lib -R$libiconv/lib -liconv"
196 AC_ARG_WITH(iconv-include,
197 [ --with-iconv-include=DIR iconv include files are in DIR []],
198 iconv_include=$withval)
199 case "$iconv_include" in
206 if test "$liteonly" = yes ; then
207 AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
209 AC_MSG_WARN([You must supply DIR to --with-iconv-include option.
214 if test "$liteonly" = yes ; then
215 AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
217 ICONVINC="-I$iconv_include"
221 if test "X$ICONVINC" != X ; then
222 iconv_include="`echo X$ICONVINC | sed -e 's/^X-I//'`"
223 if test ! -f "$iconv_include/iconv.h" ; then
224 AC_MSG_ERROR([iconv.h doesn't exist in $iconv_include])
232 [ --with-iconv=LIB special library for iconv []],
241 if test "$liteonly" = yes ; then
242 AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
244 AC_MSG_WARN([You must supply LIB to --with-iconv option.
245 -liconv is assumed.])
249 if test "$liteonly" = yes ; then
250 AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
257 AC_ARG_WITH(iconv-sofile,
258 [ --with-iconv-sofile=PATH shared library file for libiconv []],
259 iconv_file=$withval, iconv_file=guess)
261 case "$iconv_file" in
266 if test "$liteonly" = yes ; then
267 AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
269 AC_MSG_ERROR([You must supply PATH to --with-iconv-sofile option.])
272 if test "$liteonly" != yes ; then
273 if test "$ICONVLIB" = ""; then
276 AC_MSG_CHECKING(pathname of iconv shared library)
287 for arg in $ICONVLIB; do
289 -L*) ic_libdir="$ic_libdir `echo $arg | sed s/-L//`" ;;
290 -l*) ic_libname=`echo $arg | sed s/-l//` ;;
291 /*.$SO*) ICONVSOFILE=$arg ;;
294 if test "$ICONVSOFILE" = ""; then
295 if test "$ic_libname" = ""; then
296 AC_MSG_RESULT(unknown)
297 AC_MSG_WARN([use --with-iconv-sofile for specifying iconv shared library file])
300 if test "$ic_libdir" = ""; then
301 # Standard (and semi-standard) library directories
302 ic_libdir="/lib /usr/lib /usr/local/lib"
304 for dir in $ic_libdir; do
305 ICONVSOFILE=`ls -r $dir/lib$ic_libname.$SO* 2>/dev/null | head -1`
306 if test "$ICONVSOFILE" != ""; then
310 if test "$ICONVSOFILE" != ""; then
311 AC_MSG_RESULT($ICONVSOFILE)
313 AC_MSG_RESULT(unknown)
314 AC_MSG_WARN([use --with-iconv-sofile for specifying iconv shared library file])
325 if test "$liteonly" = yes ; then
326 AC_MSG_ERROR([you can't set iconv options at all when you set value \"yes\" to --enable-liteonly, because lite library does not have iconv support.])
328 ICONVSOFILE=$iconv_file
331 AC_SUBST(ICONVSOFILE)
333 dnl Figure out preload stuff.
334 PRELOAD_VAR="LD_PRELOAD"
345 PRELOAD_VAR="_RLD_LIST"
346 PRELOAD_LAST=":DEFAULT"
349 if test -x /usr/bin/file -a -x /usr/bin/grep ; then
350 case "`/usr/bin/file /usr/bin/grep`" in
359 AC_SUBST(PRELOAD_VAR)
360 AC_SUBST(PRELOAD_SEP)
361 AC_SUBST(PRELOAD_LAST)
363 dnl Checks for standard tools.
368 AC_PATH_PROGS(PERL, perl, perl)
370 dnl Checks for header files.
371 AC_CHECK_HEADERS(unistd.h locale.h langinfo.h pwd.h)
372 if test "$install_runidn" = yes ; then
373 AC_CHECK_HEADERS(dlfcn.h)
376 saved_CPPFLAGS=$CPPFLAGS
377 CPPFLAGS="$CPPFLAGS $ICONVINC"
378 if test "$liteonly" != yes ; then
379 AC_CHECK_HEADER(iconv.h, , [AC_MSG_ERROR([iconv.h doesn't exist])])
381 CPPFLAGS=$saved_CPPFLAGS
383 dnl Checks for data types.
386 AC_CHECK_TYPE(BOOL, int)
388 dnl Checks for libraries.
389 if test "$install_runidn" = yes ; then
390 AC_CHECK_LIB(socket, socket)
391 AC_CHECK_LIB(nsl, inet_addr)
392 AC_CHECK_LIB(dl, dlopen, [
395 AC_DEFINE(HAVE_LIBDL, 1, [Define if you have the dl library (-ldl).])
400 dnl Checks for library functions.
401 AC_CHECK_FUNCS(vsnprintf setvbuf setlocale nl_langinfo memmove bcopy setenv \
403 if test "$install_runidn" = yes ; then
404 AC_CHECK_FUNCS(gethostbyname gethostbyname2 gethostbyaddr)
405 AC_CHECK_FUNCS(gethostbyname_r gethostbyname2_r gethostbyaddr_r, find_gethost_r=yes)
406 AC_CHECK_FUNCS(getipnodebyname getipnodebyaddr freehostent)
407 AC_CHECK_FUNCS(getaddrinfo freeaddrinfo getnameinfo)
408 AC_CHECK_FUNCS(dlopen dlsym)
411 if test "$install_runidn" = yes ; then
412 dnl Checks the flavor of gethostbyaddr* functions.
413 AC_CACHE_CHECK(flavor of gethostbyaddr, ac_cv_flavor_gethostbyaddr,
414 [ac_cv_flavor_gethostbyaddr=unknown
418 #include <sys/types.h>
419 #include <sys/socket.h>
421 struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) {
425 (void)gethostbyaddr(NULL, 0, 0);
428 ], ac_cv_flavor_gethostbyaddr=glibc2_2,,
429 ac_cv_flavor_gethostbyaddr=unknown)
433 #include <sys/types.h>
434 #include <sys/socket.h>
436 struct hostent *gethostbyaddr(const char *addr, size_t len, int type) {
440 (void)gethostbyaddr(NULL, 0, 0);
443 ], ac_cv_flavor_gethostbyaddr=glibc,,
444 ac_cv_flavor_gethostbyaddr=unknown)
448 #include <sys/types.h>
449 #include <sys/socket.h>
451 struct hostent *gethostbyaddr(const char *addr, int len, int type) {
455 (void)gethostbyaddr(NULL, 0, 0);
458 ], ac_cv_flavor_gethostbyaddr=traditional,,
459 ac_cv_flavor_gethostbyaddr=unknown)
460 if test "$ac_cv_func_gethostbyaddr" = no ; then
461 ac_cv_flavor_gethostbyaddr=none
464 case "$ac_cv_flavor_gethostbyaddr" in
466 ac_cv_type_ghba_addr_t='const void *'
467 ac_cv_type_ghba_addrlen_t='socklen_t'
470 ac_cv_type_ghba_addr_t='const char *'
471 ac_cv_type_ghba_addrlen_t='size_t'
474 ac_cv_type_ghba_addr_t='const char *'
475 ac_cv_type_ghba_addrlen_t='int'
478 AC_MSG_ERROR([can't build runidn, since parameter type list of gethostbyaddr() is unknown to configure.])
481 AC_DEFINE_UNQUOTED(GHBA_ADDR_T, $ac_cv_type_ghba_addr_t,
482 [Define as the type of the 1st argument of gethostbyaddr.])
483 AC_DEFINE_UNQUOTED(GHBA_ADDRLEN_T, $ac_cv_type_ghba_addrlen_t,
484 [Define as the type of the 2nd argument of gethostbyaddr.])
486 dnl Checks the flavor of getnameinfo functions.
487 AC_CACHE_CHECK(flavor of getnameinfo, ac_cv_flavor_getnameinfo,
488 [ac_cv_flavor_getnameinfo=unknown
492 #include <sys/types.h>
493 #include <sys/socket.h>
495 int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
496 socklen_t hostlen, char *serv, socklen_t servlen,
497 unsigned int flags) {
501 (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
504 ], ac_cv_flavor_getnameinfo=glibc2_2_2,,
505 ac_cv_flavor_getnameinfo=unknown)
509 #include <sys/types.h>
510 #include <sys/socket.h>
512 int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
513 socklen_t hostlen, char *serv, socklen_t servlen,
518 (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
521 ], ac_cv_flavor_getnameinfo=rfc2553bis_03,,
522 ac_cv_flavor_getnameinfo=unknown)
526 #include <sys/types.h>
527 #include <sys/socket.h>
529 int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
530 size_t hostlen, char *serv, size_t servlen, int flags) {
534 (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
537 ], ac_cv_flavor_getnameinfo=rfc2553,,
538 ac_cv_flavor_getnameinfo=unknown)
542 #include <sys/types.h>
543 #include <sys/socket.h>
545 int getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
546 size_t hostlen, char *serv, size_t servlen, int flags) {
550 (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);
553 ], ac_cv_flavor_getnameinfo=rfc2133,,
554 ac_cv_flavor_getnameinfo=unknown)
555 if test "$ac_cv_func_getnameinfo" = no ; then
556 ac_cv_flavor_getnameinfo=none
559 case "$ac_cv_flavor_getnameinfo" in
561 ac_cv_type_gni_salen_t='socklen_t'
562 ac_cv_type_gni_hostlen_t='socklen_t'
563 ac_cv_type_gni_servlen_t='socklen_t'
564 ac_cv_type_gni_flags_t='unsigned int'
567 ac_cv_type_gni_salen_t='socklen_t'
568 ac_cv_type_gni_hostlen_t='socklen_t'
569 ac_cv_type_gni_servlen_t='socklen_t'
570 ac_cv_type_gni_flags_t='int'
573 ac_cv_type_gni_salen_t='socklen_t'
574 ac_cv_type_gni_hostlen_t='size_t'
575 ac_cv_type_gni_servlen_t='size_t'
576 ac_cv_type_gni_flags_t='int'
579 ac_cv_type_gni_salen_t='size_t'
580 ac_cv_type_gni_hostlen_t='size_t'
581 ac_cv_type_gni_servlen_t='size_t'
582 ac_cv_type_gni_flags_t='int'
585 AC_MSG_ERROR([can't build runidn, since parameter type list of getnameinfo() is unknown to configure.])
587 AC_DEFINE_UNQUOTED(GNI_SALEN_T, $ac_cv_type_gni_salen_t,
588 [Define as the type of the 2nd argument of getnameinfo.])
589 AC_DEFINE_UNQUOTED(GNI_HOSTLEN_T, $ac_cv_type_gni_hostlen_t,
590 [Define as the type of the 4th argument of getnameinfo.])
591 AC_DEFINE_UNQUOTED(GNI_SERVLEN_T, $ac_cv_type_gni_servlen_t,
592 [Define as the type of the 6th argument of getnameinfo.])
593 AC_DEFINE_UNQUOTED(GNI_FLAGS_T, $ac_cv_type_gni_flags_t,
594 [Define as the type of the 7th argument of getnameinfo.])
598 dnl Checks the flavor of gethost*_r functions.
599 if test "$find_gethost_r" = yes; then
600 AC_CACHE_CHECK(flavor of gethostbyname_r, ac_cv_flavor_gethost_r,
602 changequote(<<, >>)dnl
605 #include <sys/types.h>
606 #include <sys/socket.h>
612 struct hostent hebuf, *hp;
614 /* Try resolving a invalid name using glibc flavor. */
615 (void)gethostbyname_r("@#!", &hebuf, buf, sizeof(buf), &hp, &err);
617 return 0; /* glibc flavor */
619 return 1; /* Sun flavor */
623 ac_cv_flavor_gethost_r=glibc,
624 ac_cv_flavor_gethost_r=sun,
625 ac_cv_flavor_gethost_r=sun)])
626 if test "$ac_cv_flavor_gethost_r" = "glibc"; then
627 AC_DEFINE(GETHOST_R_GLIBC_FLAVOR, 1,
628 [Define if the prototype of gethost*_r is glibc flavor.])
632 dnl Find system shared object paths.
633 AC_FIND_SYSTEM_SHOBJ(libc)
634 if test "$install_runidn" = yes ; then
635 AC_FIND_SYSTEM_SHOBJ(libnsl)
638 dnl Checks for iconv library.
639 if test "$liteonly" != yes ; then
640 AC_MSG_CHECKING(for iconv)
641 saved_CPPFLAGS=$CPPFLAGS
643 CPPFLAGS="$CPPFLAGS $ICONVINC"
644 LIBS="$LIBS $ICONVLIB"
649 i = iconv_open("ISO-8859-1", "UTF-8");
650 ], [iconv_try_link=yes], [iconv_try_link=no])
652 CPPFLAGS=$saved_CPPFLAGS
653 AC_MSG_RESULT($iconv_try_link)
654 if test "$iconv_try_link" = no ; then
655 AC_MSG_ERROR(iconv function not available)
659 dnl Check for codeset name for UTF-8.
660 if test "$liteonly" != yes ; then
661 AC_MSG_CHECKING([for codeset name $UTF8_NAME])
662 saved_CPPFLAGS=$CPPFLAGS
664 CPPFLAGS="$CPPFLAGS $ICONVINC"
665 LIBS="$LIBS $ICONVLIB"
670 #define UTF8_NAME "$UTF8_NAME"
671 #define ICONV_FAIL ((iconv_t)(-1))
672 /* Check if the codeset name UTF8_NAME is valid by performing iconv_open(). */
675 /* list of codeset names likely to exist */
676 static char *codeset[] = {
677 "ASCII", "ISO-8859-1", "ISO8859-1", "iso8859_1", "8859-1",
678 "Shift_JIS", "SJIS", "sjis", NULL,
681 /* First try null conversion. */
682 if (iconv_open(UTF8_NAME, UTF8_NAME) != ICONV_FAIL) return 0;
684 /* Unfortunately, above check fails on certain systems, such as Solaris. */
685 for (i = 0; codeset[i] != NULL; i++) {
686 if (iconv_open(UTF8_NAME, codeset[i]) != ICONV_FAIL) return 0;
690 ], utf8_name_valid=yes, utf8_name_valid=no, utf8_name_valid=unknown)
692 CPPFLAGS=$saved_CPPFLAGS
693 AC_MSG_RESULT($utf8_name_valid)
697 AC_CONFIG_HEADER(include/config.h)
706 tools/idnconv/Makefile
707 tools/runidn/Makefile