Home | History | Annotate | Line # | Download | only in m4
      1  1.1  christos #serial 18
      2  1.1  christos 
      3  1.1  christos dnl This is just a wrapper function to encapsulate this kludge.
      4  1.1  christos dnl Putting it in a separate file like this helps share it between
      5  1.1  christos dnl different packages.
      6  1.1  christos AC_DEFUN([jm_CHECK_DECLS],
      7  1.1  christos [
      8  1.1  christos   AC_REQUIRE([_jm_DECL_HEADERS])
      9  1.1  christos   AC_REQUIRE([AC_HEADER_TIME])
     10  1.1  christos   headers='
     11  1.1  christos #include <stdio.h>
     12  1.1  christos #if HAVE_STRING_H
     13  1.1  christos # if !STDC_HEADERS && HAVE_MEMORY_H
     14  1.1  christos #  include <memory.h>
     15  1.1  christos # endif
     16  1.1  christos # include <string.h>
     17  1.1  christos #else
     18  1.1  christos # if HAVE_STRINGS_H
     19  1.1  christos #  include <strings.h>
     20  1.1  christos # endif
     21  1.1  christos #endif
     22  1.1  christos #if HAVE_STDLIB_H
     23  1.1  christos # include <stdlib.h>
     24  1.1  christos #endif
     25  1.1  christos #if HAVE_UNISTD_H
     26  1.1  christos # include <unistd.h>
     27  1.1  christos #endif
     28  1.1  christos 
     29  1.1  christos #include <sys/types.h>
     30  1.1  christos #if TIME_WITH_SYS_TIME
     31  1.1  christos # include <sys/time.h>
     32  1.1  christos # include <time.h>
     33  1.1  christos #else
     34  1.1  christos # if HAVE_SYS_TIME_H
     35  1.1  christos #  include <sys/time.h>
     36  1.1  christos # else
     37  1.1  christos #  include <time.h>
     38  1.1  christos # endif
     39  1.1  christos #endif
     40  1.1  christos 
     41  1.1  christos #if HAVE_UTMP_H
     42  1.1  christos # include <utmp.h>
     43  1.1  christos #endif
     44  1.1  christos 
     45  1.1  christos #if HAVE_GRP_H
     46  1.1  christos # include <grp.h>
     47  1.1  christos #endif
     48  1.1  christos 
     49  1.1  christos #if HAVE_PWD_H
     50  1.1  christos # include <pwd.h>
     51  1.1  christos #endif
     52  1.1  christos '
     53  1.1  christos 
     54  1.1  christos   AC_CHECK_DECLS([
     55  1.1  christos     free,
     56  1.1  christos     getenv,
     57  1.1  christos     geteuid,
     58  1.1  christos     getgrgid,
     59  1.1  christos     getlogin,
     60  1.1  christos     getpwuid,
     61  1.1  christos     getuid,
     62  1.1  christos     getutent,
     63  1.1  christos     lseek,
     64  1.1  christos     malloc,
     65  1.1  christos     memchr,
     66  1.1  christos     memrchr,
     67  1.1  christos     nanosleep,
     68  1.1  christos     realloc,
     69  1.1  christos     stpcpy,
     70  1.1  christos     strndup,
     71  1.1  christos     strnlen,
     72  1.1  christos     strstr,
     73  1.1  christos     strtoul,
     74  1.1  christos     strtoull,
     75  1.1  christos     ttyname], , , $headers)
     76  1.1  christos ])
     77  1.1  christos 
     78  1.1  christos dnl FIXME: when autoconf has support for it.
     79  1.1  christos dnl This is a little helper so we can require these header checks.
     80  1.1  christos AC_DEFUN([_jm_DECL_HEADERS],
     81  1.1  christos [
     82  1.1  christos   AC_REQUIRE([AC_HEADER_STDC])
     83  1.1  christos   AC_CHECK_HEADERS(grp.h memory.h pwd.h string.h strings.h stdlib.h \
     84  1.1  christos                    unistd.h sys/time.h utmp.h utmpx.h)
     85  1.1  christos ])
     86