1# Configure `patch'. 2# Copyright 1993, 1997 Free Software Foundation, Inc. 3dnl Process this file with autoconf to produce a configure script. 4 5AC_PREREQ(2.12) 6AC_INIT(patch.c) 7AC_CONFIG_HEADER(config.h:config.hin) 8AC_ARG_PROGRAM 9 10PACKAGE=patch 11VERSION=2.5 12AC_SUBST(PACKAGE) 13AC_SUBST(VERSION) 14 15AC_PROG_CC 16AC_PROG_CPP 17AC_PROG_INSTALL 18AC_PROG_MAKE_SET 19# Use ed_PROGRAM, not ED_PROGRAM, 20# because <errno.h> reserves symbols starting with `E'. 21AC_PATH_PROG(ed_PROGRAM, ed, ed) 22 23# If available, prefer support for large files unless the user specified 24# one of the CPPFLAGS, LDFLAGS, or LIBS variables. 25AC_MSG_CHECKING(whether large file support needs explicit enabling) 26ac_getconfs='' 27ac_result=yes 28ac_set='' 29ac_shellvars='CPPFLAGS LDFLAGS LIBS' 30for ac_shellvar in $ac_shellvars; do 31 case $ac_shellvar in 32 CPPFLAGS) ac_lfsvar=LFS_CFLAGS ;; 33 *) ac_lfsvar=LFS_$ac_shellvar ;; 34 esac 35 eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar 36 (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; } 37 ac_getconf=`getconf $ac_lfsvar` 38 ac_getconfs=$ac_getconfs$ac_getconf 39 eval ac_test_$ac_shellvar=\$ac_getconf 40done 41case "$ac_result$ac_getconfs" in 42yes) ac_result=no ;; 43esac 44case "$ac_result$ac_set" in 45yes?*) ac_result="yes, but $ac_set is already set, so use its settings" 46esac 47AC_MSG_RESULT($ac_result) 48case $ac_result in 49yes) 50 for ac_shellvar in $ac_shellvars; do 51 eval $ac_shellvar=\$ac_test_$ac_shellvar 52 done ;; 53esac 54 55AC_AIX 56AC_MINIX 57AC_ISC_POSIX 58 59AC_C_CONST 60 61AC_HEADER_DIRENT 62AC_HEADER_STDC 63AC_CHECK_HEADERS(fcntl.h limits.h string.h unistd.h utime.h varargs.h) 64 65AC_TYPE_MODE_T 66AC_TYPE_OFF_T 67AC_TYPE_SIGNAL 68AC_TYPE_SIZE_T 69 70dnl Some systems have utime.h but don't declare the struct anywhere. 71AC_MSG_CHECKING(for struct utimbuf) 72AC_CACHE_VAL(patch_cv_sys_struct_utimbuf, 73[AC_TRY_COMPILE([#include <sys/types.h> 74#if HAVE_UTIME_H 75#include <utime.h> 76#endif], [static struct utimbuf x; x.actime = x.modtime;], 77 patch_cv_sys_struct_utimbuf=yes, 78 patch_cv_sys_struct_utimbuf=no)]) 79AC_MSG_RESULT($patch_cv_sys_struct_utimbuf) 80if test $patch_cv_sys_struct_utimbuf = yes; then 81 AC_DEFINE(HAVE_STRUCT_UTIMBUF) 82fi 83 84# Check for NetBSD 1.0 bug, where memchr(..., 0) returns nonzero. 85AC_MSG_CHECKING(for working memchr) 86AC_CACHE_VAL(ac_cv_func_memchr, 87[AC_TRY_RUN([#include <string.h> 88main () { exit (memchr ("", 0, 0) != 0 || memchr ("", 1, 0) != 0); }], 89 ac_cv_func_memchr=yes, 90 ac_cv_func_memchr=no, 91 AC_MSG_WARN([We are cross-compiling so we assume memchr does not work.]) 92 ac_cv_func_memchr=no)])dnl 93AC_MSG_RESULT($ac_cv_func_memchr) 94if test $ac_cv_func_memchr = yes; then 95 AC_DEFINE(HAVE_MEMCHR) 96fi 97 98AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt1.o getopt.o"]) 99AC_SUBST(LIBOBJS) 100AC_CHECK_FUNCS(_doprintf isascii memcmp mkdir mktemp pathconf raise sigaction sigprocmask sigsetmask) 101AC_REPLACE_FUNCS(memchr rename) 102AC_FUNC_CLOSEDIR_VOID 103AC_FUNC_VPRINTF 104 105AC_SYS_LONG_FILE_NAMES 106 107AC_MSG_CHECKING([for d_ino member in directory struct]) 108AC_CACHE_VAL(patch_cv_sys_d_ino_in_dirent, 109[AC_TRY_LINK([ 110#include <sys/types.h> 111#if HAVE_DIRENT_H 112# include <dirent.h> 113#else 114# define dirent direct 115# if HAVE_SYS_NDIR_H 116# include <sys/ndir.h> 117# endif 118# ifdef HAVE_SYS_DIR_H 119# include <sys/dir.h> 120# endif 121# ifdef HAVE_NDIR_H 122# include <ndir.h> 123# endif 124#endif 125], 126 [struct dirent dp; dp.d_ino = 0;], 127 patch_cv_sys_d_ino_in_dirent=yes, 128 patch_cv_sys_d_ino_in_dirent=no)]) 129AC_MSG_RESULT($patch_cv_sys_d_ino_in_dirent) 130if test $patch_cv_sys_d_ino_in_dirent = yes; then 131 AC_DEFINE(D_INO_IN_DIRENT) 132fi 133 134AC_OUTPUT(Makefile) 135