📄 aclocal.m4
字号:
AC_DEFINE(HAVE_POSIX_SIGNALS)elif test "$bash_cv_signal_vintage" = "4.2bsd"; thenAC_DEFINE(HAVE_BSD_SIGNALS)elif test "$bash_cv_signal_vintage" = svr3; thenAC_DEFINE(HAVE_USG_SIGHOLD)fi])dnl Check if the pgrp of setpgrp() can't be the pid of a zombie process.AC_DEFUN(BASH_SYS_PGRP_SYNC,[AC_REQUIRE([AC_FUNC_GETPGRP])AC_MSG_CHECKING(whether pgrps need synchronization)AC_CACHE_VAL(bash_cv_pgrp_pipe,[AC_TRY_RUN([#ifdef HAVE_UNISTD_H# include <unistd.h>#endifmain(){# ifdef GETPGRP_VOID# define getpgID() getpgrp()# else# define getpgID() getpgrp(0)# define setpgid(x,y) setpgrp(x,y)# endif int pid1, pid2, fds[2]; int status; char ok; switch (pid1 = fork()) { case -1: exit(1); case 0: setpgid(0, getpid()); exit(0); } setpgid(pid1, pid1); sleep(2); /* let first child die */ if (pipe(fds) < 0) exit(2); switch (pid2 = fork()) { case -1: exit(3); case 0: setpgid(0, pid1); ok = getpgID() == pid1; write(fds[1], &ok, 1); exit(0); } setpgid(pid2, pid1); close(fds[1]); if (read(fds[0], &ok, 1) != 1) exit(4); wait(&status); wait(&status); exit(ok ? 0 : 5);}], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes, [AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no) bash_cv_pgrp_pipe=no])])AC_MSG_RESULT($bash_cv_pgrp_pipe)if test $bash_cv_pgrp_pipe = yes; thenAC_DEFINE(PGRP_PIPE)fi])AC_DEFUN(BASH_SYS_REINSTALL_SIGHANDLERS,[AC_REQUIRE([AC_TYPE_SIGNAL])AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked])AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers,[AC_TRY_RUN([#include <signal.h>#ifdef HAVE_UNISTD_H#include <unistd.h>#endiftypedef RETSIGTYPE sigfunc();int nsigint;#ifdef HAVE_POSIX_SIGNALSsigfunc *set_signal_handler(sig, handler) int sig; sigfunc *handler;{ struct sigaction act, oact; act.sa_handler = handler; act.sa_flags = 0; sigemptyset (&act.sa_mask); sigemptyset (&oact.sa_mask); sigaction (sig, &act, &oact); return (oact.sa_handler);}#else#define set_signal_handler(s, h) signal(s, h)#endifRETSIGTYPEsigint(s)int s;{ nsigint++;}main(){ nsigint = 0; set_signal_handler(SIGINT, sigint); kill((int)getpid(), SIGINT); kill((int)getpid(), SIGINT); exit(nsigint != 2);}], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes, [AC_MSG_WARN(cannot check signal handling if cross compiling -- defaulting to no) bash_cv_must_reinstall_sighandlers=no])])AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers)if test $bash_cv_must_reinstall_sighandlers = yes; thenAC_DEFINE(MUST_REINSTALL_SIGHANDLERS)fi])dnl check that some necessary job control definitions are presentAC_DEFUN(BASH_SYS_JOB_CONTROL_MISSING,[AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])AC_MSG_CHECKING(for presence of necessary job control definitions)AC_CACHE_VAL(bash_cv_job_control_missing,[AC_TRY_RUN([#include <sys/types.h>#ifdef HAVE_SYS_WAIT_H#include <sys/wait.h>#endif#ifdef HAVE_UNISTD_H#include <unistd.h>#endif#include <signal.h>/* Add more tests in here as appropriate. */main(){/* signal type */#if !defined (HAVE_POSIX_SIGNALS) && !defined (HAVE_BSD_SIGNALS)exit(1);#endif/* signals and tty control. */#if !defined (SIGTSTP) || !defined (SIGSTOP) || !defined (SIGCONT)exit (1);#endif/* process control */#if !defined (WNOHANG) || !defined (WUNTRACED) exit(1);#endif/* Posix systems have tcgetpgrp and waitpid. */#if defined (_POSIX_VERSION) && !defined (HAVE_TCGETPGRP)exit(1);#endif#if defined (_POSIX_VERSION) && !defined (HAVE_WAITPID)exit(1);#endif/* Other systems have TIOCSPGRP/TIOCGPRGP and wait3. */#if !defined (_POSIX_VERSION) && !defined (HAVE_WAIT3)exit(1);#endifexit(0);}], bash_cv_job_control_missing=present, bash_cv_job_control_missing=missing, [AC_MSG_WARN(cannot check job control if cross-compiling -- defaulting to missing) bash_cv_job_control_missing=missing])])AC_MSG_RESULT($bash_cv_job_control_missing)if test $bash_cv_job_control_missing = missing; thenAC_DEFINE(JOB_CONTROL_MISSING)fi])dnl check whether named pipes are presentdnl 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("/tmp/bash-aclocal", 0700);if (err < 0) { perror ("mkdir"); exit(1);}fd = mknod ("/tmp/bash-aclocal/sh-np-autoconf", 0666 | S_IFIFO, 0);if (fd == -1) { rmdir ("/tmp/bash-aclocal"); exit (1);}close(fd);unlink ("/tmp/bash-aclocal/sh-np-autoconf");rmdir ("/tmp/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,[if test -d /dev/fd && test -r /dev/fd/0; then bash_cv_dev_fd=standard elif test -d /proc/self/fd && test -r /proc/self/fd/0; then bash_cv_dev_fd=whacky else bash_cv_dev_fd=absent fi])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 && test -r /dev/stdin; then bash_cv_dev_stdin=present elif test -d /proc/self/fd && test -r /dev/stdin; 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 functionsdnlAC_DEFUN(BASH_CHECK_MULTIBYTE,[AC_CHECK_HEADERS(wctype.h)AC_CHECK_HEADERS(wchar.h)AC_CHECK_HEADERS(langinfo.h)AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t,[AC_TRY_RUN([#include <wchar.h>intmain (){ mbstate_t ps; return 0;}], bash_cv_have_mbstate_t=yes, bash_cv_have_mbstate_t=no)])if test $bash_cv_have_mbstate_t = yes; then AC_DEFINE(HAVE_MBSTATE_T)fiAC_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)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_TRY_RUN([#include <stdio.h>#include <readline/readline.h>main(){ FILE *fp; fp = fopen("conftest.rlv", "w"); if (fp == 0) exit(1); 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 callerRL_PREFIX=$ac_cv_rl_prefixRL_LIBDIR=$ac_cv_rl_libdirRL_INCLUDEDIR=$ac_cv_rl_includedirAC_MSG_RESULT($ac_cv_rl_version)fi])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -