forked from MapServer/MapServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
executable file
·2566 lines (2008 loc) · 87.1 KB
/
configure.in
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
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl **************************************************************************
dnl $Id$
dnl
dnl Project: MapServer
dnl Purpose: Main autoconf script ( Process this file with autoconf to
dnl produce a configure script.)
dnl Author: Steve Lime and the MapServer team.
dnl
dnl **************************************************************************
dnl Copyright (c) 1996-2007 Regents of the University of Minnesota.
dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"),
dnl to deal in the Software without restriction, including without limitation
dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
dnl and/or sell copies of the Software, and to permit persons to whom the
dnl Software is furnished to do so, subject to the following conditions:
dnl
dnl The above copyright notice and this permission notice shall be included in
dnl all copies of this Software or works derived from this Software.
dnl
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
dnl DEALINGS IN THE SOFTWARE.
dnl **************************************************************************
AC_INIT(Makefile.in)
LT_INIT([disable-static])
AC_CONFIG_MACRO_DIR([m4/])
m4_include([m4/mapserver.m4])
m4_include([m4/apache.m4])
m4_include([m4/ax_jni_include_dir.m4])
m4_include([m4/ax_pkg_swig.m4])
m4_include([m4/ax_cflags_warn_all.m4])
AC_CONFIG_SRCDIR([mapserv.c])
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
PROG_CXX_WORKS
AC_PROG_LEX
AC_PROG_YACC
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_SED
dnl ---------------------------------------------------------------------
dnl Look for MapServer version in mapserver.h
dnl ---------------------------------------------------------------------
MS_VERSION=`grep 'MS_VERSION ' mapserver.h | grep '#define' | cut -d\" -f2`
AC_MSG_RESULT([MapServer Version from mapserver.h: '$MS_VERSION'])
AC_SUBST(MS_VERSION, "$MS_VERSION")
dnl ---------------------------------------------------------------------
dnl Checks for libraries.
dnl ---------------------------------------------------------------------
AC_CHECK_LIB(m,exp, XTRALIBS="$XTRALIBS -lm",,)
AC_CHECK_LIB(dl,dlopen, XTRALIBS="$XTRALIBS -ldl",,)
AC_SUBST(XTRALIBS, $XTRALIBS)
AC_CHECK_LIB(stdc++,__gxx_personality_v0, XTRALIBS="$XTRALIBS -lstdc++",,)
AC_SUBST(XTRALIBS, $XTRALIBS)
LIBS="$XTRALIBS $LIBS"
dnl ---------------------------------------------------------------------
dnl Checks for header files.
dnl ---------------------------------------------------------------------
AC_HEADER_STDC
dnl ---------------------------------------------------------------------
dnl Check for some string functions
dnl ---------------------------------------------------------------------
AC_CHECK_FUNC(strcasecmp, , STRINGS="-DNEED_STRCASECMP $STRINGS")
AC_CHECK_FUNC(strncasecmp, , STRINGS="-DNEED_STRNCASECMP $STRINGS")
AC_CHECK_FUNC(strdup, , STRINGS="-DNEED_STRDUP $STRINGS")
AC_CHECK_FUNC(strrstr, , STRINGS="-DNEED_STRRSTR $STRINGS")
AC_CHECK_FUNC(strcasestr, , STRINGS="-DNEED_STRCASESTR $STRINGS")
AC_CHECK_FUNC(strlcat, , STRINGS="-DNEED_STRLCAT $STRINGS")
AC_CHECK_FUNC(strlcpy, , STRINGS="-DNEED_STRLCPY $STRINGS")
AC_CHECK_FUNC(vsnprintf, STRINGS="-DHAVE_VSNPRINTF $STRINGS", )
AC_SUBST(STRINGS, $STRINGS)
ALL_ENABLED="$STRINGS $ALL_ENABLED"
dnl ---------------------------------------------------------------------
dnl Several libraries may use pkg-config.
dnl ---------------------------------------------------------------------
AC_MSG_CHECKING(if pkg-config path is provided)
AC_ARG_WITH(pkg-config,
[ --with-pkg-config[[=PATH]]
Include pkg-config support (PATH is path to pkg-config)],,)
if test -n "$with_pkg_config" -a "$with_pkg_config" != "no" ; then
AC_MSG_RESULT([yes])
PKG_CONFIG=$with_pkg_config
else
PKG_CONFIG="yes"
fi
if test "$PKG_CONFIG" = "yes" ; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test "$PKG_CONFIG" = "no" ; then
AC_MSG_RESULT([couldn't find pkg-config in default path. Please specify full path to pkg-config if needed])
fi
elif test -f "$PKG_CONFIG" -a -x "$PKG_CONFIG" ; then
AC_MSG_RESULT([user supplied pkg-config ($PKG_CONFIG)])
else
AC_MSG_ERROR(['$PKG_CONFIG' is not an executable. Make sure you use --with-pkg-config=/path/to/pkg-config])
fi
dnl ---------------------------------------------------------------------
dnl Several libraries might be needed for GD: png, zlib, freetype,
dnl and jpeg (processed above). Use where GD was found as default.
dnl ---------------------------------------------------------------------
dnl ---------------------------------------------------------------------
dnl Check where FreeType is installed
dnl ---------------------------------------------------------------------
unset ac_cv_lib_freetype_FT_Init_FreeType
unset ac_cv_lib_ttf_TT_Init_FreeType
AC_ARG_WITH(freetype,
[ --with-freetype=DIR GD: Specify where FreeType 2.x is installed (DIR is
path to freetype-config program or install dir).],
FT_DIR=$withval,FT_DIR='')
FT_LDFLAGS=''
FT_CFLAGS=''
FT_BIN=''
if test "x$FT_DIR" = "xno" ; then
AC_MSG_ERROR([Freetype support disabled but is now mandatory. Rerun without --without-freetype or --with-freetype=no])
fi
if test -z "$FT_DIR" -o "$FT_DIR" = "yes" ; then
dnl no supplied argument
AC_PATH_PROG(FT_BIN, freetype-config, "")
if test "x$FT_BIN" = "xno" ; then
dnl freetype-config not found, check system locations
AC_MSG_CHECKING([for Freetype2.x in system locations])
test -f /usr/include/ft2build.h -a -d /usr/include/freetype2 && FT_CFLAGS=-I/usr/include/freetype2
test -f /usr/local/include/ft2build.h -a -d /usr/local/include/freetype2 && FT_CFLAGS=-I/usr/local/include -I/usr/local/include/freetype2
FT_LDFLAGS="-lfreetype -lz"
dnl else freetype-config found, will test further down
fi
else
AC_EXPAND_PATH($FT_DIR, FT_DIR)
AC_MSG_CHECKING(for Freetype2.x in $FT_DIR)
test -x "$FT_DIR" -a "freetype-config" = "`basename $FT_DIR ''`" && FT_BIN="$FT_DIR"
test -x "$FT_DIR/freetype-config" && FT_BIN="$FT_DIR/freetype-config"
test -x "$FT_DIR/bin/freetype-config" && FT_BIN="$FT_DIR/bin/freetype-config"
if test "x$FT_BIN" = "x"; then
test -f $FT_DIR/ft2build.h -a -d $FT_DIR/freetype2 && FT_CFLAGS="-I$FT_DIR -I$FT_DIR/freetype2"
test -f $FT_DIR/include/ft2build.h -a -d $FT_DIR/include/freetype2 && FT_CFLAGS="-I$FT_DIR/include -I$FT_DIR/include/freetype2"
test -f $FT_DIR/lib/libfreetype.a -o -f $FT_DIR/lib/libfreetype.so -o -f $FT_DIR/lib/libfreetype.sl -o -f $FT_DIR/lib/libfreetype.dylib && FT_LDFLAGS="-L$FT_DIR/lib"
test -f $FT_DIR/lib64/libfreetype.a -o -f $FT_DIR/lib64/libfreetype.so -o -f $FT_DIR/lib64/libfreetype.sl && FT_LDFLAGS="-L$FT_DIR/lib64"
test -f $FT_DIR/libfreetype.a -o -f $FT_DIR/libfreetype.so -o -f $FT_DIR/libfreetype.sl -o -f $FT_DIR/libfreetype.dylib && FT_LDFLAGS="-L$FT_DIR"
dnl else freetype-config found, will test further down
fi
fi
if test "x$FT_BIN" != "x" ; then
FT_LDFLAGS=`$FT_BIN --libs`
FT_CFLAGS=`$FT_BIN --cflags`
fi
_cppflags="$CPPFLAGS"
_ldflags="$LDFLAGS"
_libs="$LIBS"
CPPFLAGS="$FT_CFLAGS $CPPFLAGS"
LDFLAGS="$FT_LDFLAGS $LDFLAGS"
AC_CHECK_LIB(freetype,FT_Init_FreeType,[:],
AC_MSG_ERROR([unable to link - reconfigure with correct --with-freetype=dir ]))
AC_CHECK_HEADERS(ft2build.h,[:],
AC_MSG_ERROR([ft2build.h header not found - reconfigure with correct --with-freetype=dir ]))
CPPFLAGS=$_cppflags
LDFLAGS=$_ldflags
LIBS=$_libs
FT_ENABLED="-DUSE_FREETYPE"
AC_SUBST(FT_ENABLED,$FT_ENABLED)
AC_SUBST(FT_INC,$FT_CFLAGS)
AC_SUBST(FT_LIB,$FT_LDFLAGS)
ALL_ENABLED="$FT_ENABLED $ALL_ENABLED"
ALL_INC="$FT_CFLAGS $ALL_INC"
ALL_LIB="$FT_LDFLAGS $ALL_LIB"
AC_DEFUN([MS_CHECK_PNG],[
AC_ARG_WITH(png,
AC_HELP_STRING([--with-png], [libpng location: [yes|/path/to/png/prefix]]),
[],
[with_png=yes])
if test x"$with_png" == "xno"; then
AC_MSG_ERROR([png support cannot be disabled])
fi
if test -z "$with_png" -o "$with_png" == "yes" -o "$with_png" == "/usr"; then
AC_CHECK_HEADER([png.h],[:],
[AC_MSG_ERROR([png.h header not found. install png development package, or reconfigure with --with-png=/path/to/png/prefix])])
AC_CHECK_HEADER([setjmp.h],[:],
[AC_MSG_ERROR([setjmp.h header not found. install png development package, or reconfigure with --with-png=/path/to/png/prefix])])
AC_CHECK_LIB([png], [png_init_io],[:],
[AC_MSG_ERROR([libpng library not found. install png development package, or reconfigure with --with-png=/path/to/png/prefix])])
else
old_LDFLAGS="$LDFLAGS"
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-I$with_png/include"
LDFLAGS="-L$with_png/lib"
AC_CHECK_HEADER([png.h],[:],
[AC_MSG_ERROR([png.h header not found in $with_png. install png development package, or reconfigure with --with-png=/path/to/png/prefix])])
AC_CHECK_HEADER([setjmp.h],[:],
[AC_MSG_ERROR([setjmp.h header not found. install png development package, or reconfigure with --with-png=/path/to/png/prefix])])
AC_CHECK_LIB([png], [png_init_io],[:],
[AC_MSG_ERROR([libpng library not found in $with_png. install png development package, or reconfigure with --with-png=/path/to/png/prefix])])
PNG_INC="$CPPFLAGS"
PNG_LIB="$LDFLAGS"
CPPFLAGS="$old_CPPFLAGS"
LDFLAGS="$old_LDFLAGS"
fi
PNG_ENABLED="-DUSE_PNG"
ALL_ENABLED="$PNG_ENABLED $ALL_ENABLED"
ALL_INC="$ALL_INC $PNG_INC"
ALL_LIB="$ALL_LIB $PNG_LIB -lpng"
AC_SUBST(PNG_ENABLED, "$PNG_ENABLED")
AC_SUBST(PNG_INC, "$PNG_INC")
AC_SUBST(PNG_LIB, "$PNG_LIB -lpng")
])
AC_DEFUN([MS_CHECK_JPEG],[
AC_ARG_WITH(jpeg,
AC_HELP_STRING([--with-jpeg], [libjpeg location: [yes|/path/to/jpeg/prefix]]),
[],
[with_jpeg=yes])
if test x"$with_jpeg" == "xno"; then
AC_MSG_ERROR([jpeg support cannot be disabled])
fi
if test -z "$with_jpeg" -o "$with_jpeg" == "yes" -o "$with_jpeg" == "/usr"; then
AC_CHECK_HEADER([jpeglib.h],[:],
[AC_MSG_ERROR([jpeglib.h header not found. install jpeg development package, or reconfigure with --with-jpeg=/path/to/jpeg/prefix])])
AC_CHECK_LIB([jpeg], [jpeg_read_header],[:],
[AC_MSG_ERROR([libjpeg library not found. install jpeg development package, or reconfigure with --with-jpeg=/path/to/jpeg/prefix])])
else
old_LDFLAGS="$LDFLAGS"
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-I$with_jpeg/include"
LDFLAGS="-L$with_jpeg/lib"
AC_CHECK_HEADER([jpeglib.h],[:],
[AC_MSG_ERROR([jpeglib.h header not found in $with_jpeg. install jpeg development package, or reconfigure with --with-jpeg=/path/to/jpeg/prefix])])
AC_CHECK_LIB([jpeg], [jpeg_read_header],[:],
[AC_MSG_ERROR([libjpeg library not found in $with_jpeg. install jpeg development package, or reconfigure with --with-jpeg=/path/to/jpeg/prefix])])
JPEG_INC="$CPPFLAGS"
JPEG_LIB="$LDFLAGS"
CPPFLAGS="$old_CPPFLAGS"
LDFLAGS="$old_LDFLAGS"
fi
JPEG_ENABLED="-DUSE_JPEG"
ALL_ENABLED="$JPEG_ENABLED $ALL_ENABLED"
ALL_INC="$ALL_INC $JPEG_INC"
ALL_LIB="$ALL_LIB $JPEG_LIB -ljpeg"
AC_SUBST(JPEG_ENABLED, "$JPEG_ENABLED")
AC_SUBST(JPEG_INC, "$JPEG_INC")
AC_SUBST(JPEG_LIB, "$JPEG_LIB -ljpeg")
])
dnl ---------------------------------------------------------------------
dnl Check where PNG is installed
dnl ---------------------------------------------------------------------
MS_CHECK_PNG
dnl ---------------------------------------------------------------------
dnl Check where GIF is installed
dnl ---------------------------------------------------------------------
AC_MSG_CHECKING(whether we should include GIF support)
AC_DEFUN([MS_CHECK_GIF],[
AC_ARG_WITH(gif,
AC_HELP_STRING([--with-gif], [libgif location: [yes|no|/path/to/gif/prefix]]),
[],
[with_gif=yes])
if test x"$with_gif" == "xno"; then
AC_SUBST(GIF_ENABLED, "")
AC_SUBST(GIF_INC, "")
AC_SUBST(GIF_LIB, "")
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
if test -z "$with_gif" -o "$with_gif" == "yes" -o "$with_gif" == "/usr"; then
AC_CHECK_HEADER([gif_lib.h],[:],
[AC_MSG_ERROR([gif_lib.h header not found. install gif development package, or reconfigure with --with-gif=/path/to/gif/prefix])])
AC_CHECK_LIB([gif], [DGifOpenFileHandle],[:],
[AC_MSG_ERROR([libgif library not found. install gif development package, or reconfigure with --with-gif=/path/to/gif/prefix])])
else
old_LDFLAGS="$LDFLAGS"
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-I$with_gif/include"
LDFLAGS="-L$with_gif/lib"
AC_CHECK_HEADER([gif_lib.h],[:],
[AC_MSG_ERROR([gif_lib.h header not found in $with_gif. install gif development package, or reconfigure with --with-gif=/path/to/gif/prefix])])
AC_CHECK_LIB([gif], [DGifOpenFileHandle],[:],
[AC_MSG_ERROR([libgif library not found in $with_gif. install gif development package, or reconfigure with --with-gif=/path/to/gif/prefix])])
GIF_INC="$CPPFLAGS"
GIF_LIB="$LDFLAGS"
CPPFLAGS="$old_CPPFLAGS"
LDFLAGS="$old_LDFLAGS"
fi
GIF_ENABLED="-DUSE_GIF"
ALL_ENABLED="$GIF_ENABLED $ALL_ENABLED"
ALL_INC="$ALL_INC $GIF_INC"
ALL_LIB="$ALL_LIB $GIF_LIB -lgif"
AC_SUBST(GIF_ENABLED, "$GIF_ENABLED")
AC_SUBST(GIF_INC, "$GIF_INC")
AC_SUBST(GIF_LIB, "$GIF_LIB -lgif")
fi
])
MS_CHECK_GIF
AC_CHECKING([for jpeg library location (mandatory)])
MS_CHECK_JPEG
dnl ---------------------------------------------------------------------
dnl Check where libiconv is installed. We always look for it, even if not
dnl explicitly requested since GD may require it for linking.
dnl Iconv can come either as libiconv.so or as part of glibc
dnl ---------------------------------------------------------------------
unset ac_cv_lib_iconv_libiconv_open
unset ac_cv_lib_iconv_iconv_open
unset ac_cv_lib_c_iconv_open
AC_ARG_WITH(libiconv,
[ --with-libiconv=DIR Specify where libiconv is installed (DIR is path
to libiconv install dir (prefix)).],
ICONV_DIR=$withval,ICONV_DIR='')
AC_CHECKING(where libiconv is installed)
ICONV_LIB=''
if test -n "$ICONV_DIR" -a "$ICONV_DIR" != "yes" ; then
AC_EXPAND_PATH($ICONV_DIR, ICONV_DIR)
test -f $ICONV_DIR/include/iconv.h && ICONV_LIBDIR="$ICONV_DIR/lib" && ICONV_INCDIR="$ICONV_DIR/include"
test -f $ICONV_DIR/lib/libiconv.a -o -f $ICONV_DIR/lib/libiconv.so -o -f $ICONV_DIR/lib/libiconv.sl -o -f $ICONV_DIR/lib/libiconv.dylib && ICONV_LIBDIR="$ICONV_DIR/lib" && ICONV_INCDIR="$ICONV_DIR/include"
test -f $ICONV_DIR/lib64/libiconv.a -o -f $ICONV_DIR/lib64/libiconv.so -o -f $ICONV_DIR/lib64/libiconv.sl && ICONV_LIBDIR="$ICONV_DIR/lib64" && ICONV_INCDIR="$ICONV_DIR/include"
dnl If we have both the glibc and a local libiconv, then the local libiconv
dnl will be included in the link line no matter what. This shouldn't hurt
dnl programs that don't need it, and saves us from having to figure some
dnl black magic to detect what was used to build GD, etc.
dnl Just doing the AC_CHECK_LIB(iconv ...) last does the trick.
AC_CHECK_LIB(c, iconv_open, ICONV_LIB="-L$ICONV_LIBDIR -lc",,"-L$ICONV_LIBDIR")
AC_CHECK_LIB(iconv, libiconv_open, ICONV_LIB="-L$ICONV_LIBDIR -liconv",,"-L$ICONV_LIBDIR")
AC_CHECK_LIB(iconv, iconv_open, ICONV_LIB="-L$ICONV_LIBDIR -liconv",,"-L$ICONV_LIBDIR")
fi
if test -n "$ICONV_LIB" ; then
if test -n "$ICONV_INCDIR"; then
ICONV_INC="-I$ICONV_INCDIR"
fi
AC_MSG_RESULT([ using libiconv from $ICONV_LIB])
AC_ADD_RUNPATH("$ICONV_DIR")
else
dnl check for lib in system libs
unset ac_cv_lib_iconv_libiconv_open
unset ac_cv_lib_c_iconv_open
AC_CHECK_LIB(c, iconv_open, ICONV_LIB="-lc",,)
AC_CHECK_LIB(iconv, libiconv_open, ICONV_LIB="-liconv",,)
AC_CHECK_LIB(iconv, iconv_open, ICONV_LIB="-liconv",,)
if test -n "$ICONV_LIB" ; then
AC_MSG_RESULT([ using libiconv from system libs.])
else
AC_MSG_RESULT([ libiconv library cannot be found, possibly needed for GD])
fi
fi
if test -n "$ICONV_LIB" ; then
ICONV_ENABLED="-DUSE_ICONV"
AC_MSG_RESULT([ libiconv found. Enabling internationalization ($ICONV_ENABLED)])
fi
AC_SUBST(ICONV_ENABLED, $ICONV_ENABLED)
AC_SUBST(ICONV_INC, $ICONV_INC)
AC_SUBST(ICONV_LIB, $ICONV_LIB)
ALL_ENABLED="$ICONV_ENABLED $ALL_ENABLED"
ALL_INC="$ICONV_INC $ALL_INC"
ALL_LIB="$ICONV_LIB $ALL_LIB"
dnl ---------------------------------------------------------------------
dnl Find GD library
dnl
dnl ---------------------------------------------------------------------
AC_DEFUN([MS_CHECK_GD],[
AC_ARG_WITH(gd,
AC_HELP_STRING([--with-gd], [libgd location: [yes|no|/path/to/gdlib-config]]),
[],
[with_gd=no])
if test x"$with_gd" == "xno"; then
AC_SUBST(GD_ENABLED, "")
AC_SUBST(GD_INC, "")
AC_SUBST(GD_LIB, "")
AC_MSG_RESULT([GD support not requested, disabling])
else
if test "$with_gd" == "yes"; then
AC_PATH_PROG(GDCONFIG,gdlib-config,no)
if test "$GDCONFIG" == "no"; then
AC_MSG_ERROR([gdlib-config not found in path, reconfigure with --with-gd=/path/to/gdlib-config])
fi
else
if test ! -f "$with_gd"; then
if test ! -d "$with_gd"; then
AC_MSG_ERROR([cannot find $with_gd])
fi
if test ! -f "$with_gd/bin/gdlib-config"; then
AC_MSG_ERROR([gdlib-config not found in $with_gd (tried $with_gd/bin/gdlib-config)])
else
GDCONFIG="$with_gd/bin/gdlib-config"
fi
else
GDCONFIG="$with_gd"
fi
AC_PATH_PROG(GDCONFIG,$GDCONFIG,no)
if test "$GDCONFIG" == "no"; then
AC_MSG_ERROR([gdlib-config not usable, reconfigure with --with-gd[=(yes|no|/path/to/gdlib-config)]])
fi
fi
GDMAJOR=`$GDCONFIG --majorversion`
GDMINOR=`$GDCONFIG --minorversion`
GDREV=`$GDCONFIG --revision`
GDVERSION=`$GDCONFIG --version`
GDFEATURES=`$GDCONFIG --features`
AC_MSG_RESULT([using libgd $GDVERSION from $GDCONFIG])
if test -z "`echo $GDFEATURES | grep 'GD_PNG'`" ; then
AC_MSG_ERROR([supplied GD is missing PNG support])
else
GD_ENABLED="$GD_ENABLED -DUSE_GD_PNG"
fi
if test -z "`echo $GDFEATURES | grep 'GD_JPEG'`" ; then
AC_MSG_ERROR([supplied GD is missing JPEG support])
else
GD_ENABLED="$GD_ENABLED -DUSE_GD_JPEG"
fi
if test -z "`echo $GDFEATURES | grep 'GD_GIF'`" ; then
AC_MSG_ERROR([supplied GD is missing GIF support])
else
GD_ENABLED="$GD_ENABLED -DUSE_GD_GIF"
fi
if test -z "`echo $GDFEATURES | grep 'GD_FREETYPE'`" ; then
AC_MSG_ERROR([supplied GD is missing FT support])
fi
if test $GDMAJOR -lt 2 -o $GDMINOR -lt 0 -o $GDREV -lt 28 ; then
AC_MSG_ERROR([GD version $GDVERSION too old. need at least 2.0.28])
fi
dnl gdlib-config adds /usr/include and /usr/lib to the compile paths
dnl which we do not want, as they may take precedence on locally
dnl supplied paths for other libraries
dnl remove /usr/include/ from default include path
GD_INC=`$GDCONFIG --includedir`
if test "x$GD_INC" != "x/usr/include" -a "x$GD_INC" != "x/usr/include/" -a -n "$GD_INC"; then
GD_INC="-I$GD_INC"
else
GD_INC=""
fi
dnl remove /usr/lib/ from default lib path
GD_LIB=`$GDCONFIG --libdir`
if test "x$GD_LIB" != "x/usr/lib" -a "x$GD_LIB" != "x/usr/lib/" -a -n "$GD_LIB"; then
GD_LIB="-L$GD_LIB"
else
GD_LIB=""
fi
GD_ENABLED="-DUSE_GD $GD_ENABLED"
ALL_ENABLED="$GD_ENABLED $ALL_ENABLED"
AC_SUBST(GD_ENABLED, "$GD_ENABLED")
ALL_INC="$ALL_INC $GD_INC"
ALL_LIB="$ALL_LIB $GD_LIB -lgd"
AC_SUBST(GD_INC, "$GD_INC")
AC_SUBST(GD_LIB, "$GD_LIB -lgd")
fi
])
MS_CHECK_GD
dnl ---------------------------------------------------------------------
dnl FTGL Support.
dnl ---------------------------------------------------------------------
AC_MSG_CHECKING(if FTGL support requested)
AC_ARG_WITH(ftgl,
[ --with-ftgl[[=DIR]] Include OpenGl support (DIR is OpenGL's install dir).],,)
if test "$with_ftgl" = "yes" ; then
with_ftgl="/usr"
AC_MSG_RESULT([looking for ftgl libs in /usr])
fi
if test -n "$with_ftgl" -a "$with_ftgl" != "no" ; then
AC_EXPAND_PATH($with_ftgl, FTGL_DIR)
FTGL_FLAG=""
if [ test -f $FTGL_DIR/include/FTGL/ftgl.h -a -f $FTGL_DIR/include/FTGL/FTGLTextureFont.h ]; then
FTGL_INCLUDE="-I$FTGL_DIR/include/FTGL/"
elif [ test -f $FTGL_DIR/include/FTGL/FTGL.h -a -f $FTGL_DIR/include/FTGL/FTGLTextureFont.h ]; then
FTGL_INCLUDE="-I$FTGL_DIR/include/FTGL/"
FTGL_FLAG="-DUSE_FTGL_2_1_2"
fi
if test -z "$FTGL_INCLUDE" ; then
AC_MSG_ERROR("could not find ftgl.h/FTGL.h in $FTGL_DIR/include/FTGL.")
fi
test -f $FTGL_DIR/lib/libftgl.so && FTGL_LIBDIR="$FTGL_DIR/lib"
test -f $FTGL_DIR/lib/libftgl.dylib && FTGL_LIBDIR="$FTGL_DIR/lib"
test -f $FTGL_DIR/lib64/libftgl.so && FTGL_LIBDIR="$FTGL_DIR/lib64"
if test -z "$FTGL_LIBDIR" ; then
AC_MSG_ERROR("could not find libftgl in $FTGL_DIR.")
fi
dnl If we got this far all is well!
FTGL_ENABLED="-DUSE_FTGL $FTGL_FLAG"
FTGL_INC="$FTGL_INCLUDE"
FTGL_LIB="-L$FTGL_LIBDIR -lftgl"
AC_ADD_RUNPATH("$FTGL_LIBDIR")
AC_MSG_RESULT([using ftgl from $FTGL_DIR])
else
AC_MSG_RESULT([no])
fi
AC_SUBST(FTGL_ENABLED,$FTGL_ENABLED)
AC_SUBST(FTGL_INC, $FTGL_INC)
AC_SUBST(FTGL_LIB, $FTGL_LIB)
ALL_ENABLED="$FTGL_ENABLED $ALL_ENABLED"
ALL_INC="$FTGL_INC $ALL_INC"
ALL_LIB="$FTGL_LIB $ALL_LIB"
dnl ---------------------------------------------------------------------
dnl Optional OGL Support.
dnl ---------------------------------------------------------------------
AC_MSG_CHECKING(if OGL support requested)
AC_ARG_WITH(ogl,
[ --with-opengl[[=DIR]] Include OpenGl support (DIR is OpenGL's install dir).],,)
if test "$with_opengl" = "yes" ; then
with_opengl="/usr"
AC_MSG_RESULT([looking for opengl libs in /usr])
fi
if test -n "$with_opengl" -a "$with_opengl" != "no" ; then
if test -z "$FTGL_LIB" ; then
AC_MSG_ERROR([FTGL required for opengl support - please configure --with-ftgl.])
fi
AC_EXPAND_PATH($with_opengl, OGL_DIR)
test -f $OGL_DIR/include/GL/gl.h -a -f $OGL_DIR/include/GL/glx.h -a -f $OGL_DIR/include/GL/glu.h && OGL_INCLUDE="-I$OGL_DIR/include"
if test -z "$OGL_INCLUDE" ; then
AC_MSG_ERROR("could not find gl.h in $OGL_DIR/include/.")
fi
test -f $OGL_DIR/lib/libGL.so -a -f $OGL_DIR/lib/libGLU.so && OGL_LIBDIR="$OGL_DIR/lib"
test -f $OGL_DIR/lib/libGL.dylib -a -f $OGL_DIR/lib/libGLU.dylib && OGL_LIBDIR="$OGL_DIR/lib"
test -f $OGL_DIR/lib64/libGL.so -a -f $OGL_DIR/lib64/libGLU.so && OGL_LIBDIR="$OGL_DIR/lib64"
if test -z "$OGL_LIBDIR" ; then
AC_MSG_ERROR("could not find libGL or libGLU in $OGL_DIR/lib/ or $OGL_DIR/lib64/.")
fi
dnl If we got this far all is well!
OGL_ENABLED="-DUSE_OGL"
OGL_INC="$OGL_INCLUDE"
OGL_LIB="-L$OGL_LIBDIR -lGL -lGLU"
AC_ADD_RUNPATH("$OGL_LIBDIR")
AC_MSG_RESULT([using opengl from $OGL_DIR])
else
AC_MSG_RESULT([no])
fi
AC_SUBST(OGL_ENABLED,$OGL_ENABLED)
AC_SUBST(OGL_INC, $OGL_INC)
AC_SUBST(OGL_LIB, $OGL_LIB)
ALL_ENABLED="$OGL_ENABLED $ALL_ENABLED"
ALL_INC="$OGL_INC $ALL_INC"
ALL_LIB="$OGL_LIB $ALL_LIB"
dnl ---------------------------------------------------------------------
dnl Check whether expat is available (needed for svg symbol parsing)
dnl ---------------------------------------------------------------------
AC_ARG_WITH(expat,
[ --with-expat=DIR Specify expat location, needed for SVG symbol parsing],
EXPAT_DIR=$withval,EXPAT_DIR='')
AC_EXPAND_PATH($EXPAT_DIR, EXPAT_DIR)
AC_CHECKING(where EXPAT is installed)
EXPAT_LIB=''
EXPAT_INC=''
EXPAT_FOUND='no'
if test -n "$EXPAT_DIR" ; then
test -f $EXPAT_DIR/lib/libexpat.a -o -f $EXPAT_DIR/lib/libexpat.so -o -f $EXPAT_DIR/lib/libexpat.sl -o -f $EXPAT_DIR/lib/libexpat.dylib && EXPAT_LIBDIR="$EXPAT_DIR/lib"
test -f $EXPAT_DIR/lib64/libexpat.a -o -f $EXPAT_DIR/lib64/libexpat.so -o -f $EXPAT_DIR/lib64/libexpat.sl -o -f $EXPAT_DIR/libexpat.dylib && EXPAT_LIBDIR="$EXPAT_DIR/lib64"
test -f $EXPAT_DIR/libexpat.a -o -f $EXPAT_DIR/libexpat.so -o -f $EXPAT_DIR/libexpat.sl -o -f $EXPAT_DIR/libexpat.dylib && EXPAT_LIBDIR="$EXPAT_DIR"
test -f $EXPAT_DIR/include/expat.h && EXPAT_INCDIR="$EXPAT_DIR/include"
test -f $EXPAT_DIR/lib/expat.h && EXPAT_INCDIR="$EXPAT_DIR/lib"
test -f $EXPAT_DIR/expat.h && EXPAT_INCDIR="$EXPAT_DIR"
if test -n "$EXPAT_LIBDIR" ; then
EXPAT_LIB="-L$EXPAT_LIBDIR -lexpat"
AC_MSG_RESULT([ using libexpat from $EXPAT_LIB])
AC_ADD_RUNPATH("$EXPAT_LIBDIR")
else
AC_MSG_ERROR([cannot find expat lib in $EXPAT_DIR])
fi
if test -n "$EXPAT_INCDIR" ; then
AC_CHECK_HEADER([$EXPAT_INCDIR/expat.h],EXPAT_INC=-I$EXPAT_INCDIR,
[AC_MSG_ERROR([cannot find expat headers])])
ALL_INC="$EXPAT_INC $ALL_INC"
else
AC_MSG_ERROR([cannot find expat headers in $EXPAT_DIR])
fi
EXPAT_FOUND="yes"
else
dnl check for expat in system locations
AC_CHECK_LIB(expat, XML_ParserCreate, EXPAT_LIB="-lexpat",,)
AC_CHECK_HEADER([expat.h],,EXPAT_HEADER_FOUND="no")
if test -n "$EXPAT_LIB" -a "$EXPAT_HEADER_FOUND" != "no"; then
AC_MSG_RESULT([ using libexpat from system libs.])
EXPAT_FOUND='yes'
else
AC_MSG_RESULT([ not found in system libs. svg symbol support will be disabled])
EXPAT_FOUND='no'
fi
fi
dnl ---------------------------------------------------------------------
dnl Optional AGG SVG Symbol Support.
dnl ---------------------------------------------------------------------
AC_MSG_CHECKING(for AGG support)
AGG_ENABLED="internal"
AC_MSG_RESULT([ internal])
dnl ---------------------------------------------------------------------
dnl Find PROJ.4 ONLY IF REQUESTED.
dnl ---------------------------------------------------------------------
dnl Clear some cache variables
unset ac_cv_lib_proj_pj_init
unset ac_cv_lib_proj_pj_transform
unset ac_cv_lib_proj_pj_latlong_from_proj
AC_CHECKING(whether we should include PROJ.4 support)
AC_ARG_WITH(proj,
[ --with-proj[[=DIR]] Include PROJ.4 support (DIR is PROJ.4's install dir).],,)
if test "$with_proj" = "yes" ; then
AC_CHECK_LIB(proj,pj_init,PROJ_ENABLED=-DUSE_PROJ,,,)
AC_CHECK_LIB(proj,pj_transform,PJ_TRANSFORM=yes,PJ_TRANSFORM=no,,)
if test -n "$PROJ_ENABLED" -a "$PJ_TRANSFORM" = "no"; then
AC_MSG_ERROR([This version of PROJ is too old. PROJ4.4.2 or later is required.])
elif test -n "$PROJ_ENABLED" -a "$PJ_TRANSFORM" = "yes"; then
PROJ_LIBS="-lproj"
AC_MSG_RESULT([ using PROJ.4 from system libs.])
else
AC_MSG_WARN([ PROJ.4 not found in system libs... use --with-proj=DIR.])
fi
elif test -n "$with_proj" -a "$with_proj" != "no" ; then
AC_EXPAND_PATH($with_proj, PROJ_DIR)
test -f $PROJ_DIR/include/proj_api.h && PROJ_INCLUDE="$PROJ_DIR/include"
test -f $PROJ_DIR/include/proj/proj_api.h && PROJ_INCLUDE="$PROJ_DIR/include/proj"
test -f $PROJ_DIR/src/proj_api.h && PROJ_INCLUDE="$PROJ_DIR/src"
test -f $PROJ_DIR/proj_api.h && PROJ_INCLUDE="$PROJ_DIR"
test -f $PROJ_DIR/src/.libs/libproj.a && PROJ_LIBDIR="$PROJ_DIR/src/.libs"
test -f $PROJ_DIR/lib/libproj.a && PROJ_LIBDIR="$PROJ_DIR/lib"
test -f $PROJ_DIR/lib64/libproj.a && PROJ_LIBDIR="$PROJ_DIR/lib64"
test -f $PROJ_DIR/libproj.a && PROJ_LIBDIR="$PROJ_DIR"
test -f $PROJ_DIR/src/.libs/libproj.so -o -f $PROJ_DIR/src/.libs/libproj.sl -o -f $PROJ_DIR/src/.libs/libproj.dylib && PROJ_LIBDIR="$PROJ_DIR/src/.libs"
test -f $PROJ_DIR/lib/libproj.so -o -f $PROJ_DIR/lib/libproj.sl -o -f $PROJ_DIR/lib/libproj.dylib && PROJ_LIBDIR="$PROJ_DIR/lib"
test -f $PROJ_DIR/lib64/libproj.so -o -f $PROJ_DIR/lib64/libproj.sl && PROJ_LIBDIR="$PROJ_DIR/lib64"
test -f $PROJ_DIR/libproj.so -o -f $PROJ_DIR/libproj.sl -o -f $PROJ_DIR/libproj.dylib && PROJ_LIBDIR="$PROJ_DIR"
if test -n "$PROJ_INCLUDE" -a -n "$PROJ_LIBDIR" ; then
PROJ_INC=-I$PROJ_INCLUDE
PROJ_LIBS="-L$PROJ_LIBDIR -lproj"
AC_ADD_RUNPATH("$PROJ_LIBDIR")
else
AC_MSG_ERROR("Could not find proj_api.h or libproj.a/libproj.so in $PROJ_DIR.")
fi
AC_CHECK_LIB(proj,pj_transform,PJ_TRANSFORM=yes,PJ_TRANSFORM=no,$PROJ_LIBS)
if test "$PJ_TRANSFORM" = "no"; then
AC_MSG_ERROR([This version of PROJ is too old. PROJ4.4.2 or later is required.])
fi
PROJ_ENABLED=-DUSE_PROJ
AC_MSG_RESULT([ using PROJ.4 from $PROJ_DIR.])
else
AC_MSG_RESULT([ PROJ.4 support not requested.])
fi
AC_SUBST(PROJ_ENABLED,$PROJ_ENABLED)
AC_SUBST(PROJ_INC, $PROJ_INC)
AC_SUBST(PROJ_LIBS, $PROJ_LIBS)
ALL_ENABLED="$PROJ_ENABLED $ALL_ENABLED"
ALL_INC="$PROJ_INC $ALL_INC"
ALL_LIB="$PROJ_LIBS $ALL_LIB"
dnl ---------------------------------------------------------------------
dnl ENABLE THREADS ONLY IF REQUESTED.
dnl ---------------------------------------------------------------------
THREAD_LIB=""
THREAD_FLAG=""
AC_CHECKING(whether we should include thread safe support)
AC_ARG_WITH(threads,
[ --with-threads[[=linkopt]]Include thread safe support],,)
if test "$with_threads" = "yes" ; then
AC_CHECK_LIB(pthread,pthread_create,THREAD_FLAG=-DUSE_THREAD,,,)
if test -n "$THREAD_FLAG" ; then
THREAD_LIB="-lpthread"
AC_MSG_RESULT([ using -lpthread from system libs.])
else
AC_MSG_ERROR([ -lpthread not found, use --with-thread=<pthread link options>])
fi
elif test -n "$with_threads" -a "$with_threads" != "no" ; then
THREAD_FLAG=-DUSE_THREAD
THREAD_LIB="$with_threads"
AC_MSG_RESULT([ using threads with link options "$THREAD_LIB".])
else
AC_MSG_RESULT([ thread safe support disabled.])
fi
AC_SUBST(THREAD_FLAG,$THREAD_FLAG)
AC_SUBST(THREAD_LIB,$THREAD_LIB)
ALL_ENABLED="$THREAD_FLAG $ALL_ENABLED"
ALL_LIB="$THREAD_LIB $ALL_LIB"
dnl ---------------------------------------------------------------------
dnl Check for the __sync_fetch_and_add builtin
dnl ---------------------------------------------------------------------
AC_CACHE_CHECK([for __sync_fetch_and_add], ac_cv_func_sync_fetch_and_add,
[AC_TRY_LINK([],[long x=0,y=0;for(x=0;x<5;x++){if(y>1) break; y=__sync_fetch_and_add(&x,1);}],ac_cv_func_sync_fetch_and_add=yes,ac_cv_func_sync_fetch_and_add=no)])
if test "$ac_cv_func_sync_fetch_and_add" = yes; then
ALL_ENABLED="-DHAVE_SYNC_FETCH_AND_ADD $ALL_ENABLED"
AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD,1,[Define if you have the __sync_fetch_and_add function])
fi
dnl ---------------------------------------------------------------------
dnl Find ESRI SDE ONLY IF REQUESTED.
dnl ---------------------------------------------------------------------
AC_CHECKING(whether we should include ESRI SDE support)
AC_ARG_WITH(sde,
[ --with-sde[[=DIR]] Include ESRI SDE support (DIR is SDE's install dir).],,)
AC_ARG_WITH(sde-version,
[ --with-sde-version[[=VERSION NUMBER]]
Set ESRI SDE version number (Default is 91).],SDE_VERSION=$with_sde_version,SDE_VERSION=91)
if test -z "$SDE_VERSION" -o `expr "$SDE_VERSION" \>\= 92` = 1; then
SDE_VERSION=""
fi
if test "$with_sde" = "yes" ; then
AC_CHECK_LIB(sde$SDE_VERSION,SE_connection_create,SDE_ENABLED=-DUSE_SDE,,,)
if test -n "$SDE_ENABLED" ; then
SDE_LIB="-lsde$SDE_VERSION -lpe$SDE_VERSION -lsg$SDE_VERSION"
AC_CHECK_LIB(pthread, main, SDE_LIB="$SDE_LIB -lpthread",,)
AC_CHECK_LIB(socket, main, SDE_LIB="$SDE_LIB -lsocket",,)
AC_CHECK_LIB(dl, main, SDE_LIB="$SDE_LIB -ldl",,)
AC_MSG_RESULT([ using ESRI SDE from system libs.])
else
AC_MSG_WARN([ ESRI SDE not found in system libs... use --with-sde=DIR.])
fi
elif test -n "$with_sde" -a "$with_sde" != "no" ; then
AC_EXPAND_PATH($with_sde, SDE_DIR)
test -f $SDE_DIR/arcsde/coverages/include/sdetype.h && SDE_INCDIR="$SDE_DIR/arcsde/coverages/include"
test -f $SDE_DIR/include/sdetype.h && SDE_INCDIR="$SDE_DIR/include"
test -f $SDE_DIR/sdetype.h && SDE_INCDIR="$SDE_DIR"
test -f $SDE_DIR/lib/libsde$SDE_VERSION.a && SDE_LIBDIR="$SDE_DIR/lib"
test -f $SDE_DIR/lib64/libsde$SDE_VERSION.a && SDE_LIBDIR="$SDE_DIR/lib64"
test -f $SDE_DIR/libsde$SDE_VERSION.a && SDE_LIBDIR="$SDE_DIR"
test -f $SDE_DIR/lib/libsde$SDE_VERSION.so -o -f $SDE_DIR/lib/libsde$SDE_VERSION.sl && SDE_LIBDIR="$SDE_DIR/lib"
test -f $SDE_DIR/lib64/libsde$SDE_VERSION.so -o -f $SDE_DIR/lib64/libsde$SDE_VERSION.sl && SDE_LIBDIR="$SDE_DIR/lib64"
test -f $SDE_DIR/libsde$SDE_VERSION.so -o -f $SDE_DIR/libsde$SDE_VERSION.sl && SDE_LIBDIR="$SDE_DIR"
if test -n "$SDE_INCDIR" -a -n "$SDE_LIBDIR" ; then
SDE_INC=-I$SDE_INCDIR
SDE_LIB="-L$SDE_LIBDIR -lsde$SDE_VERSION -lpe$SDE_VERSION -lsg$SDE_VERSION"
AC_CHECK_LIB(pthread, main, SDE_LIB="$SDE_LIB -lpthread",,)
AC_CHECK_LIB(socket, main, SDE_LIB="$SDE_LIB -lsocket",,)
AC_CHECK_LIB(dl, main, SDE_LIB="$SDE_LIB -ldl",,)
AC_ADD_RUNPATH("$SDE_LIBDIR")
else
AC_MSG_ERROR("Could not find sdetype.h or libsde$SDE_VERSION.a/libsde$SDE_VERSION.so in $SDE_DIR.")
fi
SDE_ENABLED=-DUSE_SDE
AC_MSG_RESULT([ using ESRI SDE from $SDE_DIR.])
else
AC_MSG_RESULT([ ESRI SDE support not requested.])
fi
AC_SUBST(SDE_ENABLED,$SDE_ENABLED)
AC_SUBST(SDE_INC, $SDE_INC)
AC_SUBST(SDE_LIB, $SDE_LIB)
ALL_ENABLED="$SDE_ENABLED $ALL_ENABLED"
ALL_INC="$SDE_INC $ALL_INC"
ALL_LIB="$SDE_LIB $ALL_LIB"
dnl ---------------------------------------------------------------------
dnl Find GEOS ONLY IF REQUESTED.
dnl ---------------------------------------------------------------------
AC_MSG_CHECKING(if GEOS support requested)
AC_ARG_WITH(geos,
[ --with-geos[[=PATH]] Include GEOS support (PATH is path to geos-config)],,)
if test -n "$with_geos" -a "$with_geos" != "no" ; then
AC_MSG_RESULT([yes])
GEOS_CONFIG=$with_geos
if test "$GEOS_CONFIG" = "yes" ; then
AC_PATH_PROG(GEOS_CONFIG, geos-config, no)
if test "$GEOS_CONFIG" = "no" ; then
AC_MSG_ERROR([couldn't find geos-config in default path. Please specify full path to geos-config])
fi
elif test -f "$GEOS_CONFIG" -a -x "$GEOS_CONFIG" ; then
AC_MSG_RESULT([user supplied geos-config ($GEOS_CONFIG)])
else
AC_MSG_ERROR(['$GEOS_CONFIG' is not an executable. Make sure you use --with-geos=/path/to/geos-config])
fi
dnl
dnl Test that we have at least version 3.0.0
dnl (Version check code borrowed from GDAL's geos.m4)
dnl
min_geos_version=3.0.0
AC_MSG_CHECKING(for GEOS version >= $min_geos_version)
geos_major_version=`$GEOS_CONFIG --version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
geos_minor_version=`$GEOS_CONFIG --version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
geos_micro_version=`$GEOS_CONFIG --version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
req_major=`echo $min_geos_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
req_minor=`echo $min_geos_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
req_micro=`echo $min_geos_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
ac_req_version=`expr $req_major \* 100000 \+ $req_minor \* 100 \+ $req_micro`
ac_geos_version=`expr $geos_major_version \* 100000 \+ $geos_minor_version \* 100 \+ $geos_micro_version`
if test $ac_req_version -le $ac_geos_version; then
AC_MSG_RESULT([yes. Found version ${geos_major_version}.${geos_minor_version}.${geos_micro_version}])
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([geos-config reports version ${geos_major_version}.${geos_minor_version}.${geos_micro_version}, need at least $min_geos_version or configure --without-geos])
fi
dnl
dnl All checks passed. Set compile flags
dnl
GEOS_ENABLED=-DUSE_GEOS