You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

204 lines
4.3 KiB

diff -urN a/configure b/configure
--- a/configure 2019-03-03 22:17:03.000000000 +0900
+++ b/configure 2019-06-04 13:08:41.418919319 +0900
@@ -3,51 +3,21 @@
# 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
+cc="$CC"
+
+fgetlncheck() {
+ cat << EOF > conftest.c
+#include <stdio.h>
+int main(void){fgetln(NULL,NULL);return 0;}
+EOF
+ $cc $tflags -o conftest conftest.c > /dev/null 2>&1
+ if [ $? -eq 0 ] ; then
+ rm -f conftest conftest.c
+ return 0
+ else
+ rm -f conftest conftest.c
+ return 1
+ fi
}
fparselncheck() {
@@ -211,18 +181,19 @@
fi
}
-wflagcheck() {
+futimenscheck() {
cat << EOF > conftest.c
-int main(void){return 0;}
+#include <sys/stat.h>
+#include <stddef.h>
+int main(void){futimens(0, NULL);return 0;}
EOF
- $cc -w -o conftest conftest.c > /dev/null 2> conftest.err
- grep ':' conftest.err > /dev/null 2>&1
+ $cc $tflags -o conftest conftest.c > /dev/null 2>&1
if [ $? -eq 0 ] ; then
- rm -f conftest conftest.err conftest.c
- return 1
- else
- rm -f conftest conftest.err conftest.c
+ rm -f conftest conftest.c
return 0
+ else
+ rm -f conftest conftest.c
+ return 1
fi
}
@@ -290,54 +261,9 @@
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
-
-printf "checking for -w compiler flag... "
-wflagcheck
-if [ $? -ne 0 ] ; then
- echo "no"
-else
- cflags="$cflags -w"
- echo "yes"
-fi
-
-printf "checking for OS... "
-libs='-lncurses'
-os=`uname -s`
-echo "$os"
-
-case "x$os" in
- "xLinux"|"xCYGWIN"*)
- cflags="$cflags -D_GNU_SOURCE -D__dead=\"__attribute__((__noreturn__))\" -Dst_mtimespec=st_mtim"
- ;;
- "xDarwin")
- cflags="$cflags -DMSG_NOSIGNAL=SO_NOSIGPIPE -DLOGIN_NAME_MAX=MAXLOGNAME"
- libs="$libs -lutil"
- ;;
- "xFreeBSD")
- cflags="$cflags -D__dead=__dead2 -DLOGIN_NAME_MAX=MAXLOGNAME"
- libs="$libs -lutil"
- ;;
- "xOpenBSD")
- libs="$libs -lutil"
- ;;
- "xNetBSD")
- cflags="$cflags -D_OPENBSD_SOURCE"
- libs="$libs -lutil"
- ;;
- "xDragonFly")
- cflags="$cflags -D__dead=__dead2 -DLOGIN_NAME_MAX=MAXLOGNAME"
- libs="$libs -lutil"
- ;;
-esac
+# OpenWrt
+libs='-lncurses -lpcreposix'
+cflags="$cflags -D_GNU_SOURCE -D__dead=\"__attribute__((__noreturn__))\" -Dst_mtimespec=st_mtim"
cat << EOF > config.h
/* This file generated automatically by configure. */
@@ -357,6 +283,15 @@
EOF
+printf "checking for fgetln... "
+fgetlncheck
+if [ $? -eq 0 ] ; then
+ echo "#define HAVE_FGETLN" >> config.h
+ echo "yes"
+else
+ echo "no"
+fi
+
printf "checking for fparseln... "
fparselncheck
if [ $? -eq 0 ] ; then
diff -urN a/fparseln.c b/fparseln.c
--- a/fparseln.c 2019-03-03 22:17:03.000000000 +0900
+++ b/fparseln.c 2019-06-04 13:05:38.815543338 +0900
@@ -74,6 +74,8 @@
#include "util.h"
#endif
+#ifndef HAVE_FGETLN
+
static char *
fgetln(FILE *fp, size_t *len)
{
@@ -119,6 +121,8 @@
return buf;
}
+#endif /* !HAVE_FGETLN */
+
static int isescaped(const char *, const char *, int);
/* isescaped():
diff -urN a/linux.h b/linux.h
--- a/linux.h 2019-03-03 22:17:03.000000000 +0900
+++ b/linux.h 2019-06-04 13:45:21.787063324 +0900
@@ -7,6 +7,7 @@
#endif
#include <sys/types.h>
+#include <sys/stat.h>
#include <stdio.h>
/* Defines */