configure-no-error-on-failure-to-find-pthreads-20010705
[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                 AC_MSG_RESULT(linux)
83                 if test "x$enable_kernel_module" = "xyes"; then
84                  LINUX_FS_STRUCT_INODE_HAS_I_BYTES
85                  LINUX_INODE_SETATTR_RETURN_TYPE
86                 fi
87                 ;;
88         *-solaris*)
89                 MKAFS_OSTYPE=SOLARIS
90                 AC_MSG_RESULT(sun4)
91                 ;;
92         *-hpux*)
93                 MKAFS_OSTYPE=HPUX
94                 AC_MSG_RESULT(hp_ux)
95                 ;;
96         *-irix*)
97                 MKAFS_OSTYPE=IRIX
98                 AC_MSG_RESULT(sgi)
99                 ;;
100         *-aix*)
101                 MKAFS_OSTYPE=AIX
102                 AC_MSG_RESULT(rs_aix)
103                 ;;
104         *-osf*)
105                 MKAFS_OSTYPE=DUX
106                 AC_MSG_RESULT(alpha_dux)
107                 ;;
108         *-darwin*)
109                 MKAFS_OSTYPE=DARWIN
110                 AC_MSG_RESULT(ppc_darwin)
111                 ;;
112         *-freebsd*)
113                 MKAFS_OSTYPE=FBSD
114                 AC_MSG_RESULT(i386_fbsd)
115                 ;;
116         *)
117                 AC_MSG_RESULT($system)
118                 ;;
119 esac
120
121 if test "x${MKAFS_OSTYPE}" = "xIRIX"; then
122         echo Skipping library tests because they confuse Irix.
123 else
124   AC_CHECK_FUNCS(socket)
125
126   if test "$ac_cv_func_socket" = no; then
127     for lib in socket inet; do
128         if test "$HAVE_SOCKET" != 1; then
129                 AC_CHECK_LIB(${lib}, socket,LIBS="$LIBS -l$lib";HAVE_SOCKET=1;AC_DEFINE(HAVE_SOCKET))
130         fi
131     done
132   fi
133   
134   AC_CHECK_FUNCS(connect)       
135
136   if test "$ac_cv_func_connect" = no; then
137     for lib in nsl; do
138         if test "$HAVE_CONNECT" != 1; then
139                 AC_CHECK_LIB(${lib}, connect,LIBS="$LIBS -l$lib";HAVE_CONNECT=1;AC_DEFINE(HAVE_CONNECT))
140         fi
141     done
142   fi
143
144   AC_CHECK_FUNCS(gethostbyname)
145   if test "$ac_cv_func_gethostbyname" = no; then
146         for lib in dns nsl resolv; do
147           if test "$HAVE_GETHOSTBYNAME" != 1; then
148             AC_CHECK_LIB(${lib}, gethostbyname, LIBS="$LIBS -l$lib";HAVE_GETHOSTBYNAME=1;AC_DEFINE(HAVE_GETHOSTBYNAME))
149           fi
150         done    
151   fi    
152
153   AC_CHECK_FUNCS(res_search)
154   if test "$ac_cv_func_res_search" = no; then
155         for lib in dns nsl resolv; do
156           if test "$HAVE_RES_SEARCH" != 1; then
157             AC_CHECK_LIB(${lib}, res_search, LIBS="$LIBS -l$lib";HAVE_RES_SEARCH=1;AC_DEFINE(HAVE_RES_SEARCH))
158           fi
159         done    
160         if test "$HAVE_RES_SEARCH" = 1; then
161           LIB_res_search="-l$lib"       
162         fi
163   fi    
164 fi
165
166 PTHREAD_LIBS=error
167 AC_CHECK_LIB(pthread, pthread_attr_init,
168              PTHREAD_LIBS="-lpthread")
169 if test "x$PTHREAD_LIBS" = xerror; then
170         AC_CHECK_LIB(pthreads, pthread_attr_init,
171                 PTHREAD_LIBS="-lpthreads")
172 fi
173 if test "x$PTHREAD_LIBS" = xerror; then
174         AC_CHECK_LIB(c_r, pthread_attr_init,
175                 PTHREAD_LIBS="-lc_r")
176 fi
177 if test "x$PTHREAD_LIBS" = xerror; then
178         AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
179 fi
180 if test "x$PTHREAD_LIBS" = xerror; then
181         AC_MSG_WARN(*** Unable to locate working posix thread library ***)
182 fi
183 AC_SUBST(PTHREAD_LIBS)
184
185 WITH_OBSOLETE=NO
186 if test "$enable_obsolete" = "yes"; then
187         WITH_OBSOLETE=YES
188 fi
189
190 WITH_INSECURE=NO
191 if test "$enable_insecure" = "yes"; then
192         WITH_INSECURE=YES
193 fi
194
195 # Fast restart
196 if test "$enable_fast_restart" = "yes"; then
197         AC_DEFINE(FAST_RESTART)
198 fi
199
200 if test "$enable_bitmap_later" = "yes"; then
201         AC_DEFINE(BITMAP_LATER)
202 fi
203
204 # Should autocompute a default
205 if test "x$with_afs_sysname" != "x"; then
206         AFS_SYSNAME="$with_afs_sysname"
207 else
208         AC_MSG_ERROR(An AFS sysname is required)
209         exit 1
210 fi
211
212 if test "$enable_bos_restricted_mode" = "yes"; then
213         AC_DEFINE(BOS_RESTRICTED_MODE)
214 fi
215
216 if test "$enable_namei_fileserver" = "yes"; then
217         AC_DEFINE(AFS_NAMEI_ENV)
218 fi
219
220 if test "$enable_afsdb" = "yes"; then
221         LIB_AFSDB="$LIB_res_search"
222         AC_DEFINE(AFS_AFSDB_ENV)
223 fi
224
225 SRCDIR_PARENT=`pwd`
226 TOP_SRCDIR="${SRCDIR_PARENT}/src"
227
228 dnl checks for header files.
229 AC_HEADER_STDC
230 AC_HEADER_SYS_WAIT
231 AC_HEADER_DIRENT
232 AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h)
233 AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
234 AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h)
235 AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h)
236 AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
237 AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h)
238
239 AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)
240
241 if test "x$enable_kernel_module" = "xyes"; then
242 ENABLE_KERNEL_MODULE=libafs
243 fi
244
245 AC_SUBST(AFS_SYSNAME)
246 AC_SUBST(ENABLE_KERNEL_MODULE)
247 AC_SUBST(LIB_AFSDB)
248 AC_SUBST(LINUX_KERNEL_PATH)
249 AC_SUBST(LINUX_VERSION)
250 AC_SUBST(MKAFS_OSTYPE)
251 AC_SUBST(TOP_SRCDIR)
252 AC_SUBST(WITH_OBSOLETE)
253 AC_SUBST(WITH_INSECURE)
254
255 AC_OUTPUT(             \
256 Makefile               \
257 src/config/Makefile.${AFS_SYSNAME} \
258 src/libafs/MakefileProto.${MKAFS_OSTYPE} \
259 )