~ubuntu-branches/debian/sid/mirrordir/sid

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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/mirrordir.c)

dnl Identify target.
# AC_CANONICAL_SYSTEM
# AC_DEFINE_UNQUOTED(TARGET_MACHINE, "${target_cpu}-${target_vendor}-${target_os}")

version=`cat ./VERSION`

AM_INIT_AUTOMAKE(mirrordir, "$version")
AM_CONFIG_HEADER(config.h)

dnl Define package and version.
dnl PACKAGE=mirrordir
dnl AC_SUBST(PACKAGE)
dnl AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE}")
dnl VERSION=0.9
dnl AC_SUBST(VERSION)
dnl AC_DEFINE_UNQUOTED(VERSION, "${VERSION}")
echo
echo "Now configuring $PACKAGE-$VERSION"
echo

AC_DEFINE_UNQUOTED(USE_VFS, 1)
AC_DEFINE_UNQUOTED(USE_NETCODE, 1)
AC_DEFINE_UNQUOTED(HSC_PROXY, 1)

dnl test for international version
AC_MSG_CHECKING(for arcencrypt.inc (International version))
if test -s diffie/arcencrypt.inc ; then
    AC_DEFINE(HAVE_BUILTIN_ARC)
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
fi

dnl libtool
AM_PROG_LIBTOOL

dnl Checks for programs.
AC_PROG_MAKE_SET
AC_PROG_CC
AC_ISC_POSIX
SET_CC_FLAGS
SET_CC_WARNINGS
AC_PROG_INSTALL
AC_PROG_LN_S

AC_CHECK_PROG(system,uname,`uname`,unknown)

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h malloc.h strings.h sys/time.h unistd.h)
AC_CHECK_HEADERS(string.h memory.h crypt.h grp.h limits.h malloc.h)
AC_CHECK_HEADERS(stdlib.h termios.h sys/select.h select.h)
AC_CHECK_HEADERS(sys/ioctl.h ioctl.h termios.h sys/termios.h)
AC_CHECK_HEADERS(sys/timeb.h types.h sys/types.h paths.h)

AC_CHECK_HEADERS(sys/param.h arpa/telnet.h arpa/ftp.h arpa/inet.h)
AC_CHECK_HEADERS(pwd.h sys/param.h utime.h sys/wait.h sys/filio.h)



dnl sun has char d_name[2] or something (we no longer use this - 
dnl no use
dnl    char extra_buffer [MC_MAXPATHLEN - sizeof (struct dirent)];
dnl AC_MIRRORDIR_SHORT_D_NAME_LEN

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_HEADER_TIME
AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
AC_STRUCT_ST_RDEV
AC_STRUCT_TM
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_TYPE_UID_T
AC_CHECK_TYPE(dev_t, long)
AC_CHECK_TYPE(ino_t, unsigned long)
AC_CHECK_TYPE(nlink_t, unsigned int)

dnl check caddr_t - missing under linux with strict warnings
AC_MSG_CHECKING(for caddr_t)
AC_TRY_COMPILE([#include "vfs/net-includes.h"], [caddr_t x; x = (caddr_t) 0; ], [
caddr_t_works=yes], [
caddr_t_works=no
])
if test x$caddr_t_works = xno; then
AC_MSG_RESULT(no)
AC_DEFINE(caddr_t, char *)
else
AC_MSG_RESULT(yes)
fi

dnl check umode_t
AC_MSG_CHECKING(for umode_t)
AC_TRY_COMPILE([#include "vfs/net-includes.h"], [umode_t x; x = (umode_t) 0; ], [
umode_t_works=yes], [
umode_t_works=no
])
if test x$umode_t_works = xno; then
AC_MSG_RESULT(no)
AC_DEFINE(umode_t, mode_t)
else
AC_MSG_RESULT(yes)
fi

dnl Network related functions
AC_CHECK_LIB(nsl, t_accept)

have_socket=no
have_forkpty=no
have_logout=no
AC_CHECK_FUNCS(socket, have_socket=yes)
AC_CHECK_FUNCS(forkpty, have_forkpty=yes)
AC_CHECK_FUNCS(logout, have_logout=yes)
for lib in bsd socket inet util; do
    got_lib=no
    if test $have_forkpty = no ; then
	AC_CHECK_LIB($lib, forkpty, [
	    if test x$got_lib = xno ; then
		LIBS="$LIBS -l$lib"
	    fi
	    have_forkpty=yes
	    got_lib=yes
	    AC_DEFINE(HAVE_FORKPTY)
	    ])
    fi
    if test $have_socket = no ; then
	AC_CHECK_LIB($lib, socket, [
	    if test x$got_lib = xno ; then
		LIBS="$LIBS -l$lib"
	    fi
	    have_socket=yes
	    got_lib=yes
	    AC_DEFINE(HAVE_SOCKET)
	    ])
    fi
    if test $have_logout = no ; then
	AC_CHECK_LIB($lib, logout, [
	    if test x$got_lib = xno ; then
		LIBS="$LIBS -l$lib"
	    fi
	    have_logout=yes
	    got_lib=yes
	    AC_DEFINE(HAVE_LOGOUT)
	    ])
    fi
done

have_gethostbyname=no
AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)
if test $have_gethostbyname = no; then
  # gethostbyname is not in the default libraries.  See if it's in some other.
  for lib in bsd socket inet; do
    AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
  done
