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

  1. diff -urN a/configure b/configure
  2. --- a/configure 2019-03-03 22:17:03.000000000 +0900
  3. +++ b/configure 2019-06-04 13:08:41.418919319 +0900
  4. @@ -3,51 +3,21 @@
  5. # This configure script written by Brian Callahan <bcallah@openbsd.org>
  6. # and released into the Public Domain.
  7. -cccheck() {
  8. - if [ ! -z "$CC" ] ; then
  9. -cat << EOF > conftest.c
  10. -int main(void){return 0;}
  11. -EOF
  12. - $CC -o conftest conftest.c > /dev/null 2>&1
  13. - if [ $? -eq 0 ] ; then
  14. - ./conftest
  15. - if [ $? -eq 0 ] ; then
  16. - rm -f conftest conftest.c
  17. - cc="$CC"
  18. - return 0
  19. - else
  20. - echo "could not build working executables"
  21. - echo "Please ensure your C compiler is a native compiler"
  22. - exit 1
  23. - fi
  24. - else
  25. - rm -f conftest conftest.c
  26. - fi
  27. - fi
  28. -
  29. - for compiler in cc clang pcc xlc gcc ; do
  30. -cat << EOF > conftest.c
  31. -int main(void){return 0;}
  32. -EOF
  33. -
  34. - $compiler -o conftest conftest.c > /dev/null 2>&1
  35. -
  36. - if [ $? -eq 0 ] ; then
  37. - ./conftest
  38. - if [ $? -eq 0 ] ; then
  39. - rm -f conftest conftest.c
  40. - cc="$compiler"
  41. - return 0
  42. - else
  43. - echo "could not build working executables"
  44. - echo "Please ensure your C compiler is a native compiler"
  45. - exit 1
  46. - fi
  47. - else
  48. - rm -f conftest conftest.c
  49. - fi
  50. - done
  51. - return 1
  52. +cc="$CC"
  53. +
  54. +fgetlncheck() {
  55. + cat << EOF > conftest.c
  56. +#include <stdio.h>
  57. +int main(void){fgetln(NULL,NULL);return 0;}
  58. +EOF
  59. + $cc $tflags -o conftest conftest.c > /dev/null 2>&1
  60. + if [ $? -eq 0 ] ; then
  61. + rm -f conftest conftest.c
  62. + return 0
  63. + else
  64. + rm -f conftest conftest.c
  65. + return 1
  66. + fi
  67. }
  68. fparselncheck() {
  69. @@ -211,18 +181,19 @@
  70. fi
  71. }
  72. -wflagcheck() {
  73. +futimenscheck() {
  74. cat << EOF > conftest.c
  75. -int main(void){return 0;}
  76. +#include <sys/stat.h>
  77. +#include <stddef.h>
  78. +int main(void){futimens(0, NULL);return 0;}
  79. EOF
  80. - $cc -w -o conftest conftest.c > /dev/null 2> conftest.err
  81. - grep ':' conftest.err > /dev/null 2>&1
  82. + $cc $tflags -o conftest conftest.c > /dev/null 2>&1
  83. if [ $? -eq 0 ] ; then
  84. - rm -f conftest conftest.err conftest.c
  85. - return 1
  86. - else
  87. - rm -f conftest conftest.err conftest.c
  88. + rm -f conftest conftest.c
  89. return 0
  90. + else
  91. + rm -f conftest conftest.c
  92. + return 1
  93. fi
  94. }
  95. @@ -290,54 +261,9 @@
  96. ldflags="${ldflags}-static"
  97. fi
  98. -printf "checking for C compiler... "
  99. -cccheck
  100. -if [ $? -ne 0 ] ; then
  101. - echo "not found"
  102. - echo "Please install a C compiler and re-run configure."
  103. - exit 1
  104. -else
  105. - echo "$cc"
  106. -fi
  107. -
  108. -printf "checking for -w compiler flag... "
  109. -wflagcheck
  110. -if [ $? -ne 0 ] ; then
  111. - echo "no"
  112. -else
  113. - cflags="$cflags -w"
  114. - echo "yes"
  115. -fi
  116. -
  117. -printf "checking for OS... "
  118. -libs='-lncurses'
  119. -os=`uname -s`
  120. -echo "$os"
  121. -
  122. -case "x$os" in
  123. - "xLinux"|"xCYGWIN"*)
  124. - cflags="$cflags -D_GNU_SOURCE -D__dead=\"__attribute__((__noreturn__))\" -Dst_mtimespec=st_mtim"
  125. - ;;
  126. - "xDarwin")
  127. - cflags="$cflags -DMSG_NOSIGNAL=SO_NOSIGPIPE -DLOGIN_NAME_MAX=MAXLOGNAME"
  128. - libs="$libs -lutil"
  129. - ;;
  130. - "xFreeBSD")
  131. - cflags="$cflags -D__dead=__dead2 -DLOGIN_NAME_MAX=MAXLOGNAME"
  132. - libs="$libs -lutil"
  133. - ;;
  134. - "xOpenBSD")
  135. - libs="$libs -lutil"
  136. - ;;
  137. - "xNetBSD")
  138. - cflags="$cflags -D_OPENBSD_SOURCE"
  139. - libs="$libs -lutil"
  140. - ;;
  141. - "xDragonFly")
  142. - cflags="$cflags -D__dead=__dead2 -DLOGIN_NAME_MAX=MAXLOGNAME"
  143. - libs="$libs -lutil"
  144. - ;;
  145. -esac
  146. +# OpenWrt
  147. +libs='-lncurses -lpcreposix'
  148. +cflags="$cflags -D_GNU_SOURCE -D__dead=\"__attribute__((__noreturn__))\" -Dst_mtimespec=st_mtim"
  149. cat << EOF > config.h
  150. /* This file generated automatically by configure. */
  151. @@ -357,6 +283,15 @@
  152. EOF
  153. +printf "checking for fgetln... "
  154. +fgetlncheck
  155. +if [ $? -eq 0 ] ; then
  156. + echo "#define HAVE_FGETLN" >> config.h
  157. + echo "yes"
  158. +else
  159. + echo "no"
  160. +fi
  161. +
  162. printf "checking for fparseln... "
  163. fparselncheck
  164. if [ $? -eq 0 ] ; then
  165. diff -urN a/fparseln.c b/fparseln.c
  166. --- a/fparseln.c 2019-03-03 22:17:03.000000000 +0900
  167. +++ b/fparseln.c 2019-06-04 13:05:38.815543338 +0900
  168. @@ -74,6 +74,8 @@
  169. #include "util.h"
  170. #endif
  171. +#ifndef HAVE_FGETLN
  172. +
  173. static char *
  174. fgetln(FILE *fp, size_t *len)
  175. {
  176. @@ -119,6 +121,8 @@
  177. return buf;
  178. }
  179. +#endif /* !HAVE_FGETLN */
  180. +
  181. static int isescaped(const char *, const char *, int);
  182. /* isescaped():
  183. diff -urN a/linux.h b/linux.h
  184. --- a/linux.h 2019-03-03 22:17:03.000000000 +0900
  185. +++ b/linux.h 2019-06-04 13:45:21.787063324 +0900
  186. @@ -7,6 +7,7 @@
  187. #endif
  188. #include <sys/types.h>
  189. +#include <sys/stat.h>
  190. #include <stdio.h>
  191. /* Defines */