kdump-include-afsconfig-path-20010711
[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_INODE_SETATTR_RETURN_TYPE
95                  LINUX_NEED_RHCONFIG
96                  LINUX_WHICH_MODULES
97                  if test "x$ac_cv_linux_func_inode_setattr_returns_int" = "xyes" ; then
98                   AC_DEFINE(INODE_SETATTR_NOT_VOID)
99                  fi
100                  if test "x$ac_cv_linux_fs_struct_inode_has_i_bytes" = "xyes"; then 
101                   AC_DEFINE(STRUCT_INODE_HAS_I_BYTES)
102                  fi
103                 :
104                 fi
105                 ;;
106         *-solaris*)
107                 MKAFS_OSTYPE=SOLARIS
108                 AC_MSG_RESULT(sun4)
109                 ;;
110         *-hpux*)
111                 MKAFS_OSTYPE=HPUX
112                 AC_MSG_RESULT(hp_ux)
113                 ;;
114         *-irix*)
115                 MKAFS_OSTYPE=IRIX
116                 AC_MSG_RESULT(sgi)
117                 ;;
118         *-aix*)
119                 MKAFS_OSTYPE=AIX
120                 AC_MSG_RESULT(rs_aix)
121                 ;;
122         *-osf*)
123                 MKAFS_OSTYPE=DUX
124                 AC_MSG_RESULT(alpha_dux)
125                 if test "x$enable_kernel_module" = "xyes"; then
126                  if test "x$with_dux_kernel_headers" != "x"; then
127                    HEADER_RT=`ls ${with_dux_kernel_headers}/rt_preempt.h | head -1 | sed 's,/rt_preempt.h,,;s,/usr/sys/,,'`
128                  else
129                    HEADER_RT=`ls /usr/sys/*/rt_preempt.h | head -1 | sed 's,/rt_preempt.h,,;s,/usr/sys/,,'`
130                  fi
131                 fi
132                 if test "$HEADER_RT" = "*" ; then
133                         AC_MSG_ERROR([Need a configured kernel directory])
134                 fi
135                 AC_SUBST([HEADER_RT])
136                 ;;
137         *-darwin*)
138                 MKAFS_OSTYPE=DARWIN
139                 AC_MSG_RESULT(ppc_darwin)
140                 ;;
141         *-freebsd*)
142                 MKAFS_OSTYPE=FBSD
143                 AC_MSG_RESULT(i386_fbsd)
144                 ;;
145         *)
146                 AC_MSG_RESULT($system)
147                 ;;
148 esac
149
150 if test "x$with_afs_sysname" != "x"; then
151         AFS_SYSNAME="$with_afs_sysname"
152 else
153         AC_MSG_CHECKING(your AFS sysname)
154         case $host in
155                 i?86-*-freebsd4.2*)
156                         AFS_SYSNAME="i386_fbsd_42"
157                         ;;
158                 hppa-hp-hpux11*)
159                         AFS_SYSNAME="hp_ux110"
160                         ;;
161                 hppa-hp-hpux10*)
162                         AFS_SYSNAME="hp_ux102"
163                         ;;
164                 ppc-apple-darwin*)
165                         AFS_SYSNAME="ppc_darwin13"
166                         ;;
167                 sparc-sun-solaris2.5*)
168                         AFS_SYSNAME="sun4x_55"
169                         ;;
170                 sparc-sun-solaris2.6)
171                         AFS_SYSNAME="sun4x_56"
172                         ;;
173                 sparc-sun-solaris2.7)
174                         AFS_SYSNAME="sun4x_57"
175                         ;;
176                 sparc-sun-solaris2.8)
177                         AFS_SYSNAME="sun4x_58"
178                         ;;
179                 alpha*-dec-osf4.0*)
180                         AFS_SYSNAME="alpha_dux40"
181                         ;;
182                 alpha*-dec-osf5.0*)
183                         AFS_SYSNAME="alpha_dux50"
184                         ;;
185                 mips-sgi-irix6.5)
186                         AFS_SYSNAME="sgi_65"
187                         ;;
188                 powerpc-*-linux*)
189                         AFS_SYSNAME="ppc_linuxXX"
190                         ;;
191                 alpha*-linux*)
192                         AFS_SYSNAME="alpha_linux_XX"
193                         ;;
194                 sparc-*-linux*)
195                         AFS_SYSNAME="sparc_linuxXX"
196                         ;;
197                 sparc64-*-linux*)
198                         AFS_SYSNAME="sparc64_linuxXX"
199                         ;;
200                 i?86-*-linux*)
201                         AFS_SYSNAME="i386_linuxXX"
202                         ;;
203                 power*-ibm-aix4.2*)
204                         AFS_SYSNAME="rs_aix42"
205                         ;;
206                 power*-ibm-aix4.3*)
207                         AFS_SYSNAME="rs_aix42"
208                         ;;
209                 default)
210                         AC_MSG_ERROR(An AFS sysname is required)
211                         exit 1
212                         ;;
213         esac
214         case $AFS_SYSNAME in
215                 *_linux*)
216                         AFS_SYSKVERS=`echo $LINUX_VERSION | awk -F\. '{print $1 $2}'`
217                         _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
218                         AFS_SYSNAME="$_AFS_SYSNAME"
219                         ;;
220         esac
221         AC_MSG_RESULT($AFS_SYSNAME)
222 fi
223
224
225 if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
226         echo Skipping library tests because they confuse Irix.
227 else
228   AC_CHECK_FUNCS(socket)
229
230   if test "$ac_cv_func_socket" = no; then
231     for lib in socket inet; do
232         if test "$HAVE_SOCKET" != 1; then
233                 AC_CHECK_LIB(${lib}, socket,LIBS="$LIBS -l$lib";HAVE_SOCKET=1;AC_DEFINE(HAVE_SOCKET))
234         fi
235     done
236   fi
237   
238   AC_CHECK_FUNCS(connect)       
239
240   if test "$ac_cv_func_connect" = no; then
241     for lib in nsl; do
242         if test "$HAVE_CONNECT" != 1; then
243                 AC_CHECK_LIB(${lib}, connect,LIBS="$LIBS -l$lib";HAVE_CONNECT=1;AC_DEFINE(HAVE_CONNECT))
244         fi
245     done
246   fi
247
248   AC_CHECK_FUNCS(gethostbyname)
249   if test "$ac_cv_func_gethostbyname" = no; then
250         for lib in dns nsl resolv; do
251           if test "$HAVE_GETHOSTBYNAME" != 1; then
252             AC_CHECK_LIB(${lib}, gethostbyname, LIBS="$LIBS -l$lib";HAVE_GETHOSTBYNAME=1;AC_DEFINE(HAVE_GETHOSTBYNAME))
253           fi
254         done    
255   fi    
256
257   AC_CHECK_FUNCS(res_search)
258   if test "$ac_cv_func_res_search" = no; then
259         for lib in dns nsl resolv; do
260           if test "$HAVE_RES_SEARCH" != 1; then
261             AC_CHECK_LIB(${lib}, res_search, LIBS="$LIBS -l$lib";HAVE_RES_SEARCH=1;AC_DEFINE(HAVE_RES_SEARCH))
262           fi
263         done    
264         if test "$HAVE_RES_SEARCH" = 1; then
265           LIB_res_search="-l$lib"       
266         fi
267   fi    
268 fi
269
270 PTHREAD_LIBS=error
271 AC_CHECK_LIB(pthread, pthread_attr_init,
272              PTHREAD_LIBS="-lpthread")
273 if test "x$PTHREAD_LIBS" = xerror; then
274         AC_CHECK_LIB(pthreads, pthread_attr_init,
275                 PTHREAD_LIBS="-lpthreads")
276 fi
277 if test "x$PTHREAD_LIBS" = xerror; then
278         AC_CHECK_LIB(c_r, pthread_attr_init,
279                 PTHREAD_LIBS="-lc_r")
280 fi
281 if test "x$PTHREAD_LIBS" = xerror; then
282         AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
283 fi
284 if test "x$PTHREAD_LIBS" = xerror; then
285         AC_MSG_WARN(*** Unable to locate working posix thread library ***)
286 fi
287 AC_SUBST(PTHREAD_LIBS)
288
289 WITH_OBSOLETE=NO
290 if test "$enable_obsolete" = "yes"; then
291         WITH_OBSOLETE=YES
292 fi
293
294 WITH_INSECURE=NO
295 if test "$enable_insecure" = "yes"; then
296         WITH_INSECURE=YES
297 fi
298
299 # Fast restart
300 if test "$enable_fast_restart" = "yes"; then
301         AC_DEFINE(FAST_RESTART)
302 fi
303
304 if test "$enable_bitmap_later" = "yes"; then
305         AC_DEFINE(BITMAP_LATER)
306 fi
307
308 if test "$enable_bos_restricted_mode" = "yes"; then
309         AC_DEFINE(BOS_RESTRICTED_MODE)
310 fi
311
312 if test "$enable_namei_fileserver" = "yes"; then
313         AC_DEFINE(AFS_NAMEI_ENV)
314 fi
315
316 if test "$enable_afsdb" = "yes"; then
317         LIB_AFSDB="$LIB_res_search"
318         AC_DEFINE(AFS_AFSDB_ENV)
319 fi
320
321 SRCDIR_PARENT=`pwd`
322 TOP_SRCDIR="${SRCDIR_PARENT}/src"
323
324 dnl checks for header files.
325 AC_HEADER_STDC
326 AC_HEADER_SYS_WAIT
327 AC_HEADER_DIRENT
328 AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h)
329 AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
330 AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h)
331 AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h)
332 AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
333 AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h)
334
335 AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
336
337 if test "x$enable_kernel_module" = "xyes"; then
338 ENABLE_KERNEL_MODULE=libafs
339 fi
340
341 AC_SUBST(AFS_SYSNAME)
342 AC_SUBST(ENABLE_KERNEL_MODULE)
343 AC_SUBST(LIB_AFSDB)
344 AC_SUBST(LINUX_KERNEL_PATH)
345 AC_SUBST(LINUX_VERSION)
346 AC_SUBST(MKAFS_OSTYPE)
347 AC_SUBST(TOP_SRCDIR)
348 AC_SUBST(WITH_OBSOLETE)
349 AC_SUBST(WITH_INSECURE)
350
351 AC_OUTPUT(             \
352 Makefile               \
353 src/config/Makefile.${AFS_SYSNAME} \
354 src/libafs/MakefileProto.${MKAFS_OSTYPE} \
355 )