📄 aclocal.m4
字号:
dnldnl Improved version of AC_CHECK_LIBdnldnl Thanks to John Hawkinson (jhawk@mit.edu)dnldnl usage:dnldnl AC_LBL_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [,dnl ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])dnldnl results:dnldnl LIBSdnldefine(AC_LBL_CHECK_LIB,[AC_MSG_CHECKING([for $2 in -l$1])dnl Use a cache variable name containing both the library and function name,dnl because the test really is for library $1 defining function $2, notdnl just for library $1. Separate tests with the same $1 and different $2'sdnl may have different results.ac_lib_var=`echo $1['_']$2['_']$5 | sed 'y%./+- %__p__%'`AC_CACHE_VAL(ac_cv_lbl_lib_$ac_lib_var,[ac_save_LIBS="$LIBS"LIBS="-l$1 $5 $LIBS"AC_TRY_LINK(dnlifelse([$2], [main], , dnl Avoid conflicting decl of main.[/* Override any gcc2 internal prototype to avoid an error. */]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplusextern "C"#endif])dnl[/* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */char $2();]), [$2()], eval "ac_cv_lbl_lib_$ac_lib_var=yes", eval "ac_cv_lbl_lib_$ac_lib_var=no")LIBS="$ac_save_LIBS"])dnlif eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then AC_MSG_RESULT(yes) ifelse([$3], ,[changequote(, )dnl ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`changequote([, ])dnl AC_DEFINE_UNQUOTED($ac_tr_lib) LIBS="-l$1 $LIBS"], [$3])else AC_MSG_RESULT(no)ifelse([$4], , , [$4])dnlfi])dnldnl AC_LBL_LIBRARY_NETdnldnl This test is for network applications that need socket() anddnl gethostbyname() -ish functions. Under Solaris, those applicationsdnl need to link with "-lsocket -lnsl". Under IRIX, they need to linkdnl with "-lnsl" but should *not* link with "-lsocket" becausednl libsocket.a breaks a number of things (for instance:dnl gethostbyname() under IRIX 5.2, and snoop sockets under mostdnl versions of IRIX).dnldnl Unfortunately, many application developers are not aware of this,dnl and mistakenly write tests that cause -lsocket to be used underdnl IRIX. It is also easy to write tests that cause -lnsl to be useddnl under operating systems where neither are necessary (or useful),dnl such as SunOS 4.1.4, which uses -lnsl for TLI.dnldnl This test exists so that every application developer does not testdnl this in a different, and subtly broken fashion.dnl It has been argued that this test should be broken up into twodnl seperate tests, one for the resolver libraries, and one for thednl libraries necessary for using Sockets API. Unfortunately, the twodnl are carefully intertwined and allowing the autoconf user to usednl them independantly potentially results in unfortunate orderingdnl dependancies -- as such, such component macros would have todnl carefully use indirection and be aware if the other components werednl executed. Since other autoconf macros do not go to this trouble,dnl and almost no applications use sockets without the resolver, thisdnl complexity has not been implemented.dnldnl The check for libresolv is in case you are attempting to linkdnl statically and happen to have a libresolv.a lying around (and nodnl libnsl.a).dnlAC_DEFUN(AC_LBL_LIBRARY_NET, [ # Most operating systems have gethostbyname() in the default searched # libraries (i.e. libc): AC_CHECK_FUNC(gethostbyname, , # Some OSes (eg. Solaris) place it in libnsl: AC_LBL_CHECK_LIB(nsl, gethostbyname, , # Some strange OSes (SINIX) have it in libsocket: AC_LBL_CHECK_LIB(socket, gethostbyname, , # Unfortunately libsocket sometimes depends on libnsl. # AC_CHECK_LIB's API is essentially broken so the # following ugliness is necessary: AC_LBL_CHECK_LIB(socket, gethostbyname, LIBS="-lsocket -lnsl $LIBS", AC_CHECK_LIB(resolv, gethostbyname), -lnsl)))) AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, , AC_LBL_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl))) # DLPI needs putmsg under HPUX so test for -lstr while we're at it AC_CHECK_LIB(str, putmsg) ])dnldnl Checks to see if struct tm has the BSD tm_gmtoff memberdnldnl usage:dnldnl AC_ACME_TM_GMTOFFdnldnl results:dnldnl HAVE_TM_GMTOFF (defined)dnlAC_DEFUN(AC_ACME_TM_GMTOFF, [AC_MSG_CHECKING(if struct tm has tm_gmtoff member) AC_CACHE_VAL(ac_cv_acme_tm_has_tm_gmtoff, AC_TRY_COMPILE([# include <sys/types.h># include <time.h>], [u_int i = sizeof(((struct tm *)0)->tm_gmtoff)], ac_cv_acme_tm_has_tm_gmtoff=yes, ac_cv_acme_tm_has_tm_gmtoff=no)) AC_MSG_RESULT($ac_cv_acme_tm_has_tm_gmtoff) if test $ac_cv_acme_tm_has_tm_gmtoff = yes ; then AC_DEFINE(HAVE_TM_GMTOFF) fi])dnldnl Checks to see if struct sockaddr_storage existsdnldnl usage:dnldnl AC_ACME_SOCKADDR_STORAGEdnldnl results:dnldnl HAVE_SOCKADDR_STORAGE (defined)dnlAC_DEFUN(AC_ACME_SOCKADDR_STORAGE, [AC_MSG_CHECKING(if struct sockaddr_storage exists) AC_CACHE_VAL(ac_cv_acme_sockaddr_storage, AC_TRY_COMPILE([# include <sys/types.h># include <sys/socket.h>], [struct sockaddr_storage sas], ac_cv_acme_sockaddr_storage=yes, ac_cv_acme_sockaddr_storage=no)) AC_MSG_RESULT($ac_cv_acme_sockaddr_storage) if test $ac_cv_acme_sockaddr_storage = yes ; then AC_DEFINE(HAVE_SOCKADDR_STORAGE) fi])dnldnl Checks to see if struct sockaddr_in6 existsdnldnl usage:dnldnl AC_ACME_SOCKADDR_IN6dnldnl results:dnldnl HAVE_SOCKADDR_IN6 (defined)dnlAC_DEFUN(AC_ACME_SOCKADDR_IN6, [AC_MSG_CHECKING(if struct sockaddr_in6 exists) AC_CACHE_VAL(ac_cv_acme_sockaddr_in6, AC_TRY_COMPILE([# include <sys/types.h># include <sys/socket.h># include <netinet/in.h>], [struct sockaddr_in6 sa6], ac_cv_acme_sockaddr_in6=yes, ac_cv_acme_sockaddr_in6=no)) AC_MSG_RESULT($ac_cv_acme_sockaddr_in6) if test $ac_cv_acme_sockaddr_in6 = yes ; then AC_DEFINE(HAVE_SOCKADDR_IN6) fi])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -