1AC_INIT()
2AC_CONFIG_HEADER(config.h)
3AC_PROG_CC
4AC_AIX
5AC_PROG_INSTALL
6AC_PREFIX_DEFAULT(/usr)
7
8LIBS=""
9
10AC_CHECK_LIB(c, getusershell, result=yes, result=no)
11if test "$result" = "yes"; then
12  AC_DEFINE(HAVE_GETUSERSHELL)
13fi
14
15AC_CHECK_LIB(c, inet_ntoa, result=yes, result=no)
16if test "$result" = "no"; then
17AC_CHECK_LIB(nsl, inet_ntoa, result=yes, result=no)
18if test "$result" = "yes"; then
19  LIBS="$LIBS -lnsl"
20fi
21fi
22AC_CHECK_LIB(socket, socket, result=yes, result=no)
23if test "$result" = "yes"; then
24  LIBS="$LIBS -lsocket"
25else
26  AC_CHECK_LIB(socket, connect, result=yes, result=no)
27  if test "$result" = "yes"; then
28    LIBS="$LIBS -lsocket"
29  fi
30fi
31
32AC_CHECK_LIB(crypt, crypt, result=yes, result=no)
33if test "$result" = "yes"; then
34  LIBS="$LIBS -lcrypt"
35fi
36
37
38AC_HEADER_DIRENT
39AC_CHECK_HEADERS(paths.h)
40AC_CHECK_HEADERS(netinet/in.h)
41AC_CHECK_HEADERS(sys/time.h)
42AC_CHECK_HEADERS(time.h)
43AC_CHECK_HEADERS(sys/types.h)
44AC_CHECK_HEADERS(sys/stat.h)
45AC_CHECK_HEADERS(sys/socket.h)
46AC_CHECK_HEADERS(asm/socket.h)
47AC_CHECK_HEADERS(wait.h)
48AC_CHECK_HEADERS(sys/wait.h)
49AC_CHECK_HEADERS(shadow.h)
50AC_CHECK_HEADERS(arpa/inet.h)
51AC_CHECK_HEADERS(syslog.h)
52AC_CHECK_HEADERS(crypt.h)
53AC_CHECK_HEADERS(utmp.h)
54
55
56
57define(ARG_ENABLE_BFTPD, [
58AC_MSG_CHECKING(whether to enable $1)
59AC_ARG_ENABLE($1, [$2], result=yes, result=no)
60if test "$result" = "yes"; then
61  $3
62fi
63AC_MSG_RESULT($result)
64])
65
66ARG_ENABLE_BFTPD(pam, [  --enable-pam            Enable PAM (pluggable authentication modules) support], AC_DEFINE(WANT_PAM))
67if test "$result" = "yes"; then
68  LIBS="$LIBS -lpam"
69  AC_CHECK_HEADERS(security/pam_appl.h, result=yes, result=no)
70  if test "$result" = "no"; then
71    echo "Error: PAM header files not found. Install PAM or don't compile"
72    echo "       bftpd with PAM support."
73    exit 1
74  fi
75fi
76
77ARG_ENABLE_BFTPD(libz, [  --enable-libz           Link against libz so that gzip on the fly is supported],true)
78if test "$result" = "yes"; then
79    AC_CHECK_HEADERS(zlib.h, result=yes, result=no)
80    if test "$result" = "yes"; then
81        AC_DEFINE(WANT_GZIP)
82        LIBS="$LIBS -lz"
83    else
84        echo "Error: zlib header file not found. Install it or don't compile"
85        echo "       bftpd with zlib support."
86        exit 1
87    fi
88fi
89
90AC_ARG_ENABLE(pax, [  --enable-pax            Specify path to PAX sources], result=$enableval, result="")
91if test ! "$result" = ""; then
92    if test -d $result; then
93        DIRPAX=$result
94        AC_SUBST(DIRPAX)
95        PAX='$(DIRPAX)/append.o $(DIRPAX)/buffer.o $(DIRPAX)/cpio.o $(DIRPAX)/create.o $(DIRPAX)/extract.o $(DIRPAX)/fileio.o $(DIRPAX)/link.o $(DIRPAX)/list.o $(DIRPAX)/mem.o $(DIRPAX)/namelist.o $(DIRPAX)/names.o $(DIRPAX)/pass.o $(DIRPAX)/pathname.o $(DIRPAX)/pax.o $(DIRPAX)/port.o $(DIRPAX)/regexp.o $(DIRPAX)/replace.o $(DIRPAX)/tar.o $(DIRPAX)/ttyio.o $(DIRPAX)/warn.o $(DIRPAX)/wildmat.o'
96        AC_SUBST(PAX)
97    	AC_DEFINE(WANT_TAR)
98    else
99        echo "Error: The PAX path you specified was not found."
100        exit 1
101    fi
102fi
103
104ARG_ENABLE_BFTPD(debug, [  --enable-debug          Enable debugging],true)
105if test "$result" = "yes"; then
106	DEBUG="-DDEBUG=1"
107	AC_SUBST(DEBUG)
108fi
109
110AC_OUTPUT(Makefile)
111