kill-afs-warning-message-20010712
[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
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_ENABLE( fast-restart,
21 [  --enable-fast-restart                enable fast startup of file server without salvaging],, enable_fast_restart="no")
22 AC_ARG_ENABLE( bitmap-later,
23 [  --enable-bitmap-later                enable fast startup of file server by not reading bitmap till needed],, enable_bitmap_later="no")
24 AC_ARG_WITH(dux-kernel-headers,
25 [  --with-dux-kernel-headers=path       use the kernel headers found at path(optional, defaults to first match in /usr/sys)]
26 )
27 AC_ARG_WITH(linux-kernel-headers,
28 [  --with-linux-kernel-headers=path     use the kernel headers found at path(optional, defaults to /usr/src/linux)]
29 )
30 AC_ARG_ENABLE(kernel-module,
31 [  --disable-kernel-module              disable compilation of the kernel module (defaults to enabled)],, enable_kernel_module="yes"
32 )
33
34 AC_PROG_CC
35
36 dnl weird ass systems
37 AC_AIX
38 AC_ISC_POSIX
39 AC_MINIX
40
41 dnl Various compiler setup.
42 AC_C_INLINE
43 AC_C_CONST
44 AC_TYPE_PID_T
45 AC_TYPE_SIZE_T
46 AC_TYPE_SIGNAL
47
48 dnl Checks for programs.
49 AC_PROG_INSTALL
50 AC_PROG_LN_S
51 AC_PROG_RANLIB
52 AC_PROG_YACC
53 AM_PROG_LEX
54
55 OPENAFS_CHECK_BIGENDIAN
56
57 AC_MSG_CHECKING(your OS)
58 system=$host
59 case $system in
60         *-linux*)
61                 MKAFS_OSTYPE=LINUX
62                 if test "x$enable_kernel_module" = "xyes"; then
63                  if test "x$with_linux_kernel_headers" != "x"; then
64                    LINUX_KERNEL_PATH="$with_linux_kernel_headers"
65                  else
66                    LINUX_KERNEL_PATH="/usr/src/linux"
67                  fi
68                  if test -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
69                   linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $2 }'|tail -1`
70                   if test "x$linux_kvers" = "x"; then
71                     AC_MSG_ERROR(Linux headers lack version definition)
72                     exit 1
73                   else
74                     LINUX_VERSION="$linux_kvers"
75                   fi
76                  else
77                     enable_kernel_module="no"
78                  fi
79                  if test ! -f "$LINUX_KERNEL_PATH/include/linux/autoconf.h"; then
80                      enable_kernel_module="no"
81                  fi
82                  if test "x$enable_kernel_module" = "xno"; then
83                   if test "x$with_linux_kernel_headers" != "x"; then
84                    AC_MSG_ERROR(No usable linux headers found at $LINUX_KERNEL_PATH)
85                    exit 1
86                   else
87                    AC_MSG_WARN(No usable linux headers found at $LINUX_KERNEL_PATH so disabling kernel module)
88                   fi
89                  fi
90                 fi
91                 AC_MSG_RESULT(linux)
92                 if test "x$enable_kernel_module" = "xyes"; then
93                  LINUX_FS_STRUCT_INODE_HAS_I_BYTES
94                  LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK
95                  LINUX_INODE_SETATTR_RETURN_TYPE
96                  LINUX_NEED_RHCONFIG
97                  LINUX_WHICH_MODULES
98                  if test "x$ac_cv_linux_func_inode_setattr_returns_int" = "xyes" ; then
99                   AC_DEFINE(INODE_SETATTR_NOT_VOID)
100                  fi
101                  if test "x$ac_cv_linux_fs_struct_inode_has_i_bytes" = "xyes"; then 
102                   AC_DEFINE(STRUCT_INODE_HAS_I_BYTES)
103                  fi
104                  if test "x$ac_cv_linux_fs_struct_address_space_has_page_lock" = "xyes"; then 
105                   AC_DEFINE(STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK)
106                  fi
107                 :
108                 fi
109                 ;;
110         *-solaris*)
111                 MKAFS_OSTYPE=SOLARIS
112                 AC_MSG_RESULT(sun4)
113                 ;;
114         *-hpux*)
115                 MKAFS_OSTYPE=HPUX
116                 AC_MSG_RESULT(hp_ux)
117                 ;;
118         *-irix*)
119                 MKAFS_OSTYPE=IRIX
120                 AC_MSG_RESULT(sgi)
121                 ;;
122         *-aix*)
123                 MKAFS_OSTYPE=AIX
124                 AC_MSG_RESULT(rs_aix)
125                 ;;
126         *-osf*)
127                 MKAFS_OSTYPE=DUX
128                 AC_MSG_RESULT(alpha_dux)
129                 if test "x$enable_kernel_module" = "xyes"; then
130                  if test "x$with_dux_kernel_headers" != "x"; then
131                    HEADER_RT=`ls ${with_dux_kernel_headers}/rt_preempt.h | head -1 | sed 's,/rt_preempt.h,,;s,/usr/sys/,,'`
132                  else
133                    HEADER_RT=`ls /usr/sys/*/rt_preempt.h | head -1 | sed 's,/rt_preempt.h,,;s,/usr/sys/,,'`
134                  fi
135                 fi
136                 if test "$HEADER_RT" = "*" ; then
137                         AC_MSG_ERROR([Need a configured kernel directory])
138                 fi
139                 AC_SUBST([HEADER_RT])
140                 ;;
141         *-darwin*)
142                 MKAFS_OSTYPE=DARWIN
143                 AC_MSG_RESULT(ppc_darwin)
144                 ;;
145         *-freebsd*)
146                 MKAFS_OSTYPE=FBSD
147                 AC_MSG_RESULT(i386_fbsd)
148                 ;;
149         *)
150                 AC_MSG_RESULT($system)
151                 ;;
152 esac
153
154 if test "x$with_afs_sysname" != "x"; then
155         AFS_SYSNAME="$with_afs_sysname"
156 else
157         AC_MSG_CHECKING(your AFS sysname)
158         case $host in
159                 i?86-*-freebsd4.2*)
160                         AFS_SYSNAME="i386_fbsd_42"
161                         ;;
162                 hppa-hp-hpux11*)
163                         AFS_SYSNAME="hp_ux110"
164                         ;;
165                 hppa-hp-hpux10*)
166                         AFS_SYSNAME="hp_ux102"
167                         ;;
168                 ppc-apple-darwin*)
169                         AFS_SYSNAME="ppc_darwin13"
170                         ;;
171                 sparc-sun-solaris2.5*)
172                         AFS_SYSNAME="sun4x_55"
173                         ;;
174                 sparc-sun-solaris2.6)
175                         AFS_SYSNAME="sun4x_56"
176                         ;;
177                 sparc-sun-solaris2.7)
178                         AFS_SYSNAME="sun4x_57"
179                         ;;
180                 sparc-sun-solaris2.8)
181                         AFS_SYSNAME="sun4x_58"
182                         ;;
183                 alpha*-dec-osf4.0*)
184                         AFS_SYSNAME="alpha_dux40"
185                         ;;
186                 alpha*-dec-osf5.0*)
187                         AFS_SYSNAME="alpha_dux50"
188                         ;;
189                 mips-sgi-irix6.5)
190                         AFS_SYSNAME="sgi_65"
191                         ;;
192                 powerpc-*-linux*)
193                         AFS_SYSNAME="ppc_linuxXX"
194                         ;;
195                 alpha*-linux*)
196                         AFS_SYSNAME="alpha_linux_XX"
197                         ;;
198                 sparc-*-linux*)
199                         AFS_SYSNAME="sparc_linuxXX"
200                         ;;
201                 sparc64-*-linux*)
202                         AFS_SYSNAME="sparc64_linuxXX"
203                         ;;
204                 i?86-*-linux*)
205                         AFS_SYSNAME="i386_linuxXX"
206                         ;;
207                 power*-ibm-aix4.2*)
208                         AFS_SYSNAME="rs_aix42"
209                         ;;
210                 power*-ibm-aix4.3*)
211                         AFS_SYSNAME="rs_aix42"
212                         ;;
213                 default)
214                         AC_MSG_ERROR(An AFS sysname is required)
215                         exit 1
216                         ;;
217         esac
218         case $AFS_SYSNAME in
219                 *_linux*)
220                         AFS_SYSKVERS=`echo $LINUX_VERSION | awk -F\. '{print $1 $2}'`
221                         _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
222                         AFS_SYSNAME="$_AFS_SYSNAME"
223                         ;;
224         esac
225         AC_MSG_RESULT($AFS_SYSNAME)
226 fi
227
228
229 if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
230         echo Skipping library tests because they confuse Irix.
231 else
232   AC_CHECK_FUNCS(socket)
233
234   if test "$ac_cv_func_socket" = no; then
235     for lib in socket inet; do
236         if test "$HAVE_SOCKET" != 1; then
237                 AC_CHECK_LIB(${lib}, socket,LIBS="$LIBS -l$lib";HAVE_SOCKET=1;AC_DEFINE(HAVE_SOCKET))
238         fi
239     done
240   fi
241   
242   AC_CHECK_FUNCS(connect)       
243
244   if test "$ac_cv_func_connect" = no; then
245     for lib in nsl; do
246         if test "$HAVE_CONNECT" != 1; then
247                 AC_CHECK_LIB(${lib}, connect,LIBS="$LIBS -l$lib";HAVE_CONNECT=1;AC_DEFINE(HAVE_CONNECT))
248         fi
249     done
250   fi
251
252   AC_CHECK_FUNCS(gethostbyname)
253   if test "$ac_cv_func_gethostbyname" = no; then
254         for lib in dns nsl resolv; do
255           if test "$HAVE_GETHOSTBYNAME" != 1; then
256             AC_CHECK_LIB(${lib}, gethostbyname, LIBS="$LIBS -l$lib";HAVE_GETHOSTBYNAME=1;AC_DEFINE(HAVE_GETHOSTBYNAME))
257           fi
258         done    
259   fi    
260
261   AC_CHECK_FUNCS(res_search)
262   if test "$ac_cv_func_res_search" = no; then
263         for lib in dns nsl resolv; do
264           if test "$HAVE_RES_SEARCH" != 1; then
265             AC_CHECK_LIB(${lib}, res_search, LIBS="$LIBS -l$lib";HAVE_RES_SEARCH=1;AC_DEFINE(HAVE_RES_SEARCH))
266           fi
267         done    
268         if test "$HAVE_RES_SEARCH" = 1; then
269           LIB_res_search="-l$lib"       
270         fi
271   fi    
272 fi
273
274 PTHREAD_LIBS=error
275 AC_CHECK_LIB(pthread, pthread_attr_init,
276              PTHREAD_LIBS="-lpthread")
277 if test "x$PTHREAD_LIBS" = xerror; then
278         AC_CHECK_LIB(pthreads, pthread_attr_init,
279                 PTHREAD_LIBS="-lpthreads")
280 fi
281 if test "x$PTHREAD_LIBS" = xerror; then
282         AC_CHECK_LIB(c_r, pthread_attr_init,
283                 PTHREAD_LIBS="-lc_r")
284 fi
285 if test "x$PTHREAD_LIBS" = xerror; then
286         AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
287 fi
288 if test "x$PTHREAD_LIBS" = xerror; then
289         AC_MSG_WARN(*** Unable to locate working posix thread library ***)
290 fi
291 AC_SUBST(PTHREAD_LIBS)
292
293 WITH_OBSOLETE=NO
294 if test "$enable_obsolete" = "yes"; then
295         WITH_OBSOLETE=YES
296 fi
297
298 WITH_INSECURE=NO
299 if test "$enable_insecure" = "yes"; then
300         WITH_INSECURE=YES
301 fi
302
303 # Fast restart
304 if test "$enable_fast_restart" = "yes"; then
305         AC_DEFINE(FAST_RESTART)
306 fi
307
308 if test "$enable_bitmap_later" = "yes"; then
309         AC_DEFINE(BITMAP_LATER)
310 fi
311
312 if test "$enable_bos_restricted_mode" = "yes"; then
313         AC_DEFINE(BOS_RESTRICTED_MODE)
314 fi
315
316 if test "$enable_namei_fileserver" = "yes"; then
317         AC_DEFINE(AFS_NAMEI_ENV)
318 fi
319
320 if test "$enable_afsdb" = "yes"; then
321         LIB_AFSDB="$LIB_res_search"
322         AC_DEFINE(AFS_AFSDB_ENV)
323 fi
324
325 SRCDIR_PARENT=`pwd`
326 TOP_SRCDIR="${SRCDIR_PARENT}/src"
327
328 dnl checks for header files.
329 AC_HEADER_STDC
330 AC_HEADER_SYS_WAIT
331 AC_HEADER_DIRENT
332 AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h)
333 AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
334 AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h)
335 AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h)
336 AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
337 AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h)
338
339 AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
340
341 if test "x$enable_kernel_module" = "xyes"; then
342 ENABLE_KERNEL_MODULE=libafs
343 fi
344
345 AC_SUBST(AFS_SYSNAME)
346 AC_SUBST(ENABLE_KERNEL_MODULE)
347 AC_SUBST(LIB_AFSDB)
348 AC_SUBST(LINUX_KERNEL_PATH)
349 AC_SUBST(LINUX_VERSION)
350 AC_SUBST(MKAFS_OSTYPE)
351 AC_SUBST(TOP_SRCDIR)
352 AC_SUBST(WITH_OBSOLETE)
353 AC_SUBST(WITH_INSECURE)
354
355 AC_OUTPUT(             \
356 Makefile               \
357 src/config/Makefile.${AFS_SYSNAME} \
358 src/libafs/MakefileProto.${MKAFS_OSTYPE} \
359 )