⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 acspecific.m4

📁 这是一个自动生成MAKEFILE的工具。在LINUX工程项目里是很好的帮手。希望对大家有点帮助。
💻 M4
📖 第 1 页 / 共 5 页
字号:
ac_cv_header_sys_wait_h=yes, ac_cv_header_sys_wait_h=no)])if test $ac_cv_header_sys_wait_h = yes; then  AC_DEFINE(HAVE_SYS_WAIT_H)fi])dnl ### Checks for typedefsAC_DEFUN(AC_TYPE_GETGROUPS,[AC_REQUIRE([AC_TYPE_UID_T])dnlAC_CACHE_CHECK(type of array argument to getgroups, ac_cv_type_getgroups,[AC_TRY_RUN(changequote(<<, >>)dnl<</* Thanks to Mike Rendell for this test.  */#include <sys/types.h>#define NGID 256#undef MAX#define MAX(x, y) ((x) > (y) ? (x) : (y))main(){  gid_t gidset[NGID];  int i, n;  union { gid_t gval; long lval; }  val;  val.lval = -1;  for (i = 0; i < NGID; i++)    gidset[i] = val.gval;  n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,                 gidset);  /* Exit non-zero if getgroups seems to require an array of ints.  This     happens when gid_t is short but getgroups modifies an array of ints.  */  exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0);}>>,changequote([, ])dnl  ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int,  ac_cv_type_getgroups=cross)if test $ac_cv_type_getgroups = cross; then  dnl When we can't run the test program (we are cross compiling), presume  dnl that <unistd.h> has either an accurate prototype for getgroups or none.  dnl Old systems without prototypes probably use int.  AC_EGREP_HEADER([getgroups.*int.*gid_t], unistd.h,		  ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int)fi])AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups)])AC_DEFUN(AC_TYPE_UID_T,[AC_CACHE_CHECK(for uid_t in sys/types.h, ac_cv_type_uid_t,[AC_EGREP_HEADER(uid_t, sys/types.h,  ac_cv_type_uid_t=yes, ac_cv_type_uid_t=no)])if test $ac_cv_type_uid_t = no; then  AC_DEFINE(uid_t, int)  AC_DEFINE(gid_t, int)fi])AC_DEFUN(AC_TYPE_SIZE_T,[AC_CHECK_TYPE(size_t, unsigned)])AC_DEFUN(AC_TYPE_PID_T,[AC_CHECK_TYPE(pid_t, int)])AC_DEFUN(AC_TYPE_OFF_T,[AC_CHECK_TYPE(off_t, long)])AC_DEFUN(AC_TYPE_MODE_T,[AC_CHECK_TYPE(mode_t, int)])dnl Note that identifiers starting with SIG are reserved by ANSI C.AC_DEFUN(AC_TYPE_SIGNAL,[AC_CACHE_CHECK([return type of signal handlers], ac_cv_type_signal,[AC_TRY_COMPILE([#include <sys/types.h>#include <signal.h>#ifdef signal#undef signal#endif#ifdef __cplusplusextern "C" void (*signal (int, void (*)(int)))(int);#elsevoid (*signal ()) ();#endif],[int i;], ac_cv_type_signal=void, ac_cv_type_signal=int)])AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal)])dnl ### Checks for functionsAC_DEFUN(AC_FUNC_CLOSEDIR_VOID,[AC_REQUIRE([AC_HEADER_DIRENT])dnlAC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void,[AC_TRY_RUN([#include <sys/types.h>#include <$ac_header_dirent>int closedir(); main() { exit(closedir(opendir(".")) != 0); }],  ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)])if test $ac_cv_func_closedir_void = yes; then  AC_DEFINE(CLOSEDIR_VOID)fi])AC_DEFUN(AC_FUNC_FNMATCH,[AC_CACHE_CHECK(for working fnmatch, ac_cv_func_fnmatch_works,# Some versions of Solaris or SCO have a broken fnmatch function.# So we run a test program.  If we are cross-compiling, take no chance.# Thanks to John Oleynick and Franc,ois Pinard for this test.[AC_TRY_RUN([main() { exit (fnmatch ("a*", "abc", 0) != 0); }],ac_cv_func_fnmatch_works=yes, ac_cv_func_fnmatch_works=no,ac_cv_func_fnmatch_works=no)])if test $ac_cv_func_fnmatch_works = yes; then  AC_DEFINE(HAVE_FNMATCH)fi])AC_DEFUN(AC_FUNC_MMAP,[AC_CHECK_HEADERS(unistd.h)AC_CHECK_FUNCS(getpagesize)AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped,[AC_TRY_RUN([/* Thanks to Mike Haertel and Jim Avera for this test.   Here is a matrix of mmap possibilities:	mmap private not fixed	mmap private fixed at somewhere currently unmapped	mmap private fixed at somewhere already mapped	mmap shared not fixed	mmap shared fixed at somewhere currently unmapped	mmap shared fixed at somewhere already mapped   For private mappings, we should verify that changes cannot be read()   back from the file, nor mmap's back from the file at a different   address.  (There have been systems where private was not correctly   implemented like the infamous i386 svr4.0, and systems where the   VM page cache was not coherent with the filesystem buffer cache   like early versions of FreeBSD and possibly contemporary NetBSD.)   For shared mappings, we should conversely verify that changes get   propogated back to all the places they're supposed to be.   Grep wants private fixed already mapped.   The main things grep needs to know about mmap are:   * does it exist and is it safe to write into the mmap'd area   * how to use it (BSD variants)  */#include <sys/types.h>#include <fcntl.h>#include <sys/mman.h>/* This mess was copied from the GNU getpagesize.h.  */#ifndef HAVE_GETPAGESIZE# ifdef HAVE_UNISTD_H#  include <unistd.h># endif/* Assume that all systems that can run configure have sys/param.h.  */# ifndef HAVE_SYS_PARAM_H#  define HAVE_SYS_PARAM_H 1# endif# ifdef _SC_PAGESIZE#  define getpagesize() sysconf(_SC_PAGESIZE)# else /* no _SC_PAGESIZE */#  ifdef HAVE_SYS_PARAM_H#   include <sys/param.h>#   ifdef EXEC_PAGESIZE#    define getpagesize() EXEC_PAGESIZE#   else /* no EXEC_PAGESIZE */#    ifdef NBPG#     define getpagesize() NBPG * CLSIZE#     ifndef CLSIZE#      define CLSIZE 1#     endif /* no CLSIZE */#    else /* no NBPG */#     ifdef NBPC#      define getpagesize() NBPC#     else /* no NBPC */#      ifdef PAGESIZE#       define getpagesize() PAGESIZE#      endif /* PAGESIZE */#     endif /* no NBPC */#    endif /* no NBPG */#   endif /* no EXEC_PAGESIZE */#  else /* no HAVE_SYS_PARAM_H */#   define getpagesize() 8192	/* punt totally */#  endif /* no HAVE_SYS_PARAM_H */# endif /* no _SC_PAGESIZE */#endif /* no HAVE_GETPAGESIZE */#ifdef __cplusplusextern "C" { void *malloc(unsigned); }#elsechar *malloc();#endifintmain(){	char *data, *data2, *data3;	int i, pagesize;	int fd;	pagesize = getpagesize();	/*	 * First, make a file with some known garbage in it.	 */	data = malloc(pagesize);	if (!data)		exit(1);	for (i = 0; i < pagesize; ++i)		*(data + i) = rand();	umask(0);	fd = creat("conftestmmap", 0600);	if (fd < 0)		exit(1);	if (write(fd, data, pagesize) != pagesize)		exit(1);	close(fd);	/*	 * Next, try to mmap the file at a fixed address which	 * already has something else allocated at it.  If we can,	 * also make sure that we see the same garbage.	 */	fd = open("conftestmmap", O_RDWR);	if (fd < 0)		exit(1);	data2 = malloc(2 * pagesize);	if (!data2)		exit(1);	data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);	if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,	    MAP_PRIVATE | MAP_FIXED, fd, 0L))		exit(1);	for (i = 0; i < pagesize; ++i)		if (*(data + i) != *(data2 + i))			exit(1);	/*	 * Finally, make sure that changes to the mapped area	 * do not percolate back to the file as seen by read().	 * (This is a bug on some variants of i386 svr4.0.)	 */	for (i = 0; i < pagesize; ++i)		*(data2 + i) = *(data2 + i) + 1;	data3 = malloc(pagesize);	if (!data3)		exit(1);	if (read(fd, data3, pagesize) != pagesize)		exit(1);	for (i = 0; i < pagesize; ++i)		if (*(data + i) != *(data3 + i))			exit(1);	close(fd);	unlink("conftestmmap");	exit(0);}], ac_cv_func_mmap_fixed_mapped=yes, ac_cv_func_mmap_fixed_mapped=no,ac_cv_func_mmap_fixed_mapped=no)])if test $ac_cv_func_mmap_fixed_mapped = yes; then  AC_DEFINE(HAVE_MMAP)fi])AC_DEFUN(AC_FUNC_GETPGRP,[AC_CACHE_CHECK(whether getpgrp takes no argument, ac_cv_func_getpgrp_void,[AC_TRY_RUN([/* * If this system has a BSD-style getpgrp(), * which takes a pid argument, exit unsuccessfully. * * Snarfed from Chet Ramey's bash pgrp.c test program */#include <stdio.h>#include <sys/types.h>int     pid;int     pg1, pg2, pg3, pg4;int     ng, np, s, child;main(){        pid = getpid();        pg1 = getpgrp(0);        pg2 = getpgrp();        pg3 = getpgrp(pid);        pg4 = getpgrp(1);        /*         * If all of these values are the same, it's pretty sure that         * we're on a system that ignores getpgrp's first argument.         */        if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3)                exit(0);        child = fork();        if (child < 0)                exit(1);        else if (child == 0) {                np = getpid();                /*                 * If this is Sys V, this will not work; pgrp will be                 * set to np because setpgrp just changes a pgrp to be                 * the same as the pid.                 */                setpgrp(np, pg1);                ng = getpgrp(0);        /* Same result for Sys V and BSD */                if (ng == pg1) {                        exit(1);                } else {                        exit(0);                }        } else {                wait(&s);                exit(s>>8);        }}], ac_cv_func_getpgrp_void=yes, ac_cv_func_getpgrp_void=no,   AC_MSG_ERROR(cannot check getpgrp if cross compiling))])if test $ac_cv_func_getpgrp_void = yes; then  AC_DEFINE(GETPGRP_VOID)fi])AC_DEFUN(AC_FUNC_SETPGRP,[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void,AC_TRY_RUN([#ifdef HAVE_UNISTD_H#include <unistd.h>#endif/* * If this system has a BSD-style setpgrp, which takes arguments, exit * successfully. */main(){    if (setpgrp(1,1) == -1)	exit(0);    else	exit(1);}], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes,   AC_MSG_ERROR(cannot check setpgrp if cross compiling)))if test $ac_cv_func_setpgrp_void = yes; then  AC_DEFINE(SETPGRP_VOID)fi])AC_DEFUN(AC_FUNC_VPRINTF,[AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF))if test "$ac_cv_func_vprintf" != yes; thenAC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT))fi])AC_DEFUN(AC_FUNC_VFORK,[AC_REQUIRE([AC_TYPE_PID_T])dnlAC_CHECK_HEADER(vfork.h, AC_DEFINE(HAVE_VFORK_H))AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works,[AC_TRY_RUN([/* Thanks to Paul Eggert for this test.  */#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#ifdef HAVE_UNISTD_H#include <unistd.h>#endif#ifdef HAVE_VFORK_H#include <vfork.h>#endif/* On some sparc systems, changes by the child to local and incoming   argument registers are propagated back to the parent.   The compiler is told about this with #include <vfork.h>,   but some compilers (e.g. gcc -O) don't grok <vfork.h>.   Test for this by using a static variable whose address   is put into a register that is clobbered by the vfork.  */static#ifdef __cplusplussparc_address_test (int arg)#elsesparc_address_test (arg) int arg;#endif{  static pid_t child;  if (!child) {    child = vfork ();    if (child < 0) {      perror ("vfork");      _exit(2);    }    if (!child) {      arg = getpid();      write(-1, "", 0);      _exit (arg);    }  }}main() {  pid_t parent = getpid ();  pid_t child;  sparc_address_test ();  child = vfork ();  if (child == 0) {    /* Here is another test for sparc vfork register problems.       This test uses lots of local variables, at least       as many local variables as main has allocated so far       including compiler temporaries.  4 locals are enough for       gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe.       A buggy compiler should reuse the register of parent       for one of the local variables, since it will think that       parent can't possibly be used any more in this routine.       Assigning to the local variable will thus munge parent       in the parent process.  */    pid_t      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();    /* Convince the compiler that p..p7 are live; otherwise, it might       use the same hardware register for all 8 local variables.  */    if (p != p1 || p != p2 || p != p3 || p != p4	|| p != p5 || p != p6 || p != p7)      _exit(1);    /* On some systems (e.g. IRIX 3.3),       vfork doesn't separate parent from child file descriptors.       If the child closes a descriptor before it execs or exits,       this munges the parent's descriptor as well.       Test for this by closing stdout in the child.  */    _exit(close(fileno(stdout)) != 0);  } else {    int status;    struct stat st;    while (wait(&status) != child)      ;    exit(	 /* Was there some problem with vforking?  */	 child < 0	 /* Did the child fail?  (This shouldn't happen.)  */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -