To: [email protected]
Subject: Patch 7.4a.010
Fcc: outbox
From: Bram Moolenaar <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4a.010
Problem:    Test 86 and 97 fail when building with Python or Python 3 and
           using a static library.
Solution:   Add configure check to add -fPIE compiler flag.
Files:      src/configure.in, src/auto/configure


*** ../vim-7.4a.009/src/configure.in    2013-07-03 19:25:28.000000000 +0200
--- src/configure.in    2013-07-09 21:54:12.000000000 +0200
***************
*** 1353,1364 ****
--- 1353,1396 ----
   PYTHON_OBJ="objects/if_python.o"
   PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\""
   PYTHON_LIBS=
+ elif test "$python_ok" = yes; then
+   dnl Check that adding -fPIE works.  It may be needed when using a static
+   dnl Python library.
+   AC_MSG_CHECKING([if -fPIE can be added for Python])
+   cflags_save=$CFLAGS
+   libs_save=$LIBS
+   CFLAGS="$CFLAGS $PYTHON_CFLAGS -fPIE"
+   LIBS="$LIBS $PYTHON_LIBS"
+   AC_TRY_LINK(,[ ],
+        AC_MSG_RESULT(yes); fpie_ok=yes,
+        AC_MSG_RESULT(no); fpie_ok=no)
+   CFLAGS=$cflags_save
+   LIBS=$libs_save
+   if test $fpie_ok = yes; then
+     PYTHON_CFLAGS="$PYTHON_CFLAGS -fPIE"
+   fi
 elif test "$python3_ok" = yes && test "$enable_python3interp" = "dynamic"; then
   AC_DEFINE(DYNAMIC_PYTHON3)
   PYTHON3_SRC="if_python3.c"
   PYTHON3_OBJ="objects/if_python3.o"
   PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${python3_INSTSONAME}\\\""
   PYTHON3_LIBS=
+ elif test "$python3_ok" = yes; then
+   dnl Check that adding -fPIE works.  It may be needed when using a static
+   dnl Python library.
+   AC_MSG_CHECKING([if -fPIE can be added for Python3])
+   cflags_save=$CFLAGS
+   libs_save=$LIBS
+   CFLAGS="$CFLAGS $PYTHON3_CFLAGS -fPIE"
+   LIBS="$LIBS $PYTHON3_LIBS"
+   AC_TRY_LINK(,[ ],
+        AC_MSG_RESULT(yes); fpie_ok=yes,
+        AC_MSG_RESULT(no); fpie_ok=no)
+   CFLAGS=$cflags_save
+   LIBS=$libs_save
+   if test $fpie_ok = yes; then
+     PYTHON3_CFLAGS="$PYTHON3_CFLAGS -fPIE"
+   fi
 fi

 AC_MSG_CHECKING(--enable-tclinterp argument)
*** ../vim-7.4a.009/src/auto/configure  2013-07-03 19:25:34.000000000 +0200
--- src/auto/configure  2013-07-09 21:54:15.000000000 +0200
***************
*** 5991,5996 ****
--- 5991,6028 ----
   PYTHON_OBJ="objects/if_python.o"
   PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\""
   PYTHON_LIBS=
+ elif test "$python_ok" = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -fPIE can be added for Python" >&5
+ $as_echo_n "checking if -fPIE can be added for Python... " >&6; }
+   cflags_save=$CFLAGS
+   libs_save=$LIBS
+   CFLAGS="$CFLAGS $PYTHON_CFLAGS -fPIE"
+   LIBS="$LIBS $PYTHON_LIBS"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+
+ int
+ main ()
+ {
+
+   ;
+   return 0;
+ }
+ _ACEOF
+ if ac_fn_c_try_link "$LINENO"; then :
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ $as_echo "yes" >&6; }; fpie_ok=yes
+ else
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ $as_echo "no" >&6; }; fpie_ok=no
+ fi
+ rm -f core conftest.err conftest.$ac_objext \
+     conftest$ac_exeext conftest.$ac_ext
+   CFLAGS=$cflags_save
+   LIBS=$libs_save
+   if test $fpie_ok = yes; then
+     PYTHON_CFLAGS="$PYTHON_CFLAGS -fPIE"
+   fi
 elif test "$python3_ok" = yes && test "$enable_python3interp" = "dynamic"; then
   $as_echo "#define DYNAMIC_PYTHON3 1" >>confdefs.h

***************
*** 5998,6003 ****
--- 6030,6067 ----
   PYTHON3_OBJ="objects/if_python3.o"
   PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${python3_INSTSONAME}\\\""
   PYTHON3_LIBS=
+ elif test "$python3_ok" = yes; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -fPIE can be added for Python3" >&5
+ $as_echo_n "checking if -fPIE can be added for Python3... " >&6; }
+   cflags_save=$CFLAGS
+   libs_save=$LIBS
+   CFLAGS="$CFLAGS $PYTHON3_CFLAGS -fPIE"
+   LIBS="$LIBS $PYTHON3_LIBS"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+
+ int
+ main ()
+ {
+
+   ;
+   return 0;
+ }
+ _ACEOF
+ if ac_fn_c_try_link "$LINENO"; then :
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+ $as_echo "yes" >&6; }; fpie_ok=yes
+ else
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+ $as_echo "no" >&6; }; fpie_ok=no
+ fi
+ rm -f core conftest.err conftest.$ac_objext \
+     conftest$ac_exeext conftest.$ac_ext
+   CFLAGS=$cflags_save
+   LIBS=$libs_save
+   if test $fpie_ok = yes; then
+     PYTHON3_CFLAGS="$PYTHON3_CFLAGS -fPIE"
+   fi
 fi

 { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-tclinterp argument" >&5
*** ../vim-7.4a.009/src/version.c       2013-07-09 17:42:42.000000000 +0200
--- src/version.c       2013-07-09 21:56:54.000000000 +0200
***************
*** 729,730 ****
--- 729,732 ----
 {   /* Add new patch number below this line */
+ /**/
+     10,
 /**/

--
(letter from Mark to Mike, about the film's probable certificate)
     For an 'A' we would have to: Lose as many shits as possible; Take Jesus
     Christ out, if possible; Loose "I fart in your general direction"; Lose
     "the oral sex"; Lose "oh, fuck off"; Lose "We make castanets out of your
     testicles"
                "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
\\\            help me help AIDS victims -- http://ICCF-Holland.org    ///