$NetBSD: patch-aa,v 1.1.1.1 2005/03/06 16:36:08 taca Exp $ --- configure.in.orig 2002-11-13 13:59:18.000000000 -0500 +++ configure.in @@ -264,6 +264,8 @@ os2_emx*) LIBS="-lm $LIBS" ac_cv_lib_dir_opendir=no;; msdosdjgpp*) LIBS="-lm $LIBS" ac_cv_func_getpgrp_void=yes;; +interix3*) LIBS="-lm $LIBS" + ac_cv_func_getpgrp_void=yes;; freebsd*) LIBS="-lm $LIBS" AC_CACHE_CHECK([whether -lxpg4 has to be linked], rb_cv_lib_xpg4_needed, @@ -324,7 +326,8 @@ AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(stdlib.h string.h unistd.h limits.h sys/file.h sys/ioctl.h\ fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\ - syscall.h pwd.h a.out.h utime.h memory.h direct.h sys/resource.h) + syscall.h pwd.h a.out.h utime.h memory.h direct.h sys/resource.h\ + pthread.h ucontext.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_TYPE_UID_T @@ -456,6 +459,49 @@ else AC_DEFINE_UNQUOTED(FILE_COUNT, $rb_cv_fcnt) fi +if test "$enable_pthread" = "yes"; then + AC_CHECK_LIB(pthread, pthread_kill, + rb_with_pthread=yes, rb_with_pthread=no) + if test "$rb_with_pthread" = "yes"; then + LIBS="-lpthread $LIBS" + AC_DEFINE(_REENTRANT) + AC_DEFINE(_THREAD_SAFE) + AC_DEFINE(HAVE_LIBPTHREAD) + else + AC_CHECK_LIB(pthreads, pthread_kill, + rb_with_pthread=yes, rb_with_pthread=no) + if test "$rb_with_pthread" = "yes"; then + LIBS="-lpthreads $LIBS" + AC_DEFINE(_REENTRANT) + AC_DEFINE(_THREAD_SAFE) + AC_DEFINE(HAVE_LIBPTHREAD) + else + AC_CHECK_LIB(c, pthread_kill, + rb_with_pthread=yes, rb_with_pthread=no) + if test "$rb_with_pthread" = "yes"; then + AC_DEFINE(_REENTRANT) + AC_DEFINE(_THREAD_SAFE) + AC_DEFINE(HAVE_LIBPTHREAD) + else + AC_CHECK_LIB(c_r, pthread_kill, + rb_with_pthread=yes, rb_with_pthread=no) + if test "$rb_with_pthread" = "yes"; then + AC_DEFINE(_REENTRANT) + AC_DEFINE(_THREAD_SAFE) + AC_DEFINE(HAVE_LIBPTHREAD) + MAINLIBS="-pthread $MAINLIBS" + else + AC_MSG_WARN('Don\'t know how to find pthread library on your system -- thread support disabled') + fi + fi + fi + fi + AC_CHECK_FUNC(nanosleep) + if test "$ac_cv_func_nanosleep" = "no"; then + AC_CHECK_LIB(rt, nanosleep, AC_DEFINE(HAVE_NANOSLEEP)) + fi +fi + dnl default value for $KANJI DEFAULT_KCODE="KCODE_NONE" @@ -549,6 +595,7 @@ if test "$with_dln_a_out" != yes; then cygwin*) ;; mingw*) ;; netbsd*) CCDLFLAGS=-fPIC;; + interix3*) ;; *) CCDLFLAGS=-fPIC;; esac else @@ -563,7 +610,7 @@ if test "$with_dln_a_out" != yes; then case "$target_os" in hpux*) DLDFLAGS="-E" - LDSHARED='ld -b' + LDSHARED="ld -b $LDSHARED" LDFLAGS="-Wl,-E" rb_cv_dlopen=yes;; solaris*) if test "$GCC" = yes; then @@ -578,7 +625,8 @@ if test "$with_dln_a_out" != yes; then rb_cv_dlopen=yes;; sunos*) LDSHARED='ld -assert nodefinitions' rb_cv_dlopen=yes;; - irix*) LDSHARED='ld -shared' + irix*) LDSHARED='ld -shared -L${X11BASE}/lib${ABI}' + LDFLAGS="-L${X11BASE}/lib${ABI} ${LDFLAGS}" rb_cv_dlopen=yes;; sysv4*) LDSHARED='ld -G' rb_cv_dlopen=yes;; @@ -589,6 +637,12 @@ if test "$with_dln_a_out" != yes; then osf*) LDSHARED="$CC -shared" rb_cv_dlopen=yes ;; linux*) LDSHARED="$CC -shared" + if test "$rb_cv_binary_elf" = yes; then + LDFLAGS="$LDFLAGS -Wl,-export-dynamic" + DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$(.TARGET)' + LIBPATHFLAG=' -L%1$-s' + RPATHFLAG=' -Wl,-R%1$-s' + fi rb_cv_dlopen=yes ;; freebsd*) LDSHARED="$CC -shared" if test "$rb_cv_binary_elf" = yes; then @@ -601,8 +655,18 @@ if test "$with_dln_a_out" != yes; then netbsd*) LDSHARED='${CC} -shared' if test "$rb_cv_binary_elf" = yes; then LDFLAGS="-Wl,-export-dynamic" + DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$(.TARGET)' + LIBPATHFLAG=' -L%1$-s' + RPATHFLAG=' -Wl,-R%1$-s' fi rb_cv_dlopen=yes ;; + interix3*) LDSHARED='${CC} -shared' + LDFLAGS="-Wl,-E" + # use special random-slot linkage in 0x[56]XXXXXXX + DLDFLAGS="$DLDFLAGS "'-Wl,-h,$(.TARGET) -Wl,--image-base,$$(($$RANDOM %4096/2*262144+1342177280))' + LIBPATHFLAG=' -L%1$-s' + RPATHFLAG=' -Wl,-R%1$-s' + rb_cv_dlopen=yes ;; openbsd*) LDSHARED="ld -Bforcearchive -Bshareable" rb_cv_dlopen=yes ;; bsdi3*) case "$CC" in @@ -858,6 +922,7 @@ if test "$enable_shared" = 'yes'; then ;; linux*) LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR)' + LIBRUBYARG_SHARED='-Wl,-R -Wl,${libdir} -L${libdir} -L. -l$(RUBY_SO_NAME)' LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).so' ;; freebsd*) @@ -879,6 +944,14 @@ if test "$enable_shared" = 'yes'; then LIBRUBY_ALIASES="" fi ;; + interix3*) + SOLIBS='$(LIBS)' + LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR)$(MINOR).$(TEENY)' + # link explicitly to 0x48000000 + LIBRUBY_DLDFLAGS='-Wl,-h,lib$(RUBY_INSTALL_NAME).so.$(MAJOR)$(MINOR) -Wl,--image-base,1207959552' + LIBRUBYARG='-Wl,-R -Wl,${prefix}/lib -L${prefix}/lib -L. -l$(RUBY_INSTALL_NAME)' + LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR)$(MINOR) lib$(RUBY_INSTALL_NAME).so' + ;; openbsd*) SOLIBS='$(LIBS)' ;; @@ -1071,6 +1144,10 @@ if test "$search_path" != ""; then AC_DEFINE_UNQUOTED(RUBY_SEARCH_PATH,"$search_path") fi +AC_ARG_ENABLE(pthread, + [--enable-pthread use pthread library.], + [enable_pthread=$enableval], [enable_pthread=no]) + if test -f config.h && tr -d '\015' < confdefs.h | cmp -s config.h -; then echo "config.h unchanged" else