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