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 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
|
#! /bin/sh
# $Id: configure,v 1.17 2008-03-29 14:54:43 mjt Exp $
# autoconf-style configuration script
#
set -e
name=rbldnsd
if [ -f rbldnsd.h -a -f rbldnsd_util.c -a -f debian/changelog ] ; then :
else
echo "configure: error: sources not found at `pwd`" >&2
exit 1
fi
options="ipv6 stats master_dump zlib dso"
for opt in $options; do
eval enable_$opt=
done
if [ -f config.status ]; then
. ./config.status
fi
enable() {
opt=`echo "$1" | sed 's/^--[^-]*-//'`
case "$opt" in
ipv6|stats|master_dump|zlib|dso) ;;
master-dump) opt=master_dump ;;
*) echo "configure: unrecognized option \`$1'" >&2; exit 1;;
esac
eval enable_$opt=$2
}
while [ $# -gt 0 ]; do
case "$1" in
--disable-*|--without-*|--no-*) enable "$1" n;;
--enable-*|--with-*) enable "$1" y;;
--help | --hel | --he | --h | -help | -hel | -he | -h )
cat <<EOF
configure: configure $name package.
Usage: ./configure [options]
where options are:
--enable-option, --with-option --
enable the named option/feature
--disable-option, --without-option, --no-option --
disable the named option/feature
--help - print this help and exit
Optional features (all enabled by default if system supports a feature):
ipv6 - enable/disable IP version 6 (IPv6) support
stats - enable/disable runtime statistics
master-dump - enable/disable master-format (bind) dump support (-d option)
zlib - zlib support
dso - dynamic extensions (using shared objects) -- disabled by default
EOF
exit 0
;;
*) echo "configure: unknown option \`$1'" >&2; exit 1 ;;
esac
shift
done
. ./configure.lib
rm -f confdef.h
cat >confdef.h <<EOF
/* $name autoconfiguration header file.
* Generated automatically by configure. */
EOF
VERSION=`sed -e 's/^[^(]*(\([^)]*\)).*/\1/' -e 1q debian/changelog`
VERSION_DATE=`sed -n '/^ --/ { s/.* ..., \{0,1\}\([0-9]\{1,2\} ... [0-9]\{4\}\) .*/\1/p; q; }' debian/changelog`
ac_msg "configure: $name"
ac_result "$VERSION ($VERSION_DATE)"
ac_subst VERSION VERSION_DATE
ac_prog_c_compiler
ac_prog_ranlib
if ac_header_check_v stdint.h
then :
else
echo "#define NO_STDINT_H 1" >>confdef.h
if ac_yesno "sizes of standard integer types" \
ac_compile_run <<EOF
#include <stdio.h>
int main() {
printf("#define SIZEOF_SHORT %d\n", sizeof(short));
printf("#define SIZEOF_INT %d\n", sizeof(int));
printf("#define SIZEOF_LONG %d\n", sizeof(long));
return 0;
}
EOF
then
cat conftest.out >> confdef.h
else
ac_fatal "cannot determine sizes of standard types"
fi
if ac_yesno "for long long" \
ac_compile_run <<EOF
#include <stdio.h>
int main() {
long long x;
printf("#define SIZEOF_LONG_LONG %d\n", sizeof(long long));
return 0;
}
EOF
then
cat conftest.out >>confdef.h
else
echo "#define NO_LONG_LONG" >>confdef.h
fi
fi
has_inline=
for c in inline __inline; do
if ac_compile_v "for $c" <<EOF
static $c int foo() { return 0; }
int main() { return foo(); }
EOF
then
has_inline=$c
break
fi
done
if [ "$has_inline" != inline ]; then
echo "#define inline" $has_inline >>confdef.h
fi
if ac_compile_v "for socklen_t" <<EOF
#include <sys/types.h>
#include <sys/socket.h>
int foo() { socklen_t len; len = 0; return len; }
EOF
then :
else
echo "#define socklen_t int" >>confdef.h
fi
if ac_library_find_v 'connect()' "" "-lsocket -lnsl" <<EOF
int main() { gethostbyname(); connect(); return 0; }
EOF
then :
else
ac_fatal "cannot find libraries needed for sockets"
fi
if [ n = "$enable_ipv6" ]; then
echo "#define NO_IPv6 1 /* option disabled */" >>confdef.h
else
if ac_link_v "for IPv6" <<EOF
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
int main() {
char h[200];
char s[200];
struct sockaddr_in6 sa;
sa.sin6_family = AF_INET6;
getnameinfo((struct sockaddr*)&sa, sizeof(sa), h, sizeof(h), s, sizeof(s), 0);
return 0;
}
EOF
then :
else
if [ "$enable_ipv6" ]; then
ac_fatal "IPv6 is requested but not available"
fi
echo "#define NO_IPv6 1" >>confdef.h
fi
fi # enable_ipv6?
if ac_link_v "for mallinfo()" <<EOF
#include <sys/types.h>
#include <stdlib.h>
#include <malloc.h>
int main() {
struct mallinfo mi = mallinfo();
return 0;
}
EOF
then :
else
echo "#define NO_MEMINFO 1" >>confdef.h
fi
if ac_link_v "for poll()" <<EOF
#include <sys/types.h>
#include <sys/poll.h>
int main() {
struct pollfd pfd[2];
return poll(pfd, 2, 10);
}
EOF
then :
else
echo "#define NO_POLL 1" >>confdef.h
if ac_header_check_v "sys/select.h"
then :
else
echo "#define NO_SELECT_H 1" >>confdefs.h
fi
fi
if ac_link_v "for vsnprintf()" <<EOF
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
int test(char *fmt, ...) {
va_list ap;
char buf[40];
va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap);
return 0;
}
int main() {
test("test%d", 40);
return 0;
}
EOF
then :
else
ac_fatal "$name requires working vsnprintf() routine"
fi
if ac_link_v "for writev()/readv()" <<EOF
#include <sys/types.h>
#include <unistd.h>
#include <sys/uio.h>
int main() {
struct iovec iov;
return writev(1, &iov, 1) && readv(1, &iov, 1);
}
EOF
then :
else
echo "#define NO_IOVEC 1" >>confdef.h
fi
if ac_link_v "for setitimer()" <<EOF
#include <sys/types.h>
#include <sys/time.h>
int main() {
struct itimerval itv;
itv.it_interval.tv_sec = itv.it_value.tv_sec = 10;
itv.it_interval.tv_usec = itv.it_value.tv_usec = 20;
setitimer(ITIMER_REAL, &itv, 0);
return 0;
}
EOF
then
echo "#define HAVE_SETITIMER 1" >>confdef.h
fi
if [ n = "$enable_zlib" ]; then
echo "#define NO_ZLIB 1 /* option disabled */" >>confdef.h
elif ac_link_v "for zlib support" -lz <<EOF
#include <sys/types.h>
#include <stdio.h>
#include <zlib.h>
int main() {
z_stream z;
int r;
r = inflateInit2(&z, 0);
r = inflate(&z, Z_NO_FLUSH);
r = inflateEnd(&z);
return 0;
}
EOF
then
LIBS="$LIBS -lz"
elif [ "$enable_zlib" ]; then
ac_fatal "zlib support is requested but not found/available"
else
echo "#define NO_ZLIB" >>confdef.h
fi
if [ -z "$enable_dso" ]; then
echo "#define NO_DSO 1 /* disabled by default */" >> confdef.h
elif [ n = "$enable_dso" ]; then
echo "#define NO_DSO 1 /* option disabled */" >>confdef.h
elif ac_link_v "for dlopen() in -dl with -rdynamic" -ldl -rdynamic <<EOF
#include <dlfcn.h>
int main() {
void *handle, *func;
handle = dlopen("testfile", RTLD_NOW);
func = dlsym(handle, "function");
return 0;
}
EOF
then
LIBS="$LIBS -ldl -rdynamic"
elif [ "$enable_dso" ]; then
ac_fatal "dso support requires dlopen() in -ldl"
else
echo "#define NO_DSO 1 /* not available */" >> confdef.h
fi
if [ n = "$enable_stats" ]; then
echo "#define NO_STATS 1 /* option disabled */" >>confdef.h
fi
if [ n = "$enable_master_dump" ]; then
echo "#define NO_MASTER_DUMP 1 /* option disabled */" >>confdef.h
fi
ac_output Makefile
ac_msg "creating config.h"
mv -f confdef.h config.h
ac_result ok
ac_msg "creating config.status"
rm -f config.status
{
echo "# automatically generated by configure to hold command-line options"
echo
found=
for opt in $options; do
eval val=\$enable_$opt
if [ -n "$val" ]; then
echo enable_$opt=$val
found=y
fi
done
if [ ! "$found" ]; then
echo "# (no options encountered)"
fi
} > config.status
ac_result ok
ac_result "all done."
exit 0
|