Skip to content

Commit 827ad65

Browse files
author
Sascha Schumann
committed
@- Added --disable-pic for disabling generating PIC for shared objects
on platforms which support it (i.e. Linux) (Sascha) Additionally, we enforce passing pthread_cflags to the compiler, if libtool chooses it as linker.
1 parent 608b96a commit 827ad65

File tree

1 file changed

+35
-9
lines changed

1 file changed

+35
-9
lines changed

configure.in

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,15 @@ AC_ARG_ENABLE(url-fopen-wrapper,
540540
AC_MSG_RESULT(yes)
541541
])
542542
543+
AC_MSG_CHECKING(whether to enable PIC for shared objects)
544+
AC_ARG_ENABLE(pic,
545+
[ --disable-pic Disable PIC for shared objects],[
546+
PHP_PIC=$enableval
547+
],[
548+
PHP_PIC=yes
549+
])
550+
AC_MSG_RESULT($PHP_PIC)
551+
543552
DMALLOC_RESULT=no
544553
AC_MSG_CHECKING(whether to enable dmalloc)
545554
AC_ARG_ENABLE(dmalloc,
@@ -657,15 +666,6 @@ if test "$abs_srcdir" != "$abs_builddir"; then
657666
fi
658667
fi
659668
660-
dnl *** Commented out - generates slow code and consumes a lot of
661-
dnl *** resources during compilation - we need to figure out how
662-
dnl *** to supply it only when absolutely necessary
663-
dnl If we are using gcc add -fpic to make dl() work on some platforms
664-
dnl test -n "$GCC" && CFLAGS="$CFLAGS -fpic"
665-
666-
dnl add -fPIC option on Solaris if we are building dynamic extensions
667-
dnl PHP_SOLARIS_PIC_WEIRDNESS
668-
669669
EXTRA_LIBS="$EXTRA_LIBS $DLIBS $LIBS"
670670
LIBS=""
671671
LDFLAGS=""
@@ -742,6 +742,18 @@ PHP_SUBST(WARNING_LEVEL)
742742
PHP_SUBST(YACC)
743743
744744
PHP_CONFIGURE_PART(Configuring libtool)
745+
746+
old_CC="$CC"
747+
748+
if test "$PHP_THREAD_SAFETY" = "yes" && test -n "$ac_cv_pthreads_cflags"; then
749+
cat >meta_ccld<<EOF
750+
#! /bin/sh
751+
exec $CC $ac_cv_pthreads_cflags \$@
752+
EOF
753+
CC="$abs_builddir/meta_ccld"
754+
chmod +x meta_ccld
755+
fi
756+
745757
AM_PROG_LIBTOOL
746758
if test "$enable_debug" != "yes"; then
747759
AM_SET_LIBTOOL_VARIABLE([--silent])
@@ -761,6 +773,20 @@ else
761773
fi
762774
fi
763775
776+
CC="$old_CC"
777+
778+
changequote({,})
779+
if test "$PHP_PIC" = "no"; then
780+
cat >meta_cc<<EOF
781+
#! /bin/sh
782+
cmd="$CC \`echo \$@|sed s/-[fFD]PIC//g\`"
783+
exec \$cmd
784+
EOF
785+
chmod +x meta_cc
786+
CC="$abs_builddir/meta_cc"
787+
fi
788+
changequote([,])
789+
764790
test "$prefix" = "NONE" && prefix="/usr/local"
765791
test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
766792

0 commit comments

Comments
 (0)