fi
AC_CHECK_FUNCS(socketpair)


dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_MMAP
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(getcwd gethostname gettimeofday getwd mkdir mktime)
AC_CHECK_FUNCS(re_comp regcomp rmdir select socket strcspn strdup strerror)
AC_CHECK_FUNCS(strerror statfs getwd strcasecmp strncasecmp)
AC_CHECK_FUNCS(strdup memmove pwdauth truncate initgroups putenv)
AC_CHECK_FUNCS(memset memcpy tcsetattr tcgetattr cfgetospeed)
AC_CHECK_FUNCS(sigaction sigemptyset sigprocmask sigaddset)
AC_CHECK_FUNCS(sysconf waitpid getpwuid getgrgid setreuid inet_ntoa)
AC_CHECK_FUNCS(setsid setpgrp tcsetpgrp)

dnl for tcpwrappers libwrap to check /etc/hosts.allow file in secure-mcserv
WRAPLIB=
NSLLIB=
AC_CHECK_LIB(wrap,request_init,[
    AC_DEFINE(HAVE_WRAP)
    WRAPLIB="-lwrap"
    AC_CHECK_LIB(nsl,yp_get_default_domain,[
	NSLLIB="-lnsl"
    ])
])
AC_SUBST(WRAPLIB)
AC_SUBST(NSLLIB)

AC_CHECK_LIB(shadow, pw_encrypt, [AC_DEFINE(HAVE_PW_ENCRYPT)
SHADOWLIB="-lshadow"], [
    AC_CHECK_LIB(shadow,getspnam,[SHADOWLIB="-lshadow"], [
	SHADOWLIB=])])
AC_SUBST(SHADOWLIB)

shadow_header=no
AC_CHECK_HEADERS(shadow.h, [shadow_header=yes], [
    AC_CHECK_HEADERS(shadow/shadow.h, [shadow_header=yes])])
if test x$shadow_header = xyes; then
    AC_DEFINE(HAVE_SHADOW)
fi

have_crypt=no
AC_CHECK_FUNCS(crypt, have_crypt=yes, [
    AC_CHECK_LIB(crypt, crypt, [LIBS="$LIBS -lcrypt" ; have_crypt=yes] ,[
	AC_CHECK_LIB(crypt_i, crypt, [LIBS="$LIBS -lcrypt_i" ; have_crypt=yes] ,[
	    AC_CHECK_LIB(util, crypt, [have_crypt=yes] ,[
		AC_CHECK_LIB(bsd, crypt, [have_crypt=yes])])])])])
if test x$have_crypt = xyes; then
    AC_DEFINE(HAVE_CRYPT)
fi

dnl dnl crypt function, do we need this ???
dnl AC_MSG_CHECKING(if crypt() prototype might be specified)
dnl AC_TRY_COMPILE([#include "vfs/net-includes.h"
dnl extern char *crypt (const char *, const char *);
dnl ], [ crypt("xxx", "yyy"); ], [
dnl need_crypt_prototype=yes], [
dnl need_crypt_prototype=no
dnl ])
dnl if test x$need_crypt_prototype = xyes; then
dnl AC_DEFINE(NEED_CRYPT_PROTOTYPE)
dnl AC_MSG_RESULT(yes)
dnl else
dnl AC_MSG_RESULT(no)
dnl fi

dnl window resizing: check for `struct winsize'
AC_MSG_CHECKING(for struct winsize)
AC_TRY_COMPILE([#include "vfs/net-includes.h"], [struct winsize w; ioctl(0, 1234, &w); ], [
ioctl_get_winsize_works=yes], [
ioctl_get_winsize_works=no
])
if test x$ioctl_get_winsize_works = xno; then
AC_DEFINE(NEED_WINSIZE)
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi

dnl pam authentication for Linux
AC_MSG_CHECKING(for Linux PAM libraries)
PAMLIBS=""
if test x$system = xLinux ; then
    AC_CHECK_LIB(pam, pam_start, [
	PAMLIBS="-lpam -ldl"
    ],[],[-ldl])
fi
if test "x$PAMLIBS" != x ; then
    AC_MSG_CHECKING(if nice pam version)
    AC_TRY_COMPILE([#define HAVE_PAM
#include "vfs/net-includes.h"], [pam_handle_t *p; int s; (void) pam_strerror (p, s); ], [
	pam_version_ok=yes], [
	pam_version_ok=no
    ])
    if test x$pam_version_ok = xyes ; then
	AC_MSG_RESULT(yes)
	AC_DEFINE(HAVE_PAM)
    else
	AC_MSG_RESULT(no)
	PAMLIBS=""
    fi
fi
AC_SUBST(PAMLIBS)

AC_DEFINE(INSTALL_PREFIX, $prefix)

AC_OUTPUT(Makefile zlib/Makefile diffie/Makefile vfs/Makefile src/Makefile pam/Makefile doc/Makefile scripts/Makefile mirrordir.spec)