1--TEST--
2Test Imagick::getConfigureOptions
3--SKIPIF--
4<?php
5
6require_once(dirname(__FILE__) . '/skipif.inc');
7
8checkClassMethods('Imagick', array('getconfigureoptions'));
9
10
11?>
12--FILE--
13<?php
14
15$allOptions = Imagick::getConfigureOptions();
16
17if (!is_array($allOptions)) {
18	echo "Failed to return array".PHP_EOL;
19	var_dump($options);
20}
21else if (count($allOptions) == 0) {
22	echo "allOptions is empty".PHP_EOL;
23}
24
25
26$optionsStartingWithC = Imagick::getConfigureOptions("C*");
27
28if (!is_array($optionsStartingWithC)) {
29	echo "Failed to return array".PHP_EOL;
30	var_dump($optionsStartingWithC);
31}
32else if (count($optionsStartingWithC) == 0) {
33	echo "optionsStartingWithC is empty".PHP_EOL;
34}
35
36//Example output on Debian
37//
38//array(38) {
39//  ["CC"]=>
40//  string(3) "gcc"
41//  ["CFLAGS"]=>
42//  string(186) "-I/usr/include/libxml2 -I/usr/include/libpng16 -I/usr/include/freetype2  -fopenmp -Wall -g -O2 -mtune=core2 -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16"
43//  ["CODER_PATH"]=>
44//  string(56) "/usr/local/lib/ImageMagick-7.0.11/modules-Q16HDRI/coders"
45//  ["CONFIGURE"]=>
46//  string(155) "./configure  '--with-quantum-depth=16' '--with-magick-plus-plus=no' '--without-perl' '--disable-static' '--disable-docs' '--with-jpeg=yes' '--with-png=yes'"
47//  ["CONFIGURE_PATH"]=>
48//  string(29) "/usr/local/etc/ImageMagick-7/"
49//  ["COPYRIGHT"]=>
50//  string(46) "Copyright (C) 1999-2021 ImageMagick Studio LLC"
51//  ["CPPFLAGS"]=>
52//  string(34) "-I/usr/local/include/ImageMagick-7"
53//  ["CXX"]=>
54//  string(3) "g++"
55//  ["CXXFLAGS"]=>
56//  string(9) " -pthread"
57//  ["DEFS"]=>
58//  string(15) "-DHAVE_CONFIG_H"
59//  ["DELEGATES"]=>
60//  string(33) "freetype jng jpeg png ps xml zlib"
61//  ["DISTCHECK_CONFIG_FLAGS"]=>
62//  string(217) " --disable-deprecated  --with-quantum-depth=16  --with-jemalloc=no  --with-umem=no  --with-autotrace=no  --with-fftw=no  --with-gslib=no  --with-fontpath=  --with-jxl=no  --with-rsvg=no  --with-wmf=no  --with-perl=no "
63//  ["DOCUMENTATION_PATH"]=>
64//  string(34) "/usr/local/share/doc/ImageMagick-7"
65//  ["EXEC-PREFIX"]=>
66//  string(10) "/usr/local"
67//  ["EXECUTABLE_PATH"]=>
68//  string(14) "/usr/local/bin"
69//  ["FEATURES"]=>
70//  string(22) "DPC HDRI Cipher OpenMP"
71//  ["FILTER_PATH"]=>
72//  string(57) "/usr/local/lib/ImageMagick-7.0.11/modules-Q16HDRI/filters"
73//  ["GIT_REVISION"]=>
74//  string(24) "18571:309fcfa1c:20210328"
75//  ["HOST"]=>
76//  string(19) "x86_64-pc-linux-gnu"
77//  ["INCLUDE_PATH"]=>
78//  string(32) "/usr/local/include/ImageMagick-7"
79//  ["LDFLAGS"]=>
80//  string(17) "-L/usr/local/lib "
81//  ["LIB_VERSION"]=>
82//  string(5) "0x70B"
83//  ["LIB_VERSION_NUMBER"]=>
84//  string(8) "7,0,11,6"
85//  ["LIBRARY_PATH"]=>
86//  string(33) "/usr/local/lib/ImageMagick-7.0.11"
87//  ["LIBS"]=>
88//  string(96) "    -lfreetype  -ljpeg    -lpng16                       -lxml2  -lz     -lm    -lpthread  -lgomp"
89//  ["MAGICK_TEMPORARY_PATH"]=>
90//  string(4) "/tmp"
91//  ["NAME"]=>
92//  string(11) "ImageMagick"
93//  ["PCFLAGS"]=>
94//  string(65) "-fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16"
95//  ["PREFIX"]=>
96//  string(10) "/usr/local"
97//  ["QuantumDepth"]=>
98//  string(2) "16"
99//  ["RELEASE_DATE"]=>
100//  string(10) "2021-03-28"
101//  ["SHARE_PATH"]=>
102//  string(30) "/usr/local/share/ImageMagick-7"
103//  ["SHAREARCH_PATH"]=>
104//  string(48) "/usr/local/lib/ImageMagick-7.0.11/config-Q16HDRI"
105//  ["TARGET_CPU"]=>
106//  string(6) "x86_64"
107//  ["TARGET_OS"]=>
108//  string(9) "linux-gnu"
109//  ["TARGET_VENDOR"]=>
110//  string(2) "pc"
111//  ["VERSION"]=>
112//  string(6) "7.0.11"
113//  ["WEBSITE"]=>
114//  string(23) "https://imagemagick.org"
115//}
116
117
118
119// Examples of output on nixos
120//array(5) {
121//  ["DELEGATES"]=>
122//  string(102) "bzlib cairo djvu fontconfig freetype heic jng jp2 jpeg lcms lzma openexr png rsvg tiff webp x xml zlib"
123//  ["FEATURES"]=>
124//  string(28) "Cipher DPC HDRI OpenMP(4.5) "
125//  ["MAGICK_TEMPORARY_PATH"]=>
126//  string(4) "/tmp"
127//  ["NAME"]=>
128//  string(11) "ImageMagick"
129//  ["QuantumDepth"]=>
130//  string(3) "Q16"
131//}
132
133
134
135
136
137
138
139
140if (!(count($optionsStartingWithC) < count($allOptions))) {
141	echo "";
142	var_dump($optionsStartingWithC);
143	var_dump($allOptions);
144}
145
146foreach ($optionsStartingWithC as $key => $value) {
147	$key = strtolower($key);
148
149	if (strpos($key, "c") !== 0) {
150		echo "key $key does not start with c".PHP_EOL;
151	}
152}
153
154echo "Ok";
155
156?>
157--EXPECTF--
158Ok