summaryrefslogtreecommitdiff
path: root/DevIL/configure.ac
blob: 2268246a325ad12d2a096017ac3433fbf4adddd0 (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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
dnl 
dnl Autoconf script for DevIL Library
dnl Originally written by Meloni Dario
dnl rewritten by Matěj Týč
dnl

dnl
dnl configure.ac initialization
dnl we use some macros that are in m4 directory
dnl
AC_INIT([DevIL], 
	1.7.8,
	[bubla@users.sourceforge.net])
dnl Minimum Autoconf version
AC_PREREQ(2.52)
dnl What header will be generated by configure script
AC_CONFIG_HEADERS([include/IL/config.h])
dnl Where are some sources?
AC_CONFIG_SRCDIR([src-IL/src/il_main.c])
dnl Where are other macro definitions?
AC_CONFIG_MACRO_DIR([m4])
dnl Where to put various auxiliary files
AC_CONFIG_AUX_DIR([build-aux])
dnl Libtool init with message that we want to build DLLs
dnl LT_INIT([win32-dll])
dnl LT_PROG_RC
dnl THE ABOVE IS LIBTOOL INIT IS THE GOOD ONE, BUT MAYBE TOO UP-TO-DATE FOR MOST PEOPLE
AC_PROG_LIBTOOL
AC_LIBTOOL_WIN32_DLL
dnl Automake init with all warnings reported
AM_INIT_AUTOMAKE([-Wall])

dnl
dnl Note that the libtool version has nothing to do
dnl with the actual DevIL version, it is a version number
dnl describing the interface version (see libtool doc)
dnl wich only changes when the interface changes  
dnl
dnl format is <current>:<revision>:<age>
dnl If nothing notable changes, increment revision
dnl current is an interface number
dnl library supports interfaces from current - age to current
dnl
DEVIL_LTVERSION=2:0:1
AC_SUBST([DEVIL_LTVERSION])

dnl
dnl Test build options
dnl
AC_ARG_ENABLE([debug],
	      [AS_HELP_STRING([--enable-debug],
			      [Compile a debug version of the library])],
              [],
	      [enable_debug="no"])

AC_ARG_ENABLE([release],
	      [AS_HELP_STRING([--disable-release],
			      [Compile a debug version of the library, default enabled if not building debug version])],
              [],
	      [enable_release="yes"
	       test "x$enable_debug" = "xyes" && enable_release="no"])

AC_ARG_ENABLE([asm],
	      [AS_HELP_STRING([--disable-asm],
			      [Use assembler routines if possible, default enable if not building debug version])],
	      [],
	      [enable_asm="yes"
	       test "x$enable_debug" = "xyes" && enable_asm="no"])

dnl Set right flags regarding whether we explicitly debug or release
AS_IF([test "x$enable_release" = "xyes"],
      [AS_IF([test "x$CFLAGS" = "x"],
	     [CFLAGS="-O3"])
       AS_IF([test "x$CXXFLAGS" = "x"],
	     [CXXFLAGS="-O3"]) ],
      [test "x$enable_debug" = "xyes"],
      [CFLAGS="-DNOINLINE -Wextra -g -O0"
       CXXFLAGS="-DNOINLINE -Wextra -g -O0"
       AC_DEFINE([DEBUG],
		 [],
		 ["Enable debug code features"]) ])

dnl
dnl Basic conf
dnl
SUPPORTED_FORMATS=""
SUPPORTED_API=""
SUPPORTED_EXTENSION=""
AC_REVISION([$Revision: 1.48 $])
dnl AC_PREFIX_DEFAULT(/usr/local)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
dnl AC_LANG([C++])
AC_LANG([C])
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_MAKE_SET
AC_C_BIGENDIAN

dnl checks for X are to be done later...
dnl AC_PATH_XTRA

dnl Settling whether the user will want to build examples or not
AC_ARG_WITH([examples],
	    [AS_HELP_STRING([--with-examples[[=yes/no]]],
			    [Whether to build and install examples as well. Default is without examples])],
	    [],
	    [with_examples="no"])
AM_CONDITIONAL([BUILD_EXAMPLES],
	       [test "x$with_examples" = "xyes"])

dnl Do we want monolithic library (DevIL instead of IL, ILU, ILUT). Useful probably only on Windows... Discouraged.
dnl Whether to build IL. You have to anyway :-)
dnl AC_ARG_ENABLE([IL],
dnl	      [AS_HELP_STRING([--enable-IL[[=yes/no]]],
dnl	                      [Build IL part of DevIL. You  that. Default set to yes])],
dnl              [],
dnl	      [enable_IL="yes"])
enable_IL="yes"
AM_CONDITIONAL([BUILD_IL],
	       [test "x$enable_IL" = "xyes"])

