-
Notifications
You must be signed in to change notification settings - Fork 84
/
configure.ac
688 lines (633 loc) · 24.2 KB
/
configure.ac
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
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.60])
LT_PREREQ([2.4])
AC_INIT([sixel], [1.8.6], [[email protected]])
LS_LT_CURRENT=1
LS_LT_REVISION=6
LS_LT_AGE=0
AC_SUBST([LS_LTVERSION], [$LS_LT_CURRENT:$LS_LT_REVISION:$LS_LT_AGE])
AC_SUBST([PACKAGE_DESCRIPTION],
["A lightweight, fast implementation of DEC SIXEL graphics codec"])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([foreign subdir-objects])
LT_INIT
AC_CONFIG_SRCDIR([src/fromsixel.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AX_GCC_VAR_ATTRIBUTE([deprecated])
if test x$ax_cv_have_func_attribute_deprecated != x; then
AC_SUBST(attr_var_deprecated, [__attribute__\(\(deprecated\)\)])
fi
AX_GCC_FUNC_ATTRIBUTE([deprecated])
if test x$ax_cv_have_func_attribute_deprecated != x; then
AC_SUBST(attr_func_deprecated, [__attribute__\(\(deprecated\)\)])
fi
AX_GCC_BUILTIN([__builtin_unreachable])
CFLAGS_BACKUP=$CFLAGS
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE(
[
#pragma GCC diagnostic push
#pragma GCC diagnostic pop
#pragma GCC diagnostic ignored "-Wtypedef-redefinition"
],
[
typedef int foo;
typedef int foo;
],
[AC_DEFINE(HAVE_DIAGNOSTIC_TYPEDEF_REDEFINITION,
1,
[define 1 if GCC supports -Wtypedef-redefinition])])
CFLAGS=$CFLAGS_BACKUP
CFLAGS_BACKUP=$CFLAGS
CFLAGS="$CFLAGS -Werror"
AC_TRY_COMPILE(
[
#pragma GCC diagnostic push
#pragma GCC diagnostic pop
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
__attribute__((deprecated)) void test(void) {}
],
[
test();
],
[AC_DEFINE(HAVE_DIAGNOSTIC_DEPRECATED_DECLARATIONS,
1,
[define 1 if GCC supports -Wdeprecated-declarations])])
CFLAGS=$CFLAGS_BACKUP
# Options
AC_ARG_ENABLE([img2sixel],
[AS_HELP_STRING([--disable-img2sixel],
[whether to build img2sixel (default: yes)])],
[],
[enable_img2sixel=yes])
AM_CONDITIONAL(WANT_IMG2SIXEL, test x$enable_img2sixel != xno)
AC_ARG_ENABLE([sixel2png],
[AS_HELP_STRING([--disable-sixel2png],
[whether to build sixel2png (default: yes)])],
[],
[enable_sixel2png=yes])
AM_CONDITIONAL(WANT_SIXEL2PNG, test x$enable_sixel2png != xno)
AC_ARG_WITH([gdk-pixbuf2],
[AS_HELP_STRING([--with-gdk-pixbuf2],
[whether to build with gdk-pixbuf2 (default: no)])],
[],
[with_gdk_pixbuf2=no])
AC_ARG_WITH([gd],
[AS_HELP_STRING([--with-gd],
[whether to build with gd (default: no)])],
[],
[with_gd=no])
AC_ARG_WITH([libcurl],
[AS_HELP_STRING([--with-libcurl],
[whether to build with libcurl (default: auto)])],
[],
[with_libcurl=auto])
AC_ARG_WITH([jpeg],
[AS_HELP_STRING([--with-jpeg],
[whether to build with libjpeg (default: auto)])],
[],
[with_jpeg=auto])
AC_ARG_WITH([png],
[AS_HELP_STRING([--with-png],
[whether to build with libpng (default: auto)])],
[],
[with_png=auto])
#AC_ARG_WITH([wic],
# [AS_HELP_STRING([--with-wic],
# [whether to build with windows WIC integration, windows only (default: no)])],
# [],
# [with_wic=no])
AC_ARG_WITH(pkgconfigdir,
AC_HELP_STRING([--with-pkgconfigdir],
[Use the specified pkgconfig dir (default is libdir/pkgconfig)]),
[pkgconfigdir=${withval}],
[pkgconfigdir=${libdir}/pkgconfig])
AC_MSG_NOTICE([pkgconfig directory is ${pkgconfigdir}])
AC_SUBST(pkgconfigdir)
AC_ARG_WITH(bashcompletiondir,
AC_HELP_STRING([--with-bashcompletiondir],
[Use the specified bashcompletion.d]),
[bashcompletiondir=${withval}],
[bashcompletiondir=${datadir}/bash-completion/completions])
AC_MSG_NOTICE([bash-completion directory is ${bashcompletiondir}])
AC_SUBST(bashcompletiondir)
AC_ARG_WITH(zshcompletiondir,
AC_HELP_STRING([--with-zshcompletiondir],
[Use the specified zshcompletion.d]),
[zshcompletiondir=${withval}],
[zshcompletiondir=${datadir}/zsh/site-functions])
AC_MSG_NOTICE([zsh-completion directory is ${zshcompletiondir}])
AC_SUBST(zshcompletiondir)
AC_ARG_ENABLE([python],
[AS_HELP_STRING([--enable-python],
[Python interface (default: yes)])],
[],
[])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[Use debug macro and specific CFLAGS])],
[AC_DEFINE(HAVE_DEBUG, [1], [enable debugging support])],
[enable_debug=no])
AM_CONDITIONAL([COND_DEBUG], [test x$enable_debug != xno])
AC_ARG_ENABLE([gcov],
[AS_HELP_STRING([--enable-gcov],
[Use gcov])],
[],
[enable_gcov=no])
AM_CONDITIONAL([COND_GCOV], [test x$enable_gcov != xno])
AC_ARG_ENABLE([tests],
[AS_HELP_STRING([--enable-tests],
[Build tests])],
[AC_DEFINE(HAVE_TESTS, [1], [enable tests])],
[enable_tests=no])
AM_CONDITIONAL([COND_TESTS], [test x$enable_tests != xno])
# Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AS_IF([test x$cross_compile != xyes], [PKG_PROG_PKG_CONFIG], [])
AC_DEFUN([LS_CHECK_CFLAG], [
AC_MSG_CHECKING([if $CC supports $1])
saved_cflags="$CFLAGS"
CFLAGS="$1 -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_RESULT([yes])
m4_default([$2], :)],
[AC_MSG_RESULT([no])
m4_default([$3], :)])
CFLAGS="$saved_cflags"
])
CPPFLAGS="$CPPFLAGS -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L"
LS_CHECK_CFLAG([-std=c99], [CFLAGS="$CFLAGS -std=c99"], [])
LS_CHECK_CFLAG([-Wall],[AM_CFLAGS="$AM_CFLAGS -Wall"], [])
LS_CHECK_CFLAG([-Wextra],[AM_CFLAGS="$AM_CFLAGS -Wextra"], [])
LS_CHECK_CFLAG([-Wformat=2],[AM_CFLAGS="$AM_CFLAGS -Wformat=2"], [])
LS_CHECK_CFLAG([-Wsign-conversion],
[AC_DEFINE(HAVE_DIAGNOSTIC_SIGN_CONVERSION, 1, [define 1 if GCC supports -Wsign-conversion])])
LS_CHECK_CFLAG([-Wuninitialized],
[AC_DEFINE(HAVE_DIAGNOSTIC_UNINITIALIZED, 1, [define 1 if GCC supports -Wuninitialized])])
LS_CHECK_CFLAG([-Wstrict-overflow],
[AC_DEFINE(HAVE_DIAGNOSTIC_STRICT_OVERFLOW, 1, [define 1 if GCC supports -Wstrict-overeflow=1])])
LS_CHECK_CFLAG([-Wshadow],
[AC_DEFINE(HAVE_DIAGNOSTIC_SHADOW, 1, [define 1 if GCC supports -Wshadow])])
LS_CHECK_CFLAG([-Wdouble-promotion],
[AC_DEFINE(HAVE_DIAGNOSTIC_DOUBLE_PROMOTION, 1, [define 1 if GCC supports -Wdouble-promotion])])
LS_CHECK_CFLAG([-Wswitch-default],
[AC_DEFINE(HAVE_DIAGNOSTIC_SWITCH_DEFAULT, 1, [define 1 if GCC supports -Wswitch-default])])
LS_CHECK_CFLAG([-Wunused-function],
[AC_DEFINE(HAVE_DIAGNOSTIC_UNUSED_FUNCTION, 1, [define 1 if GCC supports -Wunused-function])])
LS_CHECK_CFLAG([-Wclobbered],
[AC_DEFINE(HAVE_DIAGNOSTIC_CLOBBERED, 1, [define 1 if GCC supports -Wclobbered])])
LS_CHECK_CFLAG([-Wunused-but-set-variable],
[AC_DEFINE(HAVE_DIAGNOSTIC_UNUSED_BUT_SET_VARIABLE, 1, [define 1 if GCC supports -Wunused-but-set-variable])])
LS_CHECK_CFLAG([-Bsymbolic],
[AM_CFLAGS="$AM_CFLAGS -Bsymbolic"
AC_DEFINE(HAVE_BSYMBOLIC, 1, [define 1 if GCC supports -Bsymbolic])])
AS_IF([test x$enable_debug = xyes],
[LS_CHECK_CFLAG([-Werror], [AM_CFLAGS="$AM_CFLAGS -Werror"], [])])
AC_SUBST([AM_CFLAGS])
# For wic integration
#AC_PROG_CXX
# For test
AC_CHECK_PROGS(MD5SUM, [md5sum md5])
AC_SUBST(MD5SUM)
# Check math library
AC_CHECK_LIB([m], [floor])
# Checks for libraries.
AC_HEADER_STDC
# Checks for header files.
AC_CHECK_HEADERS([assert.h \
math.h \
ctype.h \
memory.h \
string.h \
unistd.h \
stdint.h \
sys/unistd.h \
getopt.h \
sys/types.h \
sys/stat.h \
fcntl.h \
io.h \
errno.h \
limits.h \
sys/time.h \
time.h \
signal.h \
sys/select.h \
sys/signal.h \
termios.h \
sys/ioctl.h \
inttypes.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNC([memset], [],
[AC_MSG_ERROR(memset is not available.)])
AC_CHECK_FUNC([getopt_long],
[AC_DEFINE(HAVE_GETOPT_LONG, 1, [whether getopt_long is avilable])
have_getopt_long=1],
[AC_CHECK_FUNC([getopt],
[AC_DEFINE(HAVE_GETOPT, 1, [whether getopt is avilable])],
[AC_MSG_ERROR(getopt or getopt_long is not available.)])])
AM_CONDITIONAL([HAVE_GETOPT_LONG], [test x$have_getopt_long = xyes])
AC_CHECK_FUNCS([memcpy \
memmove \
memset \
setmode \
_setmode \
signal \
nanosleep \
strdup \
strtoul \
calloc \
clock \
clearerr \
stat \
setjmp \
longjmp \
strerror \
isatty \
strncmp \
ldiv \
floor \
localeconv \
pow \
select \
sqrt \
strchr \
strerror \
strstr \
strtol])
# for HDR
AC_CHECK_FUNCS([strtol pow])
AC_CHECK_DECLS([SIGINT, SIGTERM, SIGHUP],,,
[
#ifdef HAVE_SIGNAL_H
# include <signal.h>
#elif HAVE_SYS_SIGNAL_H
# include <sys/signal.h>
#endif
])
loaders="stb_image"
have_curl="no" have_jpeg="no"
have_png="no"
#have_wic="no"
#if test x$with_wic != xno; then
# AC_CHECK_HEADERS([wincodec.h], [],
# [AC_MSG_ERROR([WIC integration: wincodec.h is not avilable.])])
# AC_CHECK_LIB([ole32], [main], [],
# [AC_MSG_ERROR([WIC integration: library ole32 is not avilable.])])
# AC_CHECK_LIB([uuid], [main], [],
# [AC_MSG_ERROR([WIC integration: library uuid is not avilable.])])
# AC_CHECK_LIB([windowscodecs], [main], [],
# [AC_MSG_ERROR([WIC integration: library wincodecs is not avilable.])])
# have_wic="yes"
#fi
if test x$with_gdk_pixbuf2 != xno; then
if test x${PKG_CONFIG} != x; then
PKG_CHECK_MODULES([GDK_PIXBUF],
[gdk-pixbuf-2.0],
[have_gdk_pixbuf2=yes],
[have_gdk_pixbuf2=no])
if test x$have_gdk_pixbuf2 != xno; then
AC_MSG_NOTICE([gdk-pixbuf: $have_gdk_pixbuf2])
AC_DEFINE(HAVE_GDK_PIXBUF2, 1, [whether gdk-pixbuf2 is available])
loaders="${loaders} gdk-pixbuf2"
else
AC_MSG_ERROR([pkg-config is not available.])
fi
else
if test x${GDK_PIXBUF_CFLAGS} = x || test x${GDK_PIXBUF_LIBS} = x; then
AC_MSG_ERROR([please set GDK_PIXBUF_CFLAGS and GDK_PIXBUF_LIBS, or install pkg-config.])
fi
fi
AC_MSG_NOTICE([gdk-pixbuf-2.0 cflags is ${GDK_PIXBUF_CFLAGS}])
AC_MSG_NOTICE([gdk-pixbuf-2.0 libs is ${GDK_PIXBUF_LIBS}])
fi
AC_SUBST(GDK_PIXBUF_CFLAGS)
AC_SUBST(GDK_PIXBUF_LIBS)
if test x$with_gd != xno; then
CFLAGS_BACKUP=$CFLAGS
LDFLAGS_BACKUP=$LDFLAGS
if test x$with_gd != xyes -a x$with_gd != xauto; then
if test ! -d "$with_gd"; then
AC_MSG_ERROR(["${with_gd}" is not directory])
fi
ADDED_CFLAGS="-I${with_gd}/include"
ADDED_LIBS="-L${with_gd}/lib -lgd"
else
if test x${prefix} != x -a x${prefix} != xNONE; then
ADDED_CFLAGS="-I${prefix}/include"
ADDED_LIBS="-L${prefix}/lib -lgd"
else
ADDED_CFLAGS="-I/usr/local/include"
ADDED_LIBS="-L/usr/local/lib -lgd"
fi
fi
CFLAGS="${CFLAGS} ${GD_CFLAGS}"
LDFLAGS="${LDFLAGS} ${GD_LIBS}"
AC_CHECK_HEADER([gd.h],
[AC_CHECK_LIB([gd],
[gdImageCreateFromGifPtr],
[have_gd="yes"
GD_CFLAGS=$ADDED_CFLAGS
GD_LIBS=$ADDED_LIBS],
[have_gd="no"])])
CFLAGS=$CFLAGS_BACKUP
LDFLAGS=$LDFLAGS_BACKUP
if test x${PKG_CONFIG} != x; then
if test x$have_gd != xyes -a ! -d "$with_gd"; then
PKG_CHECK_MODULES(GD, [gdlib], [have_gd=yes], [have_gd=no])
fi
fi
if test x$have_gd = xyes; then
CFLAGS_BACKUP=$CFLAGS
LDFLAGS_BACKUP=$LDFLAGS
CFLAGS="$CFLAGS $GD_CFLAGS"
LDFLAGS="${LDFLAGS} ${GD_LIBS}"
AC_CHECK_LIB([gd],
[gdImageCreateFromGifPtr],
[AC_CHECK_DECLS([gdImageCreateFromGifPtr], [], [], [ #include <gd.h> ])])
AC_CHECK_LIB([gd],
[gdImageCreateFromPngPtr],
[AC_CHECK_DECLS([gdImageCreateFromPngPtr], [], [], [ #include <gd.h> ])])
AC_CHECK_LIB([gd],
[gdImageCreateFromBmpPtr],
[AC_CHECK_DECLS([gdImageCreateFromBmpPtr], [], [], [ #include <gd.h> ])])
AC_CHECK_LIB([gd],
[gdImageCreateFromJpegPtrEx],
[AC_CHECK_DECLS([gdImageCreateFromJpegPtrEx],[], [], [ #include <gd.h> ])])
AC_CHECK_LIB([gd],
[gdImageCreateFromJpegPtr],
[AC_CHECK_DECLS([gdImageCreateFromJpegPtr], [], [], [ #include <gd.h> ])])
AC_CHECK_LIB([gd],
[gdImageCreateFromTgaPtr],
[AC_CHECK_DECLS([gdImageCreateFromTgaPtr], [], [], [ #include <gd.h> ])])
AC_CHECK_LIB([gd],
[gdImageCreateFromWBMPPtr],
[AC_CHECK_DECLS([gdImageCreateFromWBMPPtr], [], [], [ #include <gd.h> ])])
AC_CHECK_LIB([gd],
[gdImageCreateFromTiffPtr],
[AC_CHECK_DECLS([gdImageCreateFromTiffPtr], [], [], [ #include <gd.h> ])])
AC_CHECK_LIB([gd],
[gdImageCreateFromGd2Ptr],
[AC_CHECK_DECLS([gdImageCreateFromGd2Ptr], [], [], [ #include <gd.h> ])])
AC_CHECK_LIB([gd],
[gdImagePaletteToTrueColor],
[AC_CHECK_DECLS([gdImagePaletteToTrueColor], [], [], [ #include <gd.h> ])])
CFLAGS=$CFLAGS_BACKUP
LDFLAGS=$LDFLAGS_BACKUP
AC_DEFINE(HAVE_GD, 1, [whether gd is available])
loaders="${loaders} gd"
else
GD_CFLAGS=
GD_LIBS=
AC_MSG_ERROR(gd is not available.)
fi
case $host in
*-*-cygwin)
AC_CHECK_LIB(iconv, [libiconv], [],
[AC_CHECK_LIB(iconv, [iconv], [],
[AC_MSG_ERROR([please install libiconv])])
])
;;
*-*-interix)
AM_CPPFLAGS="-D_ALL_SOURCES"
AC_SUBST([AM_CPPFLAGS])
;;
esac
AC_MSG_NOTICE([gd cflags is ${GD_CFLAGS}])
AC_MSG_NOTICE([gd libs is ${GD_LIBS}])
fi
AC_SUBST(GD_CFLAGS)
AC_SUBST(GD_LIBS)
if test x$with_libcurl != xno; then
if test x$build = x$host; then
CFLAGS_BACKUP=$CFLAGS
LDFLAGS_BACKUP=$LDFLAGS
if test x$with_libcurl != xyes -a x$with_libcurl != xauto; then
if test ! -d "$with_libcurl"; then
AC_MSG_ERROR(["${with_libcurl}" is not directory])
fi
ADDED_CFLAGS="-I${with_libcurl}/include"
ADDED_LIBS="-L${with_libcurl}/lib -lcurl"
else
if test x${prefix} != x -a x${prefix} != xNONE; then
ADDED_CFLAGS="-I${prefix}/include"
ADDED_LIBS="-L${prefix}/lib -lcurl"
else
ADDED_CFLAGS="-I/usr/local/include"
ADDED_LIBS="-L/usr/local/lib -lcurl"
fi
fi
CFLAGS="${CFLAGS} ${ADDED_CFLAGS}"
LDFLAGS="${LDFLAGS} ${ADDED_LIBS}"
AC_CHECK_HEADER([curl/curl.h],
[AC_CHECK_LIB([curl],
[curl_easy_cleanup],
[have_curl=yes
LIBCURL_CFLAGS=$ADDED_CFLAGS
LIBCURL_LIBS=$ADDED_LIBS],
[have_curl=no])])
CFLAGS=$CFLAGS_BACKUP
LDFLAGS=$LDFLAGS_BACKUP
if test x$have_curl != xyes -a ! -d "$with_libcurl"; then
if test x${PKG_CONFIG} != x; then
PKG_CHECK_MODULES(LIBCURL,
[libcurl],
[have_curl=yes],
[have_curl=no])
fi
fi
fi
if test x$have_curl = xyes; then
AC_DEFINE(HAVE_LIBCURL, 1, [whether libcurl is available])
else
if test x$with_libcurl != xauto; then
AC_MSG_ERROR([unable to find libcurl])
fi
AC_MSG_NOTICE([libcurl is not available])
fi
AC_MSG_NOTICE([libcurl cflags is ${LIBCURL_CFLAGS}])
AC_MSG_NOTICE([libcurl libs is ${LIBCURL_LIBS}])
fi
AC_SUBST(LIBCURL_CFLAGS)
AC_SUBST(LIBCURL_LIBS)
if test x$with_jpeg != xno; then
if test x$build = x$host; then
CFLAGS_BACKUP=$CFLAGS
LDFLAGS_BACKUP=$LDFLAGS
if test x$with_jpeg != xyes -a x$with_jpeg != xauto; then
if test ! -d "$with_jpeg"; then
AC_MSG_ERROR(["${with_jpeg}" is not directory])
fi
ADDED_CFLAGS="-I${with_jpeg}/include"
ADDED_LIBS="-L${with_jpeg}/lib -ljpeg"
else
if test x${prefix} != x -a x${prefix} != xNONE; then
ADDED_CFLAGS="-I${prefix}/include"
ADDED_LIBS="-L${prefix}/lib -ljpeg"
else
ADDED_CFLAGS="-I/usr/local/include"
ADDED_LIBS="-L/usr/local/lib -ljpeg"
fi
fi
CFLAGS="${CFLAGS} ${ADDED_CFLAGS}"
LDFLAGS="${LDFLAGS} ${ADDED_LIBS}"
AC_CHECK_HEADER([jpeglib.h],
[AC_CHECK_LIB([jpeg],
[jpeg_read_header],
[have_jpeg=yes
LIBJPEG_CFLAGS=$ADDED_CFLAGS
LIBJPEG_LIBS=$ADDED_LIBS],
[have_jpeg=no])])
CFLAGS=$CFLAGS_BACKUP
LDFLAGS=$LDFLAGS_BACKUP
if test x$have_jpeg != xyes -a ! -d "$with_jpeg"; then
if test x${PKG_CONFIG} != x; then
PKG_CHECK_MODULES(LIBJPEG,
[libjpeg],
[have_jpeg=yes],
[have_jpeg=no])
fi
fi
fi
if test x$have_jpeg = xyes; then
LIBJPEG_CFLAGS=$ADDED_CFLAGS
LIBJPEG_LIBS=$ADDED_LIBS
AC_DEFINE(HAVE_JPEG, 1, [whether jpeg codec library is available])
loaders="${loaders} jpeg"
AC_MSG_NOTICE([jpeg cflags is ${LIBJPEG_CFLAGS}])
AC_MSG_NOTICE([jpeg libs is ${LIBJPEG_LIBS}])
else
if test x$with_jpeg != xauto; then
AC_MSG_ERROR([unable to find jpeg codec library])
fi
AC_MSG_NOTICE([libjpeg is not available])
fi
fi
AC_SUBST(LIBJPEG_CFLAGS)
AC_SUBST(LIBJPEG_LIBS)
if test x$with_png != xno; then
if test x$build = x$host; then
CFLAGS_BACKUP=$CFLAGS
LDFLAGS_BACKUP=$LDFLAGS
if test x$with_png != xyes -a x$with_png != xauto; then
if test ! -d "$with_png"; then
AC_MSG_ERROR(["${with_png}" is not directory])
fi
ADDED_CFLAGS="-I${with_png}/include"
ADDED_LIBS="-L${with_png}/lib -lpng"
else
if test x${prefix} != x -a x${prefix} != xNONE; then
ADDED_CFLAGS="-I${prefix}/include"
ADDED_LIBS="-L${prefix}/lib -lpng"
else
ADDED_CFLAGS="-I/usr/local/include"
ADDED_LIBS="-L/usr/local/lib -lpng"
fi
fi
CFLAGS="${CFLAGS} ${ADDED_CFLAGS}"
LDFLAGS="${LDFLAGS} ${ADDED_LIBS}"
AC_CHECK_HEADER([png.h],
[AC_CHECK_LIB([png],
[png_check_sig],
[have_png=yes
LIBPNG_CFLAGS=$ADDED_CFLAGS
LIBPNG_LIBS=$ADDED_LIBS],
[have_png=no])])
CFLAGS=$CFLAGS_BACKUP
LDFLAGS=$LDFLAGS_BACKUP
if test x$have_png != xyes -a ! -d "$with_png"; then
if test x${PKG_CONFIG} != x; then
PKG_CHECK_MODULES(LIBPNG,
[libpng],
[have_png=yes],
[have_png=no])
fi
fi
fi
if test x$have_png = xyes; then
CFLAGS="${CFLAGS} ${LIBPNG_CFLAGS}"
LDFLAGS="${LDFLAGS} ${LIBPNG_LIBS}"
AC_CHECK_DECLS([png_set_gray_1_2_4_to_8, png_set_expand_gray_1_2_4_to_8],
[], [], [ #include <png.h> ])
CFLAGS=$CFLAGS_BACKUP
LDFLAGS=$LDFLAGS_BACKUP
AC_DEFINE(HAVE_LIBPNG, 1, [whether libpng is available])
loaders="${loaders} png"
AC_MSG_NOTICE([libpng cflags is ${LIBPNG_CFLAGS}])
AC_MSG_NOTICE([libpng libs is ${LIBPNG_LIBS}])
else
if test x$with_png != xauto; then
AC_MSG_ERROR([unable to find libpng])
fi
AC_MSG_NOTICE([libpng is not available])
fi
fi
AC_SUBST(LIBPNG_CFLAGS)
AC_SUBST(LIBPNG_LIBS)
have_python=no
if test x$enable_python != xno; then
AM_PATH_PYTHON([2.3], [have_python=yes], [have_python=no])
if test x$enable_python = xyes -a x$have_python = xno; then
AC_MSG_ERROR([python is not available])
fi
fi
AM_CONDITIONAL([HAVE_PYTHON], [test x$have_python = xyes])
if test x$have_python = xyes; then
message_python="$have_python: $pythondir"
else
message_python=$have_python
fi
AC_DEFUN([LS_UPDATE_TIMESTAMP], [
touch -c aclocal.m4 Makefile.in configure config.h.in \
converters/Makefile.in include/Makefile.in \
python/Makefile.in src/Makefile.in tools/Makefile.in
])
LS_UPDATE_TIMESTAMP
AM_CONDITIONAL([HAVE_JPEG], [test x$have_jpeg = xyes])
AM_CONDITIONAL([HAVE_PNG], [test x$have_png = xyes])
AM_CONDITIONAL([HAVE_CURL], [test x$have_curl = xyes])
AC_CONFIG_FILES([Makefile
libsixel.pc
package.json.in
include/sixel.h
src/Makefile
include/Makefile
converters/Makefile
tools/Makefile
tools/libsixel-config
python/Makefile
])
AC_OUTPUT
echo ""
echo ""
echo "libsixel was configured as follows"
echo ""
echo " Loader component : $loaders"
echo " libcurl integration : $have_curl"
echo " pkg-config dir : $pkgconfigdir"
echo " Bash completion dir : $bashcompletiondir"
echo " Zsh completion dir : $zshcompletiondir"
#echo " WIC integration : $have_wic"
echo " python bindings : $message_python"
echo " gcov integration : $enable_gcov"
echo " debugging : $enable_debug"
echo " tests : $enable_tests"
echo ""
echo ""