summaryrefslogtreecommitdiff
blob: c92eb1e1d3cbd920aaf695b671a123ef3f5c1b9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
--- a/configure.in
+++ b/configure.in
@@ -38,6 +38,8 @@
 AC_PROG_LIBTOOL
 AC_PROG_LN_S
 
+PKG_PROG_PKG_CONFIG
+
 # Checks for libraries.
 AC_CHECK_LIB([m], [pow],,AC_MSG_ERROR(-lm was not found but required.))
 
@@ -81,7 +83,15 @@
 AC_CHECK_FUNCS(random_r nrand48)
 
 # Check for ImageMagick.
-PKG_CHECK_MODULES(Wand, Wand >= 6.4)
+PKG_CHECK_MODULES(Wand, [Wand >= 6.4],,
+	[PKG_CHECK_MODULES(Wand, MagickWand >= 6.4)]
+)
+
+old_CPPFLAGS="$CPPFLAGS"; CPPFLAGS="$Wand_CFLAGS"
+AC_CHECK_HEADERS([magick/api.h] [wand/magick-wand.h],,
+	AC_CHECK_HEADERS([MagickCore/MagickCore.h] [MagickWand/MagickWand.h])
+)
+CPPFLAGS="$old_CPPFLAGS"
 
 if test -d src/skyrocket_sounds ; then
 	AC_ARG_ENABLE(sound, [  --disable-sound         Don't compile with sound.])
--- a/src/TexMgr.cpp
+++ b/src/TexMgr.cpp
@@ -25,8 +25,19 @@
 #endif
 #include <cstdlib>
 
+#ifdef HAVE_MAGICK_API_H
+#ifdef HAVE_WAND_MAGICK_WAND_H
 #include <magick/api.h>
 #include <wand/magick-wand.h>
+#endif /* HAVE_WAND_MAGICK_WAND_H */
+#endif /* HAVE_MAGICK_API_H */
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+#ifdef HAVE_MAGICKWAND_MAGICKWAND_H
+#include <MagickCore/MagickCore.h>
+#include <MagickWand/MagickWand.h>
+#endif /* HAVE_MAGICKWAND_MAGICKWAND_H */
+#endif /* HAVE_MAGICKCORE_MAGICKCORE_H */
+
 #include <dirent.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -255,10 +266,18 @@
 // Directory scanning + image loading code in a separate function callable either from loadNextImage or another thread if pthreads is available.
 void TexMgr::loadNextImageFromDisk() {
 	MagickWand *magick_wand = NewMagickWand();
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+	ExceptionInfo *exception;
+#else
 	ExceptionInfo exception;
+#endif
 	int dirLoop = 0;
 
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+	exception = AcquireExceptionInfo ();
+#else
 	GetExceptionInfo (&exception);
+#endif
 
 	int imageLoaded = 0;
 	do {
@@ -317,7 +336,11 @@
 		nextH = ohh;
 	}
 
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+	ExportImagePixels (GetImageFromMagickWand(magick_wand), 0, 0, oww, ohh, "RGBA", CharPixel, nextTex, exception);
+#else
 	ExportImagePixels (GetImageFromMagickWand(magick_wand), 0, 0, oww, ohh, "RGBA", CharPixel, nextTex, &exception);
+#endif
 
 	magick_wand = DestroyMagickWand (magick_wand);
 
--- a/src/matrixview.c
+++ b/src/matrixview.c
@@ -84,8 +84,19 @@
 float *texcoords;
 unsigned char *colors;
 
+#ifdef HAVE_MAGICK_API_H
+#ifdef HAVE_WAND_MAGICK_WAND_H
 #include <magick/api.h>
 #include <wand/magick-wand.h>
+#endif /* HAVE_WAND_MAGICK_WAND_H */
+#endif /* HAVE_MAGICK_API_H */
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+#ifdef HAVE_MAGICKWAND_MAGICKWAND_H
+#include <MagickCore/MagickCore.h>
+#include <MagickWand/MagickWand.h>
+#endif /* HAVE_MAGICKWAND_MAGICKWAND_H */
+#endif /* HAVE_MAGICKCORE_MAGICKCORE_H */
+
 #include <dirent.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -99,10 +110,18 @@
 // Directory scanning + image loading code in a separate function callable either from loadNextImage or another thread if pthreads is available.
 void loadNextImageFromDisk() {
 	MagickWand *magick_wand = NewMagickWand();
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+	ExceptionInfo *exception;
+#else
 	ExceptionInfo exception;
+#endif
 	int dirLoop = 0;
 
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+	exception = AcquireExceptionInfo ();
+#else
 	GetExceptionInfo (&exception);
+#endif
 
 	int imageLoaded = 0;
 	do {
@@ -159,7 +178,11 @@
 	if (!next_pic)
 		next_pic = (unsigned char *)malloc (text_x * text_y);
 
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+	ExportImagePixels (GetImageFromMagickWand(magick_wand), 0, 0, text_x, text_y, "I", CharPixel, next_pic, exception);
+#else
 	ExportImagePixels (GetImageFromMagickWand(magick_wand), 0, 0, text_x, text_y, "I", CharPixel, next_pic, &exception);
+#endif
 
 	magick_wand = DestroyMagickWand (magick_wand);
 }
@@ -211,11 +234,19 @@
 			pthread_cond_signal(next_pic_cond);
 		}
 	} else {
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+		ExceptionInfo *exception;
+#else
 		ExceptionInfo exception;
+#endif
 		Image *image = NULL, *scaled_image;
 		ImageInfo *image_info;
 
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+		exception = AcquireExceptionInfo ();
+#else
 		GetExceptionInfo (&exception);
+#endif
 
 		if (!pics)
 			LOAD_TEXTURE (pics, cpics, cpics_compressedsize, cpics_size)
@@ -227,6 +258,15 @@
 			image_info = CloneImageInfo ((ImageInfo *) NULL);
 			image_info->size = AcquireMagickMemory(sizeof("90x70"));
 			strcpy(image_info->size, "90x70");
+#ifdef HAVE_MAGICKCORE_MAGICKCORE_H
+			image = AcquireImage(image_info, exception);
+
+			ImportImagePixels(image, 0, 0, 90, 70, "I", CharPixel, (unsigned char *)(pics + ((random () & 15) * (90 * 70))), exception);
+
+			scaled_image = ScaleImage (image, text_x, text_y, exception);
+
+			ExportImagePixels (scaled_image, 0, 0, text_x, text_y, "I", CharPixel, pic, exception);
+#else
 			image = AcquireImage(image_info);
 
 			ImportImagePixels(image, 0, 0, 90, 70, "I", CharPixel, (unsigned char *)(pics + ((random () & 15) * (90 * 70))));
@@ -234,6 +274,7 @@
 			scaled_image = ScaleImage (image, text_x, text_y, &exception);
 
 			ExportImagePixels (scaled_image, 0, 0, text_x, text_y, "I", CharPixel, pic, &exception);
+#endif
 
 			DestroyImage (image);
 			DestroyImage (scaled_image);