--- a/configure
|
|
+++ b/configure
|
|
@@ -3,66 +3,7 @@
|
|
# This configure script written by Brian Callahan <bcallah@openbsd.org>
|
|
# and released into the Public Domain.
|
|
|
|
-cccheck() {
|
|
- if [ ! -z "$CC" ] ; then
|
|
-cat << EOF > conftest.c
|
|
-int main(void){return 0;}
|
|
-EOF
|
|
- $CC -o conftest conftest.c > /dev/null 2>&1
|
|
- if [ $? -eq 0 ] ; then
|
|
- ./conftest
|
|
- if [ $? -eq 0 ] ; then
|
|
- rm -f conftest conftest.c
|
|
- cc="$CC"
|
|
- return 0
|
|
- else
|
|
- echo "could not build working executables"
|
|
- echo "Please ensure your C compiler is a native compiler"
|
|
- exit 1
|
|
- fi
|
|
- else
|
|
- rm -f conftest conftest.c
|
|
- fi
|
|
- fi
|
|
-
|
|
- for compiler in cc clang pcc xlc gcc ; do
|
|
-cat << EOF > conftest.c
|
|
-int main(void){return 0;}
|
|
-EOF
|
|
-
|
|
- $compiler -o conftest conftest.c > /dev/null 2>&1
|
|
-
|
|
- if [ $? -eq 0 ] ; then
|
|
- ./conftest
|
|
- if [ $? -eq 0 ] ; then
|
|
- rm -f conftest conftest.c
|
|
- cc="$compiler"
|
|
- return 0
|
|
- else
|
|
- echo "could not build working executables"
|
|
- echo "Please ensure your C compiler is a native compiler"
|
|
- exit 1
|
|
- fi
|
|
- else
|
|
- rm -f conftest conftest.c
|
|
- fi
|
|
- done
|
|
- return 1
|
|
-}
|
|
-
|
|
-defaultcflagscheck() {
|
|
- cat << EOF > conftest.c
|
|
-int main(void){return 0;}
|
|
-EOF
|
|
- $cc $cflags -g -O2 -o conftest.o -c conftest.c > /dev/null 2>&1
|
|
- if [ $? -eq 0 ] ; then
|
|
- rm -f conftest conftest.o conftest.c
|
|
- return 1
|
|
- else
|
|
- rm -f conftest conftest.o conftest.c
|
|
- return 0
|
|
- fi
|
|
-}
|
|
+cc="$CC"
|
|
|
|
fparselncheck() {
|
|
cat << EOF > conftest.c
|
|
@@ -229,20 +170,6 @@ EOF
|
|
fi
|
|
}
|
|
|
|
-wflagcheck() {
|
|
- cat << EOF > conftest.c
|
|
-int main(void){return 0;}
|
|
-EOF
|
|
- $cc $cflags -w -o conftest conftest.c > /dev/null 2>&1
|
|
- if [ $? -eq 0 ] ; then
|
|
- rm -f conftest conftest.o conftest.c
|
|
- return 1
|
|
- else
|
|
- rm -f conftest conftest.o conftest.c
|
|
- return 0
|
|
- fi
|
|
-}
|
|
-
|
|
# Option variables
|
|
if [ ! -z "$PREFIX" ] ; then
|
|
prefix="$PREFIX"
|
|
@@ -327,80 +254,9 @@ if [ $static -ne 0 ] ; then
|
|
ldflags="${ldflags}-static"
|
|
fi
|
|
|
|
-printf "checking for C compiler... "
|
|
-cccheck
|
|
-if [ $? -ne 0 ] ; then
|
|
- echo "not found"
|
|
- echo "Please install a C compiler and re-run configure."
|
|
- exit 1
|
|
-else
|
|
- echo "$cc"
|
|
-fi
|
|
-
|
|
-if [ "x$cflags" = "x-DREGEX" ] ; then
|
|
- printf "checking if the compiler accepts -g -O2... "
|
|
- defaultcflagscheck
|
|
- if [ $? -eq 0 ] ; then
|
|
- echo "no"
|
|
- else
|
|
- cflags="-g -O2 $cflags"
|
|
- echo "yes"
|
|
- fi
|
|
-fi
|
|
-
|
|
-printf "checking for -w compiler flag... "
|
|
-wflagcheck
|
|
-if [ $? -eq 0 ] ; then
|
|
- echo "no"
|
|
-else
|
|
- cflags="$cflags -w"
|
|
- echo "yes"
|
|
-fi
|
|
-
|
|
-printf "checking for OS... "
|
|
-
|
|
-if [ $terminfo -eq 0 ] ; then
|
|
- libs="-lncursesw"
|
|
-else
|
|
- libs=""
|
|
-fi
|
|
-
|
|
-os=`uname -s`
|
|
-echo "$os"
|
|
-
|
|
-case "x$os" in
|
|
- "xLinux"|"xCYGWIN"*)
|
|
- cflags="$cflags -D_GNU_SOURCE -D__dead=\"__attribute__((__noreturn__))\" -Dst_mtimespec=st_mtim"
|
|
- libs="$libs -lutil"
|
|
- ;;
|
|
- "xDarwin")
|
|
- cflags="$cflags -DMSG_NOSIGNAL=SO_NOSIGPIPE -DLOGIN_NAME_MAX=MAXLOGNAME"
|
|
- if [ $terminfo -eq 0 ] ; then
|
|
- libs="-lncurses -lutil"
|
|
- else
|
|
- libs="-lutil"
|
|
- fi
|
|
- ;;
|
|
- "xFreeBSD")
|
|
- cflags="$cflags -D__dead=__dead2 -DLOGIN_NAME_MAX=MAXLOGNAME"
|
|
- libs="$libs -lutil"
|
|
- ;;
|
|
- "xOpenBSD")
|
|
- libs="$libs -lutil"
|
|
- ;;
|
|
- "xNetBSD")
|
|
- cflags="$cflags -D_OPENBSD_SOURCE"
|
|
- if [ $terminfo -eq 0 ] ; then
|
|
- libs="-lcurses -lutil"
|
|
- else
|
|
- libs="-lutil"
|
|
- fi
|
|
- ;;
|
|
- "xDragonFly")
|
|
- cflags="$cflags -D__dead=__dead2 -DLOGIN_NAME_MAX=MAXLOGNAME"
|
|
- libs="$libs -lutil"
|
|
- ;;
|
|
-esac
|
|
+# OpenWrt
|
|
+libs='-lncurses -lpcreposix -lutil'
|
|
+cflags="$cflags -D_GNU_SOURCE -D__dead=\"__attribute__((__noreturn__))\" -Dst_mtimespec=st_mtim"
|
|
|
|
cat << EOF > config.h
|
|
/* This file generated automatically by configure. */
|