dnl Whether to build ILU...
AC_ARG_ENABLE([ILU],
	      [AS_HELP_STRING([--enable-ILU[[=yes/no]]],
			      [Build ILU part of DevIL. Default set to no])],
              [],
	      [enable_ILU="no"])

dnl Whether to build ILUT...
AC_ARG_ENABLE([ILUT],
	      [AS_HELP_STRING([--enable-ILUT[[=yes/no]]],
			      [Build ILUT part of DevIL. Default set to no. ILU will be built along whether you want it or not since ILUT depends upon it.])],
              [],
	      [enable_ILUT="no"])
dnl We have to build ILU if we want ILUT as well...
AM_CONDITIONAL([BUILD_ILU],
	       [test "x$enable_ILU" = "xyes" -o "x$enable_ILUT" = "xyes"])
AM_CONDITIONAL([BUILD_ILUT],
	       [test "x$enable_ILUT" = "xyes"])

dnl
dnl We want to build ILU, so let's tell it (useful for examples/tests)
dnl while iluErrorString is still in ILU
dnl
AS_IF([test "x$enable_ILU" = "xyes" -o "x$enable_ILUT" = "xyes"],
      [AC_DEFINE([ILU_ENABLED],,
		 [Define if you want to build ILU part of DevIL (used in DevIL examples/tests)]) ])

dnl Test for restrict c/c++ keyword
DEVIL_CHECK_RESTRICT



dnl must add AC_CACHE_CHECK support where possible

dnl AM_MAINTAINER_MODE

dnl Now the phase of testing of extensions...
TEST_EXT([Altivec],
	 [-faltivec -maltivec],
	 [vector int vec;vec=vec_splat_u32(0);],
	 [ALTIVEC_GCC],
	 [],
	 [altivec])

