deal-with-non-modversioned-non-exported-sys-call-table-20021204
[openafs.git] / acinclude.m4
1 dnl This file contains the common configuration code which would
2 dnl otherwise be duplicated between configure and configure-libafs.
3 dnl
4 dnl NB: Because this code is a macro, references to positional shell
5 dnl parameters must be done like $[]1 instead of $1
6
7 AC_DEFUN(OPENAFS_CONFIGURE_COMMON,[
8
9 AC_CANONICAL_HOST
10 SRCDIR_PARENT=`pwd`
11
12 #BOZO_SAVE_CORES BOS_RESTRICTED_MODE BOS_NEW_CONFIG pam sia
13 AC_ARG_WITH(afs-sysname,
14 [  --with-afs-sysname=sys    use sys for the afs sysname]
15 )
16 AC_ARG_ENABLE( obsolete,
17 [  --enable-obsolete                    enable obsolete portions of AFS (mpp, ntp and package)],, enable_obsolete="no")
18 AC_ARG_ENABLE( insecure,
19 [  --enable-insecure                    enable insecure portions of AFS (ftpd, inetd, rcp, rlogind and rsh)],, enable_insecure="no")
20 AC_ARG_ENABLE( afsdb,
21 [  --disable-afsdb                      disable AFSDB RR support],, enable_afsdb="yes")
22 AC_ARG_ENABLE( bos-restricted-mode,
23 [  --enable-bos-restricted-mode         enable bosserver restricted mode which disables certain bosserver functionality],, enable_bos_restricted_mode="no")
24 AC_ARG_ENABLE( namei-fileserver,
25 [  --enable-namei-fileserver            force compilation of namei fileserver in preference to inode fileserver],, enable_namei_fileserver="no")
26 AC_ARG_ENABLE( fast-restart,
27 [  --enable-fast-restart                enable fast startup of file server without salvaging],, enable_fast_restart="no")
28 AC_ARG_ENABLE( bitmap-later,
29 [  --enable-bitmap-later                enable fast startup of file server by not reading bitmap till needed],, enable_bitmap_later="no")
30 AC_ARG_ENABLE( full-vos-listvol-switch,
31 [  --enable-full-vos-listvol-switch     enable vos full listvol switch for formatted output],, enable_full_vos_listvol_switch="no")
32 AC_ARG_WITH(dux-kernel-headers,
33 [  --with-dux-kernel-headers=path       use the kernel headers found at path(optional, defaults to first match in /usr/sys)]
34 )
35 AC_ARG_WITH(linux-kernel-headers,
36 [  --with-linux-kernel-headers=path     use the kernel headers found at path(optional, defaults to /usr/src/linux)]
37 )
38 AC_ARG_ENABLE(kernel-module,
39 [  --disable-kernel-module              disable compilation of the kernel module (defaults to enabled)],, enable_kernel_module="yes"
40 )
41 AC_ARG_ENABLE(redhat-buildsys,
42 [  --enable-redhat-buildsys             enable compilation of the redhat build system kernel (defaults to disabled)],, enable_redhat_buildsys="no"
43 )
44 AC_ARG_ENABLE(transarc-paths,
45 [  --enable-transarc-paths                      Use Transarc style paths like /usr/afs and /usr/vice],, enable_transarc_paths="no"
46 )
47 AC_ARG_ENABLE(tivoli-tsm,
48 [  --enable-tivoli-tsm                  Enable use of the Tivoli TSM API libraries for butc support],, enable_tivoli_tsm="no"
49 )
50 AC_ARG_ENABLE(debug-kernel,
51 [  --enable-debug-kernel                enable compilation of the kernel module with debugging information (defaults to disabled)],, enable_debug_kernel="no"
52 )
53
54 dnl weird ass systems
55 AC_AIX
56 AC_ISC_POSIX
57 AC_MINIX
58
59 dnl Various compiler setup.
60 AC_TYPE_PID_T
61 AC_TYPE_SIZE_T
62 AC_TYPE_SIGNAL
63
64 dnl Checks for programs.
65 AC_PROG_INSTALL
66 AC_PROG_LN_S
67 AC_PROG_RANLIB
68 AC_PROG_YACC
69 AM_PROG_LEX
70
71 OPENAFS_CHECK_BIGENDIAN
72
73 KERN_DEBUG_OPT=
74 if test "x$enable_debug_kernel" = "xyes"; then
75   KERN_DEBUG_OPT=-g
76 fi
77
78 AC_MSG_CHECKING(your OS)
79 system=$host
80 case $system in
81         *-linux*)
82                 MKAFS_OSTYPE=LINUX
83                 if test "x$enable_redhat_buildsys" = "xyes"; then
84                  AC_DEFINE(ENABLE_REDHAT_BUILDSYS, 1, [define if you have redhat buildsystem])
85                 fi
86                 if test "x$enable_kernel_module" = "xyes"; then
87                  if test "x$with_linux_kernel_headers" != "x"; then
88                    LINUX_KERNEL_PATH="$with_linux_kernel_headers"
89                  else
90                    LINUX_KERNEL_PATH="/usr/src/linux"
91                  fi
92                  if test -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then
93                   linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -1`
94                   if test "x$linux_kvers" = "x"; then
95                     if test -f "$LINUX_KERNEL_PATH/include/linux/version-up.h"; then
96                       linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/version-up.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -1`
97                       if test "x$linux_kvers" = "x"; then
98
99                         AC_MSG_ERROR(Linux headers lack version definition [2])
100                         exit 1
101                       else
102                         LINUX_VERSION="$linux_kvers"
103                       fi
104                     else
105                       AC_MSG_ERROR(Linux headers lack version definition)
106                       exit 1
107                     fi
108                   else
109                     LINUX_VERSION="$linux_kvers"
110                   fi
111                  else
112                     enable_kernel_module="no"
113                  fi
114                  if test ! -f "$LINUX_KERNEL_PATH/include/linux/autoconf.h"; then
115                      enable_kernel_module="no"
116                  fi
117                  if test "x$enable_kernel_module" = "xno"; then
118                   if test "x$with_linux_kernel_headers" != "x"; then
119                    AC_MSG_ERROR(No usable linux headers found at $LINUX_KERNEL_PATH)
120                    exit 1
121                   else
122                    AC_MSG_WARN(No usable linux headers found at $LINUX_KERNEL_PATH so disabling kernel module)
123                   fi
124                  fi
125                 fi
126                 AC_MSG_RESULT(linux)
127                 if test "x$enable_kernel_module" = "xyes"; then
128                  OMIT_FRAME_POINTER=
129                  if test "x$enable_debug_kernel" = "xno"; then
130                         OMIT_FRAME_POINTER=-fomit-frame-pointer
131                  fi
132                  AC_SUBST(OMIT_FRAME_POINTER)
133                  OPENAFS_GCC_SUPPORTS_MARCH
134                  AC_SUBST(P5PLUS_KOPTS)
135                  OPENAFS_GCC_NEEDS_NO_STRENGTH_REDUCE
136                  OPENAFS_GCC_NEEDS_NO_STRICT_ALIASING
137                  OPENAFS_GCC_SUPPORTS_NO_COMMON
138                  AC_SUBST(LINUX_GCC_KOPTS)
139                  ifdef([OPENAFS_CONFIGURE_LIBAFS],
140                    [LINUX_BUILD_VNODE_FROM_INODE(src/config,afs)],
141                    [LINUX_BUILD_VNODE_FROM_INODE(${srcdir}/src/config,src/afs/LINUX,${srcdir}/src/afs/LINUX)]
142                  )
143                  LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK
144                  LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_GFP_MASK
145                  LINUX_FS_STRUCT_INODE_HAS_I_TRUNCATE_SEM
146                  LINUX_FS_STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS
147                  LINUX_FS_STRUCT_INODE_HAS_I_DEVICES
148                  LINUX_INODE_SETATTR_RETURN_TYPE
149                  LINUX_COMPLETION_H_EXISTS
150                  LINUX_EXPORTS_TASKLIST_LOCK
151                  LINUX_NEED_RHCONFIG
152                  LINUX_WHICH_MODULES
153                  if test "x$ac_cv_linux_config_modversions" = "xno"; then
154                    AC_MSG_WARN([Cannot determine sys_call_table status. assuming it's exported])
155                    ac_cv_linux_exports_sys_call_table=yes
156                  else
157                    LINUX_EXPORTS_SYS_CALL_TABLE
158                    LINUX_EXPORTS_KALLSYMS_SYMBOL
159                    LINUX_EXPORTS_KALLSYMS_ADDRESS
160                    LINUX_EXPORTS_INIT_MM
161                    if test "x$ac_cv_linux_exports_sys_call_table" = "xno"; then
162                          linux_syscall_method=none
163                          if test "x$ac_cv_linux_exports_init_mm" = "xyes"; then
164                             linux_syscall_method=scan
165                             if test "x$ac_cv_linux_exports_kallsyms_address" = "xyes"; then
166                                linux_syscall_method=scan_with_kallsyms_address
167                             fi
168                          fi
169                          if test "x$ac_cv_linux_exports_kallsyms_symbol" = "xyes"; then
170                             linux_syscall_method=kallsyms_symbol
171                          fi
172                          if test "x$linux_syscall_method" = "xnone"; then
173                         AC_MSG_ERROR([no available sys_call_table access method])
174                          fi
175                    fi
176                  fi
177                  if test "x$ac_cv_linux_exports_tasklist_lock" = "xyes" ; then
178                   AC_DEFINE(EXPORTED_TASKLIST_LOCK, 1, [define if your linux kernel exports tasklist_lock])
179                  fi
180                  if test "x$ac_cv_linux_exports_sys_call_table" = "xyes"; then
181                   AC_DEFINE(EXPORTED_SYS_CALL_TABLE)
182                  fi
183                  if test "x$ac_cv_linux_exports_kallsyms_symbol" = "xyes"; then
184                   AC_DEFINE(EXPORTED_KALLSYMS_SYMBOL)
185                  fi
186                  if test "x$ac_cv_linux_exports_kallsyms_address" = "xyes"; then
187                   AC_DEFINE(EXPORTED_KALLSYMS_ADDRESS)
188                  fi
189                  if test "x$ac_cv_linux_completion_h_exists" = "xyes" ; then
190                   AC_DEFINE(COMPLETION_H_EXISTS, 1, [define if your h_exists exists])
191                  fi
192                  if test "x$ac_cv_linux_func_inode_setattr_returns_int" = "xyes" ; then
193                   AC_DEFINE(INODE_SETATTR_NOT_VOID, 1, [define if your setattr return return non-void])
194                  fi
195                  if test "x$ac_cv_linux_fs_struct_address_space_has_page_lock" = "xyes"; then 
196                   AC_DEFINE(STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK, 1, [define if your struct address_space has page_lock])
197                  fi
198                  if test "x$ac_cv_linux_fs_struct_address_space_has_gfp_mask" = "xyes"; then 
199                   AC_DEFINE(STRUCT_ADDRESS_SPACE_HAS_GFP_MASK, 1, [define if your struct address_space has gfp_mask])
200                  fi
201                  if test "x$ac_cv_linux_fs_struct_inode_has_i_truncate_sem" = "xyes"; then 
202                   AC_DEFINE(STRUCT_INODE_HAS_I_TRUNCATE_SEM, 1, [define if your struct inode has truncate_sem])
203                  fi
204                  if test "x$ac_cv_linux_fs_struct_inode_has_i_devices" = "xyes"; then 
205                   AC_DEFINE(STRUCT_INODE_HAS_I_DEVICES, 1, [define if you struct inode has i_devices])
206                  fi
207                  if test "x$ac_cv_linux_fs_struct_inode_has_i_dirty_data_buffers" = "xyes"; then 
208                   AC_DEFINE(STRUCT_INODE_HAS_I_DIRTY_DATA_BUFFERS, 1, [define if you struct inode has data_buffers])
209                  fi
210                 :
211                 fi
212                 ;;
213         *-solaris*)
214                 MKAFS_OSTYPE=SOLARIS
215                 AC_MSG_RESULT(sun4)
216                 SOLARIS_UFSVFS_HAS_DQRWLOCK
217                 SOLARIS_PROC_HAS_P_COREFILE
218                 ;;
219         *-sunos*)
220                 MKAFS_OSTYPE=SUNOS
221                 enable_kernel_module=no
222                 AC_MSG_RESULT(sun4)
223                 ;;
224         *-hpux*)
225                 MKAFS_OSTYPE=HPUX
226                 AC_MSG_RESULT(hp_ux)
227                 ;;
228         *-irix*)
229                 if test -d /usr/include/sys/SN/SN1; then
230                  IRIX_BUILD_IP35="IP35"
231                 fi
232                 MKAFS_OSTYPE=IRIX
233                 AC_MSG_RESULT(sgi)
234                 ;;
235         *-aix*)
236                 MKAFS_OSTYPE=AIX
237                 AC_MSG_RESULT(rs_aix)
238                 ;;
239         *-osf*)
240                 MKAFS_OSTYPE=DUX
241                 AC_MSG_RESULT(alpha_dux)
242                 if test "x$enable_kernel_module" = "xyes"; then
243                  if test "x$with_dux_kernel_headers" != "x"; then
244                    HEADER_RT=`ls ${with_dux_kernel_headers}/rt_preempt.h | head -1 | sed 's,/rt_preempt.h,,;s,/usr/sys/,,'`
245                  else
246                    HEADER_RT=`ls /usr/sys/*/rt_preempt.h | head -1 | sed 's,/rt_preempt.h,,;s,/usr/sys/,,'`
247                  fi
248                 fi
249                 if test "$HEADER_RT" = "*" ; then
250                         AC_MSG_ERROR([Need a configured kernel directory])
251                 fi
252                 AC_SUBST([HEADER_RT])
253                 ;;
254         *-darwin*)
255                 MKAFS_OSTYPE=DARWIN
256                 AC_MSG_RESULT(ppc_darwin)
257                 ;;
258         *-freebsd*)
259                 MKAFS_OSTYPE=FBSD
260                 AC_MSG_RESULT(i386_fbsd)
261                 ;;
262         *-netbsd*)
263                 MKAFS_OSTYPE=NBSD
264                 AC_MSG_RESULT(nbsd)
265                 ;;
266         *-openbsd*)
267                 MKAFS_OSTYPE=OBSD
268                 AC_MSG_RESULT(i386_obsd)
269                 ;;
270         *)
271                 AC_MSG_RESULT($system)
272                 ;;
273 esac
274 AC_SUBST(KERN_DEBUG_OPT)
275
276 if test "x$with_afs_sysname" != "x"; then
277         AFS_SYSNAME="$with_afs_sysname"
278 else
279         AC_MSG_CHECKING(your AFS sysname)
280         case $host in
281                 i386-unknown-openbsd3.1)
282                         AFS_SYSNAME="i386_obsd31"
283                         ;;
284                 i?86-*-freebsd4.2*)
285                         AFS_SYSNAME="i386_fbsd_42"
286                         ;;
287                 i?86-*-freebsd4.3*)
288                         AFS_SYSNAME="i386_fbsd_43"
289                         ;;
290                 i?86-*-freebsd4.4*)
291                         AFS_SYSNAME="i386_fbsd_44"
292                         ;;
293                 i?86-*-freebsd4.5*)
294                         AFS_SYSNAME="i386_fbsd_45"
295                         ;;
296                 i?86-*-freebsd4.6*)
297                         AFS_SYSNAME="i386_fbsd_46"
298                         ;;
299                 i?86-*-netbsd*1.5*)
300                         AFS_PARAM_COMMON=param.nbsd15.h
301                         AFS_SYSNAME="i386_nbsd15"
302                         ;;
303                 alpha-*-netbsd*1.5*)
304                         AFS_PARAM_COMMON=param.nbsd15.h
305                         AFS_SYSNAME="alpha_nbsd15"
306                         ;;
307                 i?86-*-netbsd*1.6*)
308                         AFS_PARAM_COMMON=param.nbsd16.h
309                         AFS_SYSNAME="i386_nbsd16"
310                         ;;
311                 alpha-*-netbsd*1.6*)
312                         AFS_PARAM_COMMON=param.nbsd16.h
313                         AFS_SYSNAME="alpha_nbsd16"
314                         ;;
315                 hppa*-hp-hpux11*)
316                         AFS_SYSNAME="hp_ux110"
317                         ;;
318                 hppa*-hp-hpux10*)
319                         AFS_SYSNAME="hp_ux102"
320                         ;;
321                 powerpc-apple-darwin1.2*)
322                         AFS_SYSNAME="ppc_darwin_12"
323                         ;;
324                 powerpc-apple-darwin1.3*)
325                         AFS_SYSNAME="ppc_darwin_13"
326                         ;;
327                 powerpc-apple-darwin1.4*)
328                         AFS_SYSNAME="ppc_darwin_14"
329                         ;;
330                 powerpc-apple-darwin5.1*)
331                         AFS_SYSNAME="ppc_darwin_14"
332                         ;;
333                 powerpc-apple-darwin5.2*)
334                         AFS_SYSNAME="ppc_darwin_14"
335                         ;;
336                 powerpc-apple-darwin5.3*)
337                         AFS_SYSNAME="ppc_darwin_14"
338                         ;;
339                 powerpc-apple-darwin5.4*)
340                         AFS_SYSNAME="ppc_darwin_14"
341                         ;;
342                 powerpc-apple-darwin5.5*)
343                         AFS_SYSNAME="ppc_darwin_14"
344                         ;;
345                 powerpc-apple-darwin6.0*)
346                         AFS_SYSNAME="ppc_darwin_60"
347                         ;;
348                 powerpc-apple-darwin6.1*)
349                         AFS_SYSNAME="ppc_darwin_60"
350                         ;;
351                 powerpc-apple-darwin6.2*)
352                         AFS_SYSNAME="ppc_darwin_60"
353                         ;;
354                 sparc-sun-solaris2.5*)
355                         AFS_SYSNAME="sun4x_55"
356                         ;;
357                 sparc-sun-solaris2.6)
358                         AFS_SYSNAME="sun4x_56"
359                         ;;
360                 sparc-sun-solaris2.7)
361                         AFS_SYSNAME="sun4x_57"
362                         ;;
363                 sparc-sun-solaris2.8)
364                         AFS_SYSNAME="sun4x_58"
365                         ;;
366                 sparc-sun-solaris2.9)
367                         AFS_SYSNAME="sun4x_59"
368                         ;;
369                 sparc-sun-sunos4*)
370                         AFS_SYSNAME="sun4_413"
371                         ;;
372                 i386-pc-solaris2.7)
373                         AFS_SYSNAME="sunx86_57"
374                         ;;
375                 i386-pc-solaris2.8)
376                         AFS_SYSNAME="sunx86_58"
377                         ;;
378                 i386-pc-solaris2.9)
379                         AFS_SYSNAME="sunx86_59"
380                         ;;
381                 alpha*-dec-osf4.0*)
382                         AFS_SYSNAME="alpha_dux40"
383                         ;;
384                 alpha*-dec-osf5.0*)
385                         AFS_SYSNAME="alpha_dux50"
386                         ;;
387                 alpha*-dec-osf5.1*)
388                         AFS_SYSNAME="alpha_dux51"
389                         ;;
390                 mips-sgi-irix6.5)
391                         AFS_SYSNAME="sgi_65"
392                         ;;
393                 ia64-*-linux*)
394                         AFS_SYSNAME="ia64_linuxXX"
395                         ;;
396                 powerpc-*-linux*)
397                         AFS_SYSNAME="ppc_linuxXX"
398                         ;;
399                 alpha*-linux*)
400                         AFS_SYSNAME="alpha_linux_XX"
401                         ;;
402                 s390-*-linux*)
403                         AFS_SYSNAME="s390_linuxXX"
404                         ;;
405                 sparc-*-linux*)
406                         AFS_SYSNAME="sparc_linuxXX"
407                         ;;
408                 sparc64-*-linux*)
409                         AFS_SYSNAME="sparc64_linuxXX"
410                         ;;
411                 i?86-*-linux*)
412                         AFS_SYSNAME="i386_linuxXX"
413                         ;;
414                 parisc-*-linux-gnu)
415                         AFS_SYSNAME="parisc_linuxXX"
416                         ;;
417                 power*-ibm-aix4.2*)
418                         AFS_SYSNAME="rs_aix42"
419                         ;;
420                 power*-ibm-aix4.3*)
421                         AFS_SYSNAME="rs_aix42"
422                         ;;
423                 *)
424                         AC_MSG_ERROR(An AFS sysname is required)
425                         exit 1
426                         ;;
427         esac
428         case $AFS_SYSNAME in
429                 *_linux*)
430                         AFS_SYSKVERS=`echo $LINUX_VERSION | awk -F\. '{print $[]1 $[]2}'`
431                         if test "x${AFS_SYSKVERS}" = "x"; then
432                          AC_MSG_ERROR(Couldn't guess your Linux version. Please use the --with-afs-sysname option to configure an AFS sysname.)
433                         fi
434                         _AFS_SYSNAME=`echo $AFS_SYSNAME|sed s/XX\$/$AFS_SYSKVERS/`
435                         AFS_SYSNAME="$_AFS_SYSNAME"
436                         ;;
437         esac
438         AC_MSG_RESULT($AFS_SYSNAME)
439 fi
440
441 case $AFS_SYSNAME in
442         *_darwin*)
443                 DARWIN_PLIST=src/libafs/afs.${AFS_SYSNAME}.plist
444                 DARWIN_INFOFILE=afs.${AFS_SYSNAME}.plist
445                 dnl the test below fails on darwin, even if the CPPFLAGS below
446                 dnl are added. the headers from Kernel.Framework must be used
447                 dnl when KERNEL is defined.
448
449                 dnl really, such a thing isn't guaranteed to work on any 
450                 dnl platform until the kernel cflags from MakefileProto are
451                 dnl known to configure
452                 AC_DEFINE(HAVE_STRUCT_BUF, 1, [define if you have a struct buf])
453                 ;;
454         *)
455 AC_MSG_CHECKING(for definition of struct buf)
456 dnl save_CPPFLAGS="$CPPFLAGS"
457 dnl CPPFLAGS="$CPPFLAGS -DKERNEL -D_KERNEL -D__KERNEL -D__KERNEL__"
458 AC_CACHE_VAL(ac_cv_have_struct_buf, [
459         ac_cv_have_struct_buf=no
460         AC_TRY_COMPILE(
461                 [#include <sys/buf.h>],
462                 [struct buf x;
463                 printf("%d\n", sizeof(x));],
464                 ac_cv_have_struct_buf=yes,)
465         ]
466 )
467 dnl CPPFLAGS="$save_CPPFLAGS"
468 AC_MSG_RESULT($ac_cv_have_struct_buf)
469 if test "$ac_cv_have_struct_buf" = yes; then
470         AC_DEFINE(HAVE_STRUCT_BUF, 1, [define if you have a struct buf])
471 fi
472 ;;
473 esac
474
475
476 AC_CACHE_VAL(ac_cv_sockaddr_len,
477 [
478 AC_MSG_CHECKING([if struct sockaddr has sa_len field])
479 AC_TRY_COMPILE( [#include <sys/types.h>
480 #include <sys/socket.h>],
481 [struct sockaddr *a;
482 a->sa_len=0;], ac_cv_sockaddr_len=yes, ac_cv_sockaddr_len=no)
483 AC_MSG_RESULT($ac_cv_sockaddr_len)])
484 if test "$ac_cv_sockaddr_len" = "yes"; then
485    AC_DEFINE(STRUCT_SOCKADDR_HAS_SA_LEN, 1, [define if you struct sockaddr sa_len])
486 fi
487 if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
488         echo Skipping library tests because they confuse Irix.
489 else
490   AC_CHECK_FUNCS(socket)
491
492   if test "$ac_cv_func_socket" = no; then
493     for lib in socket inet; do
494         if test "$HAVE_SOCKET" != 1; then
495                 AC_CHECK_LIB(${lib}, socket,LIBS="$LIBS -l$lib";HAVE_SOCKET=1;AC_DEFINE(HAVE_SOCKET, 1, [define if you have socket]))
496         fi
497     done
498   fi
499   
500   AC_CHECK_FUNCS(connect)       
501
502   if test "$ac_cv_func_connect" = no; then
503     for lib in nsl; do
504         if test "$HAVE_CONNECT" != 1; then
505                 AC_CHECK_LIB(${lib}, connect,LIBS="$LIBS -l$lib";HAVE_CONNECT=1;AC_DEFINE(HAVE_CONNECT, 1, [define if you have connect]))
506         fi
507     done
508   fi
509
510   AC_CHECK_FUNCS(gethostbyname)
511   if test "$ac_cv_func_gethostbyname" = no; then
512         for lib in dns nsl resolv; do
513           if test "$HAVE_GETHOSTBYNAME" != 1; then
514             AC_CHECK_LIB(${lib}, gethostbyname, LIBS="$LIBS -l$lib";HAVE_GETHOSTBYNAME=1;AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [define if you have gethostbyname]))
515           fi
516         done    
517   fi    
518
519   AC_CHECK_FUNCS(res_search)
520   if test "$ac_cv_func_res_search" = no; then
521         for lib in dns nsl resolv; do
522           if test "$HAVE_RES_SEARCH" != 1; then
523             AC_CHECK_LIB(${lib}, res_search, LIBS="$LIBS -l$lib";HAVE_RES_SEARCH=1;AC_DEFINE(HAVE_RES_SEARCH, 1, [define if you have res_search]))
524           fi
525         done    
526         if test "$HAVE_RES_SEARCH" = 1; then
527           LIB_res_search="-l$lib"       
528         fi
529   fi    
530 fi
531
532 PTHREAD_LIBS=error
533 AC_CHECK_LIB(pthread, pthread_attr_init,
534              PTHREAD_LIBS="-lpthread")
535 if test "x$PTHREAD_LIBS" = xerror; then
536         AC_CHECK_LIB(pthreads, pthread_attr_init,
537                 PTHREAD_LIBS="-lpthreads")
538 fi
539 if test "x$PTHREAD_LIBS" = xerror; then
540         AC_CHECK_LIB(c_r, pthread_attr_init,
541                 PTHREAD_LIBS="-lc_r")
542 fi
543 if test "x$PTHREAD_LIBS" = xerror; then
544         AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
545 fi
546 if test "x$PTHREAD_LIBS" = xerror; then
547         AC_MSG_WARN(*** Unable to locate working posix thread library ***)
548 fi
549 AC_SUBST(PTHREAD_LIBS)
550
551 WITH_OBSOLETE=NO
552 if test "$enable_obsolete" = "yes"; then
553         WITH_OBSOLETE=YES
554 fi
555
556 WITH_INSECURE=NO
557 if test "$enable_insecure" = "yes"; then
558         WITH_INSECURE=YES
559 fi
560
561 # Fast restart
562 if test "$enable_fast_restart" = "yes"; then
563         AC_DEFINE(FAST_RESTART, 1, [define if you want to have fast restart])
564 fi
565
566 if test "$enable_bitmap_later" = "yes"; then
567         AC_DEFINE(BITMAP_LATER, 1, [define if you want to salvager to check bitmasks later])
568 fi
569
570 if test "$enable_full_vos_listvol_switch" = "yes"; then
571         AC_DEFINE(FULL_LISTVOL_SWITCH, 1, [define if you want to want listvol switch])
572 fi
573
574 if test "$enable_bos_restricted_mode" = "yes"; then
575         AC_DEFINE(BOS_RESTRICTED_MODE, 1, [define if you want to want bos restricted mode])
576 fi
577
578 if test "$enable_namei_fileserver" = "yes"; then
579         AC_DEFINE(AFS_NAMEI_ENV, 1, [define if you want to want namei fileserver])
580 fi
581
582 if test "$enable_afsdb" = "yes"; then
583         LIB_AFSDB="$LIB_res_search"
584         AC_DEFINE(AFS_AFSDB_ENV, 1, [define if you want to want search afsdb rr])
585 fi
586
587 dnl check for tivoli
588 AC_MSG_CHECKING(for tivoli tsm butc support)
589 XBSA_CFLAGS=""
590 if test "$enable_tivoli_tsm" = "yes"; then
591         XBSADIR1=/usr/tivoli/tsm/client/api/bin/xopen
592         XBSADIR2=/opt/tivoli/tsm/client/api/bin/xopen
593
594         if test -e "$XBSADIR1/xbsa.h"; then
595                 XBSA_CFLAGS="-Dxbsa -I$XBSADIR1"
596                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
597         elif test -e "$XBSADIR2/xbsa.h"; then
598                 XBSA_CFLAGS="-Dxbsa -I$XBSADIR2"
599                 AC_MSG_RESULT([yes, $XBSA_CFLAGS])
600         else
601                 AC_MSG_RESULT([no, missing xbsa.h header file])
602         fi
603 else
604         AC_MSG_RESULT([no])
605 fi
606 AC_SUBST(XBSA_CFLAGS)
607
608 dnl checks for header files.
609 AC_HEADER_STDC
610 AC_HEADER_SYS_WAIT
611 AC_HEADER_DIRENT
612 AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h)
613 AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
614 AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h)
615 AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h)
616 AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
617 AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h ucontext.h)
618
619 AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
620 AC_CHECK_FUNCS(setprogname getprogname sigaction)
621 AC_CHECK_TYPE(ssize_t, int)
622 AC_SIZEOF_TYPE(long)
623
624 AC_CHECK_FUNCS(timegm)
625
626 dnl Directory PATH handling
627 if test "x$enable_transarc_paths" = "xyes"  ; then 
628     afsconfdir=${afsconfdir=/usr/afs/etc}
629     viceetcdir=${viceetcdir=/usr/vice/etc}
630     afskerneldir=${afskerneldir=${viceetcdir}}
631     afssrvbindir=${afssrvbindir=/usr/afs/bin}
632     afssrvsbindir=${afssrvsbindir=/usr/afs/bin}
633     afssrvlibexecdir=${afssrvlibexecdir=/usr/afs/bin}
634     afsdbdir=${afsdbdir=/usr/afs/db}
635     afslogsdir=${afslogsdir=/usr/afs/logs}
636     afslocaldir=${afslocaldir=/usr/afs/local}
637     afsbackupdir=${afsbackupdir=/usr/afs/backup}
638     afsbosconfigdir=${afsbosconfigdir=/usr/afs/local}
639 else 
640     afsconfdir=${afsconfdir='${sysconfdir}/openafs/server'}
641     viceetcdir=${viceetcdir='${sysconfdir}/openafs'}
642     afskerneldir=${afskerneldir='${libdir}/openafs'}
643     afssrvbindir=${afssrvbindir='${bindir}'}
644     afssrvsbindir=${afssrvsbindir='${sbindir}'}
645     afssrvlibexecdir=${afssrvlibexecdir='${libexecdir}/openafs'}
646     afsdbdir=${afsdbdir='${localstatedir}/openafs/db'}
647     afslogsdir=${afslogsdir='${localstatedir}/openafs/logs'}
648     afslocaldir=${afslocaldir='${localstatedir}/openafs'}
649     afsbackupdir=${afsbackupdir='${localstatedir}/openafs/backup'}
650     afsbosconfigdir=${afsbosconfigdir='${sysconfdir}/openafs'}
651 fi
652 AC_SUBST(afsconfdir)
653 AC_SUBST(viceetcdir)
654 AC_SUBST(afskerneldir)
655 AC_SUBST(afssrvbindir)
656 AC_SUBST(afssrvsbindir)
657 AC_SUBST(afssrvlibexecdir)
658 AC_SUBST(afsdbdir)
659 AC_SUBST(afslogsdir)
660 AC_SUBST(afslocaldir)
661 AC_SUBST(afsbackupdir)
662 AC_SUBST(afsbosconfigdir)
663
664 if test "x$enable_kernel_module" = "xyes"; then
665 ENABLE_KERNEL_MODULE=libafs
666 fi
667
668 AC_SUBST(AFS_SYSNAME)
669 AC_SUBST(AFS_PARAM_COMMON)
670 AC_SUBST(ENABLE_KERNEL_MODULE)
671 AC_SUBST(LIB_AFSDB)
672 AC_SUBST(LINUX_KERNEL_PATH)
673 AC_SUBST(LINUX_VERSION)
674 AC_SUBST(MKAFS_OSTYPE)
675 AC_SUBST(TOP_OBJDIR)
676 AC_SUBST(TOP_SRCDIR)
677 AC_SUBST(TOP_INCDIR)
678 AC_SUBST(TOP_LIBDIR)
679 AC_SUBST(DEST)
680 AC_SUBST(WITH_OBSOLETE)
681 AC_SUBST(WITH_INSECURE)
682 AC_SUBST(DARWIN_INFOFILE)
683 AC_SUBST(IRIX_BUILD_IP35)
684
685 OPENAFS_OSCONF
686
687 TOP_SRCDIR="${srcdir}/src"
688 dnl
689 dnl If we're using ./configure, need a more reasonable TOP_SRCDIR, since relative links don't work everywhere
690 dnl
691 case $TOP_SRCDIR in
692         /*)
693                 ;;
694         *)
695                 TOP_SRCDIR=${SRCDIR_PARENT}/src
696 esac
697
698 TOP_OBJDIR="${SRCDIR_PARENT}"
699 TOP_INCDIR="${SRCDIR_PARENT}/include"
700 TOP_LIBDIR="${SRCDIR_PARENT}/lib"
701 if test "${DEST}x" = "x"; then
702         DEST="${SRCDIR_PARENT}/${AFS_SYSNAME}/dest"
703 fi
704
705
706 ])