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