TEST_EXT([SSE],
	 [-msse],
	 [__m128 v;v=_mm_sub_ss(v,v);],
	 [SSE],
	 [#include <xmmintrin.h>],
	 [sse])

TEST_EXT([SSE2],
	 [-msse2],
	 [__m128i v;v=_mm_add_epi32(v,v);],
	 [SSE2],
	 [#include <emmintrin.h>],
	 [sse2])

TEST_EXT([SSE3],
	 [-msse3],
	 [__m128d v;v=_mm_addsub_pd(v,v);],
	 [SSE3],
	 [#include <pmmintrin.h>],
	 [sse3])

dnl Do we want to use ASM routines?
AS_IF([test "x$enable_asm" = "xyes"],
      [TEST_ASM([i[[3456]]86*],
                [X86_ASM],
	        [GCC_X86_ASM],
                [x86])
       TEST_ASM([x86_64*],
                [X86_64_ASM],
                [GCC_X86_64_ASM],
                [x86_64])
       TEST_ASM([powerpc*],
                [PPC_ASM],
                [GCC_PCC_ASM],
                [ppc]) 
	AS_IF([test -n "$SUPPORTED_EXTENSION"],
	      [AC_DEFINE([IL_INLINE_ASM],
			 [1],
			 [Define if you can support at least some ASM]) ]) ])

dnl
dnl Memory alignment functions
dnl
AC_CHECK_FUNC([valloc], 
	      [AC_DEFINE([VALLOC],
			 [1],
			 [define if you have valloc memory allocation]) ])
AC_CHECK_FUNC([posix_memalign], 
	      [AC_DEFINE([POSIX_MEMALIGN],
			 [1],
			 [define if you have posix_memalign memory allocation]) ])

AC_CHECK_FUNC([memalign], 
	      [AC_DEFINE([MEMALIGN],
			 [1],
			 [define if you have memalign memory allocation]) ])

AC_CHECK_HEADER([mm_malloc.h],
		[AC_DEFINE([MM_MALLOC],
			   [1],
			   [define if you have mm_malloc.h header]) ])

dnl
dnl Libraries development checking
dnl
AC_ARG_WITH([zlib],
            [AC_HELP_STRING([--with-zlib[[=yes/no]]],
                            [Do wou want to use zlib?])],
	    [],
            [enable_zlib="yes"])

AS_IF([test "x$enable_zlib" = "xyes"],
      [AC_CHECK_HEADER([zlib.h], 
		       [use_z="yes"], 
		       [use_z="no"]) 
       AS_IF([test "$enable_zlib" = "yes"],
             [AC_CHECK_LIB([z],
                           [main]) ]) ])

dnl 
dnl We need to link in math stuff, maybe we have to do it manually here...
dnl
AC_CHECK_LIB([m],
	     [main])

dnl
dnl DevIL now supports a lot of game image formats.
dnl Some people may not like it, so let's give'em a choice!
dnl
AC_ARG_ENABLE([game-formats],
	       [AS_HELP_STRING([--enable-game-formats[[=yes/no]]],
			       [Enable support for various game formats. Some people may consider that redundant. (default=yes)]) ],
	       [],
	       [enable_game_formats="yes"])
AS_IF([test "x$enable_game_formats" = "xno"],
      [AC_DEFINE([IL_NO_GAMES],,
		 [Define if you want to disable support for various game formats]) ])

dnl 
dnl Ask here whether the user wants to support a format, optionally do some tests whether it can be supported
dnl
TEST_FORMAT([blp], [BLP], [BLP is the texture format for Blizzard games.])
TEST_FORMAT([bmp], [BMP], [BMP is a standard Windows bitmap.])
TEST_FORMAT([dcx], [DCX], [DCX is a multi-page PCX file.])
TEST_FORMAT([dds], [DDS], [DDS (DirectDraw Surface) is used by DirectX to load images (usually DXTC).])
TEST_FORMAT([dicom], [DICOM], [DICOM (Digital Imaging and Communications in Medicine) is used extensively in medical imaging.])
TEST_FORMAT([doom],[WAD], [WAD is the format for graphics in the original DooM I/II.])
TEST_FORMAT([exr], [EXR], [EXR is a HDR image file format standardized by Industrial Light and Magic. OpenEXR powered], [SETTLE_OPENEXR])
TEST_FORMAT([fits], [FITS], [FITS (Flexible Image Transport System) is used for storing scientific images and is used extensively in astronomy.])
TEST_FORMAT([gif], [GIF], [GIF is lossy and proprietary format used mainly to make animations])
TEST_FORMAT([hdr], [HDR], [HDR is the Radiance High Dynamic Range format, using more bits per channel than normal.])
TEST_FORMAT([icns],[ICNS], [ICNS is the icon format for the Mac OS X operation system.])
TEST_FORMAT([icon],[ICON], [ICO is the icon format for the Windows operating system.])
TEST_FORMAT([iff], [IFF], [IFF (Interchange File Format) is used to transfer images between software from different companies.])
TEST_FORMAT([ilbm], [ILBM], [ILBM (Amiga Interleaved BitMap Format).])
TEST_FORMAT([iwi], [IWI], [IWI is the Infinity Ward Image format used in the Call of Duty games.])
TEST_FORMAT([jpeg],[JPG], [JPEG is most common lossy format. libjpeg powered], [SETTLE_JPEG])
TEST_FORMAT([jp2], [JP2], [JP2 (JPEG 2000) is a better, but not so widespread, alternative to JPEG. JasPer powered], [SETTLE_JASPER])
TEST_FORMAT([lcms],[LCMS], [],[SETTLE_LCMS])
TEST_FORMAT([lif], [LIF], [LIF is the image format of the game Homeworld.])
TEST_FORMAT([mdl], [MDL], [MDL is the format for models in the game Half-Life.])
TEST_FORMAT([mng], [MNG], [MNG is basically the animated version of PNG but is not widespread.], [SETTLE_MNG])
TEST_FORMAT([mp3], [MP3], [MP3 (MPEG-1 Audio Layer 3) sometimes have images in them, such as cover art.])
TEST_FORMAT([pcx], [PCX], [PCX is one of the first widely accepted DOS imaging standards])
TEST_FORMAT([pcd], [PCD], [PCD is the Kodak PhotoCD format.])
TEST_FORMAT([pic], [PIC], [PIC is used by SoftImage software.])
TEST_FORMAT([pix], [PIX], [])
TEST_FORMAT([png], [PNG], [PNG is a smart, loseless and even open format. libpng powered.], [SETTLE_PNG])
TEST_FORMAT([pnm], [PNM], [PNM (Portable aNy Map format) is considered the least-common-denominator for converting pixmap, graymap, or bitmap files between different platforms.])
TEST_FORMAT([psd], [PSD], [PSD is the PhotoShop native file format.])
TEST_FORMAT([psp], [PSP], [PSP is the Paint Shop Pro native file format.])
TEST_FORMAT([pxr], [PXR], [PXR is used by Pixar.])
TEST_FORMAT([raw], [RAW], [RAW is simply raw data.])
TEST_FORMAT([rot], [ROT], [ROT is the image format for the game Homeworld 2.])
TEST_FORMAT([sgi], [SGI], [SGI is the native raster graphics file format for Silicon Graphics workstations])
TEST_FORMAT([sun], [SUN], [SUN is the image format used on Sun's operating systems.])
TEST_FORMAT([texture], [TEXTURE], [TEXTURE is the format used in Medieval II: Total War (similar to DDS).])
TEST_FORMAT([tga], [TGA], [TGA (aka TARGA file format) has been used mainly in games. It is open and simple.])
TEST_FORMAT([tiff],[TIF], [TIFF is a lossless format supporting greater color depths. libtiff powered], [SETTLE_TIFF])
TEST_FORMAT([tpl], [TPL], [TPL is the format used by many GameCube and Wii games.])
TEST_FORMAT([utx], [UTX], [UTX is the format used in the Unreal Tournament game series.])
TEST_FORMAT([vtf], [VTF], [VTF (Valve Texture Format) is used by games based on Valve's Source engine.])
TEST_FORMAT([wal], [WAL], [WAL is the image format used for the game Quake 2.])
TEST_FORMAT([wbmp], [WBMP], [WBMP (Wireless Application Protocol Bitmap) is a monochrome graphics file format optimized for mobile computing devices])
TEST_FORMAT([wdp], [WDP], [WDP is Microsoft's successor to JPEG, able to store many different image types either lossy or losslessly, also known as HD Photo.])
TEST_FORMAT([xpm], [XPM], [XPM (X PixMap) is an ASCII-based image used in X Windows.])

dnl
dnl Give users chance to disable check for these two libraries that can't be disabled 
dnl by any other means...
dnl 
AC_ARG_WITH([libsquish],
	    [AS_HELP_STRING([--with-squish[[=yes/no]]],
			    [Do you want to use the squish library if possible? (enables HW accelerated DXT compression, default="yes")]) ],
	    [],
	    [with_libsquish="yes"])
AS_IF([test "x$with_libsquish" = "xyes"],
      [DEVIL_CHECK_LIBSQUISH])

AC_ARG_WITH([nvtt],
	    [AS_HELP_STRING([--with-nvtt[[=yes/no]]],
			    [Do you want to use the Nvidia texture tools if possible? (enables GPU accelerated image manipulation, default="yes")]) ],
	    [],
	    [with_nvtt="yes"])
AS_IF([test "x$with_nvtt" = "xyes"],
      [DEVIL_CHECK_NVIDIA_TEXTOOLS])

dnl
dnl ILUT APIs library checking
dnl
AS_IF([test "x$enable_ILUT" = "xyes"],
      [SETTLE_ALLEGRO
       SETTLE_DX8
       SETTLE_DX9
       SETTLE_OPENGL
       SETTLE_SDL
       SETTLE_W32
       SETTLE_X11])
 
dnl
dnl AM_COND_IF([condition],[do-if-true]) has to be kept in sync with examples/Makefile.am
dnl The AM_COND_IF seems to be too new at the moment, let's wait a little bit till things settle...
dnl

dnl AM_COND_IF([BUILD_ILU],
AS_IF([test "x$enable_ILU" != "xyes"],
	   [EXAMPLES_TO_BUILD="$EXAMPLES_TO_BUILD IL_override IL_read IL_simple"])

AS_IF([test "x$enable_ILU" = "xyes"],
	   [EXAMPLES_TO_BUILD="$EXAMPLES_TO_BUILD ILU_override ILU_read ILU_simple"])

dnl AM_COND_IF([BUILD_ILUT],
AS_IF([test "x$enable_ILUT" = "xyes"],
	   [EXAMPLES_TO_BUILD="$EXAMPLES_TO_BUILD ILUT_cpp_wrapper"])

AM_CONDITIONAL([USE_ALLEGRO], 
	       [test "x$use_allegro" = "xyes"])
dnl AM_COND_IF([USE_ALLEGRO],
AS_IF([test "x$use_allegro" = "xyes"],
	   [EXAMPLES_TO_BUILD="$EXAMPLES_TO_BUILD ILUT_allegro"])

AM_CONDITIONAL([USE_DIRECTX8],
               [test "x$use_directx8" = "xyes"])

AM_CONDITIONAL([USE_DIRECTX9],
               [test "x$use_directx9" = "xyes"])

AM_CONDITIONAL([USE_DIRECTX],
               [test "x$use_directx8" = "xyes" -o "x$use_directx9" = "xyes"])
dnl AM_COND_IF([USE_DIRECTX],
AS_IF([test "x$use_directx8" = "xyes" -o "x$use_directx9" = "xyes"],
	   [EXAMPLES_TO_BUILD="$EXAMPLES_TO_BUILD ILUT_d3d ILUT_windows"])

AM_CONDITIONAL([USE_OPENGL],
               [test "x$use_ogl" = "xyes"])

AM_CONDITIONAL([HAVE_GLUT],
	       [test "x$have_glut" = "xyes"])

AM_CONDITIONAL([USE_SDL],
               [test "x$use_sdl" = "xyes"])
dnl AM_COND_IF([USE_SDL],
AS_IF([test "x$use_sdl" = "xyes"],
	   [EXAMPLES_TO_BUILD="$EXAMPLES_TO_BUILD ILUT_sdl"])

AM_CONDITIONAL([USE_W32],
               [test "x$use_w32" = "xyes"])
dnl AM_COND_IF([USE_W32],
AS_IF([test "x$use_w32" = "xyes"],
	   [EXAMPLES_TO_BUILD="$EXAMPLES_TO_BUILD ILUT_animation"])

AM_CONDITIONAL([USE_X11],
               [test "x$use_x11" = "xyes"])
#this is instedad AM_COND_IF([USE_OPENGL && USE_X11])
AS_IF([test "x$have_glut" = "xyes" -a "x$use_x11" = "xyes"],
      [EXAMPLES_TO_BUILD="$EXAMPLES_TO_BUILD ILUT_gl ILUT_volume"])

dnl Win32
AS_CASE([$host],
        [*mingw32*],
        [PLATFORM="MINGW32"],
        [*cygwin*],
        [ADD_CFLAGS([-mno-cygwin])
	 LIBILUT_WIN32LIBPATH="-L/usr/lib/w32api"
	 PLATFORM="CYGWIN"],
        [*darwin*],
	[AC_DEFINE([MAX_OS_X],
		   [],
		   [Building on Mac OS X]) 
	 PLATFORM="OSX"],
	 [*linux*],
	 [PLATFORM="LINUX"])
AC_SUBST([PLATFORM])

AM_CONDITIONAL([WINDOWS_BUILD],
	       [test "x$PLATFORM" = "xMINGW32" -o "x$PLATFORM" = "xCYGWIN"])

dnl Final substitution
AC_SUBST([GENERAL_CFLAGS])
AC_SUBST([IL_CFLAGS])
AC_SUBST([IL_LIBS])
AC_SUBST([ILU_CFLAGS])
AC_SUBST([ILU_LIBS])
AC_SUBST([ILUT_CFLAGS])
AC_SUBST([ILUT_LIBS])
AC_SUBST([LIBILUT_WIN32LIBPATH])
AC_SUBST([SUPPORTED_FORMATS])

dnl
dnl Ouput files to generate
dnl note: keep the list on one line separated by single spaces 
dnl (otherwise MSYS compilation breaks)
AC_CONFIG_FILES([Makefile 
		 lib/Makefile 
		 bin/Makefile
		 test/Makefile 
		 docs/Makefile 
		 data/Makefile 
		 data/IL.pc data/ILU.pc data/ILUT.pc
		 test/format_test/format_checks.sh test/format_test/ilu_checks.sh])
dnl		 projects/Makefile]) 
# src-IL/Makefile  src-IL/src/Makefile  src-IL/include/Makefile  src-ILU/Makefile  src-ILU/src/Makefile  src-ILU/include/Makefile  src-ILUT/Makefile  src-ILUT/src/Makefile  src-ILUT/include/Makefile  include/Makefile  include/IL/Makefile
AC_OUTPUT

dnl And a nice report in the end!
IL_REPORT
ILU_REPORT
ILUT_REPORT
EXTENSIONS_REPORT
EXAMPLES_REPORT