allow-all-target-for-rxstat-20010629
[openafs.git] / configure.in
1 AC_INIT(src/config/stds.h)
2 AM_INIT_AUTOMAKE(openafs,devel)
3 AC_CANONICAL_HOST
4 AC_CONFIG_HEADER(src/config/afsconfig.h)
5
6 #BOZO_SAVE_CORES BOS_RESTRICTED_MODE BOS_NEW_CONFIG pam sia  BITMAP_LATER FAST_RESTART
7 AC_ARG_WITH(afs-sysname,
8 [  --with-afs-sysname=sys    use sys for the afs sysname]
9 )
10 AC_ARG_ENABLE( obsolete,
11 [  --enable-obsolete                    enable obsolete portions of AFS (mpp, ntp and package)],, enable_obsolete="no")
12 AC_ARG_ENABLE( insecure,
13 [  --enable-insecure                    enable insecure portions of AFS (ftpd, inetd, rcp, rlogind and rsh)],, enable_insecure="no")
14 AC_ARG_ENABLE( afsdb,
15 [  --disable-afsdb                      disable AFSDB RR support],, enable_afsdb="yes")
16 AC_ARG_ENABLE( bos-restricted-mode,
17 [  --enable-bos-restricted-mode         enable bosserver restricted mode which disables certain bosserver functionality],, enable_bos_restricted_mode="no")
18 AC_ARG_ENABLE( namei-fileserver,
19 [  --enable-namei-fileserver            force compilation of namei fileserver in preference to inode fileserver],, enable_namei_fileserver="no")
20 AC_ARG_WITH(linux-kernel-headers,
21 [  --with-linux-kernel-headers=path     use the kernel headers found at path(optional, defaults to /usr/src/linux)]
22 )
23
24 AC_PROG_CC
25
26 dnl weird ass systems
27 AC_AIX
28 AC_ISC_POSIX
29 AC_MINIX
30
31 dnl Various compiler setup.
32 AC_C_INLINE
33 AC_C_CONST
34 AC_TYPE_PID_T
35 AC_TYPE_SIZE_T
36 AC_TYPE_SIGNAL
37
38 dnl Checks for programs.
39 AC_PROG_INSTALL
40 AC_PROG_LN_S
41 AC_PROG_RANLIB
42 AC_PROG_YACC
43 AM_PROG_LEX
44
45 OPENAFS_CHECK_BIGENDIAN
46
47 AC_MSG_CHECKING(your OS)
48 system=$host
49 case $system in
50         *-linux*)
51                 MKAFS_OSTYPE=LINUX
52                 if test "x$with_linux_kernel_headers" != "x"; then
53                         LINUX_KERNEL_PATH="$with_linux_kernel_headers"
54                 else
55                         LINUX_KERNEL_PATH="/usr/src/linux"
56                 fi
57                 if test -f "$with_linux_kernel_headers/include/linux/version.h"; then
58                  linux_kvers=`fgrep UTS_RELEASE $with_linux_kernel_headers/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $2 }'`
59                  if test "x$linux_kvers" = "x"; then
60                   AC_MSG_ERROR(Linux headers lack version definition)
61                   exit 1
62                  else
63                   LINUX_VERSION="$linux_kvers"
64                  fi
65                 else
66                  AC_MSG_ERROR(No linux headers found at $with_linux_kernel_headers)
67                  exit 1
68                 fi
69                 AC_MSG_RESULT(linux)
70                 LINUX_FS_STRUCT_INODE_HAS_I_BYTES
71                 LINUX_INODE_SETATTR_RETURN_TYPE
72                 ;;
73         *-solaris*)
74                 MKAFS_OSTYPE=SOLARIS
75                 AC_MSG_RESULT(sun4)
76                 ;;
77         *-hpux*)
78                 MKAFS_OSTYPE=HPUX
79                 AC_MSG_RESULT(hp_ux)
80                 ;;
81         *-irix*)
82                 MKAFS_OSTYPE=IRIX
83                 AC_MSG_RESULT(sgi)
84                 ;;
85         *-aix*)
86                 MKAFS_OSTYPE=AIX
87                 AC_MSG_RESULT(rs_aix)
88                 ;;
89         *-osf*)
90                 MKAFS_OSTYPE=DUX
91                 AC_MSG_RESULT(alpha_dux)
92                 ;;
93         *-darwin*)
94                 MKAFS_OSTYPE=DARWIN
95                 AC_MSG_RESULT(ppc_darwin)
96                 ;;
97         *-freebsd*)
98                 MKAFS_OSTYPE=FBSD
99                 AC_MSG_RESULT(i386_fbsd)
100                 ;;
101         *)
102                 AC_MSG_RESULT($system)
103                 ;;
104 esac
105
106 if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
107         echo Skipping library tests because they confuse Irix.
108 else
109   AC_CHECK_FUNCS(socket)
110
111   if test "$ac_cv_func_socket" = no; then
112     for lib in socket inet; do
113         if test "$HAVE_SOCKET" != 1; then
114                 AC_CHECK_LIB($lib, socket,LIBS="$LIBS -l$lib";HAVE_SOCKET=1;AC_DEFINE(HAVE_SOCKET))
115         fi
116     done
117   fi
118   
119   AC_CHECK_FUNCS(connect)       
120
121   if test "$ac_cv_func_connect" = no; then
122     for lib in nsl; do
123         if test "$HAVE_CONNECT" != 1; then
124                 AC_CHECK_LIB($lib, connect,LIBS="$LIBS -l$lib";HAVE_CONNECT=1;AC_DEFINE(HAVE_CONNECT))
125         fi
126     done
127   fi
128
129   AC_CHECK_FUNCS(gethostbyname)
130   if test "$ac_cv_func_gethostbyname" = no; then
131         for lib in dns nsl resolv; do
132           if test "$HAVE_GETHOSTBYNAME" != 1; then
133             AC_CHECK_LIB($lib, gethostbyname, LIBS="$LIBS -l$lib";HAVE_GETHOSTBYNAME=1;AC_DEFINE(HAVE_GETHOSTBYNAME))
134           fi
135         done    
136   fi    
137
138   AC_CHECK_FUNCS(res_search)
139   if test "$ac_cv_func_res_search" = no; then
140         for lib in dns nsl resolv; do
141           if test "$HAVE_RES_SEARCH" != 1; then
142             AC_CHECK_LIB($lib, res_search, LIBS="$LIBS -l$lib";HAVE_RES_SEARCH=1;AC_DEFINE(HAVE_RES_SEARCH))
143           fi
144         done    
145         if test "$HAVE_RES_SEARCH" = 1; then
146           LIB_res_search="-l$lib"       
147         fi
148   fi    
149 fi
150
151 PTHREAD_LIBS=error
152 AC_CHECK_LIB(pthread, pthread_attr_init,
153              PTHREAD_LIBS="-lpthread")
154 if test "x$PTHREAD_LIBS" = xerror; then
155         AC_CHECK_LIB(pthreads, pthread_attr_init,
156                 PTHREAD_LIBS="-lpthreads")
157 fi
158 if test "x$PTHREAD_LIBS" = xerror; then
159         AC_CHECK_LIB(c_r, pthread_attr_init,
160                 PTHREAD_LIBS="-lc_r")
161 fi
162 if test "x$PTHREAD_LIBS" = xerror; then
163         AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
164 fi
165 if test "x$PTHREAD_LIBS" = xerror; then
166         AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
167 fi
168 AC_SUBST(PTHREAD_LIBS)
169
170 WITH_OBSOLETE=NO
171 if test "$enable_obsolete" = "yes"; then
172         WITH_OBSOLETE=YES
173 fi
174
175 WITH_INSECURE=NO
176 if test "$enable_insecure" = "yes"; then
177         WITH_INSECURE=YES
178 fi
179
180 # Should autocompute a default
181 if test "x$with_afs_sysname" != "x"; then
182         AFS_SYSNAME="$with_afs_sysname"
183 else
184         AC_MSG_ERROR(An AFS sysname is required)
185         exit 1
186 fi
187
188 if test "$enable_bos_restricted_mode" = "yes"; then
189         AC_DEFINE(BOS_RESTRICTED_MODE)
190 fi
191
192 if test "$enable_namei_fileserver" = "yes"; then
193         AC_DEFINE(AFS_NAMEI_ENV)
194 fi
195
196 if test "$enable_afsdb" = "yes"; then
197         LIB_AFSDB="$LIB_res_search"
198         AC_DEFINE(AFS_AFSDB_ENV)
199 fi
200
201 SRCDIR_PARENT=`pwd`
202 TOP_SRCDIR="${SRCDIR_PARENT}/src"
203
204 dnl checks for header files.
205 AC_HEADER_STDC
206 AC_HEADER_SYS_WAIT
207 AC_HEADER_DIRENT
208 AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h)
209 AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
210 AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h)
211 AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h)
212 AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
213 AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h)
214
215 AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
216
217 AC_SUBST(AFS_SYSNAME)
218 AC_SUBST(LIB_AFSDB)
219 AC_SUBST(LINUX_KERNEL_PATH)
220 AC_SUBST(LINUX_VERSION)
221 AC_SUBST(MKAFS_OSTYPE)
222 AC_SUBST(TOP_SRCDIR)
223 AC_SUBST(WITH_OBSOLETE)
224 AC_SUBST(WITH_INSECURE)
225
226 AC_OUTPUT(             \
227 Makefile               \
228 src/config/Makefile.${AFS_SYSNAME} \
229 src/libafs/MakefileProto.${MKAFS_OSTYPE} \
230 )