37
37
#include "php_open_temporary_file.h"
38
38
39
39
40
- #if HAVE_SYS_WAIT_H
40
+ #ifdef HAVE_SYS_WAIT_H
41
41
# include <sys/wait.h>
42
42
#endif
43
- #if HAVE_UNISTD_H
43
+ #ifdef HAVE_UNISTD_H
44
44
# include <unistd.h>
45
45
#endif
46
46
#ifdef PHP_WIN32
51
51
# include <Wingdi.h>
52
52
#endif
53
53
54
- #ifdef HAVE_GD_XPM
54
+ #if defined( HAVE_GD_XPM ) && defined( HAVE_GD_BUNDLED )
55
55
# include <X11/xpm.h>
56
56
#endif
57
57
@@ -68,7 +68,7 @@ static int le_gd, le_gd_font;
68
68
#include <gdfontl.h> /* 4 Large font */
69
69
#include <gdfontg.h> /* 5 Giant font */
70
70
71
- #if HAVE_LIBFREETYPE
71
+ #if defined( HAVE_GD_FREETYPE ) && defined( HAVE_GD_BUNDLED )
72
72
# include <ft2build.h>
73
73
# include FT_FREETYPE_H
74
74
#endif
@@ -81,7 +81,7 @@ static int le_gd, le_gd_font;
81
81
#define M_PI 3.14159265358979323846
82
82
#endif
83
83
84
- #if HAVE_LIBFREETYPE
84
+ #ifdef HAVE_GD_FREETYPE
85
85
static void php_imagettftext_common (INTERNAL_FUNCTION_PARAMETERS , int , int );
86
86
#endif
87
87
@@ -722,7 +722,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_imagegetclip, 0)
722
722
ZEND_ARG_INFO (0 , im )
723
723
ZEND_END_ARG_INFO ()
724
724
725
- #if HAVE_LIBFREETYPE
725
+ #ifdef HAVE_GD_FREETYPE
726
726
ZEND_BEGIN_ARG_INFO_EX (arginfo_imageftbbox , 0 , 0 , 4 )
727
727
ZEND_ARG_INFO (0 , size )
728
728
ZEND_ARG_INFO (0 , angle )
@@ -987,13 +987,11 @@ static const zend_function_entry gd_functions[] = {
987
987
PHP_FE (imagegetclip , arginfo_imagegetclip )
988
988
PHP_FE (imagedashedline , arginfo_imagedashedline )
989
989
990
- #if HAVE_LIBFREETYPE
990
+ #ifdef HAVE_GD_FREETYPE
991
991
PHP_FE (imagettfbbox , arginfo_imagettfbbox )
992
992
PHP_FE (imagettftext , arginfo_imagettftext )
993
- #if HAVE_GD_FREETYPE && HAVE_LIBFREETYPE
994
993
PHP_FE (imageftbbox , arginfo_imageftbbox )
995
994
PHP_FE (imagefttext , arginfo_imagefttext )
996
- #endif
997
995
#endif
998
996
999
997
PHP_FE (imagetypes , arginfo_imagetypes )
@@ -1027,11 +1025,7 @@ zend_module_entry gd_module_entry = {
1027
1025
PHP_MINIT (gd ),
1028
1026
PHP_MSHUTDOWN (gd ),
1029
1027
NULL ,
1030
- #if HAVE_GD_FREETYPE && HAVE_LIBFREETYPE
1031
1028
PHP_RSHUTDOWN (gd ),
1032
- #else
1033
- NULL ,
1034
- #endif
1035
1029
PHP_MINFO (gd ),
1036
1030
PHP_GD_VERSION ,
1037
1031
STANDARD_MODULE_PROPERTIES
@@ -1099,7 +1093,7 @@ PHP_MINIT_FUNCTION(gd)
1099
1093
le_gd = zend_register_list_destructors_ex (php_free_gd_image , NULL , "gd" , module_number );
1100
1094
le_gd_font = zend_register_list_destructors_ex (php_free_gd_font , NULL , "gd font" , module_number );
1101
1095
1102
- #if HAVE_GD_BUNDLED && HAVE_LIBFREETYPE
1096
+ #if defined( HAVE_GD_FREETYPE ) && defined( HAVE_GD_BUNDLED )
1103
1097
gdFontCacheMutexSetup ();
1104
1098
#endif
1105
1099
gdSetErrorMethod (php_gd_error_method );
@@ -1238,7 +1232,7 @@ PHP_MINIT_FUNCTION(gd)
1238
1232
*/
1239
1233
PHP_MSHUTDOWN_FUNCTION (gd )
1240
1234
{
1241
- #if HAVE_GD_BUNDLED && HAVE_LIBFREETYPE
1235
+ #if defined( HAVE_GD_FREETYPE ) && defined( HAVE_GD_BUNDLED )
1242
1236
gdFontCacheMutexShutdown ();
1243
1237
#endif
1244
1238
return SUCCESS ;
@@ -1247,13 +1241,13 @@ PHP_MSHUTDOWN_FUNCTION(gd)
1247
1241
1248
1242
/* {{{ PHP_RSHUTDOWN_FUNCTION
1249
1243
*/
1250
- #if HAVE_GD_FREETYPE && HAVE_LIBFREETYPE
1251
1244
PHP_RSHUTDOWN_FUNCTION (gd )
1252
1245
{
1246
+ #ifdef HAVE_GD_FREETYPE
1253
1247
gdFontCacheShutdown ();
1248
+ #endif
1254
1249
return SUCCESS ;
1255
1250
}
1256
- #endif
1257
1251
/* }}} */
1258
1252
1259
1253
#if defined(HAVE_GD_BUNDLED )
@@ -1280,9 +1274,10 @@ PHP_MINFO_FUNCTION(gd)
1280
1274
#endif
1281
1275
#endif
1282
1276
1283
- #if HAVE_LIBFREETYPE
1277
+ #ifdef HAVE_GD_FREETYPE
1284
1278
php_info_print_table_row (2 , "FreeType Support" , "enabled" );
1285
1279
php_info_print_table_row (2 , "FreeType Linkage" , "with freetype" );
1280
+ #ifdef HAVE_GD_BUNDLED
1286
1281
{
1287
1282
char tmp [256 ];
1288
1283
@@ -1295,6 +1290,7 @@ PHP_MINFO_FUNCTION(gd)
1295
1290
#endif
1296
1291
php_info_print_table_row (2 , "FreeType Version" , tmp );
1297
1292
}
1293
+ #endif
1298
1294
#endif
1299
1295
1300
1296
php_info_print_table_row (2 , "GIF Read Support" , "enabled" );
@@ -1303,22 +1299,28 @@ PHP_MINFO_FUNCTION(gd)
1303
1299
#ifdef HAVE_GD_JPG
1304
1300
{
1305
1301
php_info_print_table_row (2 , "JPEG Support" , "enabled" );
1302
+ #if defined(HAVE_GD_BUNDLED )
1306
1303
php_info_print_table_row (2 , "libJPEG Version" , gdJpegGetVersionString ());
1304
+ #endif
1307
1305
}
1308
1306
#endif
1309
1307
1310
1308
#ifdef HAVE_GD_PNG
1311
1309
php_info_print_table_row (2 , "PNG Support" , "enabled" );
1310
+ #if defined(HAVE_GD_BUNDLED )
1312
1311
php_info_print_table_row (2 , "libPNG Version" , gdPngGetVersionString ());
1312
+ #endif
1313
1313
#endif
1314
1314
php_info_print_table_row (2 , "WBMP Support" , "enabled" );
1315
1315
#if defined(HAVE_GD_XPM )
1316
1316
php_info_print_table_row (2 , "XPM Support" , "enabled" );
1317
+ #if defined(HAVE_GD_BUNDLED )
1317
1318
{
1318
1319
char tmp [12 ];
1319
1320
snprintf (tmp , sizeof (tmp ), "%d" , XpmLibraryVersion ());
1320
1321
php_info_print_table_row (2 , "libXpm Version" , tmp );
1321
1322
}
1323
+ #endif
1322
1324
#endif
1323
1325
php_info_print_table_row (2 , "XBM Support" , "enabled" );
1324
1326
#if defined(USE_GD_JISX0208 )
@@ -1350,7 +1352,7 @@ PHP_FUNCTION(gd_info)
1350
1352
1351
1353
add_assoc_string (return_value , "GD Version" , PHP_GD_VERSION_STRING );
1352
1354
1353
- #if HAVE_LIBFREETYPE
1355
+ #ifdef HAVE_GD_FREETYPE
1354
1356
add_assoc_bool (return_value , "FreeType Support" , 1 );
1355
1357
add_assoc_string (return_value , "FreeType Linkage" , "with freetype" );
1356
1358
#else
@@ -3965,14 +3967,10 @@ PHP_FUNCTION(imagegetclip)
3965
3967
}
3966
3968
/* }}} */
3967
3969
3968
- #if HAVE_LIBFREETYPE
3969
3970
#define TTFTEXT_DRAW 0
3970
3971
#define TTFTEXT_BBOX 1
3971
- #endif
3972
-
3973
- #if HAVE_LIBFREETYPE
3974
3972
3975
- #if HAVE_GD_FREETYPE
3973
+ #ifdef HAVE_GD_FREETYPE
3976
3974
/* {{{ proto array imageftbbox(float size, float angle, string font_file, string text [, array extrainfo])
3977
3975
Give the bounding box of a text using fonts via freetype2 */
3978
3976
PHP_FUNCTION (imageftbbox )
@@ -3988,7 +3986,6 @@ PHP_FUNCTION(imagefttext)
3988
3986
php_imagettftext_common (INTERNAL_FUNCTION_PARAM_PASSTHRU , TTFTEXT_DRAW , 1 );
3989
3987
}
3990
3988
/* }}} */
3991
- #endif /* HAVE_GD_FREETYPE */
3992
3989
3993
3990
/* {{{ proto array imagettfbbox(float size, float angle, string font_file, string text)
3994
3991
Give the bounding box of a text using TrueType fonts */
@@ -4069,14 +4066,11 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
4069
4066
4070
4067
PHP_GD_CHECK_OPEN_BASEDIR (fontname , "Invalid font filename" );
4071
4068
4072
- #ifdef HAVE_GD_FREETYPE
4073
4069
if (extended ) {
4074
4070
error = gdImageStringFTEx (im , brect , col , fontname , ptsize , angle , x , y , str , & strex );
4075
- }
4076
- else
4071
+ } else {
4077
4072
error = gdImageStringFT (im , brect , col , fontname , ptsize , angle , x , y , str );
4078
-
4079
- #endif /* HAVE_GD_FREETYPE */
4073
+ }
4080
4074
4081
4075
if (error ) {
4082
4076
php_error_docref (NULL , E_WARNING , "%s" , error );
@@ -4091,7 +4085,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
4091
4085
}
4092
4086
}
4093
4087
/* }}} */
4094
- #endif /* HAVE_LIBFREETYPE */
4088
+ #endif /* HAVE_GD_FREETYPE */
4095
4089
4096
4090
/* {{{ proto bool image2wbmp(resource im [, string filename [, int foreground]])
4097
4091
Output WBMP image to browser or file */
0 commit comments