configure.in
来自「这是一个完全开放的」· IN 代码 · 共 723 行 · 第 1/2 页
IN
723 行
#endif])dnldnl typedefs, structs, compiler quirksdnlAC_TYPE_MODE_TAC_TYPE_OFF_TAC_TYPE_PID_TAC_TYPE_SIZE_TAC_STRUCT_TMAC_STRUCT_TIMEZONEdnldnl ipv6 stuffdnlAC_DEFUN([_IP6_INCLUDES],[[#include "ac-stdint.h"#ifdef HAVE_SYS_TYPES_H# include <sys/types.h>#endif#ifdef HAVE_SYS_SOCKET_H# include <sys/socket.h>#endif#ifdef HAVE_NETINET_IN_H# include <netinet/in.h>#endif#ifdef HAVE_ARPA_INET_H# include <arpa/inet.h>#endif]])dnl these types are missing in placesAC_CHECK_TYPES([in_port_t, sa_family_t, struct sockaddr_storage, struct sockaddr_in6, struct in6_addr],,, _IP6_INCLUDES)dnldnl quirky functionsdnlAC_CHECK_FUNC(connect, ,[AC_CHECK_LIB(socket, connect)])AC_CHECK_LIB(ws2_32, _head_libws2_32_a)AC_CHECK_FUNC(gethostbyname, ,[AC_CHECK_LIB(resolv, gethostbyname)])AC_CHECK_FUNC(gethostbyname, ,[AC_CHECK_LIB(nsl, gethostbyname)])if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])fiif test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then AC_MSG_CHECKING([if we can include libnsl + libsocket]) LIBS="-lnsl -lsocket $LIBS" AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ]) if test "$my_ac_link_result" = "no" ; then AC_MSG_RESULT([failure]) AC_MSG_ERROR([unable to use gethostbyname()]) else AC_MSG_RESULT([success]) fifidnl res_query has been seen in libc, libbind and libresolvif test "x-$ac_cv_header_resolv_h" = "x-yes" ; then AC_CHECK_FUNCS(res_query) if test "x-$ac_cv_func_res_query" = "x-yes" ; then have_res_query=yes else AC_CHECK_LIB(resolv, res_query) if test "x-$ac_cv_lib_resolv_res_query" = "x-yes" ; then have_res_query=yes else AC_CHECK_LIB(bind, res_query) if test "x-$ac_cv_lib_bind_res_query" = "x-yes" ; then have_res_query=yes else dnl some glibcs have res_query as a macro, so work around it AC_MSG_CHECKING([for res_query in -lresolv (alternate version)]) save_libs="$LIBS" LIBS="-lresolv $LIBS" AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <resolv.h>]], [[res_query(0,0,0,0,0)]])], [AC_MSG_RESULT(yes) have_res_query=yes], [AC_MSG_RESULT(no) LIBS="$save_libs"]) fi fi fifidnl windows calls it DnsQueryif test "x-$ac_cv_header_windns_h" = "x-yes" ; then AC_MSG_CHECKING([for DnsQuery in -ldnsapi]) save_libs="$LIBS" LIBS="-ldnsapi $LIBS" AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h> #include <windns.h>]], [[DnsQuery(0,0,0,0,0,0)]])], [AC_MSG_RESULT(yes) have_dnsquery=yes], [AC_MSG_RESULT(no) LIBS="$save_libs"])fiif test "x-$have_res_query" = "x-yes" ; then AC_DEFINE(HAVE_RES_QUERY,1,[Define to 1 if you have the 'res_query' function.])elif test "x-$have_dnsquery" = "x-yes" ; then AC_DEFINE(HAVE_DNSQUERY,1,[Define to 1 if you have the 'DnsQuery' function.])else AC_MSG_ERROR([no DNS resolver interface (res_query or DnsQuery) found])fidnl inet_ntop/inet_pton have been seen in -lnsl, and sometimes not at allAC_CHECK_FUNC(inet_ntop, ,[AC_CHECK_LIB(nsl, inet_ntop)])unset ac_cv_func_inet_ntopAC_CHECK_FUNCS(inet_ntop inet_pton)dnl some glibcs have broken sockaddr_storage membersif test "x-$ac_cv_type_struct_sockaddr_storage" = "x-yes" ; then AC_MSG_CHECKING(for broken __ss_family member in struct sockaddr_storage) AC_COMPILE_IFELSE([AC_LANG_PROGRAM(_IP6_INCLUDES, [[do { struct sockaddr_storage s; s.__ss_family = 0; } while(0)]])], [AC_MSG_RESULT(yes) AC_DEFINE(ss_family, __ss_family, [Define to '__ss_family' if 'struct sockaddr_storage' defines '__ss_family' instead of 'ss_family'.])], AC_MSG_RESULT(no)) AC_MSG_CHECKING(for broken __ss_len member in struct sockaddr_storage) AC_COMPILE_IFELSE([AC_LANG_PROGRAM(_IP6_INCLUDES, [[do { struct sockaddr_storage s; s.__ss_len = 0; } while(0)]])], [AC_MSG_RESULT(yes) AC_DEFINE(ss_len, __ss_len, [Define to '__ss_len' if 'struct sockaddr_storage' defines '__ss_len' instead of 'ss_len'.])], AC_MSG_RESULT(no))fidnl syslogif test "x-$ac_cv_header_syslog_h" = "x-yes" ; then AC_CHECK_FUNCS(syslog)fiif test "x-$ac_cv_header_windows_h" = "x-yes" ; then AC_MSG_CHECKING(for ReportEvent) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>]], [[ReportEvent(0,0,0,0,0,0,0,0,0)]])], [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_REPORTEVENT,1,[Define to 1 if you have the 'ReportEvent' function.])], AC_MSG_RESULT(no))fidnl snprintf/vsnprintf don't exist everywhere. additionally, we requirednl them to gracefully accept NULLs, which is non-standardAC_CHECK_FUNCS(snprintf vsnprintf)if test "x-$ac_cv_func_snprintf" = "x-yes" ; then AC_MSG_CHECKING([if snprintf can handle NULL arguments]) AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> #include <signal.h> segv() { exit(1); } main() { char b[10]; signal(SIGSEGV,segv); snprintf(b,10,"%s",NULL); exit(0); }]])], AC_MSG_RESULT(yes), [AC_MSG_RESULT(no) AC_DEFINE(HAVE_BROKEN_SNPRINTF,1,[Define to 1 if 'snprintf' cannot handle NULL arguments.])])fiif test "x-$ac_cv_func_vsnprintf" = "x-yes" ; then AC_MSG_CHECKING([if vsnprintf can handle NULL arguments]) AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h> #include <signal.h> #include <stdarg.h> segv() { exit(1); } expand(char *f,...) { va_list ap; char b[10]; va_start(ap,f); vsnprintf(b,10,f,ap); va_end(ap); } main() { char b[10]; signal(SIGSEGV,segv); expand("%s", NULL); exit(0); }]])], AC_MSG_RESULT(yes), [AC_MSG_RESULT(no) AC_DEFINE(HAVE_BROKEN_VSNPRINTF,1,[Define to 1 if 'vsnprintf' cannot handle NULL arguments.])])fidnldnl mio backend checksdnlAC_ARG_ENABLE(mio, AC_HELP_STRING([--enable-mio=BACKEND], [use BACKEND to drive MIO]), mio_check=$enableval, mio_check='poll select')mio_backend=''for backend in $mio_check ; do if test "x-$mio_backend" = "x-" ; then case x-$backend in x-poll) AC_CHECK_HEADERS(poll.h) if test "x-$ac_cv_header_poll_h" = "x-yes" ; then AC_CHECK_FUNCS(poll,[ mio_backend='poll' AC_DEFINE(MIO_POLL,1,[Define to 1 if you want to use 'poll' for non-blocking I/O.])]) fi ;; x-select) AC_CHECK_HEADERS(sys/select.h) if test "x-$ac_cv_header_sys_select_h" = "x-yes" ; then AC_CHECK_FUNCS(select, have_select=yes) fi if test "x-$have_select" != "x-yes" -a "x-$ac_cv_header_winsock2_h" = "x-yes" ; then AC_MSG_CHECKING([for select in ws2_32]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]], [[select(0,0,0,0,0)]])], [AC_MSG_RESULT(yes) have_select=yes], AC_MSG_RESULT(no)) fi if test "x-$have_select" = "x-yes" ; then mio_backend='select' AC_DEFINE(MIO_SELECT,1,[Define to 1 if you want to use 'select' for non-blocking I/O.]) fi ;; esac fidoneif test "x-$mio_backend" = "x-" ; then AC_MSG_ERROR([no MIO backend available out of: $backend])fidnl functions we needAC_FUNC_MALLOCAC_FUNC_MEMCMPAC_FUNC_MKTIMEAC_FUNC_REALLOCAC_FUNC_STATAC_FUNC_VPRINTFAC_CHECK_FUNCS( \ close \ dup2 \ fcntl \ inet_aton \ ioctl \ isascii \ _findfirst \ getopt \ gettimeofday \ getpid \ _getpid \ memchr \ memmove \ memset \ mkdir \ _mkdir \ modf \ sleep \ Sleep \ strcasecmp \ stricmp \ strchr \ strdup \ strerror \ strncasecmp \ strnicmp \ strstr \ tzset \ uname \ getpagesize )dnl windows has different names for a few basic thingsif test "x-$ac_cv_func_getpid" != "x-yes" -a "x-$ac_cv_func__getpid" = "x-yes" ; then AC_DEFINE(getpid,_getpid,[Define to a function than can provide getpid(2) functionality.])fiif test "x-$ac_cv_func_sleep" != "x-yes" -a "x-$ac_cv_func_Sleep" = "x-yes" ; then AC_DEFINE(sleep,Sleep,[Define to a function than can provide sleep(2) functionality.])fiif test "x-$ac_cv_func_strcasecmp" != "x-yes" -a "x-$ac_cv_func_stricmp" = "x-yes" ; then AC_DEFINE(strcasecmp,stricmp,[Define to a function than can provide strcasecmp(3) functionality.])fiif test "x-$ac_cv_func_strncasecmp" != "x-yes" -a "x-$ac_cv_func_strnicmp" = "x-yes" ; then AC_DEFINE(strncasecmp,strnicmp,[Define to a function than can provide strncasecmp(3) functionality.])fidnl winsock substitutionsif test "x-$ac_cv_func_close" != "x-yes" ; then AC_MSG_CHECKING(for closesocket) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]], [[closesocket(0)]])], [AC_MSG_RESULT(yes) AC_DEFINE(close,closesocket,[Define to a function than can provide close(2) functionality.])], AC_DEFINE(HAVE_CLOSE,1,[Define to 1 if you have the 'close' function.]) AC_MSG_RESULT(no))fiif test "x-$ac_cv_func_ioctl" != "x-yes" ; then AC_MSG_CHECKING(for ioctlsocket) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]], [[ioctlsocket(0,0,0)]])], [AC_MSG_RESULT(yes) AC_DEFINE(ioctl,ioctlsocket,[Define to a function than can provide ioctl(2) functionality.])], AC_DEFINE(HAVE_IOCTL,1,[Define to 1 if you have the 'ioctl' function.]) AC_MSG_RESULT(no))fidnldnl debuggingdnlAC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable debug messages]), want_debug=$enableval, want_debug=no)if test "x-$want_debug" = "x-yes" ; then AC_DEFINE(DEBUG,1,[Define to 1 if you want to get debug output with -D.]) AC_DEFINE(SX_DEBUG,1,[Define to 1 if you want to get SX debug output with -D.])fiAC_ARG_ENABLE(nad_debug, AC_HELP_STRING([--enable-nad-debug], [enable NAD pointer tracking]), want_nad_debug=$enableval, want_nad_debug=no)if test "x-$want_nad_debug" = "x-yes" ; then AC_DEFINE(NAD_DEBUG,1,[Define to 1 if you want to enable NAD pointer tracking.])fiAC_ARG_ENABLE(pool_debug, AC_HELP_STRING([--enable-pool-debug], [enable memory pool statistics]), want_pool_debug=$enableval, want_pool_debug=no)if test "x-$want_pool_debug" = "x-yes" ; then AC_DEFINE(POOL_DEBUG,1,[Define to 1 if you want to enable memory pool statistics.])fidnldnl finishing updnldnl put our config in its own subdirsysconfdir="$sysconfdir/jabberd"dnl done!AC_OUTPUT(Makefile \ etc/Makefile \ etc/templates/Makefile \ tools/Makefile \ man/Makefile \ expat/Makefile \ mio/Makefile \ scod/Makefile \ subst/Makefile \ sx/Makefile \ util/Makefile \ c2s/Makefile \ resolver/Makefile \ router/Makefile \ s2s/Makefile \ sm/Makefile \ Doxyfile)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?