summaryrefslogtreecommitdiffstats
path: root/contrib/lukemftpd/configure.in
blob: 87331d04793a82c1f7c18ed8839d85ef351a71e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
dnl $Id: configure.in,v 1.16 2001/04/28 07:11:06 lukem Exp $
dnl
dnl configure.in --
dnl	process this file with autoconf to produce a configure script.
dnl

AC_REVISION($Revision: 1.16 $)dnl

AC_INIT(lukemftpd.h)


dnl Arguments for which features are included
dnl
AC_ARG_ENABLE(ipv6, [\
  --enable-ipv6           Enable IPv6 support (if your OS supports it).
  --disable-ipv6          Disable IPv6 support (even if your OS supports it) 
                          [default: enabled].], 
    opt_ipv6=$enableval,
    opt_ipv6=yes)
AC_ARG_ENABLE(builtinls, [\
  --enable-builtinls      Enable built-in /bin/ls.  [default: enabled]
  --disable-builtinls     Disable built-in /bin/ls.],
    opt_builtinls=$enableval,
    opt_builtinls=yes)


dnl Checks for programs.
dnl
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_YACC
AC_CHECK_PROGS(AR, ar)


dnl Checks for libraries.
dnl
AC_CHECK_LIB(crypt, crypt)
AC_CHECK_LIB(util, fparseln)
if test $ac_cv_lib_util_fparseln != yes; then
	AC_CHECK_LIB(util, setproctitle)
fi
AC_LIBRARY_NET
AC_LIBRARY_SOCKS
if test -n "$socks"; then
	if test $opt_ipv6 = yes; then
		echo "IPv6 is incompatible with socks, disabling IPv6 support"
		opt_ipv6=no
	fi
fi
AC_ARG_WITH(skey,
[  --with-skey             Compile with S/Key authentication support.],
[	if test $withval = yes; then
		AC_CHECK_LIB(skey, skey_haskey)
	fi ] )
AC_MSG_CHECKING(whether to support S/Key)
if test x"$ac_cv_lib_skey_skey_haskey" = "xyes"; then
	AC_MSG_RESULT(yes)
	AC_DEFINE(SKEY, 1)
else
	AC_MSG_RESULT(no)
fi


dnl Checks for header files.
dnl
AC_CONFIG_HEADER(config.h)
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(arpa/nameser.h err.h fts.h libutil.h paths.h \
		sys/sysmacros.h util.h)


dnl Checks for typedefs, structures, and compiler characteristics.
dnl
AC_HEADER_TIME
AC_TYPE_OFF_T
AC_CHECK_SIZEOF(off_t, 0)
AC_MSG_TRY_LINK(for long long, ftp_cv_HAVE_LONG_LONG, [
#include <sys/types.h>] , [
long long X = 2, Y = 1, Z;
Z = X / Y; ], [
AC_DEFINE(HAVE_LONG_LONG, 1)
have_long_long=yes], [have_long_long=no])

AC_MSG_TRY_COMPILE(for in_port_t, ftp_cv_HAVE_IN_PORT_T, [
#include <sys/types.h>
#include <netinet/in.h> ], [ in_port_t X ], [AC_DEFINE(HAVE_IN_PORT_T, 1)])

AC_MSG_TRY_COMPILE(for sockaddr_in.sin_len, ftp_cv_HAVE_SOCKADDR_SA_LEN, [
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h> ], [
	struct sockaddr_in sin;
	int X = sin.sin_len ], [AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1)])

AC_MSG_TRY_COMPILE(for socklen_t, ftp_cv_HAVE_SOCKLEN_T, [
#include <sys/types.h>
#include <sys/socket.h> ], [ socklen_t X ], [AC_DEFINE(HAVE_SOCKLEN_T, 1)])

if test $opt_ipv6 = yes; then

	AC_MSG_TRY_COMPILE(for AF_INET6, ftp_cv_HAVE_AF_INET6, [
#include <sys/types.h>
#include <sys/socket.h> ],
	    [ int X = AF_INET6 ], [AC_DEFINE(HAVE_AF_INET6, 1)])

	AC_MSG_TRY_COMPILE(for struct sockaddr_in6, ftp_cv_HAVE_SOCKADDR_IN6, [
#include <sys/types.h>
#include <netinet/in.h> ],
	    [ struct sockaddr_in6 X ], [AC_DEFINE(HAVE_SOCKADDR_IN6, 1)])

fi

AC_MSG_TRY_COMPILE(for struct addrinfo, ftp_cv_HAVE_ADDRINFO, [
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h> ],
	    [ struct addrinfo X ], [AC_DEFINE(HAVE_ADDRINFO, 1)])

AC_MSG_TRY_COMPILE(for d_namlen in struct dirent, ftp_cv_HAVE_D_NAMLEN, [
#if HAVE_DIRENT_H
# include <dirent.h>
#else
# define dirent direct
# if HAVE_SYS_NDIR_H
#  include <sys/ndir.h>
# endif
# if HAVE_SYS_DIR_H
#  include <sys/dir.h>
# endif
# if HAVE_NDIR_H
#  include <ndir.h>
# endif
#endif ], [
	struct dirent dp;
	int X = dp.d_namlen; ], [AC_DEFINE(HAVE_D_NAMLEN, 1)])

AC_MSG_TRY_COMPILE(for struct passwd.pw_expire, ftp_cv_HAVE_PW_EXPIRE, [
#include <sys/types.h>
#include <pwd.h> ],
	    [ struct passwd pw;
	      time_t X = pw.pw_expire ], [AC_DEFINE(HAVE_PW_EXPIRE, 1)])

AC_C_CONST


dnl Checks for library functions.
dnl
AC_REPLACE_FUNCS(err fgetln getaddrinfo getgrouplist getnameinfo \
		getusershell inet_net_pton inet_ntop inet_pton mkstemp \
		sl_init snprintf strdup strerror strlcat strlcpy strsep \
		usleep vsyslog)
AC_CHECK_FUNCS(flock lockf getspnam setlogin setproctitle vfork)
if test $ac_cv_lib_util_fparseln != yes; then
	AC_REPLACE_FUNCS(fparseln)
fi

LIBOBJS="$LIBOBJS glob.o"

AC_MSG_TRY_COMPILE(for crypt() declaration, ftp_cv_HAVE_CRYPT_D, [
#include <unistd.h> ], [ char *(*X)() = crypt ], [AC_DEFINE(HAVE_CRYPT_D, 1)])

AC_MSG_TRY_COMPILE(for fclose() declaration, ftp_cv_HAVE_FCLOSE_D, [
#include <stdio.h> ], [ int (*X)() = fclose ], [AC_DEFINE(HAVE_FCLOSE_D, 1)])

AC_MSG_TRY_COMPILE(for optarg declaration, ftp_cv_HAVE_OPTARG_D, [
#include <stdlib.h>
#include <unistd.h> ], [ char *X = optarg ], [AC_DEFINE(HAVE_OPTARG_D, 1)])

AC_MSG_TRY_COMPILE(for optind declaration, ftp_cv_HAVE_OPTIND_D, [
#include <stdlib.h>
#include <unistd.h> ], [ int X = optind ], [AC_DEFINE(HAVE_OPTIND_D, 1)])

AC_MSG_TRY_LINK(for optreset, ftp_cv_HAVE_OPTRESET, [
#include <stdlib.h>
#include <unistd.h> ], [ int X = optreset ], [AC_DEFINE(HAVE_OPTRESET, 1)])

AC_MSG_TRY_COMPILE(for pclose() declaration, ftp_cv_HAVE_PCLOSE_D, [
#include <stdio.h> ], [ int (*X)() = pclose ], [AC_DEFINE(HAVE_PCLOSE_D, 1)])

if test $ac_cv_func_getusershell = yes; then
	AC_MSG_TRY_COMPILE(for getusershell() declaration,
	ftp_cv_HAVE_GETUSERSHELL_D, [
	#include <unistd.h> ], [ char *(*X)() = getusershell ],
	[AC_DEFINE(HAVE_GETUSERSHELL_D, 1)])
fi


if test $have_long_long = yes -a $ac_cv_sizeof_off_t -ge 8; then

dnl		We assume that if sprintf() supports %lld or %qd,
dnl		then all of *printf() does. If not, disable long long
dnl		support because we don't know how to display it.

	AC_MSG_CHECKING(*printf() support for %lld)
	can_printf_longlong=no
	AC_TRY_RUN([
		#include <stdio.h>
		int main() {
			char buf[100];
			sprintf(buf, "%lld", 4294967300LL);
			return (strcmp(buf, "4294967300"));
		}
	], [
		AC_MSG_RESULT(yes)
		can_printf_longlong=yes
	], [
		AC_MSG_RESULT(no)
	], [ : ])

	if test $can_printf_longlong != yes; then
		AC_MSG_CHECKING(*printf() support for %qd)
		AC_TRY_RUN([
			#include <stdio.h>
			int main() {
				char buf[100];
				sprintf(buf, "%qd", 4294967300LL);
				return (strcmp(buf, "4294967300"));
			}
		], [
			AC_MSG_RESULT(yes)
			can_printf_longlong=yes
			AC_DEFINE(HAVE_PRINTF_QD, 1)
		], [
			AC_MSG_RESULT(no)
		], [ : ])
	fi

	if test $can_printf_longlong = yes; then
		AC_DEFINE(HAVE_QUAD_SUPPORT, 1)
		AC_REPLACE_FUNCS(strtoll)
	fi

fi


have_rfc2553_netdb=no
if test $ac_cv_func_getaddrinfo = yes -a ! -n "$socks"; then
	AC_MSG_TRY_COMPILE(for AI_NUMERICHOST,
	    ftp_cv_have_ai_numerichost, [
	#include <sys/types.h>
	#include <sys/socket.h>
	#include <netdb.h> ],
	    [ int X = AI_NUMERICHOST ], [ have_rfc2553_netdb=yes ])
fi
AC_MSG_CHECKING(for working getaddrinfo())
if test $have_rfc2553_netdb = yes; then
	AC_DEFINE(HAVE_RFC2553_NETDB, 1)
	AC_MSG_RESULT(yes)
else
	if test $ac_cv_func_getaddrinfo = yes; then
		LIBOBJS="$LIBOBJS getaddrinfo.o"
		AC_MSG_RESULT(no - using local version)
	else
		AC_MSG_RESULT(using local version)
	fi
fi

if test $ac_cv_func_sl_init = yes; then
	AC_MSG_TRY_COMPILE(if sl_add() returns int, ftp_cv_INT_SL_ADD, [
	#include <stringlist.h> ], [ int f = sl_add((StringList *)0, "foo") ],
	[:] , [LIBOBJS="$LIBOBJS sl_init.o"])
fi


dnl Tests for stuff for inbuilt ls
dnl

if test $opt_builtinls = yes; then
	AC_REPLACE_FUNCS(fts_open strmode user_from_uid)
	LSOBJS="cmp.o ls.o print.o util.o"
else
	AC_DEFINE(NO_INTERNAL_LS,1)
fi


dnl Build libukem if necessary
dnl

if test -n "$LIBOBJS"; then
	INCLUDES="$INCLUDES -I\${srcdir}/../libukem"
	LDFLAGS="$LDFLAGS -L../libukem"
	LIBS="$LIBS -lukem"
	LIBUKEM=libukem.a
	LIBDEPENDS="$LIBDEPENDS ../libukem/libukem.a"
fi


dnl Create the Makefiles
dnl

AC_SUBST(INCLUDES)
AC_SUBST(LIBUKEM)
AC_SUBST(LIBDEPENDS)
AC_SUBST(LSOBJS)

AC_OUTPUT(Makefile libukem/Makefile src/Makefile)
OpenPOWER on IntegriCloud