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