File: configure.in

package info (click to toggle)
abiword 0.7.7-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 20,604 kB
  • ctags: 18,358
  • sloc: cpp: 88,791; ansic: 66,296; sh: 7,777; makefile: 3,397; xml: 687; perl: 361; awk: 273; sed: 36; csh: 28
file content (781 lines) | stat: -rw-r--r-- 19,980 bytes parent folder | download
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
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
dnl Process this file with autoconf to produce a configure script.
AC_INIT(fib.c)
AC_CONFIG_HEADER(config.h)

dnl Checks for programs.
dnl AC_PROG_CC
dnl AC_PROG_CC shoves in -g by default, i *really* hate this so here goes...
dnl ill shove in the autoconf def of AC_PROG_CC verbatim and remove the -g 
dnl stuff
dnl autoconf stuff begins here

AC_DEFUN(AC_PROG_CC_NO_G,
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_CHECK_PROG(CC, gcc, gcc)
if test -z "$CC"; then
  AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
  test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
fi

AC_PROG_CC_WORKS
AC_PROG_CC_GNU

dnl exec suffix for DOSish OSes, autoconf-2.13 required.

if test $ac_cv_prog_gcc = yes; then
  GCC=yes
dnl Check whether -g works, even if CFLAGS is set, in case the package
dnl plays around with CFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
  ac_test_CFLAGS="${CFLAGS+set}"
  ac_save_CFLAGS="$CFLAGS"
  CFLAGS=
dnl   C Begin
dnl AC_PROG_CC_G
dnl   C End
  if test "$ac_test_CFLAGS" = set; then
    CFLAGS="$ac_save_CFLAGS"
dnl   C Begin
dnl  elif test $ac_cv_prog_cc_g = yes; then
dnl    CFLAGS="-g -O2"
dnl   C End
  else
    CFLAGS="-O2"
  fi
else
  GCC=
  test "${CFLAGS+set}" = set 
dnl   C Begin
dnl || CFLAGS="-g"
dnl   C End
fi
])

dnl autoconf stuff ends here


AC_PROG_CC_NO_G
AC_PROG_MAKE_SET
AC_PROG_INSTALL

AC_PROG_RANLIB

# Tests for Windows
AC_CYGWIN
AC_EXEEXT
AC_OBJEXT
AC_MINGW32
# End Tests for Windows

# Configure libtool
#AM_ENABLE_SHARED(no)
#AM_ENABLE_STATIC(no)
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
#end libtool stuff


AC_HEADER_STDC
dnl AC_HEADER_SYS_WAIT
dnl AC_TYPE_SIGNAL
dnl AC_FUNC_WAIT3

AC_CHECK_HEADERS(fcntl.h sys/file.h sys/ioctl.h unistd.h)
CFLAGS="$CFLAGS $X_CFLAGS"


dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

dnl LDFLAGS="$LDFLAGS -lm"

dnl test for X, and Xpm and ttf to get the flags needed to compile something to use libwmf

dnl finding X
AC_PATH_X
### Check for the pt library (for SCO, needed for X)
AC_CHECK_LIB(pt,ptsname,[X_EXTRA_LIBS="$X_EXTRA_LIBS -lpt"])

AC_PATH_XTRA

dnl CFLAGS="$CFLAGS $X_CFLAGS"

if test [ "$no_x" = yes ]; then
X11=""
else
X11="-lX11" 
fi

dnl LIBS="$X_LIBS $LIBS -lX11 $X_EXTRA_LIBS"


dnl system ZLIB support, originally nicked from mozilla source
dnl ========================================================
AC_ARG_WITH(zlib,
[  --with-zlib=\$dir        use system libz in \$dir],
    ZLIB_DIR=$withval)

_SAVE_CFLAGS=$CFLAGS
_SAVE_LDFLAGS=$LDFLAGS
CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
if test "$ZLIB_DIR" = no; then
    SYSTEM_ZLIB=
else
    AC_MSG_CHECKING("for zlib.h")
    AC_TRY_COMPILE([#include "zlib.h"], [],
    [result="yes" SYSTEM_ZLIB=1],
    [result="no" SYSTEM_ZLIB=])
    AC_MSG_RESULT("$result") 
fi  

if [ test "$SYSTEM_ZLIB" = 1 ]; then

dnl there is often a crap libz hiding in the X11 lib dir
dnl redhat 4.2 and SuSE have been known to do this, something to do with the libgr 
dnl package and imake
dnl so for this reason i stick -L/usr/lib before the X11 options here first

	_SAVE_LD=$LDFLAGS
	LDFLAGS="-L/usr/lib $LDFLAGS"
	
    AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz"],
    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])

dnl if there wasn't a usable libz, then look for libgz ala SuSE

	if [ test "$SYSTEM_ZLIB" = "" ]; then
    AC_CHECK_LIB(gz, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lgz"],
    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
	fi
fi

if [ test -n "${ZLIB_DIR}" && test -d "${ZLIB_DIR}" && test "$SYSTEM_ZLIB" = 1 ]; then
    ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
    ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
fi

if [ test "$SYSTEM_ZLIB" = "" ]; then
	CFLAGS="-I${ZLIB_DIR} $CFLAGS"
	LDFLAGS="-L${ZLIB_DIR} $LDFLAGS"
	if test "$ZLIB_DIR" = no; then
		SYSTEM_ZLIB=
	else
		AC_MSG_CHECKING("for zlib.h")
		AC_TRY_COMPILE([#include "zlib.h"], [],
		[result="yes" SYSTEM_ZLIB=1],
		[result="no, WARNING mswordview will not be able to decompress wmf files" SYSTEM_ZLIB=])
		AC_MSG_RESULT("$result") 
	fi  

	if [ test "$SYSTEM_ZLIB" = 1 ]; then

	dnl there is often a crap libz hiding in the X11 lib dir
	dnl redhat 4.2 and SuSE have been known to do this, something to do with the libgr 
	dnl package and imake
	dnl so for this reason i stick -L/usr/lib before the X11 options here first

		LDFLAGS=$_SAVE_LD
		LDFLAGS="-L/usr/lib $LDFLAGS"
		
		AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz"],
		[SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])

	dnl if there wasn't a usable libz, then look for libgz ala SuSE

		if [ test "$SYSTEM_ZLIB" = "" ]; then
		AC_CHECK_LIB(gz, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lgz"],
		[SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
		fi
	fi


if [ test -n "${ZLIB_DIR}" && test -d "${ZLIB_DIR}" && test "$SYSTEM_ZLIB" = 1 ]; then
    ZLIB_CFLAGS="-I${ZLIB_DIR}"
    ZLIB_LIBS="-L${ZLIB_DIR} ${ZLIB_LIBS}"
fi

fi

CFLAGS=$_SAVE_CFLAGS
LDFLAGS=$_SAVE_LDFLAGS

dnl ========================================================
dnl end of zlib

dnl system xpm support, done after X, as its usually in the same place
dnl ========================================================
AC_ARG_WITH(xpm,
[  --with-xpm=\$dir   find the xpm library in \$dir],
    XPM_DIR=$withval)

_SAVE_CFLAGS=$CFLAGS
_SAVE_LDFLAGS=$LDFLAGS
_SAVE_LIBS=$LIBS

CFLAGS="$CFLAGS $X_CFLAGS"

dnl LIBS="$LIBS $X_LIBS $X_EXTRA_LIBS"

if test "$XPM_DIR" != "" ; then
CFLAGS="-I${XPM_DIR}/include $CFLAGS"
LDFLAGS="-L${XPM_DIR}/lib $LDFLAGS"
fi


if test "$XPM_DIR" = no; then
    SYSTEM_XPM=0
else
    AC_MSG_CHECKING("for xpm.h")
    AC_TRY_COMPILE([#include <X11/xpm.h>], [],
    [result="yes" SYSTEM_XPM=1],
    [result="no" SYSTEM_XPM=0])
    if [test "$SYSTEM_XPM" = 0]; then
        AC_TRY_COMPILE([#include <xpm.h>], [],
        [result="yes" SYSTEM_XPM=1],
        [result="no" SYSTEM_XPM=0])
        XPMINCLUDE="<xpm.h>"
    else
        XPMINCLUDE="<X11/xpm.h>"
    fi
    AC_MSG_RESULT("$result")
fi
if [ test "$SYSTEM_XPM" = 1 ]; then
    AC_CHECK_LIB(Xpm, main, [XPM_LIBS="-lXpm"],no_Xpm=yes,$X_LIBS -lX11 $X_EXTRA_LIBS)
else
    no_Xpm=yes
fi

if [ test -n "${XPM_DIR}" && test -d "${XPM_DIR}" && test "$SYSTEM_XPM" = 1 ]; then
    XPM_CFLAGS="-I${XPM_DIR}/include"
    XPM_LIBS="-L${XPM_DIR}/lib ${XPM_LIBS}"
fi

if test "x$no_Xpm" = "xyes"; then
	if test "$XPM_DIR" != "" ; then
	CFLAGS="-I${XPM_DIR}/include $CFLAGS"
	LDFLAGS="-L${XPM_DIR}/lib $LDFLAGS"
	fi


	if test "$XPM_DIR" = no; then
		SYSTEM_XPM=0
	else
		AC_MSG_CHECKING("for xpm.h")
		AC_TRY_COMPILE([#include <X11/xpm.h>], [],
		[result="yes" SYSTEM_XPM=1],
		[result="no" SYSTEM_XPM=0])
		if [test "$SYSTEM_XPM" = 0]; then
			AC_TRY_COMPILE([#include <xpm.h>], [],
			[result="yes" SYSTEM_XPM=1],
			[result="no" SYSTEM_XPM=0])
			XPMINCLUDE="<xpm.h>"
		else
			XPMINCLUDE="<X11/xpm.h>"
		fi
		AC_MSG_RESULT("$result")
	fi
	if [ test "$SYSTEM_XPM" = 1 ]; then
		AC_CHECK_LIB(Xpm, main, [XPM_LIBS="-lXpm"],no_Xpm=yes,$X_LIBS -lX11 $X_EXTRA_LIBS)
	else
		no_Xpm=yes
	fi


if [ test -n "${XPM_DIR}" && test -d "${XPM_DIR}" && test "$SYSTEM_XPM" = 1 ]; then
    XPM_CFLAGS="-I${XPM_DIR}"
    XPM_LIBS="-L${XPM_DIR} ${XPM_LIBS}"
fi

fi

CFLAGS=$_SAVE_CFLAGS
LDFLAGS=$_SAVE_LDFLAGS
LIBS=$_SAVE_LIBS



dnl system ttf support
dnl ========================================================
AC_ARG_WITH(ttf,
[  --with-ttf=\$dir   find the ttf library in \$dir],
    TTF_DIR=$withval)

_SAVE_CFLAGS=$CFLAGS
_SAVE_LDFLAGS=$LDFLAGS

if test "$TTF_DIR" != "" ; then
CFLAGS="-I${TTF_DIR}/include $CFLAGS"
LDFLAGS="-L${TTF_DIR}/lib $LDFLAGS"
fi

if test "$TTF_DIR" = no; then
    SYSTEM_TTF=0
else
    AC_MSG_CHECKING("for freetype.h")
    AC_TRY_COMPILE([#include "freetype.h"], [],
    [result="yes" SYSTEM_TTF=1],
    [])
    AC_MSG_RESULT("$result")
fi
if [ test "$SYSTEM_TTF" = 1 ]; then
    AC_CHECK_LIB(ttf, TT_Init_FreeType, [TTF_LIBS="-lttf"],no_ttf=yes,-lm)
else
    no_ttf=yes
fi

if [ test -n "${TTF_DIR}" && test -d "${TTF_DIR}" && test "$SYSTEM_TTF" = 1 ]; then
    TTF_CFLAGS="-I${TTF_DIR}/include"
    TTF_LIBS="-L${TTF_DIR}/lib ${TTF_LIBS}"
fi

if test "x$no_ttf" = xyes; then
	if test "$TTF_DIR" != "" ; then
	CFLAGS="-I${TTF_DIR} $CFLAGS"
	LDFLAGS="-L${TTF_DIR} $LDFLAGS"
	fi

	if test "$TTF_DIR" = no; then
		SYSTEM_TTF=0
	else
		AC_MSG_CHECKING("for freetype.h")
		AC_TRY_COMPILE([#include "freetype.h"], [],
		[result="yes" SYSTEM_TTF=1],
		[result="no, WARNING the gd binding will not be able to handle wmf text" SYSTEM_TTF=0])
		AC_MSG_RESULT("$result")
	fi
	if [ test "$SYSTEM_TTF" = 1 ]; then
		AC_CHECK_LIB(ttf, TT_Init_FreeType, [TTF_LIBS="-lttf"],no_ttf=yes,-lm)
	else
		no_ttf=yes
	fi


if [ test -n "${TTF_DIR}" && test -d "${TTF_DIR}" && test "$SYSTEM_TTF" = 1 ]; then
    TTF_CFLAGS="-I${TTF_DIR}"
    TTF_LIBS="-L${TTF_DIR} ${TTF_LIBS}"
fi

fi

 CFLAGS=$_SAVE_CFLAGS
 LDFLAGS=$_SAVE_LDFLAGS



dnl system libwmf support
dnl ========================================================
AC_ARG_WITH(wmf,
[  --with-wmf=\$dir        use wmf libraries in \$dir],
    WMF_DIR=$withval)

_SAVE_CFLAGS=$CFLAGS
_SAVE_LDFLAGS=$LDFLAGS
_SAVE_LIBS=$LIBS

if test "$WMF_DIR" != "" ; then
CFLAGS="-I${WMF_DIR}/include $CFLAGS"
LDFLAGS="-L${WMF_DIR}/lib $LDFLAGS"
fi

dnl LIBS="$LIBS $TTF_LIBS $XPM_LIBS"

if test "$WMF_DIR" = no; then
    SYSTEM_WMF=0
else
    AC_MSG_CHECKING("for gdwmfapi.h")
    AC_TRY_COMPILE([#include "gdwmfapi.h"], [],
    [result="yes" SYSTEM_WMF=1],
    [result="no" SYSTEM_WMF=0])
    AC_MSG_RESULT("$result") 
fi  
if [ test "$SYSTEM_WMF" = 1 ]; then
    AC_CHECK_LIB(gdwmf, gd_draw_rectangle, [WMF_LIBS="-lgdwmf -lwmf -lxgd -ldib"],
	no_wmf=yes,-lwmf -lxgd -ldib $TTF_LIBS $XPM_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS -lm)
else
    no_wmf=yes
fi

if [ test -n "${WMF_DIR}" && test -d "${WMF_DIR}" && test "$SYSTEM_WMF" = 1 ]; then
    WMF_CFLAGS="-I${WMF_DIR}/include"
    WMF_LIBS="-L${WMF_DIR}/lib ${WMF_LIBS}"
fi

if test "x$no_wmf" = xyes; then
	if test "$WMF_DIR" != "" ; then
	CFLAGS="-I${WMF_DIR}/include $CFLAGS"
	LDFLAGS="-L${WMF_DIR}/lib $LDFLAGS"
	fi

	LDFLAGS="$LDFLAGS $TTF_LIBS $XPM_LIBS"

	if test "$WMF_DIR" = no; then
		SYSTEM_WMF=0
	else
		AC_MSG_CHECKING("for gdwmfapi.h")
		AC_TRY_COMPILE([#include "gdwmfapi.h"], [],
		[result="yes" SYSTEM_WMF=1],
		[result="no, WARNING mswordview will not be able to convert wmf files to gif" SYSTEM_WMF=0])
		AC_MSG_RESULT("$result") 
	fi  
	if [ test "$SYSTEM_WMF" = 1 ]; then
		AC_CHECK_LIB(gdwmf, gd_draw_rectangle, [WMF_LIBS="-lgdwmf -lwmf -lxgd -ldib"],
		no_wmf=yes,-lwmf -lxgd -ldib $TTF_LIBS $XPM_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS -lm)
	else
		no_wmf=yes
	fi


if [ test -n "${WMF_DIR}" && test -d "${WMF_DIR}" && test "$SYSTEM_WMF" = 1 ]; then
    WMF_CFLAGS="-I${WMF_DIR}"
    WMF_LIBS="-L${WMF_DIR} ${WMF_LIBS}"
fi

fi

CFLAGS=$_SAVE_CFLAGS
LDFLAGS=$_SAVE_LDFLAGS
LIBS=$_SAVE_LIBS

dnl ========================================================
dnl end of libwmf


dnl ========================================================
dnl test for iconv


AC_DEFUN(AC_SYS_ICONV_WIN_CP_SUPPORT,
[
AC_MSG_CHECKING([for existance of $1 to $2 iconv support])
dnl AC_CACHE_VAL(have_codepages,
dnl [
AC_TRY_RUN([
	#include <iconv.h>
	#include <stdio.h>
	#include <errno.h>
	#include <string.h>
	#include <stdlib.h>

	int main(int argc, char *argv[])
	{
		char f_code[33];              /* From CCSID                           */
		char t_code[33];              /* To CCSID                             */
		iconv_t iconv_handle;         /* Conversion Descriptor returned       */
									/* from iconv_open() function           */
		const char *ibuf = "ABCxyz012#&";   /* Buffer of characters to be converted */
		char *obuf;                   /* Buffer for converted characters      */
		size_t ibuflen;               /* Length of input buffer               */
		size_t obuflen;               /* Length of output buffer              */
		const char *isav;             /* Saved pointer to input buffer        */
		char *osav;                   /* Saved pointer to output buffer       */

	/* All reserved positions of from code (last 12 characters) and to code   */
	/* (last 19 characters) must be set to hexadecimal zeros.                 */

		memset(f_code,'\0',33);
		memset(t_code,'\0',33);

		strcpy(f_code,"$1");
		strcpy(t_code,"$2");

		iconv_handle = iconv_open(t_code,f_code);
		if (iconv_handle == (iconv_t)-1)
		{
			perror("ERROR");
			fprintf(stderr,"iconv_open fail: cannot handle %s to %s\n","$1","$2");
			exit(-1);
		}
		else
			{
			fprintf(stderr,"success!, can handle %s to %s\n","$1","$2");
			iconv_close(iconv_handle);
			}
		return(0);
	}
], have_codepages=yes, have_codepages=no, have_codepages=no)
dnl])
AC_MSG_RESULT($have_codepages)
if test $have_codepages = no; then
AC_DEFINE(MUST_USE_INTERNAL_ICONV_TABLE)
ICONVOBJS="\$(RICONVOBJS)"
ICONV="ICONV"
fi
])

AC_CHECK_FUNC(iconv, [
AC_DEFINE(USE_ICONV)
have_iconv=yes], 
ICONVOBJS="\$(RICONVOBJS)"
ICONV="ICONV"
have_iconv=no)

if [ test "$have_iconv" = yes ]; then
	AC_SYS_ICONV_WIN_CP_SUPPORT(CP874,UCS-2)
dnl	AC_SYS_ICONV_WIN_CP_SUPPORT(CP936,UCS-2)
dnl	AC_SYS_ICONV_WIN_CP_SUPPORT(CP932,UCS-2)
dnl	AC_SYS_ICONV_WIN_CP_SUPPORT(CP949,UCS-2)
dnl	AC_SYS_ICONV_WIN_CP_SUPPORT(CP950,UCS-2)
	AC_SYS_ICONV_WIN_CP_SUPPORT(CP1250,UCS-2)
	AC_SYS_ICONV_WIN_CP_SUPPORT(CP1251,UCS-2)
	AC_SYS_ICONV_WIN_CP_SUPPORT(CP1252,UCS-2)
	AC_SYS_ICONV_WIN_CP_SUPPORT(CP1253,UCS-2)
	AC_SYS_ICONV_WIN_CP_SUPPORT(CP1254,UCS-2)
	AC_SYS_ICONV_WIN_CP_SUPPORT(CP1255,UCS-2)
	AC_SYS_ICONV_WIN_CP_SUPPORT(CP1256,UCS-2)
	AC_SYS_ICONV_WIN_CP_SUPPORT(CP1257,UCS-2)

	AC_SYS_ICONV_WIN_CP_SUPPORT(UCS-2,UTF-8)
	AC_SYS_ICONV_WIN_CP_SUPPORT(UCS-2,koi8-r)
	AC_SYS_ICONV_WIN_CP_SUPPORT(UCS-2,tis-620)
	AC_SYS_ICONV_WIN_CP_SUPPORT(UCS-2,iso-8859-15)
fi

dnl end of iconv
dnl ========================================================

dnl ========================================================
dnl test for imagemagick
dnl test for the existance of the MagickConfig program,
dnl if its not there then we dont have imagemagick, if it
dnl is there then we still have to do a big dance to get
dnl something to link against it as it does not provide all
dnl the information that we need to compile against it
dnl first try it raw, maybe the author will have fixed it
dnl by now, then try it with the prefix attached, and then
dnl try it with the X varient of that, and then try it with
dnl both.

AC_ARG_WITH(Magick,
[  --with-Magick=\$dir        use system Magick in \$Magici],
MAGICK_DIR=$withval)

if test "$MAGICK_DIR" = no; then
	result="no"
else
	AC_CHECK_PROG(havemagick,Magick-config,"yes","no")
	if test "x$havemagick" = xyes; then
dnl cflags test begins 

		_SAVE_CFLAGS=$CFLAGS

		mflags=`Magick-config --cflags`

		CFLAGS="$mflags $CFLAGS"

		AC_MSG_CHECKING("for magick.h")
		AC_TRY_COMPILE([#include "magick.h"], [],
		[result="yes"],
		[result="no" CFLAGS=$_SAVE_CFLAGS])
		AC_MSG_RESULT("$result") 

		if test "x$result" = xno; then
			_SAVE_CFLAGS=$CFLAGS

			mflags=`Magick-config --cflags`
			CFLAGS="$mflags $CFLAGS"
			mflags=`Magick-config --prefix`
			CFLAGS="-I$mflags/include/magick/ $CFLAGS"

			AC_MSG_CHECKING("for magick.h in location 2")
			AC_TRY_COMPILE([#include "magick.h"], [],
			[result="yes"],
			[result="no" CFLAGS=$_SAVE_CFLAGS])
			AC_MSG_RESULT("$result")
			
			if test "x$result" = xno; then
				_SAVE_CFLAGS=$CFLAGS

				mflags=`Magick-config --cflags`
				CFLAGS="$mflags $CFLAGS"
				mflags=`Magick-config --prefix`
				CFLAGS="-I$mflags/include/X11/magick/ $CFLAGS $X_CFLAGS/X11"

				AC_MSG_CHECKING("for magick.h in location 3")
				AC_TRY_COMPILE([#include "magick.h"], [],
				[result="yes"],
				[result="no" CFLAGS=$_SAVE_CFLAGS])
				AC_MSG_RESULT("$result")
			fi
dnl cflags test ends
		fi

dnl lib test begins 
		if test "x$result" = xyes; then
			_SAVE_CFLAGS=$CFLAGS
			_SAVE_LDFLAGS=$LDFLAGS

			mflags=`Magick-config --libs`

			LDFLAGS="$mflags $LDFLAGS"
			CFLAGS="$CFLAGS $X_CFLAGS"
			
			AC_CHECK_LIB(Magick, GetImageInfo, 
			[result="yes" MAGICK_LIBS="$mflags"],
			[result="no" LDFLAGS=$_SAVE_LDFLAGS])

			if test "x$result" = xno; then
				_SAVE_LDFLAGS=$LDFLAGS
				mflags=`Magick-config --libs`
				LDFLAGS="$mflags $LDFLAGS"
				AC_CHECK_LIB(Magick, WritePNGImage, 
				[result="yes" MAGICK_LIBS="$mflags $X_LIBS -lX11 $X_EXTRA_LIBS"],
				[result="no" LDFLAGS=$_SAVE_LDFLAGS],
				$X_LIBS -lX11 $X_EXTRA_LIBS
				)
			fi
		LDFLAGS=$_SAVE_LDFLAGS
		CFLAGS=$_SAVE_CFLAGS
		fi
dnl lib test ends
	else
		result="no";
	fi
fi

if test "x$result" != xyes; then
	MAGICK="MAGICK"
	MAGICKOBJS="\$(RMAGICKOBJS)"

dnl if we have to use our own then we need libpng
#
# Check for PNG
#
_SAVE_CFLAGS=$CFLAGS
_SAVE_LDFLAGS=$LDFLAGS
	have_png='no'
	LIB_PNG=''
	if test "$with_png" != 'no'; then

		AC_CHECKING(for PNG support ...)
		failed=0;
		passed=0;
		AC_CHECK_HEADER(png.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
		AC_CHECK_HEADER(pngconf.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
		AC_CHECK_LIB(png,png_info_init,passed=`expr $passed + 1`,failed=`expr $failed + 1`,$ZLIB_LIBS -lm)
		AC_MSG_CHECKING(if PNG package is complete)
		if test $passed -gt 0; then
			if test $failed -gt 0; then
				AC_MSG_RESULT(no -- some components failed test)
				have_png='no (failed tests)'
			else
				LIB_PNG='-lpng'
				AC_DEFINE(HasPNG)
				AC_MSG_RESULT(yes)
				have_png='yes'
			fi
		else
			AC_MSG_RESULT(no)
		fi
	fi
fi
CFLAGS=$_SAVE_CFLAGS
LDFLAGS=$_SAVE_LDFLAGS


dnl end of imagemagick
dnl ========================================================


if test "x$no_wmf" = xyes; then
	AC_MSG_WARN(Could not find gdwmf library or some of its components: \nmswordview will not have wmf to gif support: see README)
else
	AC_DEFINE(HAVE_WMF)
fi

if test "x$no_ttf" = xyes; then
	AC_MSG_WARN(Could not find ttf library or some of its components: \nmswordview will not have text in its wmf to gif support: see README)
else
	AC_DEFINE(HAVE_TTF)
fi

if [ test "$SYSTEM_ZLIB" != "" ]; then
AC_DEFINE(SYSTEM_ZLIB)
fi

AC_SUBST(TTF_LIBS)
AC_SUBST(TTF_CFLAGS)
AC_SUBST(XPM_LIBS)
AC_SUBST(WMF_LIBS)
AC_SUBST(WMF_CFLAGS)

if [ test "$XPM_LIBS" != "" ]; then
AC_DEFINE(USE_X)
AC_SUBST(X11)
AC_SUBST(X_LIBS)
AC_SUBST(X_EXTRA_LIBS)
fi

dnl ========================================================
dnl begin of possible optimization tests
dnl read notes/optimization

AC_CHECK_SIZEOF(char,1)
AC_CHECK_SIZEOF(short,2)
AC_CHECK_SIZEOF(int,4)
AC_CHECK_SIZEOF(long,4)

if [test "$SIZEOF_CHAR" != "1" ]; then
    if [test "$SIZEOF_SHORT" != "2" ]; then
        if [test "$SIZEOF_INT" != "4" ]; then
            AC_DEFINE(MATCHED_TYPE)
        fi
    fi
fi

if [ test "$cross_compiling" != "yes" ]; then
    AC_C_BIGENDIAN
dnl	here we will know the endianness
	if [ test "$ac_cv_c_bigendian" = "no" ]; then
	    AC_DEFINE(XML_BYTE_ORDER,12)
	else 
		if [ test "$ac_cv_c_bigendian" = "yes" ]; then
			AC_DEFINE(XML_BYTE_ORDER,21)
		fi
	fi
else
dnl	here we will not know the endianness, so we will
dnl go with the mechanism that works everywhere
    AC_DEFINE(WORDS_BIGENDIAN)
fi

dnl given matched types and little endian we can read types larger
dnl than a byte with fread and avoid byteswapping

dnl at some later stage we will have a test to see if the compiler can
dnl get rid of holes, for the moment we will assume only that we can
dnl do it if we have __GNUC__ defined

dnl end of possible optimization tests


dnl check for getopt
AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt1.o getopt.o"])
dnl check for strerror
AC_CHECK_FUNC(strerror, , [LIBOBJS="$LIBOBJS strerror.o"])
dnl check for strcasecmp
AC_CHECK_FUNC(strcasecmp, , [LIBOBJS="$LIBOBJS strcasecmp.o"])
dnl check for memcpy, if not there we'll use bcopy
AC_CHECK_FUNCS(memcpy)
dnl check for mmap
AC_FUNC_MMAP

AC_SUBST(LIBOBJS)
AC_SUBST(ICONV)
AC_SUBST(ICONVOBJS)
AC_SUBST(MAGICK)
AC_SUBST(MAGICKOBJS)
AC_SUBST(MAGICK_LIBS)
AC_SUBST(ZLIB_CFLAGS)
AC_SUBST(ZLIB_LIBS)
AC_SUBST(LIB_PNG)

AC_OUTPUT(
Makefile 
oledecod/Makefile 
expat/Makefile 
expat/xmltok/Makefile 
expat/xmlparse/Makefile
iconv/Makefile
magick/Makefile
)