From: NIIBE Y. <gn...@fs...> - 2010-05-11 03:07:19
|
NIIBE Yutaka wrote: > For accurate library dependency, here is a first cut. > > Naming (filename, variable name) would not be good. My intention is > follow the practice of ext/net and ext/dbm. > > The changes are: > > * New configure variable: TERMIOSLIB > * New configure in the ext/termios subdirectory > * New header file in the ext/termios subdirectory > * Move AC_SEARCH_LIBS from configure.ac > * Move HAVE_FORKPTY, HAVE_OPENPTY, HAVE_PTY_H, HAVE_UTIL_H, > HAVE_LIBUTIL_H from config.h.in > > Perhaps, this patch is _not_ yet ready to commit, while I am using it > for Debian build. Specifically, configure output on GNU/Linux was > changed: [...] > This is because of a bug of autoconf, I claim. > I am submitting a patch to bug...@gn.... I did: http://lists.gnu.org/archive/html/bug-autoconf/2010-04/msg00005.html It seems that my use of AC_SERCH_LIBS was mistake, so I stop using it. Besides, I think that Cygwin DLL problem has gone. I found: http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/Makefile.in.diff?r1=1.133&r2=1.134&cvsroot=src&f=h It's date is 2003-09-10. Could Cygwin users confirm this? Here is updated patch. Index: src/gauche/config.h.in =================================================================== --- src/gauche/config.h.in (revision 7133) +++ src/gauche/config.h.in (working copy) @@ -101,9 +101,6 @@ /* Define if the system has dlopen() */ #undef HAVE_DLOPEN -/* Define if you have forkpty */ -#undef HAVE_FORKPTY - /* Define to 1 if you have the <getopt.h> header file. */ #undef HAVE_GETOPT_H @@ -134,9 +131,6 @@ /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM -/* Define to 1 if you have the <libutil.h> header file. */ -#undef HAVE_LIBUTIL_H - /* Define to 1 if you have the `lrand48' function. */ #undef HAVE_LRAND48 @@ -152,15 +146,9 @@ /* Define to 1 if you have the <net/if.h> header file. */ #undef HAVE_NET_IF_H -/* Define if you have openpty */ -#undef HAVE_OPENPTY - /* Define to 1 if you have pthread_spin_init. */ #undef HAVE_PTHREAD_SPINLOCK_T -/* Define to 1 if you have the <pty.h> header file. */ -#undef HAVE_PTY_H - /* Define to 1 if you have the `random' function. */ #undef HAVE_RANDOM @@ -295,9 +283,6 @@ /* Define to 1 if you have the `usleep' function. */ #undef HAVE_USLEEP -/* Define to 1 if you have the <util.h> header file. */ -#undef HAVE_UTIL_H - /* Define if iconv takes const char **input */ #undef ICONV_CONST_INPUT Index: ext/termios/Makefile.in =================================================================== --- ext/termios/Makefile.in (revision 7133) +++ ext/termios/Makefile.in (working copy) @@ -11,13 +11,14 @@ OBJECTS = termios.$(OBJEXT) termiolib.$(OBJEXT) -GENERATED = Makefile +GENERATED = Makefile termios_config.h XCLEANFILES = termiolib.c +TERMIOSLIB = @TERMIOSLIB@ all : $(LIBFILES) gauche--termios.$(SOEXT) : $(OBJECTS) - $(MODLINK) gauche--termios.$(SOEXT) $(OBJECTS) $(EXT_LIBGAUCHE) $(LIBS) + $(MODLINK) gauche--termios.$(SOEXT) $(OBJECTS) $(EXT_LIBGAUCHE) $(LIBS) $(TERMIOSLIB) termiolib.c : termiolib.stub Index: ext/termios/termiolib.stub =================================================================== --- ext/termios/termiolib.stub (revision 7133) +++ ext/termios/termiolib.stub (working copy) @@ -31,6 +31,7 @@ ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;;; +"#include \"termios_config.h\"" "#include \"gauche-termios.h\"" ;;--------------------------------------------------------------------- Index: ext/termios/termios_config.h.in =================================================================== --- ext/termios/termios_config.h.in (revision 0) +++ ext/termios/termios_config.h.in (revision 0) @@ -0,0 +1,15 @@ +/* Define if you have forkpty */ +#undef HAVE_FORKPTY + +/* Define to 1 if you have the <libutil.h> header file. */ +#undef HAVE_LIBUTIL_H + +/* Define if you have openpty */ +#undef HAVE_OPENPTY + +/* Define to 1 if you have the <pty.h> header file. */ +#undef HAVE_PTY_H + +/* Define to 1 if you have the <util.h> header file. */ +#undef HAVE_UTIL_H + Index: ext/termios/termios.c =================================================================== --- ext/termios/termios.c (revision 7133) +++ ext/termios/termios.c (working copy) @@ -36,6 +36,7 @@ #include <gauche/class.h> #include <gauche/extend.h> +#include "termios_config.h" #include "gauche-termios.h" #if !defined(GAUCHE_WINDOWS) Index: ext/termios/termios.ac =================================================================== --- ext/termios/termios.ac (revision 0) +++ ext/termios/termios.ac (revision 0) @@ -0,0 +1,24 @@ +dnl +dnl Configure ext/termios +dnl This file is included by the toplevel configure.in +dnl +AC_CONFIG_HEADER(ext/termios/termios_config.h) +AC_CHECK_HEADERS(pty.h util.h libutil.h) +dnl +ac_termios_save_LIBS=$LIBS +AC_CHECK_FUNC(openpty, , [AC_CHECK_LIB(util, openpty)]) +if test "x$ac_cv_func_openpty" = xyes -o "x$ac_cv_lib_util_openpty" = xyes; then + AC_DEFINE(HAVE_OPENPTY, 1, [Define if you have openpty]) +fi +AC_CHECK_FUNC(forkpty, , [AC_CHECK_LIB(util, forkpty)]) +if test "x$ac_cv_func_forkpty" = xyes -o "x$ac_cv_lib_util_forkpty" = xyes; then + AC_DEFINE(HAVE_FORKPTY, 1, [Define if you have forkpty]) +fi +if test "x$ac_cv_lib_util_openpty" = xyes -o "x$ac_cv_lib_util_forkpty" = xyes; then + TERMIOSLIB="-lutil" +fi +LIBS=$ac_termios_save_LIBS +AC_SUBST(TERMIOSLIB) +dnl Local variables: +dnl mode: autoconf +dnl end: Index: configure.ac =================================================================== --- configure.ac (revision 7133) +++ configure.ac (working copy) @@ -320,7 +320,7 @@ AC_CHECK_HEADERS(sys/time.h sys/types.h glob.h dlfcn.h getopt.h sched.h unistd.h) AC_CHECK_HEADERS(stdint.h inttypes.h rpc/types.h malloc.h) AC_CHECK_HEADERS(syslog.h crypt.h) -AC_CHECK_HEADERS(pty.h util.h libutil.h sys/loadavg.h sys/resource.h) +AC_CHECK_HEADERS(sys/loadavg.h sys/resource.h) dnl solaris specific AC_CHECK_HEADERS(sunmath.h) @@ -422,18 +422,6 @@ AC_CHECK_FUNCS(select);; esac -dnl Checks for pty-related fns. It appears that recent Cygwin has them, -dnl but only in a static library. That prevents us from creating DLL -dnl version of gauche. Thus we explictly exclude them on cygwin. -case "$host" in - *cygwin*) - : ;; - *) - AC_SEARCH_LIBS(openpty, util, AC_DEFINE(HAVE_OPENPTY, 1, [Define if you have openpty])) - AC_SEARCH_LIBS(forkpty, util, AC_DEFINE(HAVE_FORKPTY, 1, [Define if you have forkpty])) - ;; -esac - dnl Checks if crypt() exists and whether it's in libc or libcrypt. dnl Note: on cygwin, libcrypt is only available as a static library, dnl and prevents libgauche.dll from building. We explicitly excludes it. @@ -722,6 +710,7 @@ m4_include([ext/charconv/charconv.ac]) m4_include([ext/dbm/dbm.ac]) m4_include([ext/net/net.ac]) +m4_include([ext/termios/termios.ac]) m4_include([ext/zlib/zlib.ac]) dnl =========================================================== |