initial-configure-work-take-two-20010601
[openafs.git] / src / configure.in
1 AC_INIT(src/config/stds.h)
2 AC_CANONICAL_HOST
3 AC_CONFIG_HEADER(src/afsconfig.h)
4
5 AC_ARG_ENABLE( obsolete,
6 [  --disable-obsolete disable obsolete portions of AFS (mpp, ntp and package)],, enable_obsolete="yes")
7 AC_ARG_ENABLE( insecure,
8 [  --disable-insecure disable insecure portions of AFS (ftpd, inetd, rcp, rlogind and rsh)],, enable_insecure="yes")
9 AC_ARG_ENABLE( afsdb,
10 [  --enable-afsdb enable AFSDB RR support],, enable_afsdb="no")
11 AC_ARG_ENABLE( namei-fileserver,
12 [  --enable-namei-fileserver force compilation of namei fileserver in preference to inode fileserver],, enable_namei_fileserver="no")
13
14 AC_PROG_CC
15
16 dnl weird ass systems
17 AC_AIX
18 AC_ISC_POSIX
19 AC_MINIX
20
21 dnl Various compiler setup.
22 AC_C_BIGENDIAN
23 AC_C_INLINE
24 AC_C_CONST
25 AC_TYPE_PID_T
26 AC_TYPE_SIZE_T
27 AC_TYPE_SIGNAL
28
29 dnl Checks for programs.
30 AC_PROG_INSTALL
31 AC_PROG_LN_S
32 AC_PROG_RANLIB
33
34 dnl fix to use config.sub output
35 AC_MSG_CHECKING(your OS)
36 system=$host
37 IRIX=no
38 case $system in
39         *-linux*)
40                 LINUX=1
41                 AC_MSG_RESULT(Linux)
42                 ;;
43         *-solaris*)
44                 SYSV=1
45                 SVR4=1
46                 SOLARIS=1
47                 AC_MSG_RESULT(Solaris)
48                 if test "$CC" = cc; then
49                         CFLAGS="$CFLAGS -mt"
50                 fi
51                 ;;
52         *-hpux*)
53                 hpux=1
54                 AC_MSG_RESULT(HP-UX)
55                 CFLAGS="$CFLAGS -D_HPUX_SOURCE -DHPUX"
56                 if test "$CC" = cc; then
57                         CFLAGS="$CFLAGS -Aa"
58                 fi
59                 ;;
60         *-irix*)
61                 IRIX=yes
62                 AC_MSG_RESULT(IRIX)
63                 ;;
64         *-aix*)
65                 AIX=yes
66                 AC_MSG_RESULT(AIX)
67                 ;;
68         *)
69                 AC_MSG_RESULT($system)
70                 ;;
71 esac
72
73 if test ${IRIX} = yes; then
74         echo Skipping library tests because they confuse Irix.
75 else
76   AC_CHECK_FUNCS(socket)
77
78   if test "$ac_cv_func_socket" = no; then
79     for lib in socket inet; do
80         if test "$HAVE_SOCKET" != 1; then
81                 AC_CHECK_LIB($lib, socket,LIBS="$LIBS -l$lib";HAVE_SOCKET=1;AC_DEFINE(HAVE_SOCKET))
82         fi
83     done
84   fi
85   
86   AC_CHECK_FUNCS(connect)       
87
88   if test "$ac_cv_func_connect" = no; then
89     for lib in nsl; do
90         if test "$HAVE_CONNECT" != 1; then
91                 AC_CHECK_LIB($lib, connect,LIBS="$LIBS -l$lib";HAVE_CONNECT=1;AC_DEFINE(HAVE_CONNECT))
92         fi
93     done
94   fi
95
96   AC_CHECK_FUNCS(gethostbyname)
97   if test "$ac_cv_func_gethostbyname" = no; then
98         for lib in dns nsl resolv; do
99           if test "$HAVE_GETHOSTBYNAME" != 1; then
100             AC_CHECK_LIB($lib, gethostbyname, LIBS="$LIBS -l$lib";HAVE_GETHOSTBYNAME=1;AC_DEFINE(HAVE_GETHOSTBYNAME))
101           fi
102         done    
103   fi    
104 fi
105
106 PTHREAD_LIBS=error
107 AC_CHECK_LIB(pthread, pthread_attr_init,
108              PTHREAD_LIBS="-lpthread")
109 if test "x$PTHREAD_LIBS" = xerror; then
110         AC_CHECK_LIB(pthreads, pthread_attr_init,
111                 PTHREAD_LIBS="-lpthreads")
112 fi
113 if test "x$PTHREAD_LIBS" = xerror; then
114         AC_CHECK_LIB(c_r, pthread_attr_init,
115                 PTHREAD_LIBS="-lc_r")
116 fi
117 if test "x$PTHREAD_LIBS" = xerror; then
118         AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
119 fi
120 if test "x$PTHREAD_LIBS" = xerror; then
121         AC_MSG_ERROR(*** Unable to locate working posix thread library ***)
122 fi
123 AC_SUBST(PTHREAD_LIBS)
124
125 dnl checks for header files.
126 AC_HEADER_STDC
127 AC_HEADER_SYS_WAIT
128 AC_HEADER_DIRENT
129 AC_CHECK_HEADERS(stdlib.h string.h unistd.h fcntl.h sys/time.h sys/file.h)
130 AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
131 AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h)
132 AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h)
133 AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
134
135 AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf re_comp re_exec)