build: PHP<7.2 compatibility
[m6w6/ext-psi] / m4 / psi / psi.m4
index 9bb1a4bb57408f7b573420199c3d9fb4575bd705..d9dd4c44fac6d78ea604870727e1791f212efa47 100644 (file)
@@ -7,6 +7,16 @@ AC_DEFUN(PSI_CONFIG_INIT, [
        psi_save_LIBS=$LIBS
        LIBS=
 
+       AC_PROG_AWK
+       AC_PATH_PROG(NM, nm)
+       AC_CACHE_CHECK(for libc start main symbol, psi_cv_libc_main, [
+               psi_libc_main=
+               AC_TRY_LINK(PSI_INCLUDES, [(void)0;], [
+                       psi_libc_main=`nm -g conftest$ac_exeext | $AWK -F ' *|@' '/^@<:@@<:@:space:@:>@@:>@+U / {print$[]3; exit}'`
+               ])
+               psi_cv_libc_main=$psi_libc_main
+       ])
+
        if test "$PHP_PSI_MAINTAINER_MODE" = "yes"; then
                PSI_FAST_CONFIG=true
                PSI_DEPS=true
@@ -15,7 +25,6 @@ AC_DEFUN(PSI_CONFIG_INIT, [
                PHP_SUBST(PSI_DEPS)
                
                PSI_CONFIG_TMP=$(mktemp -d)
-               PSI_FUNC_LIBC_MAIN
        else
                PSI_FAST_CONFIG=false
                PSI_DEPS=false