📄 aclocal.m4
字号:
dnl this requires a previous check for mkfifo, but that is awkward to specifyAC_DEFUN(BASH_SYS_NAMED_PIPES,[AC_MSG_CHECKING(for presence of named pipes)AC_CACHE_VAL(bash_cv_sys_named_pipes,[AC_TRY_RUN([#include <sys/types.h>#include <sys/stat.h>#ifdef HAVE_UNISTD_H#include <unistd.h>#endif/* Add more tests in here as appropriate. */main(){int fd, err;#if defined (HAVE_MKFIFO)exit (0);#endif#if !defined (S_IFIFO) && (defined (_POSIX_VERSION) && !defined (S_ISFIFO))exit (1);#endif#if defined (NeXT)exit (1);#endiferr = mkdir("bash-aclocal", 0700);if (err < 0) { perror ("mkdir"); exit(1);}fd = mknod ("bash-aclocal/sh-np-autoconf", 0666 | S_IFIFO, 0);if (fd == -1) { rmdir ("bash-aclocal"); exit (1);}close(fd);unlink ("bash-aclocal/sh-np-autoconf");rmdir ("bash-aclocal");exit(0);}], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing, [AC_MSG_WARN(cannot check for named pipes if cross-compiling -- defaulting to missing) bash_cv_sys_named_pipes=missing])])AC_MSG_RESULT($bash_cv_sys_named_pipes)if test $bash_cv_sys_named_pipes = missing; thenAC_DEFINE(NAMED_PIPES_MISSING)fi])AC_DEFUN(BASH_SYS_DEFAULT_MAIL_DIR,[AC_MSG_CHECKING(for default mail directory)AC_CACHE_VAL(bash_cv_mail_dir,[if test -d /var/mail; then bash_cv_mail_dir=/var/mail elif test -d /var/spool/mail; then bash_cv_mail_dir=/var/spool/mail elif test -d /usr/mail; then bash_cv_mail_dir=/usr/mail elif test -d /usr/spool/mail; then bash_cv_mail_dir=/usr/spool/mail else bash_cv_mail_dir=unknown fi])AC_MSG_RESULT($bash_cv_mail_dir)AC_DEFINE_UNQUOTED(DEFAULT_MAIL_DIRECTORY, "$bash_cv_mail_dir")])AC_DEFUN(BASH_HAVE_TIOCGWINSZ,[AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)AC_CACHE_VAL(bash_cv_tiocgwinsz_in_ioctl,[AC_TRY_COMPILE([#include <sys/types.h>#include <sys/ioctl.h>], [int x = TIOCGWINSZ;], bash_cv_tiocgwinsz_in_ioctl=yes,bash_cv_tiocgwinsz_in_ioctl=no)])AC_MSG_RESULT($bash_cv_tiocgwinsz_in_ioctl)if test $bash_cv_tiocgwinsz_in_ioctl = yes; then AC_DEFINE(GWINSZ_IN_SYS_IOCTL)fi])AC_DEFUN(BASH_HAVE_TIOCSTAT,[AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)AC_CACHE_VAL(bash_cv_tiocstat_in_ioctl,[AC_TRY_COMPILE([#include <sys/types.h>#include <sys/ioctl.h>], [int x = TIOCSTAT;], bash_cv_tiocstat_in_ioctl=yes,bash_cv_tiocstat_in_ioctl=no)])AC_MSG_RESULT($bash_cv_tiocstat_in_ioctl)if test $bash_cv_tiocstat_in_ioctl = yes; then AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL)fi])AC_DEFUN(BASH_HAVE_FIONREAD,[AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)AC_CACHE_VAL(bash_cv_fionread_in_ioctl,[AC_TRY_COMPILE([#include <sys/types.h>#include <sys/ioctl.h>], [int x = FIONREAD;], bash_cv_fionread_in_ioctl=yes,bash_cv_fionread_in_ioctl=no)])AC_MSG_RESULT($bash_cv_fionread_in_ioctl)if test $bash_cv_fionread_in_ioctl = yes; then AC_DEFINE(FIONREAD_IN_SYS_IOCTL)fi])dnldnl See if speed_t is declared in <sys/types.h>. Some versions of linuxdnl require a definition of speed_t each time <termcap.h> is included,dnl but you can only get speed_t if you include <termios.h> (on somednl versions) or <sys/types.h> (on others).dnlAC_DEFUN(BASH_CHECK_SPEED_T,[AC_MSG_CHECKING(for speed_t in sys/types.h)AC_CACHE_VAL(bash_cv_speed_t_in_sys_types,[AC_TRY_COMPILE([#include <sys/types.h>], [speed_t x;], bash_cv_speed_t_in_sys_types=yes,bash_cv_speed_t_in_sys_types=no)])AC_MSG_RESULT($bash_cv_speed_t_in_sys_types)if test $bash_cv_speed_t_in_sys_types = yes; then AC_DEFINE(SPEED_T_IN_SYS_TYPES)fi])AC_DEFUN(BASH_CHECK_GETPW_FUNCS,[AC_MSG_CHECKING(whether getpw functions are declared in pwd.h)AC_CACHE_VAL(bash_cv_getpw_declared,[AC_EGREP_CPP(getpwuid,[#include <sys/types.h>#ifdef HAVE_UNISTD_H# include <unistd.h>#endif#include <pwd.h>],bash_cv_getpw_declared=yes,bash_cv_getpw_declared=no)])AC_MSG_RESULT($bash_cv_getpw_declared)if test $bash_cv_getpw_declared = yes; thenAC_DEFINE(HAVE_GETPW_DECLS)fi])AC_DEFUN(BASH_CHECK_DEV_FD,[AC_MSG_CHECKING(whether /dev/fd is available)AC_CACHE_VAL(bash_cv_dev_fd,[bash_cv_dev_fd=""if test -d /dev/fd && (exec test -r /dev/fd/0 < /dev/null) ; then# check for systems like FreeBSD 5 that only provide /dev/fd/[012] if (exec test -r /dev/fd/3 3</dev/null) ; then bash_cv_dev_fd=standard else bash_cv_dev_fd=absent fifiif test -z "$bash_cv_dev_fd" ; then if test -d /proc/self/fd && (exec test -r /proc/self/fd/0 < /dev/null) ; then bash_cv_dev_fd=whacky else bash_cv_dev_fd=absent fifi])AC_MSG_RESULT($bash_cv_dev_fd)if test $bash_cv_dev_fd = "standard"; then AC_DEFINE(HAVE_DEV_FD) AC_DEFINE(DEV_FD_PREFIX, "/dev/fd/")elif test $bash_cv_dev_fd = "whacky"; then AC_DEFINE(HAVE_DEV_FD) AC_DEFINE(DEV_FD_PREFIX, "/proc/self/fd/")fi])AC_DEFUN(BASH_CHECK_DEV_STDIN,[AC_MSG_CHECKING(whether /dev/stdin stdout stderr are available)AC_CACHE_VAL(bash_cv_dev_stdin,[if test -d /dev/fd && (exec test -r /dev/stdin < /dev/null) ; then bash_cv_dev_stdin=present elif test -d /proc/self/fd && (exec test -r /dev/stdin < /dev/null) ; then bash_cv_dev_stdin=present else bash_cv_dev_stdin=absent fi])AC_MSG_RESULT($bash_cv_dev_stdin)if test $bash_cv_dev_stdin = "present"; then AC_DEFINE(HAVE_DEV_STDIN)fi])dnldnl Check if HPUX needs _KERNEL defined for RLIMIT_* definitionsdnlAC_DEFUN(BASH_CHECK_KERNEL_RLIMIT,[AC_MSG_CHECKING([whether $host_os needs _KERNEL for RLIMIT defines])AC_CACHE_VAL(bash_cv_kernel_rlimit,[AC_TRY_COMPILE([#include <sys/types.h>#include <sys/resource.h>],[ int f; f = RLIMIT_DATA;], bash_cv_kernel_rlimit=no,[AC_TRY_COMPILE([#include <sys/types.h>#define _KERNEL#include <sys/resource.h>#undef _KERNEL],[ int f; f = RLIMIT_DATA;], bash_cv_kernel_rlimit=yes, bash_cv_kernel_rlimit=no)])])AC_MSG_RESULT($bash_cv_kernel_rlimit)if test $bash_cv_kernel_rlimit = yes; thenAC_DEFINE(RLIMIT_NEEDS_KERNEL)fi])dnldnl Check for 64-bit off_t -- used for malloc alignmentdnldnl C does not allow duplicate case labels, so the compile will fail ifdnl sizeof(off_t) is > 4.dnlAC_DEFUN(BASH_CHECK_OFF_T_64,[AC_CACHE_CHECK(for 64-bit off_t, bash_cv_off_t_64,AC_TRY_COMPILE([#ifdef HAVE_UNISTD_H#include <unistd.h>#endif#include <sys/types.h>],[switch (0) case 0: case (sizeof (off_t) <= 4):;], bash_cv_off_t_64=no, bash_cv_off_t_64=yes))if test $bash_cv_off_t_64 = yes; then AC_DEFINE(HAVE_OFF_T_64)fi])AC_DEFUN(BASH_CHECK_RTSIGS,[AC_MSG_CHECKING(for unusable real-time signals due to large values)AC_CACHE_VAL(bash_cv_unusable_rtsigs,[AC_TRY_RUN([#include <sys/types.h>#include <signal.h>#ifndef NSIG# define NSIG 64#endifmain (){ int n_sigs = 2 * NSIG;#ifdef SIGRTMIN int rtmin = SIGRTMIN;#else int rtmin = 0;#endif exit(rtmin < n_sigs);}], bash_cv_unusable_rtsigs=yes, bash_cv_unusable_rtsigs=no, [AC_MSG_WARN(cannot check real-time signals if cross compiling -- defaulting to yes) bash_cv_unusable_rtsigs=yes])])AC_MSG_RESULT($bash_cv_unusable_rtsigs)if test $bash_cv_unusable_rtsigs = yes; thenAC_DEFINE(UNUSABLE_RT_SIGNALS)fi])dnldnl check for availability of multibyte characters and functionsdnldnl geez, I wish I didn't have to check for all of this stuff separatelydnlAC_DEFUN(BASH_CHECK_MULTIBYTE,[AC_CHECK_HEADERS(wctype.h)AC_CHECK_HEADERS(wchar.h)AC_CHECK_HEADERS(langinfo.h)AC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN))AC_CHECK_FUNC(mbscasecmp, AC_DEFINE(HAVE_MBSCMP))AC_CHECK_FUNC(mbscmp, AC_DEFINE(HAVE_MBSCMP))AC_CHECK_FUNC(mbsnrtowcs, AC_DEFINE(HAVE_MBSNRTOWCS))AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))AC_REPLACE_FUNCS(mbschr)AC_CHECK_FUNC(wcrtomb, AC_DEFINE(HAVE_WCRTOMB))AC_CHECK_FUNC(wcscoll, AC_DEFINE(HAVE_WCSCOLL))AC_CHECK_FUNC(wcsdup, AC_DEFINE(HAVE_WCSDUP))AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))AC_CHECK_FUNC(wctype, AC_DEFINE(HAVE_WCTYPE))AC_REPLACE_FUNCS(wcswidth)dnl checks for both mbrtowc and mbstate_tAC_FUNC_MBRTOWCif test $ac_cv_func_mbrtowc = yes; then AC_DEFINE(HAVE_MBSTATE_T)fiAC_CHECK_FUNCS(iswlower iswupper towlower towupper iswctype)AC_CACHE_CHECK([for nl_langinfo and CODESET], bash_cv_langinfo_codeset,[AC_TRY_LINK([#include <langinfo.h>],[char* cs = nl_langinfo(CODESET);],bash_cv_langinfo_codeset=yes, bash_cv_langinfo_codeset=no)])if test $bash_cv_langinfo_codeset = yes; then AC_DEFINE(HAVE_LANGINFO_CODESET)fidnl check for wchar_t in <wchar.h>AC_CACHE_CHECK([for wchar_t in wchar.h], bash_cv_type_wchar_t,[AC_TRY_COMPILE([#include <wchar.h>],[ wchar_t foo; foo = 0;], bash_cv_type_wchar_t=yes, bash_cv_type_wchar_t=no)])if test $bash_cv_type_wchar_t = yes; then AC_DEFINE(HAVE_WCHAR_T, 1, [systems should define this type here])fidnl check for wctype_t in <wctype.h>AC_CACHE_CHECK([for wctype_t in wctype.h], bash_cv_type_wctype_t,[AC_TRY_COMPILE([#include <wctype.h>],[ wctype_t foo; foo = 0;], bash_cv_type_wctype_t=yes, bash_cv_type_wctype_t=no)])if test $bash_cv_type_wctype_t = yes; then AC_DEFINE(HAVE_WCTYPE_T, 1, [systems should define this type here])fidnl check for wint_t in <wctype.h>AC_CACHE_CHECK([for wint_t in wctype.h], bash_cv_type_wint_t,[AC_TRY_COMPILE([#include <wctype.h>],[ wint_t foo; foo = 0;], bash_cv_type_wint_t=yes, bash_cv_type_wint_t=no)])if test $bash_cv_type_wint_t = yes; then AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here])fiif test "$am_cv_func_iconv" = yes; then OLDLIBS="$LIBS" LIBS="$LIBS $LIBICONV" AC_CHECK_FUNCS(locale_charset) LIBS="$OLDLIBS"fi])dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIBdnl require:dnl AC_PROG_CCdnl BASH_CHECK_LIB_TERMCAPAC_DEFUN([RL_LIB_READLINE_VERSION],[AC_REQUIRE([BASH_CHECK_LIB_TERMCAP])AC_MSG_CHECKING([version of installed readline library])# What a pain in the ass this is.# save cpp and ld options_save_CFLAGS="$CFLAGS"_save_LDFLAGS="$LDFLAGS"_save_LIBS="$LIBS"# Don't set ac_cv_rl_prefix if the caller has already assigned a value. This# allows the caller to do something like $_rl_prefix=$withval if the user# specifies --with-installed-readline=PREFIX as an argument to configureif test -z "$ac_cv_rl_prefix"; thentest "x$prefix" = xNONE && ac_cv_rl_prefix=$ac_default_prefix || ac_cv_rl_prefix=${prefix}fieval ac_cv_rl_includedir=${ac_cv_rl_prefix}/includeeval ac_cv_rl_libdir=${ac_cv_rl_prefix}/libLIBS="$LIBS -lreadline ${TERMCAP_LIB}"CFLAGS="$CFLAGS -I${ac_cv_rl_includedir}"LDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}"AC_CACHE_VAL(ac_cv_rl_version,[AC_TRY_RUN([#include <stdio.h>#include <readline/readline.h>extern int rl_gnu_readline_p;main(){ FILE *fp; fp = fopen("conftest.rlv", "w"); if (fp == 0) exit(1); if (rl_gnu_readline_p != 1) fprintf(fp, "0.0\n"); else fprintf(fp, "%s\n", rl_library_version ? rl_library_version : "0.0"); fclose(fp); exit(0);}],ac_cv_rl_version=`cat conftest.rlv`,ac_cv_rl_version='0.0',ac_cv_rl_version='4.2')])CFLAGS="$_save_CFLAGS"LDFLAGS="$_save_LDFLAGS"LIBS="$_save_LIBS"RL_MAJOR=0RL_MINOR=0# (case "$ac_cv_rl_version" in2*|3*|4*|5*|6*|7*|8*|9*) RL_MAJOR=`echo $ac_cv_rl_version | sed 's:\..*$::'` RL_MINOR=`echo $ac_cv_rl_version | sed -e 's:^.*\.::' -e 's:[[a-zA-Z]]*$::'` ;;esac# (((case $RL_MAJOR in[[0-9][0-9]]) _RL_MAJOR=$RL_MAJOR ;;[[0-9]]) _RL_MAJOR=0$RL_MAJOR ;;*) _RL_MAJOR=00 ;;esac# (((case $RL_MINOR in[[0-9][0-9]]) _RL_MINOR=$RL_MINOR ;;[[0-9]]) _RL_MINOR=0$RL_MINOR ;;*) _RL_MINOR=00 ;;esacRL_VERSION="0x${_RL_MAJOR}${_RL_MINOR}"# Readline versions greater than 4.2 have these defines in readline.hif test $ac_cv_rl_version = '0.0' ; then AC_MSG_WARN([Could not test version of installed readline library.])elif test $RL_MAJOR -gt 4 || { test $RL_MAJOR = 4 && test $RL_MINOR -gt 2 ; } ; then # set these for use by the caller RL_PREFIX=$ac_cv_rl_prefix RL_LIBDIR=$ac_cv_rl_libdir RL_INCLUDEDIR=$ac_cv_rl_includedir AC_MSG_RESULT($ac_cv_rl_version)elseAC_DEFINE_UNQUOTED(RL_READLINE_VERSION, $RL_VERSION, [encoded version of the installed readline library])AC_DEFINE_UNQUOTED(RL_VERSION_MAJOR, $RL_MAJOR, [major version of installed readline library])AC_DEFINE_UNQUOTED(RL_VERSION_MINOR, $RL_MINOR, [minor version of installed readline library])AC_SUBST(RL_VERSION)AC_SUBST(RL_MAJOR)AC_SUBST(RL_MINOR)# set these for use by the caller
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -