📄 aclocal.m4
字号:
else CC="$CC -Xp" fi ;; #( MINIX) AC_DEFINE(_POSIX_SOURCE)dnl AC_DEFINE(_POSIX_1_SOURCE, 2)dnl AC_DEFINE(_MINIX)dnl ;; #( SCO) AC_DEFINE(OS_SCO)dnl ;; #( OS2_EMX) # XXX change this to OS_OS2 or OS_OS2_EMX? AC_DEFINE(OS2)dnl ac_exe_suffix=.exe ;; #( TITANOS) # Need to use cc -43 to get a shell with job control case "$CC" in #(( *-43*) # Already have -43 option? ;; #( */cc|*/cc' '|*/cc' '|cc|cc' '|cc' ') # Using stock compiler? CC="$CC -43" ;; #( esac #)) # # Force dirent check to find the right thing. There is a dirent.h # (and a sys/dirent.h) file which compiles, but generates garbage... # ac_cv_header_dirent_dirent_h=no ac_cv_header_dirent_sys_ndir_h=no ac_cv_header_dirent_sys_dir_h=yes ;; #( NEXT) # # NeXT 3.2 (other versions?) - cc -E doesn't work and /lib/cpp # doesn't define things that need defining, so tests that rely # on $CPP will break. # AC_EGREP_CPP([Bad NeXT], [#include <signal.h> #if !defined(SIGINT) || !defined(SIGQUIT) Bad NeXT #endif ], AC_MSG_ERROR([There is a problem on NeXT boxes resulting in a bad siglist.out file beinggenerated (which breaks the trap and kill commands) and probably resultingin many configuration tests not working correctly.You appear to have this problem - see the comments on NeXT in the pdkshREADME file for work arounds.]))dnl ;; #( HPUX) # # In some versions of hpux (eg, 10.2), getwd & getcwd will dump core # if directory is not readble. # # name is used in test program AC_CACHE_CHECK(for bug in getwd, ksh_cv_hpux_getwd_bug, [ tmpdir=conftest.dir if mkdir $tmpdir ; then AC_TRY_RUN([ int main() { char buf[8 * 1024]; char *dirname = "conftest.dir"; int ok = 0; if (chdir(dirname) < 0) exit(2); if (chmod(".", 0) < 0) exit(3); /* Test won't work if run as root - so don't be root */ if (getuid() == 0 || geteuid() == 0) setresuid(1, 1, 1); /* hpux has this */#ifdef HAVE_GETWD /* silly since HAVE_* tests haven't been done yet */ { extern char *getwd(); ok = getwd(buf) == 0; }#else { extern char *getcwd(); ok = getcwd(buf, sizeof(buf)) == 0; }#endif exit(ok ? 0 : 10); return ok ? 0 : 10; }], ksh_cv_hpux_getwd_bug=no, ksh_cv_hpux_getwd_bug=yes, AC_MSG_WARN(assuming getwd broken); ksh_cv_hpux_getwd_bug=yes) test -d $tmpdir && rmdir $tmpdir else AC_MSG_ERROR(could not make temp directory for test); ksh_cv_hpux_getwd_bug=yes fi]) if test $ksh_cv_hpux_getwd_bug = yes; then AC_DEFINE(HPUX_GETWD_BUG) fi ;; #( esac #)) ])dnldnldnldnldnl Some systems (eg, SunOS 4.0.3) have <termios.h> and <termio.h> but don'tdnl have the related functions/defines (eg, tcsetattr(), TCSADRAIN, etc.)dnl or the functions don't work well with tty process groups. Sun's baddnl termios can be detected by the lack of tcsetattr(), but its bad termiodnl is harder to detect - so check for (sane) termios first, then check fordnl BSD, then termio.AC_DEFUN(KSH_TERM_CHECK, [AC_CACHE_CHECK(terminal interface, ksh_cv_term_check, [AC_TRY_LINK([#include <termios.h>], [ struct termios t;#if defined(ultrix) || defined(__ultrix__) Termios in ultrix 4.2 botches type-ahead when going from cooked to cbreak mode. The BSD tty interface works fine though, so use it (would be good to know if alter versions of ultrix work).#endif /* ultrix */ tcgetattr(0, &t); tcsetattr(0, TCSADRAIN, &t); ], ksh_cv_term_check=termios, [AC_TRY_LINK([#include <sys/ioctl.h>], [ struct sgttyb sb; ioctl(0, TIOCGETP, &sb);#ifdef TIOCGATC { struct ttychars lc; ioctl(0, TIOCGATC, &lc); }#else /* TIOCGATC */ { struct tchars tc; ioctl(0, TIOCGETC, &tc); }# ifdef TIOCGLTC { struct ltchars ltc; ioctl(0, TIOCGLTC, <c); }# endif /* TIOCGLTC */#endif /* TIOCGATC */ ], ksh_cv_term_check=bsd, [AC_CHECK_HEADER(termio.h, ksh_cv_term_check=termio, ksh_cv_term_check=sgtty)])])]) if test $ksh_cv_term_check = termios; then AC_DEFINE(HAVE_TERMIOS_H)dnl Don't know of a system on which this fails...dnl AC_CACHE_CHECK(sys/ioctl.h can be included with termios.h,dnl ksh_cv_sys_ioctl_with_termios,dnl [AC_TRY_COMPILE([#include <termios.h>dnl #include <sys/ioctl.h>], , ksh_cv_sys_ioctl_with_termios=yes,dnl ksh_cv_sys_ioctl_with_termios=no)])dnl if test $ksh_cv_sys_ioctl_with_termios = yes; thendnl AC_DEFINE(SYS_IOCTL_WITH_TERMIOS)dnl fi elif test $ksh_cv_term_check = termio; then AC_DEFINE(HAVE_TERMIO_H)dnl Don't know of a system on which this fails...dnl AC_CACHE_CHECK(sys/ioctl.h can be included with termio.h,dnl ksh_cv_sys_ioctl_with_termio,dnl [AC_TRY_COMPILE([#include <termio.h>dnl #include <sys/ioctl.h>], , ksh_cv_sys_ioctl_with_termio=yes,dnl ksh_cv_sys_ioctl_with_termio=no)])dnl if test $ksh_cv_sys_ioctl_with_termio = yes; thendnl AC_DEFINE(SYS_IOCTL_WITH_TERMIO)dnl fi fi ])dnldnldnldnldnl Check if lstat() is available - special test needed 'cause lstat onlydnl becomes visable if <sys/stat.h> is included (linux 1.3.x)...AC_DEFUN(KSH_FUNC_LSTAT,[AC_CACHE_CHECK(for lstat, ksh_cv_func_lstat,[AC_TRY_LINK([#include <sys/types.h>#include <sys/stat.h> ], [ struct stat statb; lstat("/", &statb); ], ksh_cv_func_lstat=yes, ksh_cv_func_lstat=no)])if test $ksh_cv_func_lstat = yes; then AC_DEFINE(HAVE_LSTAT)fi])dnldnldnldnl Modified test from autoconf's acspecific.m4: MMAP test needs to checkdnl for/use the MAP_FILE flag. (Needed for older NetBSD systems).undefine([AC_FUNC_MMAP])dnlAC_DEFUN(AC_FUNC_MMAP,[AC_CHECK_FUNCS(valloc getpagesize)AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap,[AC_TRY_RUN([/* Thanks to Mike Haertel and Jim Avera for this test. */#include <sys/types.h>#include <fcntl.h>#include <sys/mman.h>#ifndef HAVE_GETPAGESIZE# include <sys/param.h># ifdef EXEC_PAGESIZE# define getpagesize() EXEC_PAGESIZE# else# ifdef NBPG# define getpagesize() NBPG * CLSIZE# ifndef CLSIZE# define CLSIZE 1# endif# else# ifdef NBPC# define getpagesize() NBPC# else# define getpagesize() PAGESIZE /* SVR4 */# endif# endif# endif#endif#ifndef HAVE_VALLOC# define valloc malloc#endif#ifdef __cplusplusextern "C" { void *valloc(unsigned), *malloc(unsigned); }#elsechar *valloc(), *malloc();#endif#ifndef MAP_FILE# define MAP_FILE 0#endif /* MAP_FILE */intmain(){ char *buf1, *buf2, *buf3; int i = getpagesize(), j; int i2 = i * 2; int fd; buf1 = (char *)valloc(i2); buf2 = (char *)valloc(i); buf3 = (char *)malloc(i2); for (j = 0; j < i2; ++j) *(buf1 + j) = rand(); fd = open("conftestmmap", O_CREAT | O_RDWR, 0666); write(fd, buf1, i2); mmap(buf2, i, PROT_READ | PROT_WRITE, MAP_FILE | MAP_FIXED | MAP_PRIVATE, fd, 0); for (j = 0; j < i; ++j) if (*(buf1 + j) != *(buf2 + j)) exit(1); lseek(fd, (long)i, 0); read(fd, buf2, i); /* read into mapped memory -- file should not change */ /* (it does in i386 SVR4.0 - Jim Avera, jima@netcom.com) */ lseek(fd, (long)0, 0); read(fd, buf3, i2); for (j = 0; j < i2; ++j) if (*(buf1 + j) != *(buf3 + j)) exit(1); exit(0);}], ac_cv_func_mmap=yes, ac_cv_func_mmap=no, ac_cv_func_mmap=no)])if test $ac_cv_func_mmap = yes; then AC_DEFINE(HAVE_MMAP)fi])dnldnldnldnl Modified AC_LANG_C, AC_LANG_CPLUSPLUS, AC_TRY_RUN to handle executablednl extensions.undefine([AC_LANG_C])dnlundefine([AC_LANG_CPLUXPLUS])dnlundefine([AC_TRY_RUN])dnldnl AC_LANG_C()AC_DEFUN(AC_LANG_C,[define([AC_LANG], [C])dnlac_ext=c# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.ac_cpp='echo $CPP $CPPFLAGS 1>&AC_FD_CC;$CPP $CPPFLAGS'ac_compile='echo ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC;${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC 2>&AC_FD_CC'ac_link='echo ${CC-cc} -o conftest$ac_exe_suffix $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC;${CC-cc} -o conftest$ac_exe_suffix $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC 2>&AC_FD_CC'])dnl AC_LANG_CPLUSPLUS()AC_DEFUN(AC_LANG_CPLUSPLUS,[define([AC_LANG], [CPLUSPLUS])dnlac_ext=C# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.ac_cpp='echo $CXXCPP $CPPFLAGS 1>&AC_FD_CC;$CXXCPP $CPPFLAGS'ac_compile='echo ${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC;${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC 2>&AC_FD_CC'ac_link='echo ${CXX-g++} -o conftest$ac_exe_suffix $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC;${CXX-g++} -o conftest$ac_exe_suffix $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC 2>&AC_FD_CC'])dnl AC_TRY_RUN(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSEdnl [, ACTION-IF-CROSS-COMPILING]]])AC_DEFUN(AC_TRY_RUN,[AC_REQUIRE([AC_PROG_CC])dnlif test "$cross_compiling" = yes; then ifelse([$4], , [errprint(__file__:__line__: warning: [AC_TRY_RUN] called without default to allow cross compiling)dnl AC_MSG_ERROR(can not run test program while cross compiling)], [$4])elsecat > conftest.$ac_ext <<EOF[#]line __oline__ "configure"#include "confdefs.h"ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplusextern "C" void exit(int);#endif])dnl[$1]EOFeval $ac_linkif test -s conftest$ac_exe_suffix && (./conftest; exit) 2>/dev/null; then ifelse([$2], , :, [$2])ifelse([$3], , , [else $3])dnlfifirm -fr conftest*])dnldnldnl Like AC_HEADER_SYS_WAIT, only HAVE_SYS_WAIT_H if sys/wait.h exists anddnl defines POSIX_SYS_WAIT if it is posix compatable. This way thingsdnl like WNOHANG, WUNTRACED can still be used.AC_DEFUN(KSH_HEADER_SYS_WAIT,[AC_CACHE_CHECK([for sys/wait.h that is POSIX.1 compatible], ksh_cv_header_sys_wait_h,[AC_TRY_COMPILE([#include <sys/types.h>#include <sys/wait.h>#ifndef WEXITSTATUS#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)#endif#ifndef WIFEXITED#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)#endif], [int s;wait (&s);s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;],ksh_cv_header_sys_wait_h=yes, ksh_cv_header_sys_wait_h=no)])if test $ksh_cv_header_sys_wait_h = yes; then AC_DEFINE(POSIX_SYS_WAIT)dnl AC_DEFINE(HAVE_SYS_WAIT_H)dnlelse AC_CHECK_HEADERS(sys/wait.h)dnlfi])dnldnldnl Modified test from autoconf's acspecific.m4(AC_HEADER_STAT) test: needdnl to check if S_ISSOCK == S_ISFIFO (FreeBSD).undefine([AC_HEADER_STAT])dnlAC_DEFUN(AC_HEADER_STAT,[AC_CACHE_CHECK(whether stat file-mode macros are broken, ac_cv_header_stat_broken,[AC_EGREP_CPP([You lose], [#include <sys/types.h>#include <sys/stat.h>#if defined(S_ISBLK) && defined(S_IFDIR)# if S_ISBLK (S_IFDIR)You lose.# endif#endif#if defined(S_ISBLK) && defined(S_IFCHR)# if S_ISBLK (S_IFCHR)You lose.# endif#endif#if defined(S_ISLNK) && defined(S_IFREG)# if S_ISLNK (S_IFREG)You lose.# endif#endif#if defined(S_ISSOCK) && defined(S_IFREG)# if S_ISSOCK (S_IFREG)You lose.# endif#endif#if defined(S_ISSOCK) && defined(S_IFIFO)# if S_ISSOCK (S_IFIFO)You lose.# endif#endif], ac_cv_header_stat_broken=yes, ac_cv_header_stat_broken=no)])if test $ac_cv_header_stat_broken = yes; then AC_DEFINE(STAT_MACROS_BROKEN)fi])dnldnldnl Need to change the "accepts -g" test - some broken systemsdnl allow "cc -c -g ..." but fail on the link (missing -lg).dnl LaserMoon's linux/FT is such a broken system...undefine([AC_PROG_CC])dnlAC_DEFUN(AC_PROG_CC,[AC_BEFORE([$0], [AC_PROG_CPP])dnlAC_CHECK_PROG(CC, gcc, gcc, cc)AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,[dnl The semicolon is to pacify NeXT's syntax-checking cpp.cat > conftest.c <<EOF#ifdef __GNUC__ yes;#endifEOFif ${CC-cc} -E conftest.c 2>&AC_FD_CC | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yeselse ac_cv_prog_gcc=nofi])if test $ac_cv_prog_gcc = yes; then GCC=yes if test "${CFLAGS+set}" != set; then AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_gcc_g,[echo 'int main(){ return 0; }' > conftest.cif test -z "`${CC-cc} -g conftest.c 2>&1`"; then ac_cv_prog_gcc_g=yeselse ac_cv_prog_gcc_g=nofirm -f conftest*]) if test $ac_cv_prog_gcc_g = yes; then CFLAGS="-g -O" else CFLAGS="-O" fi fielse GCC= test "${CFLAGS+set}" = set || CFLAGS="-g"fi])dnldnldnl Need to change to check for ndirdnlundefine([AC_HEADER_DIRENT])dnlAC_DEFUN(AC_HEADER_DIRENT,[ac_header_dirent=noAC_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h, [ac_header_dirent=$ac_hdr; break])# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.if test $ac_header_dirent = dirent.h; thenAC_CHECK_LIB(dir, opendir, LIBS="$LIBS -ldir", AC_CHECK_LIB(ndir, opendir, LIBS="$LIBS -lndir"))elseAC_CHECK_LIB(x, opendir, LIBS="$LIBS -lx")fi])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -