| 1 |
Description: Correct library dependency for openpty/forkpty |
| 2 |
Forwarded: Yes |
| 3 |
Author: NIIBE Yutaka <[email protected]> |
| 4 |
Last-Update: 2020-12-17 |
| 5 |
|
| 6 |
Index: gauche/configure.ac |
| 7 |
=================================================================== |
| 8 |
--- gauche.orig/configure.ac |
| 9 |
+++ gauche/configure.ac |
| 10 |
@@ -399,7 +399,7 @@ AC_HEADER_TIME |
| 11 |
AC_CHECK_HEADERS(time.h sys/time.h sys/types.h glob.h dlfcn.h getopt.h sched.h) |
| 12 |
AC_CHECK_HEADERS(unistd.h rpc/types.h malloc.h) |
| 13 |
AC_CHECK_HEADERS(syslog.h crypt.h) |
| 14 |
-AC_CHECK_HEADERS(pty.h util.h bsd/libutil.h libutil.h sys/loadavg.h sys/resource.h) |
| 15 |
+AC_CHECK_HEADERS(sys/loadavg.h sys/resource.h) |
| 16 |
AC_CHECK_HEADERS(sys/statvfs.h) |
| 17 |
|
| 18 |
dnl glibc specific |
| 19 |
@@ -558,10 +558,6 @@ dnl version of gauche. Thus we explicit |
| 20 |
case "$host" in |
| 21 |
*cygwin*) |
| 22 |
: ;; |
| 23 |
- *) |
| 24 |
- AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, [Define if you have openpty])) |
| 25 |
- AC_SEARCH_LIBS(forkpty, util, AC_DEFINE(HAVE_FORKPTY, 1, [Define if you have forkpty])) |
| 26 |
- ;; |
| 27 |
esac |
| 28 |
|
| 29 |
dnl Check for fcntl |
| 30 |
@@ -863,6 +859,7 @@ EXT_LIBS= |
| 31 |
m4_include([ext/charconv/charconv.ac]) |
| 32 |
m4_include([ext/dbm/dbm.ac]) |
| 33 |
m4_include([ext/net/net.ac]) |
| 34 |
+m4_include([ext/termios/termios.ac]) |
| 35 |
m4_include([ext/zlib/zlib.ac]) |
| 36 |
m4_include([ext/tls/tls.ac]) |
| 37 |
|
| 38 |
Index: gauche/ext/termios/termios.ac |
| 39 |
=================================================================== |
| 40 |
--- /dev/null |
| 41 |
+++ gauche/ext/termios/termios.ac |
| 42 |
@@ -0,0 +1,27 @@ |
| 43 |
+dnl |
| 44 |
+dnl Configure ext/termios |
| 45 |
+dnl This file is included by the toplevel configure.in |
| 46 |
+dnl |
| 47 |
+AC_CONFIG_HEADER(ext/termios/termios_config.h) |
| 48 |
+AC_CHECK_HEADERS(pty.h util.h libutil.h) |
| 49 |
+dnl |
| 50 |
+ac_termios_save_LIBS=$LIBS |
| 51 |
+AC_CHECK_FUNC(openpty, , [AC_CHECK_LIB(util, openpty)]) |
| 52 |
+if test "x$ac_cv_func_openpty" = xyes -o "x$ac_cv_lib_util_openpty" = xyes; then |
| 53 |
+ AC_DEFINE(HAVE_OPENPTY, 1, [Define if you have openpty]) |
| 54 |
+fi |
| 55 |
+AC_CHECK_FUNC(forkpty, , [AC_CHECK_LIB(util, forkpty)]) |
| 56 |
+if test "x$ac_cv_func_forkpty" = xyes -o "x$ac_cv_lib_util_forkpty" = xyes; then |
| 57 |
+ AC_DEFINE(HAVE_FORKPTY, 1, [Define if you have forkpty]) |
| 58 |
+fi |
| 59 |
+if test "x$ac_cv_lib_util_openpty" = xyes -o "x$ac_cv_lib_util_forkpty" = xyes; then |
| 60 |
+ TERMIOSLIB="-lutil" |
| 61 |
+fi |
| 62 |
+LIBS=$ac_termios_save_LIBS |
| 63 |
+AC_SUBST(TERMIOSLIB) |
| 64 |
+ |
| 65 |
+EXT_LIBS="$EXT_LIBS $TERMIOSLIB" |
| 66 |
+ |
| 67 |
+dnl Local variables: |
| 68 |
+dnl mode: autoconf |
| 69 |
+dnl end: |
| 70 |
Index: gauche/ext/termios/Makefile.in |
| 71 |
=================================================================== |
| 72 |
--- gauche.orig/ext/termios/Makefile.in |
| 73 |
+++ gauche/ext/termios/Makefile.in |
| 74 |
@@ -11,13 +11,14 @@ SCMFILES = termios.sci |
| 75 |
|
| 76 |
OBJECTS = termios.$(OBJEXT) gauche--termios.$(OBJEXT) |
| 77 |
|
| 78 |
-GENERATED = Makefile |
| 79 |
+GENERATED = Makefile termios_config.h |
| 80 |
XCLEANFILES = gauche--termios.c termios.sci |
| 81 |
+TERMIOSLIB = @TERMIOSLIB@ |
| 82 |
|
| 83 |
all : $(LIBFILES) |
| 84 |
|
| 85 |
gauche--termios.$(SOEXT) : $(OBJECTS) |
| 86 |
- $(MODLINK) gauche--termios.$(SOEXT) $(OBJECTS) $(EXT_LIBGAUCHE) $(LIBS) |
| 87 |
+ $(MODLINK) gauche--termios.$(SOEXT) $(OBJECTS) $(EXT_LIBGAUCHE) $(LIBS) $(TERMIOSLIB) |
| 88 |
|
| 89 |
gauche--termios.c termios.sci : termios.scm |
| 90 |
$(PRECOMP) -e -P -o gauche--termios $(srcdir)/termios.scm |
| 91 |
Index: gauche/ext/termios/termios.c |
| 92 |
=================================================================== |
| 93 |
--- gauche.orig/ext/termios/termios.c |
| 94 |
+++ gauche/ext/termios/termios.c |
| 95 |
@@ -36,6 +36,7 @@ |
| 96 |
#include <gauche/class.h> |
| 97 |
#include <gauche/extend.h> |
| 98 |
|
| 99 |
+#include "termios_config.h" |
| 100 |
#include "gauche-termios.h" |
| 101 |
|
| 102 |
#if !defined(GAUCHE_WINDOWS) |
| 103 |
Index: gauche/ext/termios/termios_config.h.in |
| 104 |
=================================================================== |
| 105 |
--- /dev/null |
| 106 |
+++ gauche/ext/termios/termios_config.h.in |
| 107 |
@@ -0,0 +1,15 @@ |
| 108 |
+/* Define if you have forkpty */ |
| 109 |
+#undef HAVE_FORKPTY |
| 110 |
+ |
| 111 |
+/* Define to 1 if you have the <libutil.h> header file. */ |
| 112 |
+#undef HAVE_LIBUTIL_H |
| 113 |
+ |
| 114 |
+/* Define if you have openpty */ |
| 115 |
+#undef HAVE_OPENPTY |
| 116 |
+ |
| 117 |
+/* Define to 1 if you have the <pty.h> header file. */ |
| 118 |
+#undef HAVE_PTY_H |
| 119 |
+ |
| 120 |
+/* Define to 1 if you have the <util.h> header file. */ |
| 121 |
+#undef HAVE_UTIL_H |
| 122 |
+ |
| 123 |
Index: gauche/ext/termios/termios.scm |
| 124 |
=================================================================== |
| 125 |
--- gauche.orig/ext/termios/termios.scm |
| 126 |
+++ gauche/ext/termios/termios.scm |
| 127 |
@@ -39,6 +39,7 @@ |
| 128 |
|
| 129 |
(inline-stub |
| 130 |
(declcode |
| 131 |
+ (.include "termios_config.h") |
| 132 |
(.include "gauche-termios.h")) |
| 133 |
|
| 134 |
;;--------------------------------------------------------------------- |
| 135 |
Index: gauche/src/gauche/config.h.in |
| 136 |
=================================================================== |
| 137 |
--- gauche.orig/src/gauche/config.h.in |
| 138 |
+++ gauche/src/gauche/config.h.in |
| 139 |
@@ -132,9 +132,6 @@ |
| 140 |
*/ |
| 141 |
#undef HAVE_ALLOCA_H |
| 142 |
|
| 143 |
-/* Define to 1 if you have the <bsd/libutil.h> header file. */ |
| 144 |
-#undef HAVE_BSD_LIBUTIL_H |
| 145 |
- |
| 146 |
/* Define to 1 if you have the `clearenv' function. */ |
| 147 |
#undef HAVE_CLEARENV |
| 148 |
|
| 149 |
@@ -168,9 +165,6 @@ |
| 150 |
/* Define if you have fcntl */ |
| 151 |
#undef HAVE_FCNTL |
| 152 |
|
| 153 |
-/* Define if you have forkpty */ |
| 154 |
-#undef HAVE_FORKPTY |
| 155 |
- |
| 156 |
/* Define to 1 if you have the `fpsetprec' function. */ |
| 157 |
#undef HAVE_FPSETPREC |
| 158 |
|
| 159 |
@@ -255,9 +249,6 @@ |
| 160 |
/* Define to 1 if you have the `sunmath' library (-lsunmath). */ |
| 161 |
#undef HAVE_LIBSUNMATH |
| 162 |
|
| 163 |
-/* Define to 1 if you have the <libutil.h> header file. */ |
| 164 |
-#undef HAVE_LIBUTIL_H |
| 165 |
- |
| 166 |
/* Define to 1 if the system has the type `long double'. */ |
| 167 |
#undef HAVE_LONG_DOUBLE |
| 168 |
|
| 169 |
@@ -294,15 +285,9 @@ |
| 170 |
/* Define to 1 if you have the <net/if.h> header file. */ |
| 171 |
#undef HAVE_NET_IF_H |
| 172 |
|
| 173 |
-/* Define if you have openpty */ |
| 174 |
-#undef HAVE_OPENPTY |
| 175 |
- |
| 176 |
/* Define to 1 if the system has the type `pthread_spinlock_t'. */ |
| 177 |
#undef HAVE_PTHREAD_SPINLOCK_T |
| 178 |
|
| 179 |
-/* Define to 1 if you have the <pty.h> header file. */ |
| 180 |
-#undef HAVE_PTY_H |
| 181 |
- |
| 182 |
/* Define to 1 if you have the `putenv' function. */ |
| 183 |
#undef HAVE_PUTENV |
| 184 |
|