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