1
2# configure.in for gopher
3# Process this file with autoconf to produce a configure script.
4
5dnl
6dnl MACROS
7dnl
8define(UP_ASK_FOR,
9[echo "$2 ($3)?";
10read $1;
11if test "$$1" = "" ; then
12        $1="$3";
13fi])dnl
14
15
16AC_INIT(gopher/gopher.c)
17echo "----------------------------------------------------------------------"
18echo "You are about to build the Gopher system for Unix"
19echo "Please read the file doc/INSTALL for full information on"
20echo "building Gopher"
21echo " "
22echo "Gopher is copyrighted software, see the file Copyright in"
23echo "the distribution for more information and limitations."
24echo "----------------------------------------------------------------------"
25echo " "
26dnl AC_CANONICAL_HOST
27
28
29AC_CONFIG_HEADER(config.h)
30dnl Checks for programs.
31AC_PROG_CC
32AC_PROG_INSTALL
33AC_PROG_LN_S
34AC_PROG_RANLIB
35AC_PROG_MAKE_SET
36
37dnl Checks for libraries.
38AC_CHECK_LIB(m, main)
39
40######################################################################
41AC_SUBST(DEBUGGING)
42AC_ARG_ENABLE(debug, [  --disable-debug         controls whether debug text is compilied in], DEBUGGING=$enableval, DEBUGGING="")
43
44if test "$DEBUGGING" = yes; then
45	DEBUGGING="-DDEBUGGING"
46fi
47
48######################################################################
49AC_SUBST(SOCKSLIBS)
50AC_SUBST(SOCKSFLAGS)
51HAVE_SOCKS=0
52AC_ARG_ENABLE(socks, [  --enable-socks          use socks library, requires -lsocks], HAVE_SOCKS=1, HAVE_SOCKS=0)
53
54if test "$HAVE_SOCKS" = 1; then
55  AC_CHECK_LIB(socks, main,
56  SOCKSLIBS="-lsocks";
57  SOCKSFLAGS="-Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect")
58fi
59
60######################################################################
61AC_SUBST(GINTERNATIONAL)
62GINTERNATIONAL=""
63AC_ARG_ENABLE(locale, [  --enable-locale         use international localized msgs for the client], GINTERNATIONAL="-DGINTERNATIONAL", GINTERNATIONAL="")
64
65######################################################################
66AC_SUBST(GOPHER_DATA)
67GOPHER_DATA="/gopher-data"
68AC_ARG_ENABLE(datadir, [  --enable-datadir=dir    enable custom datadir (/gopher-data)], GOPHER_DATA="$enableval", GOPHER_DATA="/gopher-data")
69
70######################################################################
71AC_SUBST(GOPHER_PORT)
72GOPHER_PORT=70
73AC_ARG_ENABLE(port, [  --enable-port=portnum   enable custom port (70)], GOPHER_PORT="$enableval", GOPHER_PORT=70)
74
75######################################################################
76AC_SUBST(DLPATH)
77AC_SUBST(DLOBJS)
78AC_ARG_ENABLE(dl,        [  --enable-dl=dlpathname  use Tim Cook's dl databases], DLPATH="$enableval";DLOBJS="$enableval/getdesc.o $enableval/enddesc.o";SERVEROPTS="$SERVEROPTS -DDL",:)
79
80######################################################################
81AC_SUBST(OPT)
82AC_ARG_ENABLE(opt,       [  --enable-opt=args       Special optimization flags to pass to the compiler], OPT="$enableval",OPT="$CFLAGS")
83
84######################################################################
85
86dnl
87dnl LIBRARIES
88dnl
89
90# If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
91# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
92# libsocket.so which has a bad implementation of gethostbyname (it
93# only looks in /etc/hosts), so we only look for -lsocket if we need
94# it.
95unset ac_cv_func_connect
96AC_CHECK_FUNC(connect, :,
97[case $LIBS in
98*-lnsl*) ;;
99*) AC_CHECK_LIB(nsl_s, main) ;;
100esac
101case $LIBS in
102*-lnsl*) ;;
103*) AC_CHECK_LIB(nsl, main) ;;
104esac
105case $LIBS in
106*-lsocket*) ;;
107*) AC_CHECK_LIB(socket, connect) ;;
108esac
109case $LIBS in
110*-linet*) ;;
111*) AC_CHECK_LIB(inet, connect) ;;
112esac
113
114unset ac_cv_func_connect
115AC_CHECK_FUNCS(connect)])
116
117AC_CHECK_FUNC(gethostname, :, LIBOBJS="$LIBOBJS hostname.o")
118
119######################################################################
120dnl Check for WAIS
121with_wais=1
122AC_ARG_WITH(wais,[  --without-wais          Don't try using WAIS (default: try)], with_wais=1, with_wais=0)
123
124AC_SUBST(REGEXLIBS)
125AC_SUBST(WAISTYPE)
126AC_SUBST(SEARCH)
127
128LDFLAGS=$OLDLDFLAGS
129
130AC_CHECK_LIB(compat, re_comp, REGEXLIBS="$REGEXLIBS -lcompat")
131
132######################################################################
133AC_CHECK_LIB(malloc, main)
134
135AC_SUBST(CLIENTLIBS)
136AC_CHECK_LIB(curses, main, CLIENTLIBS="$CLIENTLIBS -lcurses")
137AC_CHECK_LIB(termcap, main, CLIENTLIBS="$CLIENTLIBS -ltermcap")
138
139dnl Checks for header files.
140AC_HEADER_DIRENT
141AC_HEADER_STDC
142AC_HEADER_SYS_WAIT
143AC_CHECK_HEADERS(strings.h string.h sys/param.h term.h re_comp.h regex.h crypt.h fcntl.h time.h ctype.h limits.h locale.h sys/types.h sys/stat.h sys/file.h sys/ioctl.h sys/time.h syslog.h unistd.h malloc.h stdlib.h libgen.h regexp.h)
144
145dnl Checks for typedefs, structures, and compiler characteristics.
146AC_C_CONST
147AC_TYPE_UID_T
148AC_TYPE_PID_T
149AC_TYPE_SIZE_T
150AC_HEADER_TIME
151AC_STRUCT_TM
152
153dnl Checks for library functions.
154AC_PROG_GCC_TRADITIONAL
155AC_FUNC_MMAP
156dnl AC_FUNC_SETVBUF_REVERSED
157AC_TYPE_SIGNAL
158AC_FUNC_STRCOLL
159AC_FUNC_VFORK
160AC_FUNC_VPRINTF
161AC_FUNC_GETLOADAVG
162
163dnl Do this again so the AC_CHECK_FUNCS works.
164
165AC_CHECK_LIB(curses, main)
166AC_CHECK_LIB(termcap, main)
167AC_CHECK_FUNCS(bzero gethostname fgetpwent get_current_dir_name getcwd getwd madvise mkdir mktime putenv re_comp select seteuid setsid socket strcasecmp strcspn strdup strerror strftime strspn strstr strtol sysconf tempnam tzset wait3 waitpid strcasestr regcomp regfree wattron wattroff wstandout wstandend)
168
169AC_TRY_LINK([#include <unistd.h>], [getdtablesize();])
170AC_OUTPUT(Makefile Makefile.config object/Makefile gopher/Makefile gopher/locales/Makefile doc/Makefile gophfilt/Makefile)
171
172