@@ -147,14 +147,15 @@ dnl that gd defines "junk" versions of each gdImageCreateFromFoo function
147147dnl even when it does not support the Foo format. Those junk functions
148148dnl display a warning but eventually return normally, making a simple link
149149dnl or run test insufficient.
150- AC_DEFUN ( [ PHP_GD_CHECK_FORMAT] ,[
151- old_LIBS="${LIBS}"
152- LIBS="${LIBS} ${GD_SHARED_LIBADD}"
153- old_CFLAGS="${CFLAGS}"
154- CFLAGS="${CFLAGS} ${GDLIB_CFLAGS}"
155- AC_MSG_CHECKING ( [ for working gdImageCreateFrom$1 in libgd] )
156- AC_LANG_PUSH ( [ C] )
157- AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [
150+ AC_DEFUN ( [ PHP_GD_CHECK_FORMAT] ,
151+ [ AS_VAR_PUSHDEF ( [ php_var] , [ php_cv_lib_gd_gdImageCreateFrom$1 ] )
152+ old_LIBS="${LIBS}"
153+ LIBS="${LIBS} ${GD_SHARED_LIBADD}"
154+ old_CFLAGS="${CFLAGS}"
155+ CFLAGS="${CFLAGS} ${GDLIB_CFLAGS}"
156+ AC_LANG_PUSH ( [ C] )
157+ AC_CACHE_CHECK ( [ for working gdImageCreateFrom$1 in libgd] , [ php_var] ,
158+ [ AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [
158159#include <stdio.h>
159160#include <unistd.h>
160161#include <gd.h>
@@ -173,17 +174,17 @@ int main(int argc, char** argv) {
173174 gdSetErrorMethod(exit1);
174175 gdImagePtr p = gdImageCreateFrom$1 (f);
175176 return 0;
176- }] ) ] ,[
177- AC_MSG_RESULT ( [ yes] )
178- AC_DEFINE ( $2 , 1 , [ Does gdImageCreateFrom $1 work? ] )
179- ] , [
180- AC_MSG_RESULT ( [ no ] )
181- ] , [
182- AC_MSG_RESULT ( [ no ] )
183- ] )
184- AC_LANG_POP ( [ C ] )
185- CFLAGS ="${old_CFLAGS }"
186- LIBS="${old_LIBS}"
177+ }] ) ] ,
178+ [ AS_VAR_SET ( [ php_var ] , [ yes] ) ] ,
179+ [ AS_VAR_SET ( [ php_var ] , [ no ] ) ] ,
180+ [ AS_VAR_SET ( [ php_var ] , [ no ] ) ] ) ] )
181+ AS_VAR_IF ( [ php_var ] , [ yes ] ,
182+ [ AC_DEFINE_UNQUOTED ( [ $2 ] , [ 1 ] ,
183+ [ Define to 1 if GD library has 'gdImageCreateFrom $1 '. ] ) ] )
184+ AC_LANG_POP ( [ C ] )
185+ CFLAGS="${old_CFLAGS}"
186+ LIBS ="${old_LIBS }"
187+ AS_VAR_POPDEF ( [ php_var ] )
187188] )
188189
189190AC_DEFUN ( [ PHP_GD_CHECK_VERSION] ,[
0 commit comments