- fix order problem in Makefile, Makefile.${ARCH} has to be included before
[dragonfly.git] / contrib / patch / configure.in
1 # Configure `patch'.
2 # Copyright 1993, 1997 Free Software Foundation, Inc.
3 dnl Process this file with autoconf to produce a configure script.
4
5 AC_PREREQ(2.12)
6 AC_INIT(patch.c)
7 AC_CONFIG_HEADER(config.h:config.hin)
8 AC_ARG_PROGRAM
9
10 PACKAGE=patch
11 VERSION=2.5
12 AC_SUBST(PACKAGE)
13 AC_SUBST(VERSION)
14
15 AC_PROG_CC
16 AC_PROG_CPP
17 AC_PROG_INSTALL
18 AC_PROG_MAKE_SET
19 # Use ed_PROGRAM, not ED_PROGRAM,
20 # because <errno.h> reserves symbols starting with `E'.
21 AC_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.
25 AC_MSG_CHECKING(whether large file support needs explicit enabling)
26 ac_getconfs=''
27 ac_result=yes
28 ac_set=''
29 ac_shellvars='CPPFLAGS LDFLAGS LIBS'
30 for 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
40 done
41 case "$ac_result$ac_getconfs" in
42 yes) ac_result=no ;;
43 esac
44 case "$ac_result$ac_set" in
45 yes?*) ac_result="yes, but $ac_set is already set, so use its settings"
46 esac
47 AC_MSG_RESULT($ac_result)
48 case $ac_result in
49 yes)
50   for ac_shellvar in $ac_shellvars; do
51     eval $ac_shellvar=\$ac_test_$ac_shellvar
52   done ;;
53 esac
54
55 AC_AIX
56 AC_MINIX
57 AC_ISC_POSIX
58
59 AC_C_CONST
60
61 AC_HEADER_DIRENT
62 AC_HEADER_STDC
63 AC_CHECK_HEADERS(fcntl.h limits.h string.h unistd.h utime.h varargs.h)
64
65 AC_TYPE_MODE_T
66 AC_TYPE_OFF_T
67 AC_TYPE_SIGNAL
68 AC_TYPE_SIZE_T
69
70 dnl Some systems have utime.h but don't declare the struct anywhere.
71 AC_MSG_CHECKING(for struct utimbuf)
72 AC_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)])
79 AC_MSG_RESULT($patch_cv_sys_struct_utimbuf)
80 if test $patch_cv_sys_struct_utimbuf = yes; then
81    AC_DEFINE(HAVE_STRUCT_UTIMBUF)
82 fi
83
84 # Check for NetBSD 1.0 bug, where memchr(..., 0) returns nonzero.
85 AC_MSG_CHECKING(for working memchr)
86 AC_CACHE_VAL(ac_cv_func_memchr,
87 [AC_TRY_RUN([#include <string.h>
88 main () { 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
93 AC_MSG_RESULT($ac_cv_func_memchr)
94 if test $ac_cv_func_memchr = yes; then
95   AC_DEFINE(HAVE_MEMCHR)
96 fi
97
98 AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt1.o getopt.o"])
99 AC_SUBST(LIBOBJS)
100 AC_CHECK_FUNCS(_doprintf isascii memcmp mkdir mktemp pathconf raise sigaction sigprocmask sigsetmask)
101 AC_REPLACE_FUNCS(memchr rename)
102 AC_FUNC_CLOSEDIR_VOID
103 AC_FUNC_VPRINTF
104
105 AC_SYS_LONG_FILE_NAMES
106
107 AC_MSG_CHECKING([for d_ino member in directory struct])
108 AC_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)])
129 AC_MSG_RESULT($patch_cv_sys_d_ino_in_dirent)
130 if test $patch_cv_sys_d_ino_in_dirent = yes; then
131   AC_DEFINE(D_INO_IN_DIRENT)
132 fi
133
134 AC_OUTPUT(Makefile)