1#!/bin/sh 2# 3# This file was generated by confgen version 2. 4# Do not edit. 5# 6 7PREFIX='/usr' 8#EXECPREFIX='$PREFIX' 9INSTALLROOT='' 10BINMODE='755' 11MANMODE='644' 12 13while [ x$1 != x ]; do case $1 in 14 15 --help) 16 cat <<EOF 17Usage: configure [options] 18 --help Show this message 19 --with-debug Enable debugging 20 --without-readline Disable readline support 21 --prefix=path Prefix for location of files [/usr] 22 --exec-prefix=path Location for arch-depedent files [prefix] 23 --installroot=root Top of filesystem tree to install in [/] 24 --binmode=mode Mode for binaries [755] 25 --manmode=mode Mode for manual pages [644] 26 --with-c-compiler=cc Program for compiling C source [guessed] 27EOF 28 exit 0;; 29 --verbose) ;; 30 --quiet) ;; 31 32 --subdir) . ../configure.defs;; 33 34 --with-debug|--debug) DEBUG=1;; 35 --prefix=*) PREFIX=`echo $1 | sed 's/^[^=]*=//'` ;; 36 --exec-prefix=*) EXECPREFIX=`echo $1 | sed 's/^[^=]*=//'` ;; 37 --installroot=*) INSTALLROOT=`echo $1 | sed 's/^[^=]*=//'` ;; 38 --binmode=*) BINMODE=`echo $1 | sed 's/^[^=]*=//'` ;; 39 --manmode=*) MANMODE=`echo $1 | sed 's/^[^=]*=//'` ;; 40 --with-c-compiler=*) CC=`echo $1 | sed 's/^[^=]*=//'` ;; 41 --without-readline|--disable-readline) WITHOUT_READLINE=1;; 42 *) echo "Unrecognized option: $1"; exit 1;; 43esac 44shift 45done 46 47if [ x$EXECPREFIX = x ]; then 48 EXECPREFIX="$PREFIX" 49fi 50 51BINDIR="$EXECPREFIX/bin" 52MANDIR="$PREFIX/man" 53 54echo "Directories: $BINDIR $MANDIR " 55 56if [ x$INSTALLROOT != x ]; then 57 echo "Installing in chroot tree rooted at $INSTALLROOT" 58fi 59 60################################################## 61 62WARNINGS='-Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline ' 63 64cat << EOF > __conftest.c 65 int main() { int class=0; return class; } 66EOF 67 68if [ x"$CC" = x ]; then 69 echo -n 'Looking for a C compiler... ' 70 for TRY in egcs gcc g++ CC c++ cc; do 71 ( 72 $TRY __conftest.c -o __conftest || exit 1; 73 ./__conftest || exit 1; 74 ) >/dev/null 2>&1 || continue; 75 CC=$TRY 76 break; 77 done 78 if [ x"$CC" = x ]; then 79 echo 'failed.' 80 echo 'Cannot find a C compiler. Run configure with --with-c-compiler.' 81 rm -f __conftest* 82 exit 83 fi 84 echo "$CC" 85else 86 echo -n 'Checking if C compiler works... ' 87 if ( 88 $CC __conftest.c -o __conftest || exit 1 89 ./__conftest || exit 1 90 ) >/dev/null 2>&1; then 91 echo 'yes' 92 else 93 echo 'no' 94 echo 'Compiler '"$CC"' does not exist or cannot compile C; try another.' 95 rm -f __conftest* 96 exit 97 fi 98fi 99 100echo -n "Checking if $CC accepts gcc warnings... " 101if ( 102 $CC $WARNINGS __conftest.c -o __conftest || exit 1 103 ) >/dev/null 2>&1; then 104 echo 'yes' 105 CC_WARNINGS=1 106else 107 echo 'no' 108fi 109 110if [ x$DEBUG = x ]; then 111 echo -n "Checking if $CC accepts -O2... " 112 if ( 113 $CC -O2 __conftest.c -o __conftest 114 ) >/dev/null 2>&1; then 115 echo 'yes' 116 CFLAGS="$CFLAGS -O2" 117 else 118 echo 'no' 119 echo -n "Checking if $CC accepts -O... " 120 if ( 121 $CC -O __conftest.c -o __conftest 122 ) >/dev/null 2>&1; then 123 echo 'yes' 124 CFLAGS="$CFLAGS -O" 125 else 126 echo 'no' 127 fi 128 fi 129 130else 131 echo -n "Checking if $CC accepts -g... " 132 if ( 133 $CC -g __conftest.c -o __conftest 134 ) >/dev/null 2>&1; then 135 echo 'yes' 136 CFLAGS="$CFLAGS -g" 137 else 138 echo 'no' 139 fi 140 141fi 142 143LDFLAGS= 144LIBS= 145 146rm -f __conftest* 147 148################################################## 149 150echo -n 'Checking for BSD signal semantics... ' 151cat <<EOF >__conftest.c 152#include <unistd.h> 153#include <signal.h> 154int count=0; 155void handle(int foo) { count++; } 156int main() { 157 int pid=getpid(); 158 signal(SIGINT, handle); 159 kill(pid,SIGINT); 160 kill(pid,SIGINT); 161 kill(pid,SIGINT); 162 if (count!=3) return 1; 163 return 0; 164} 165 166EOF 167if ( 168 $CC $CFLAGS __conftest.c -o __conftest || exit 1 169 ./__conftest || exit 1 170 ) >/dev/null 2>&1; then 171 echo 'yes' 172else 173 if ( 174 $CC $CFLAGS -D__USE_BSD_SIGNAL __conftest.c -o __conftest || exit 1 175 ./__conftest || exit 1 176 ) >/dev/null 2>&1; then 177 echo '-D__USE_BSD_SIGNAL' 178 CFLAGS="$CFLAGS -D__USE_BSD_SIGNAL" 179 else 180 echo 'no' 181 echo 'This package needs BSD signal semantics to run.' 182 rm -f __conftest* 183 exit 184 fi 185fi 186rm -f __conftest* 187 188################################################## 189 190echo -n 'Checking for ncurses... ' 191cat <<EOF >__conftest.c 192#include <stdio.h> 193#include <curses.h> 194#ifndef KEY_DOWN 195syntax error. /* not ncurses */ 196#endif 197int main() { 198 endwin(); 199 return 0; 200} 201 202EOF 203if ( 204 $CC $CFLAGS __conftest.c -lncurses -o __conftest || exit 1 205 ) >/dev/null 2>&1; then 206 echo 'yes' 207 NCURSES=1 208else 209 if ( 210 $CC $CFLAGS -I/usr/include/ncurses __conftest.c -lncurses -o __conftest || exit 1 211 ) >/dev/null 2>&1; then 212 echo '-I/usr/include/ncurses' 213 CFLAGS="$CFLAGS -I/usr/include/ncurses" 214 NCURSES=1 215 else 216 echo 'no' 217 fi 218fi 219 220if [ x$NCURSES != x ]; then 221 LIBTERMCAP=-lncurses 222else 223 echo -n 'Checking for traditional termcap... ' 224cat <<EOF >__conftest.c 225#include <stdio.h> 226#include <termcap.h> 227int main() { 228 tgetent(NULL, NULL); return 0; 229} 230 231EOF 232 if ( 233 $CC $CFLAGS __conftest.c -ltermcap -o __conftest || exit 1 234 ) >/dev/null 2>&1; then 235 echo '-ltermcap' 236 LIBTERMCAP=-ltermcap 237 else 238 echo 'not found' 239 echo 'This package needs termcap to run.' 240 rm -f __conftest* 241 exit 242 fi 243fi 244rm -f __conftest* 245 246################################################## 247 248echo -n 'Checking for GNU libc... ' 249cat <<EOF >__conftest.c 250#include <stdio.h> 251#if defined(__GLIBC__) && (__GLIBC__ >= 2) 252int tester; 253#endif 254int main() { tester=6; return 0; } 255 256EOF 257if ( 258 $CC $CFLAGS __conftest.c -o __conftest || exit 1 259 ) >/dev/null 2>&1; then 260 echo 'yes' 261 USE_GLIBC=1 262else 263 echo 'no' 264fi 265rm -f __conftest* 266 267################################################## 268 269echo -n 'Checking for libreadline... ' 270if [ x$WITHOUT_READLINE != x ]; then 271 echo disabled 272else 273cat <<EOF >__conftest.c 274#include <stdio.h> 275#include <readline/readline.h> 276#include <readline/tilde.h> 277int main() { readline("foo"); return 0; } 278 279EOF 280if ( 281 $CC $CFLAGS __conftest.c -lreadline $LIBTERMCAP -o __conftest || exit 1 282 ) >/dev/null 2>&1; then 283 echo 'yes' 284 USE_READLINE=1 285 else 286 echo 'no' 287 fi 288fi 289rm -f __conftest* 290 291################################################## 292 293echo -n 'Checking for socklen_t... ' 294cat <<EOF >__conftest.c 295#include <sys/types.h> 296#include <sys/socket.h> 297#include <netinet/in.h> 298int main() { 299 struct sockaddr_in sn; 300 socklen_t len = sizeof(sn); 301 getpeername(0, (struct sockaddr *)&sn, &len); 302 return 0; 303} 304 305EOF 306if ( 307 $CC $CFLAGS __conftest.c -o __conftest || exit 1 308 ) >/dev/null 2>&1; then 309 echo 'yes' 310else 311 if ( 312 $CC $CFLAGS -Dsocklen_t=int __conftest.c -o __conftest || exit 1 313 ) >/dev/null 2>&1; then 314 echo 'int' 315 CFLAGS="$CFLAGS -Dsocklen_t=int" 316 else 317 if ( 318 $CC $CFLAGS -Dsocklen_t=size_t __conftest.c -o __conftest || exit 1 319 ) >/dev/null 2>&1; then 320 echo 'size_t' 321 CFLAGS="$CFLAGS -Dsocklen_t=size_t" 322 else 323 echo 'no' 324 echo 'Cannot work out what to use for socklen_t. Help...' 325 rm -f __conftest* 326 exit 327 fi 328 fi 329fi 330rm -f __conftest* 331 332################################################## 333 334echo -n 'Checking for snprintf declaration... ' 335cat <<EOF >__conftest.c 336#include <stdio.h> 337int main() { 338 void *x = (void *)snprintf; 339 printf("%lx", (long)x); 340 return 0; 341} 342 343EOF 344if ( 345 $CC $CFLAGS __conftest.c -o __conftest || exit 1 346 ) >/dev/null 2>&1; then 347 echo 'ok' 348else 349 if ( 350 $CC $CFLAGS -D_GNU_SOURCE __conftest.c -o __conftest || exit 1 351 ./__conftest || exit 1 352 ) >/dev/null 2>&1; then 353 echo '-D_GNU_SOURCE' 354 CFLAGS="$CFLAGS -D_GNU_SOURCE" 355 else 356 echo 'manual' 357 CFLAGS="$CFLAGS -DDECLARE_SNPRINTF" 358 fi 359fi 360rm -f __conftest* 361 362echo -n 'Checking for snprintf implementation... ' 363cat <<EOF >__conftest.c 364#include <stdio.h> 365#include <string.h> 366#ifdef DECLARE_SNPRINTF 367#ifdef __cplusplus 368extern "C" 369#endif /*__cplusplus*/ 370int snprintf(char *, int, const char *, ...); 371#endif /*DECLARE_SNPRINTF*/ 372int main() { 373 char buf[32]; 374 snprintf(buf, 8, "%s", "1234567890"); 375 if (strlen(buf)!=7) return 1; 376 return 0; 377} 378 379EOF 380if ( 381 $CC $CFLAGS __conftest.c $LIBBSD -o __conftest || exit 1 382 ./__conftest || exit 1 383 ) >/dev/null 2>&1; then 384 echo 'ok' 385else 386 if ( 387 $CC $CFLAGS __conftest.c -lsnprintf $LIBBSD -o __conftest || exit 1 388 ./__conftest || exit 1 389 ) >/dev/null 2>&1; then 390 echo '-lsnprintf' 391 LIBS="$LIBS -lsnprintf" 392 else 393 if ( 394 $CC $CFLAGS __conftest.c -ldb $LIBBSD -o __conftest || exit 1 395 ./__conftest || exit 1 396 ) >/dev/null 2>&1; then 397 echo '-ldb' 398 LIBS="$LIBS -ldb" 399 else 400 echo 'missing' 401 echo 'This package requires snprintf.' 402 rm -f __conftest* 403 exit 404 fi 405 fi 406fi 407rm -f __conftest* 408 409################################################## 410 411## libbsd should go last in case it's broken 412if [ "x$LIBBSD" != x ]; then 413 LIBS="$LIBS $LIBBSD" 414fi 415 416echo 'Generating MCONFIG...' 417( 418 echo -n '# Generated by configure (confgen version 2) on ' 419 date 420 echo '#' 421 echo 422 423 echo "BINDIR=$BINDIR" 424 echo "MANDIR=$MANDIR" 425 echo "BINMODE=$BINMODE" 426 echo "MANMODE=$MANMODE" 427 echo "PREFIX=$PREFIX" 428 echo "EXECPREFIX=$EXECPREFIX" 429 echo "INSTALLROOT=$INSTALLROOT" 430 echo "CC=$CC" 431 if [ x$CC_WARNINGS != x ]; then 432 CFLAGS="$CFLAGS $WARNINGS" 433 fi 434 435 echo "CFLAGS=$CFLAGS" | sed 's/= */=/' 436 echo "LDFLAGS=$LDFLAGS" | sed 's/= */=/' 437 echo "LIBS=$LIBS" | sed 's/= */=/' 438 439 echo "LIBTERMCAP=$LIBTERMCAP" 440 echo "USE_GLIBC=$USE_GLIBC" 441 echo "USE_READLINE=$USE_READLINE" 442) > MCONFIG 443 444