To: vim-dev@vim.org Subject: Patch 6.1.393 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.393 Problem: When compiled with Python and threads, detaching the terminal may cause Vim to loop forever. Solution: Add -pthread to $CFLAGS when using Python and gcc. (Daniel Elstner) Files: src/auto/configure,, src/configure.in *** ../vim61.392/src/auto/configure Sat Mar 8 20:33:31 2003 --- src/auto/configure Sat Mar 15 15:40:58 2003 *************** *** 1648,1671 **** fi PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" ! echo $ac_n "checking if -pthread should be used""... $ac_c" 1>&6 ! echo "configure:1636: checking if -pthread should be used" >&5 if test "`(uname) 2>/dev/null`" = FreeBSD; then cflags_save=$CFLAGS libs_save=$LIBS ! CFLAGS="$CFLAGS -D_THREAD_SAFE" ! LIBS="$LIBS -pthread" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ! echo "$ac_t""yes" 1>&6; PYTHON_CFLAGS="$PYTHON_CFLAGS -D_THREAD_SAFE" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 --- 1648,1678 ---- fi PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" ! echo $ac_n "checking if -pthread should be used""... $ac_c" 1>&6 ! echo "configure:1653: checking if -pthread should be used" >&5 ! threadsafe_flag= ! thread_lib= ! test "$GCC" = yes && threadsafe_flag="-pthread" if test "`(uname) 2>/dev/null`" = FreeBSD; then + threadsafe_flag="-D_THREAD_SAFE" + thread_lib="-pthread" + fi + if test -n "$threadsafe_flag"; then cflags_save=$CFLAGS libs_save=$LIBS ! CFLAGS="$CFLAGS $threadsafe_flag" ! LIBS="$LIBS $thread_lib" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ! echo "$ac_t""yes" 1>&6; PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 *** ../vim61.392/src/configure.in Sat Mar 8 20:33:31 2003 --- src/configure.in Sat Mar 15 15:37:52 2003 *************** *** 381,398 **** fi PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" ! dnl On FreeBSD "-pthread" is required to use threads. dnl _THREAD_SAFE must be used for compiling then. dnl The "-pthread" is added to $LIBS, so that the following check for dnl sigaltstack() will look in libc_r (it's there in libc!). AC_MSG_CHECKING([if -pthread should be used]) if test "`(uname) 2>/dev/null`" = FreeBSD; then cflags_save=$CFLAGS libs_save=$LIBS ! CFLAGS="$CFLAGS -D_THREAD_SAFE" ! LIBS="$LIBS -pthread" AC_TRY_LINK(,[ ], ! AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS -D_THREAD_SAFE", AC_MSG_RESULT(no); LIBS=$libs_save ) CFLAGS=$cflags_save --- 381,407 ---- fi PYTHON_GETPATH_CFLAGS="-DPYTHONPATH='\"${vi_cv_path_pythonpath}\"' -DPREFIX='\"${vi_cv_path_python_pfx}\"' -DEXEC_PREFIX='\"${vi_cv_path_python_epfx}\"'" ! dnl On FreeBSD linking with "-pthread" is required to use threads. dnl _THREAD_SAFE must be used for compiling then. dnl The "-pthread" is added to $LIBS, so that the following check for dnl sigaltstack() will look in libc_r (it's there in libc!). + dnl Otherwise, when using GCC, try adding -pthread to $CFLAGS. GCC + dnl will then define target-specific defines, e.g., -D_REENTRANT. AC_MSG_CHECKING([if -pthread should be used]) + threadsafe_flag= + thread_lib= + test "$GCC" = yes && threadsafe_flag="-pthread" if test "`(uname) 2>/dev/null`" = FreeBSD; then + threadsafe_flag="-D_THREAD_SAFE" + thread_lib="-pthread" + fi + if test -n "$threadsafe_flag"; then cflags_save=$CFLAGS libs_save=$LIBS ! CFLAGS="$CFLAGS $threadsafe_flag" ! LIBS="$LIBS $thread_lib" AC_TRY_LINK(,[ ], ! AC_MSG_RESULT(yes); PYTHON_CFLAGS="$PYTHON_CFLAGS $threadsafe_flag", AC_MSG_RESULT(no); LIBS=$libs_save ) CFLAGS=$cflags_save *** ../vim61.392/src/version.c Fri Mar 14 22:54:15 2003 --- src/version.c Sat Mar 15 16:08:08 2003 *************** *** 613,614 **** --- 613,616 ---- { /* Add new patch number below this line */ + /**/ + 393, /**/ -- hundred-and-one symptoms of being an internet addict: 88. Every single time you press the 'Get mail' button...it does get new mail. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///