Skip to content

Commit 7141036

Browse files
committed
updated for version 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.
1 parent 356a698 commit 7141036

File tree

3 files changed

+98
-0
lines changed

3 files changed

+98
-0
lines changed

src/auto/configure

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5991,13 +5991,77 @@ elif test "$python_ok" = yes && test "$enable_pythoninterp" = "dynamic"; then
59915991
PYTHON_OBJ="objects/if_python.o"
59925992
PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\""
59935993
PYTHON_LIBS=
5994+
elif test "$python_ok" = yes; then
5995+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if -fPIE can be added for Python" >&5
5996+
$as_echo_n "checking if -fPIE can be added for Python... " >&6; }
5997+
cflags_save=$CFLAGS
5998+
libs_save=$LIBS
5999+
CFLAGS="$CFLAGS $PYTHON_CFLAGS -fPIE"
6000+
LIBS="$LIBS $PYTHON_LIBS"
6001+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6002+
/* end confdefs.h. */
6003+
6004+
int
6005+
main ()
6006+
{
6007+
6008+
;
6009+
return 0;
6010+
}
6011+
_ACEOF
6012+
if ac_fn_c_try_link "$LINENO"; then :
6013+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
6014+
$as_echo "yes" >&6; }; fpie_ok=yes
6015+
else
6016+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
6017+
$as_echo "no" >&6; }; fpie_ok=no
6018+
fi
6019+
rm -f core conftest.err conftest.$ac_objext \
6020+
conftest$ac_exeext conftest.$ac_ext
6021+
CFLAGS=$cflags_save
6022+
LIBS=$libs_save
6023+
if test $fpie_ok = yes; then
6024+
PYTHON_CFLAGS="$PYTHON_CFLAGS -fPIE"
6025+
fi
59946026
elif test "$python3_ok" = yes && test "$enable_python3interp" = "dynamic"; then
59956027
$as_echo "#define DYNAMIC_PYTHON3 1" >>confdefs.h
59966028

59976029
PYTHON3_SRC="if_python3.c"
59986030
PYTHON3_OBJ="objects/if_python3.o"
59996031
PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${python3_INSTSONAME}\\\""
60006032
PYTHON3_LIBS=
6033+
elif test "$python3_ok" = yes; then
6034+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if -fPIE can be added for Python3" >&5
6035+
$as_echo_n "checking if -fPIE can be added for Python3... " >&6; }
6036+
cflags_save=$CFLAGS
6037+
libs_save=$LIBS
6038+
CFLAGS="$CFLAGS $PYTHON3_CFLAGS -fPIE"
6039+
LIBS="$LIBS $PYTHON3_LIBS"
6040+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6041+
/* end confdefs.h. */
6042+
6043+
int
6044+
main ()
6045+
{
6046+
6047+
;
6048+
return 0;
6049+
}
6050+
_ACEOF
6051+
if ac_fn_c_try_link "$LINENO"; then :
6052+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
6053+
$as_echo "yes" >&6; }; fpie_ok=yes
6054+
else
6055+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
6056+
$as_echo "no" >&6; }; fpie_ok=no
6057+
fi
6058+
rm -f core conftest.err conftest.$ac_objext \
6059+
conftest$ac_exeext conftest.$ac_ext
6060+
CFLAGS=$cflags_save
6061+
LIBS=$libs_save
6062+
if test $fpie_ok = yes; then
6063+
PYTHON3_CFLAGS="$PYTHON3_CFLAGS -fPIE"
6064+
fi
60016065
fi
60026066

60036067
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-tclinterp argument" >&5

src/configure.in

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,12 +1353,44 @@ elif test "$python_ok" = yes && test "$enable_pythoninterp" = "dynamic"; then
13531353
PYTHON_OBJ="objects/if_python.o"
13541354
PYTHON_CFLAGS="$PYTHON_CFLAGS -DDYNAMIC_PYTHON_DLL=\\\"${python_INSTSONAME}\\\""
13551355
PYTHON_LIBS=
1356+
elif test "$python_ok" = yes; then
1357+
dnl Check that adding -fPIE works. It may be needed when using a static
1358+
dnl Python library.
1359+
AC_MSG_CHECKING([if -fPIE can be added for Python])
1360+
cflags_save=$CFLAGS
1361+
libs_save=$LIBS
1362+
CFLAGS="$CFLAGS $PYTHON_CFLAGS -fPIE"
1363+
LIBS="$LIBS $PYTHON_LIBS"
1364+
AC_TRY_LINK(,[ ],
1365+
AC_MSG_RESULT(yes); fpie_ok=yes,
1366+
AC_MSG_RESULT(no); fpie_ok=no)
1367+
CFLAGS=$cflags_save
1368+
LIBS=$libs_save
1369+
if test $fpie_ok = yes; then
1370+
PYTHON_CFLAGS="$PYTHON_CFLAGS -fPIE"
1371+
fi
13561372
elif test "$python3_ok" = yes && test "$enable_python3interp" = "dynamic"; then
13571373
AC_DEFINE(DYNAMIC_PYTHON3)
13581374
PYTHON3_SRC="if_python3.c"
13591375
PYTHON3_OBJ="objects/if_python3.o"
13601376
PYTHON3_CFLAGS="$PYTHON3_CFLAGS -DDYNAMIC_PYTHON3_DLL=\\\"${python3_INSTSONAME}\\\""
13611377
PYTHON3_LIBS=
1378+
elif test "$python3_ok" = yes; then
1379+
dnl Check that adding -fPIE works. It may be needed when using a static
1380+
dnl Python library.
1381+
AC_MSG_CHECKING([if -fPIE can be added for Python3])
1382+
cflags_save=$CFLAGS
1383+
libs_save=$LIBS
1384+
CFLAGS="$CFLAGS $PYTHON3_CFLAGS -fPIE"
1385+
LIBS="$LIBS $PYTHON3_LIBS"
1386+
AC_TRY_LINK(,[ ],
1387+
AC_MSG_RESULT(yes); fpie_ok=yes,
1388+
AC_MSG_RESULT(no); fpie_ok=no)
1389+
CFLAGS=$cflags_save
1390+
LIBS=$libs_save
1391+
if test $fpie_ok = yes; then
1392+
PYTHON3_CFLAGS="$PYTHON3_CFLAGS -fPIE"
1393+
fi
13621394
fi
13631395

13641396
AC_MSG_CHECKING(--enable-tclinterp argument)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,8 @@ static char *(features[]) =
727727

728728
static int included_patches[] =
729729
{ /* Add new patch number below this line */
730+
/**/
731+
10,
730732
/**/
731733
9,
732734
/**/

0 commit comments

Comments
 (0)