📄 configure.in
字号:
esacAC_SUBST(PRELOAD_VAR)AC_SUBST(PRELOAD_SEP)AC_SUBST(PRELOAD_LAST)dnl Checks for standard tools.AC_PROG_CCAC_PROG_INSTALLAM_PROG_LIBTOOLAC_PATH_PROGS(PERL, perl, perl)dnl Checks for header files.AC_CHECK_HEADERS(unistd.h locale.h langinfo.h pwd.h)if test "$install_runidn" = yes ; then AC_CHECK_HEADERS(dlfcn.h)fisaved_CPPFLAGS=$CPPFLAGSCPPFLAGS="$CPPFLAGS $ICONVINC"if test "$liteonly" != yes ; then AC_CHECK_HEADER(iconv.h, , [AC_MSG_ERROR([iconv.h doesn't exist])])fiCPPFLAGS=$saved_CPPFLAGSdnl Checks for data types.AC_TYPE_UID_Tdnl for dnsproxy.AC_CHECK_TYPE(BOOL, int)dnl Checks for libraries.if test "$install_runidn" = yes ; then AC_CHECK_LIB(socket, socket) AC_CHECK_LIB(nsl, inet_addr) AC_CHECK_LIB(dl, dlopen, [ LIBS="-ldl $LIBS" LIBDL="-ldl" AC_DEFINE(HAVE_LIBDL, 1, [Define if you have the dl library (-ldl).]) AC_SUBST(LIBDL) ])fidnl Checks for library functions.AC_CHECK_FUNCS(vsnprintf setvbuf setlocale nl_langinfo memmove bcopy setenv \ unsetenv)if test "$install_runidn" = yes ; then AC_CHECK_FUNCS(gethostbyname gethostbyname2 gethostbyaddr) AC_CHECK_FUNCS(gethostbyname_r gethostbyname2_r gethostbyaddr_r, find_gethost_r=yes) AC_CHECK_FUNCS(getipnodebyname getipnodebyaddr freehostent) AC_CHECK_FUNCS(getaddrinfo freeaddrinfo getnameinfo) AC_CHECK_FUNCS(dlopen dlsym)fiif test "$install_runidn" = yes ; thendnl Checks the flavor of gethostbyaddr* functions. AC_CACHE_CHECK(flavor of gethostbyaddr, ac_cv_flavor_gethostbyaddr, [ac_cv_flavor_gethostbyaddr=unknown AC_TRY_RUN( [ #include <stddef.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type) { return NULL; } int main() { (void)gethostbyaddr(NULL, 0, 0); return 0; } ], ac_cv_flavor_gethostbyaddr=glibc2_2,, ac_cv_flavor_gethostbyaddr=unknown) AC_TRY_RUN( [ #include <stddef.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> struct hostent *gethostbyaddr(const char *addr, size_t len, int type) { return NULL; } int main() { (void)gethostbyaddr(NULL, 0, 0); return 0; } ], ac_cv_flavor_gethostbyaddr=glibc,, ac_cv_flavor_gethostbyaddr=unknown) AC_TRY_RUN( [ #include <stddef.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> struct hostent *gethostbyaddr(const char *addr, int len, int type) { return NULL; } int main() { (void)gethostbyaddr(NULL, 0, 0); return 0; } ], ac_cv_flavor_gethostbyaddr=traditional,, ac_cv_flavor_gethostbyaddr=unknown) if test "$ac_cv_func_gethostbyaddr" = no ; then ac_cv_flavor_gethostbyaddr=none fi]) case "$ac_cv_flavor_gethostbyaddr" in glibc2_2) ac_cv_type_ghba_addr_t='const void *' ac_cv_type_ghba_addrlen_t='socklen_t' ;; glibc) ac_cv_type_ghba_addr_t='const char *' ac_cv_type_ghba_addrlen_t='size_t' ;; traditional | none) ac_cv_type_ghba_addr_t='const char *' ac_cv_type_ghba_addrlen_t='int' ;; *) AC_MSG_ERROR([can't build runidn, since parameter type list of gethostbyaddr() is unknown to configure.]) ;; esac AC_DEFINE_UNQUOTED(GHBA_ADDR_T, $ac_cv_type_ghba_addr_t, [Define as the type of the 1st argument of gethostbyaddr.]) AC_DEFINE_UNQUOTED(GHBA_ADDRLEN_T, $ac_cv_type_ghba_addrlen_t, [Define as the type of the 2nd argument of gethostbyaddr.])dnl Checks the flavor of getnameinfo functions. AC_CACHE_CHECK(flavor of getnameinfo, ac_cv_flavor_getnameinfo, [ac_cv_flavor_getnameinfo=unknown AC_TRY_RUN( [ #include <stddef.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, unsigned int flags) { return NULL; } int main() { (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0); return 0; } ], ac_cv_flavor_getnameinfo=glibc2_2_2,, ac_cv_flavor_getnameinfo=unknown) AC_TRY_RUN( [ #include <stddef.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags) { return NULL; } int main() { (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0); return 0; } ], ac_cv_flavor_getnameinfo=rfc2553bis_03,, ac_cv_flavor_getnameinfo=unknown) AC_TRY_RUN( [ #include <stddef.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags) { return NULL; } int main() { (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0); return 0; } ], ac_cv_flavor_getnameinfo=rfc2553,, ac_cv_flavor_getnameinfo=unknown) AC_TRY_RUN( [ #include <stddef.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> int getnameinfo(const struct sockaddr *sa, size_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags) { return NULL; } int main() { (void)getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0); return 0; } ], ac_cv_flavor_getnameinfo=rfc2133,, ac_cv_flavor_getnameinfo=unknown) if test "$ac_cv_func_getnameinfo" = no ; then ac_cv_flavor_getnameinfo=none fi]) case "$ac_cv_flavor_getnameinfo" in glibc2_2_2) ac_cv_type_gni_salen_t='socklen_t' ac_cv_type_gni_hostlen_t='socklen_t' ac_cv_type_gni_servlen_t='socklen_t' ac_cv_type_gni_flags_t='unsigned int' ;; rfc2553bis_03) ac_cv_type_gni_salen_t='socklen_t' ac_cv_type_gni_hostlen_t='socklen_t' ac_cv_type_gni_servlen_t='socklen_t' ac_cv_type_gni_flags_t='int' ;; rfc2553) ac_cv_type_gni_salen_t='socklen_t' ac_cv_type_gni_hostlen_t='size_t' ac_cv_type_gni_servlen_t='size_t' ac_cv_type_gni_flags_t='int' ;; rfc2133 | none) ac_cv_type_gni_salen_t='size_t' ac_cv_type_gni_hostlen_t='size_t' ac_cv_type_gni_servlen_t='size_t' ac_cv_type_gni_flags_t='int' ;; *) AC_MSG_ERROR([can't build runidn, since parameter type list of getnameinfo() is unknown to configure.]) esac AC_DEFINE_UNQUOTED(GNI_SALEN_T, $ac_cv_type_gni_salen_t, [Define as the type of the 2nd argument of getnameinfo.]) AC_DEFINE_UNQUOTED(GNI_HOSTLEN_T, $ac_cv_type_gni_hostlen_t, [Define as the type of the 4th argument of getnameinfo.]) AC_DEFINE_UNQUOTED(GNI_SERVLEN_T, $ac_cv_type_gni_servlen_t, [Define as the type of the 6th argument of getnameinfo.]) AC_DEFINE_UNQUOTED(GNI_FLAGS_T, $ac_cv_type_gni_flags_t, [Define as the type of the 7th argument of getnameinfo.])fidnl resume here.dnl Checks the flavor of gethost*_r functions.if test "$find_gethost_r" = yes; then AC_CACHE_CHECK(flavor of gethostbyname_r, ac_cv_flavor_gethost_r, [AC_TRY_RUN(changequote(<<, >>)dnl<<#include <stddef.h>#include <sys/types.h>#include <sys/socket.h>#include <netdb.h>#include <stdio.h>int main(){ int err = 0; struct hostent hebuf, *hp; char buf[10]; /* Try resolving a invalid name using glibc flavor. */ (void)gethostbyname_r("@#!", &hebuf, buf, sizeof(buf), &hp, &err); if (err != 0) return 0; /* glibc flavor */ else return 1; /* Sun flavor */}>>,changequote([, ])dnl ac_cv_flavor_gethost_r=glibc, ac_cv_flavor_gethost_r=sun, ac_cv_flavor_gethost_r=sun)]) if test "$ac_cv_flavor_gethost_r" = "glibc"; then AC_DEFINE(GETHOST_R_GLIBC_FLAVOR, 1, [Define if the prototype of gethost*_r is glibc flavor.]) fifidnl Find system shared object paths.AC_FIND_SYSTEM_SHOBJ(libc)if test "$install_runidn" = yes ; then AC_FIND_SYSTEM_SHOBJ(libnsl)fidnl Checks for iconv library.if test "$liteonly" != yes ; then AC_MSG_CHECKING(for iconv) saved_CPPFLAGS=$CPPFLAGS saved_LIBS=$LIBS CPPFLAGS="$CPPFLAGS $ICONVINC" LIBS="$LIBS $ICONVLIB" AC_TRY_LINK([ #include <iconv.h> ], [ iconv_t i; i = iconv_open("ISO-8859-1", "UTF-8"); ], [iconv_try_link=yes], [iconv_try_link=no]) LIBS=$saved_LIBS CPPFLAGS=$saved_CPPFLAGS AC_MSG_RESULT($iconv_try_link) if test "$iconv_try_link" = no ; then AC_MSG_ERROR(iconv function not available) fifidnl Check for codeset name for UTF-8.if test "$liteonly" != yes ; then AC_MSG_CHECKING([for codeset name $UTF8_NAME]) saved_CPPFLAGS=$CPPFLAGS saved_LIBS=$LIBS CPPFLAGS="$CPPFLAGS $ICONVINC" LIBS="$LIBS $ICONVLIB" AC_TRY_RUN([ #include <stddef.h> #include <stdlib.h> #include <iconv.h> #define UTF8_NAME "$UTF8_NAME" #define ICONV_FAIL ((iconv_t)(-1)) /* Check if the codeset name UTF8_NAME is valid by performing iconv_open(). */ int main() { int i; /* list of codeset names likely to exist */ static char *codeset[] = { "ASCII", "ISO-8859-1", "ISO8859-1", "iso8859_1", "8859-1", "Shift_JIS", "SJIS", "sjis", NULL, }; /* First try null conversion. */ if (iconv_open(UTF8_NAME, UTF8_NAME) != ICONV_FAIL) return 0; /* Unfortunately, above check fails on certain systems, such as Solaris. */ for (i = 0; codeset[i] != NULL; i++) { if (iconv_open(UTF8_NAME, codeset[i]) != ICONV_FAIL) return 0; } return 1; } ], utf8_name_valid=yes, utf8_name_valid=no, utf8_name_valid=unknown) LIBS=$saved_LIBS CPPFLAGS=$saved_CPPFLAGS AC_MSG_RESULT($utf8_name_valid)fidnl Output.AC_CONFIG_HEADER(include/config.h)AC_OUTPUT( Makefile include/Makefile include/idn/Makefile include/mdn/Makefile lib/Makefile man/Makefile tools/Makefile tools/idnconv/Makefile tools/runidn/Makefile tools/runidn/runidn map/Makefile lib/tests/Makefile)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -