forked from OSGeo/grass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
executable file
·2050 lines (1522 loc) · 47.7 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
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
#############################################################################
#
# MODULE: Grass Compilation
# AUTHOR(S): Original author unknown - probably CERL
# Eric G. Miller - egm2 jps.net
# Justin Hickey - Thailand - jhickey hpcc.nectec.or.th
# Markus Neteler - Germany/Italy - neteler itc.it
# Nicklas Larsson (update to autoconfig 2.69)
# PURPOSE: This configure runs all the tests to determine what components
# are installed on the current system. It also defines certain
# configuration variables for compilation and installation.
# COPYRIGHT: (C) 2000-2023 by the GRASS Development Team
#
# This program is free software under the GNU General
# Public License (>=v2). Read the file COPYING that
# comes with GRASS for details.
#
# MANUAL: http://www.gnu.org/software/autoconf/manual/autoconf.html
# http://savannah.gnu.org/projects/autoconf/
# Website for config.guess, config.sub:
# wget http://git.savannah.gnu.org/cgit/config.git/plain/config.guess
# wget http://git.savannah.gnu.org/cgit/config.git/plain/config.sub
# Note: use autoconf-2.69
#############################################################################
define([AC_CACHE_LOAD], )
define([AC_CACHE_SAVE], )
define([AC_CACHE_VAL], [
$2
])
AC_INIT
AC_CONFIG_SRCDIR([configure.ac])
AC_PREREQ([2.69])
AC_CONFIG_HEADER(include/grass/config.h)
AC_CANONICAL_HOST
AC_PROG_CC
# Enable C++ option
LOC_ARG_WITH(cxx, C++)
LOC_CHECK_USE(cxx,C++,USE_CXX)
if test -n "$USE_CXX"; then
AC_PROG_CXX
else
CXX=
CXXFLAGS=
AC_SUBST(CXX)
AC_SUBST(CXXFLAGS)
fi
# Done checking C++
LOC_EXEEXT
AC_SUBST(MINGW32)
# Set WINDRES
if test "$MINGW32" = yes ; then
WINDRES=${WINDRES-windres}
else
WINDRES=
fi
AC_SUBST(WINDRES)
# Check for custom PKG_CONFIG
PKG_CONFIG=${PKG_CONFIG-pkg-config}
# Check for full floating-point support, including Infinity and NaN
IEEEFLAG=
LOC_CHECK_FP_INF_NAN([],
[],
[ ac_save_cflags=${CFLAGS}
CFLAGS=-mieee
LOC_CHECK_FP_INF_NAN([ with -mieee],
[IEEEFLAG="-mieee"],
[AC_MSG_WARN([*** Incomplete floating-point support.])],
[AC_MSG_ERROR([*** INTERNAL CONFIGURE ERROR])])
CFLAGS=${ac_save_cflags}],
[ LOC_CHECK_CC_MIEEE ])
CFLAGS="$CFLAGS $IEEEFLAG"
# Set BINDIR
if test -n "${bindir}"; then
BINDIR="${bindir}"
else
BINDIR=/usr/local/bin
fi
AC_SUBST(BINDIR)
# Set SRCDIR and DSTDIR
AC_PATH_PROG(pwd, pwd, pwd)
if test "$MINGW32" = yes -a "$cross_compiling" != yes ; then
winpwd="pwd -W"
else
winpwd="$pwd"
fi
AC_MSG_CHECKING(for source directory)
if test -z "$srcdir" ; then
SRCDIR=`$pwd`
else
SRCDIR=`(cd "$srcdir" ; $pwd)`
fi
AC_MSG_RESULT("$SRCDIR")
AC_MSG_CHECKING(for build directory)
DSTDIR=`$pwd`
WINDSTDIR=`$winpwd`
AC_MSG_RESULT("$DSTDIR")
AC_SUBST(SRCDIR)
AC_SUBST(DSTDIR)
# Set ARCH
ARCH=
if test -z "${host}"; then
ARCH="unknown"
else
ARCH="${host}"
fi
AC_SUBST(ARCH)
# Set GISBASE and GRASS_BIN
GISBASE="${WINDSTDIR}/dist.${ARCH}"
GRASS_BIN="${DSTDIR}/bin.${ARCH}"
AC_SUBST(GISBASE)
AC_SUBST(GRASS_BIN)
# Set GRASS_VERSION_*
GRASS_VERSION_FILE=include/VERSION
GRASS_VERSION_MAJOR=`sed -n 1p "${GRASS_VERSION_FILE}"`
GRASS_VERSION_MINOR=`sed -n 2p "${GRASS_VERSION_FILE}"`
GRASS_VERSION_RELEASE=`sed -n 3p "${GRASS_VERSION_FILE}"`
GRASS_VERSION_DATE=`sed -n 4p "${GRASS_VERSION_FILE}"`
GRASS_VERSION_NUMBER=`echo ${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}.${GRASS_VERSION_RELEASE}`
NAME_VER=`echo ${GRASS_VERSION_NUMBER} | sed 's/\..*//'`
changequote(,)
LIB_VER=`echo ${GRASS_VERSION_NUMBER} | sed 's/^\([0-9.]*\).*$/\1/'`
changequote([,])
GRASS_VERSION_GIT="exported"
# get git short hash + date of last change in GRASS headers
# (and anything else in include)
GRASS_HEADERS_GIT_HASH="${GRASS_VERSION_NUMBER}"
GRASS_HEADERS_GIT_DATE=`date -u +%FT%T%z | sed 's/\(..\)$/:\1/'`
AC_PATH_PROG(GIT, git, no)
if test "$GIT" != "no" ; then
GRASS_VERSION_GIT=`$GIT rev-parse --short HEAD 2>/dev/null`
if test -z "$GRASS_VERSION_GIT"; then
GRASS_VERSION_GIT="exported"
fi
GRASS_HEADERS_GIT_HASH=`$GIT log -1 --pretty=format:"%h" -- "${SRCDIR}/include" 2>/dev/null`
if test -z "$GRASS_HEADERS_GIT_HASH"; then
GRASS_HEADERS_GIT_HASH="${GRASS_VERSION_NUMBER}"
fi
GRASS_HEADERS_GIT_DATE=`date -d $($GIT log -1 --pretty=format:"%cI" -- "${SRCDIR}/include") -u +%FT%T%z | sed 's/\(..\)$/:\1/'` 2>/dev/null
if test -z "$GRASS_HEADERS_GIT_DATE"; then
GRASS_HEADERS_GIT_DATE=`date -u +%FT%T%z | sed 's/\(..\)$/:\1/'`
fi
fi
AC_SUBST(GRASS_VERSION_FILE)
AC_SUBST(GRASS_VERSION_MAJOR)
AC_SUBST(GRASS_VERSION_MINOR)
AC_SUBST(GRASS_VERSION_RELEASE)
AC_SUBST(GRASS_VERSION_NUMBER)
AC_SUBST(GRASS_VERSION_DATE)
AC_SUBST(GRASS_VERSION_GIT)
AC_SUBST(GRASS_HEADERS_GIT_HASH)
AC_SUBST(GRASS_HEADERS_GIT_DATE)
AC_SUBST(NAME_VER)
AC_SUBST(LIB_VER)
# Check for MacOSX App
AC_ARG_ENABLE(macosx-app,
[ --enable-macosx-app create a MacOSX application],,
[enable_macosx_app=no])
AC_MSG_CHECKING(for MacOSX App)
case "$enable_macosx_app" in
yes) MACOSX_APP=1 ;;
no) MACOSX_APP= ;;
*) AC_MSG_ERROR([*** You must answer yes or no.]) ;;
esac
AC_MSG_RESULT("$enable_macosx_app")
AC_SUBST(MACOSX_APP)
# Check for MacOSX archs
AC_MSG_CHECKING(for MacOSX architectures)
MACOSX_ARCHS=
if test -z "$with_macosx_archs" ; then
AC_MSG_RESULT(no)
else
for a in $with_macosx_archs
do
# check if valid arch?
case "$a" in
i386|ppc|x86_64|ppc64)
MACOSX_ARCHS="$MACOSX_ARCHS -arch $a"
;;
esac
done
AC_MSG_RESULT([$MACOSX_ARCHS])
LDFLAGS="$LDFLAGS $MACOSX_ARCHS"
CFLAGS="$CFLAGS $MACOSX_ARCHS"
CXXFLAGS="$CXXFLAGS $MACOSX_ARCHS"
fi
AC_SUBST(MACOSX_ARCHS)
# Done checking MacOSX archs
# Check for MacOSX SDK
AC_MSG_CHECKING(for MacOSX SDK)
MACOSX_SDK=
if test -z "$with_macosx_sdk" ; then
AC_MSG_RESULT(no)
else
AC_CHECK_FILE($with_macosx_sdk/SDKSettings.plist, [
MACOSX_SDK="-isysroot $with_macosx_sdk"],[
AC_MSG_ERROR([*** specified SDK does not exist or is not a SDK])])
LDFLAGS="$LDFLAGS $MACOSX_SDK"
CFLAGS="$CFLAGS $MACOSX_SDK"
CXXFLAGS="$CXXFLAGS $MACOSX_SDK"
fi
AC_SUBST(MACOSX_SDK)
# Done checking MacOSX SDK
# Set INST_DIR
if test -n "$MACOSX_APP" ; then
INSTDIR='${prefix}'"/GRASS-${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}.app/Contents/MacOS"
else
INSTDIR='${prefix}'"/grass${GRASS_VERSION_MAJOR}${GRASS_VERSION_MINOR}"
fi
AC_SUBST(INSTDIR)
# Get flags for building shared libraries
SC_ENABLE_SHARED
ac_save_ldflags="$LDFLAGS"
SC_CONFIG_CFLAGS
LDFLAGS="${ac_save_ldflags} $LDFLAGS"
# Enable options
AC_ARG_ENABLE(w11,
[ --enable-w11 use W11 library for Windows X11 emulation],,
[enable_w11=no])
# With options
#LOC_ARG_WITH(g77, GNU Fortran 77, no)
AC_ARG_WITH(macosx-archs,
[ --with-macosx-archs[=arch list]
compile multiple architectures on MacOSX, ie.
universal. Valid architectures are i386, ppc,
x86_64 and ppc64. (default: no [native])],, with_macosx_archs="no")
AC_ARG_WITH(macosx-sdk,
[ --with-macosx-sdk[=path/sdk]
compile with a system SDK on MacOSX. (default: no)],, with_macosx_sdk="no")
LOC_ARG_WITH(tiff, TIFF)
LOC_ARG_WITH(postgres, PostgreSQL, no)
LOC_ARG_WITH(mysql, MySQL, no)
LOC_ARG_WITH(sqlite, SQLite)
LOC_ARG_WITH(opengl, OpenGL)
LOC_ARG_WITH(odbc, ODBC, no)
LOC_ARG_WITH(fftw, FFTW)
LOC_ARG_WITH(blas, BLAS, no)
LOC_ARG_WITH(lapack, LAPACK, no)
LOC_ARG_WITH(cairo, Cairo)
LOC_ARG_WITH(freetype, FreeType)
LOC_ARG_WITH(nls, NLS, no)
LOC_ARG_WITH(readline, Readline, no)
LOC_ARG_WITH(opendwg, openDWG, no)
LOC_ARG_WITH(regex, regex)
LOC_ARG_WITH(pthread, POSIX threads, no)
LOC_ARG_WITH(openmp, OpenMP, no)
LOC_ARG_WITH(opencl, OpenCL, no)
LOC_ARG_WITH(bzlib, BZIP2, no)
LOC_ARG_WITH(zstd, Zstandard)
LOC_ARG_WITH(pdal, PDAL)
AC_ARG_WITH(libpng,
[ --with-libpng[=path/libpng-config]
enable PNG support (libpng-config with path,
e.g. '--with-libpng=/usr/local/bin/libpng-config')])
AC_ARG_WITH(gdal,
[ --with-gdal[=path/gdal-config]
enable GDAL/OGR support (gdal-config with path,
e.g. '--with-gdal=/usr/local/bin/gdal-config')])
AC_ARG_WITH(liblas,
[ --with-liblas[=path/liblas-config]
enable libLAS support (liblas-config with path,
e.g. '--with-liblas=/usr/local/bin/liblas-config',
default: no)],, with_liblas="no")
AC_ARG_WITH(netcdf,
[ --with-netcdf[=path/nc-config]
enable NetCDF support (nc-config with path,
e.g. '--with-nc=/usr/local/bin/nc-config',
default: no)],, with_netcdf="no")
# With includes and libs options
AC_ARG_WITH(geos,
[ --with-geos[=path/geos-config]
enable GEOS support (geos-config with path,
e.g. '--with-geos=/usr/local/bin/geos-config',
default: no)],, with_geos="no")
AC_ARG_WITH(includes,
[ --with-includes=DIRS site include files are in DIRS])
AC_ARG_WITH(libs,
[ --with-libs=DIRS site library files are in DIRS])
LOC_ARG_WITH_INC(zlib, zlib)
LOC_ARG_WITH_LIB(zlib, zlib)
LOC_ARG_WITH_INC(bzlib, BZIP2)
LOC_ARG_WITH_LIB(bzlib, BZIP2)
LOC_ARG_WITH_INC(zstd, ZSTD)
LOC_ARG_WITH_LIB(zstd, ZSTD)
LOC_ARG_WITH_INC(readline, Readline)
LOC_ARG_WITH_LIB(readline, Readline)
LOC_ARG_WITH_INC(tiff, TIFF)
LOC_ARG_WITH_LIB(tiff, TIFF)
LOC_ARG_WITH_INC(postgres, PostgreSQL)
LOC_ARG_WITH_LIB(postgres, PostgreSQL)
LOC_ARG_WITH_INC(mysql, MySQL)
LOC_ARG_WITH_LIB(mysql, MySQL)
LOC_ARG_WITH_INC(sqlite, SQLite)
LOC_ARG_WITH_LIB(sqlite, SQLite)
LOC_ARG_WITH_INC(opengl, OpenGL)
LOC_ARG_WITH_LIB(opengl, OpenGL)
LOC_ARG_WITH_FRAMEWORK(opengl, OpenGL)
LOC_ARG_WITH_INC(odbc, ODBC)
LOC_ARG_WITH_LIB(odbc, ODBC)
LOC_ARG_WITH_INC(fftw, FFTW)
LOC_ARG_WITH_LIB(fftw, FFTW)
LOC_ARG_WITH_INC(blas, BLAS)
LOC_ARG_WITH_LIB(blas, BLAS)
LOC_ARG_WITH_INC(lapack, LAPACK)
LOC_ARG_WITH_LIB(lapack, LAPACK)
LOC_ARG_WITH_INC(cairo, cairo)
LOC_ARG_WITH_LIB(cairo, cairo)
LOC_ARG_WITH_LDFLAGS(cairo, cairo)
LOC_ARG_WITH_INC(freetype, FreeType)
LOC_ARG_WITH_LIB(freetype, FreeType)
LOC_ARG_WITH_INC(proj, External PROJ.4)
LOC_ARG_WITH_LIB(proj, External PROJ.4)
LOC_ARG_WITH_SHARE(proj, External PROJ.4)
LOC_ARG_WITH_INC(opendwg, openDWG)
LOC_ARG_WITH_LIB(opendwg, openDWG)
LOC_ARG_WITH_INC(regex, regex)
LOC_ARG_WITH_LIB(regex, regex)
LOC_ARG_WITH_INC(pthread, POSIX threads)
LOC_ARG_WITH_LIB(pthread, POSIX threads)
LOC_ARG_WITH_INC(openmp, OpenMP)
LOC_ARG_WITH_LIB(openmp, OpenMP)
LOC_ARG_WITH_INC(opencl, OpenCL)
LOC_ARG_WITH_LIB(opencl, OpenCL)
#LOC_ARG_WITH_FRAMEWORK(opencl, OpenCL)
# Put this early on so CPPFLAGS and LDFLAGS have any additional dirs
# With includes option
# Handle Fortran compiler choice
#LOC_CHECK_USE(g77, GNU Fortran 77, USE_G77)
# Done checking fortran
AC_MSG_CHECKING(for additional include dirs)
case "$with_includes" in
y | ye | yes | n | no)
AC_MSG_ERROR([*** You must supply a directory to list --with-includes.])
;;
esac
AC_MSG_RESULT($with_includes)
if test -n "$with_includes"; then
for dir in $with_includes; do
if test -d "$dir"; then
INCLUDE_DIRS="$INCLUDE_DIRS -I$dir"
else
AC_MSG_ERROR([*** Include directory $dir does not exist.])
fi
done
CPPFLAGS="$CPPFLAGS $INCLUDE_DIRS"
fi
AC_SUBST(INCLUDE_DIRS)
# With libs option
AC_MSG_CHECKING(for additional library dirs)
case "$with_libs" in
y | ye | yes | n | no)
AC_MSG_ERROR([*** You must supply a directory list to --with-libs.])
;;
esac
AC_MSG_RESULT($with_libs)
if test -n "$with_libs"; then
for dir in $with_libs; do
if test -d "$dir"; then
LIBRARY_DIRS="$LIBRARY_DIRS -L$dir"
else
AC_MSG_ERROR([*** Library directory $dir does not exist.])
fi
done
LDFLAGS="$LDFLAGS $LIBRARY_DIRS"
fi
AC_SUBST(LIBRARY_DIRS)
# Programs and standard headers, libraries, functions
AC_PROG_INSTALL
AC_PROG_LEX
if test "$LEX" = "lex"; then
AC_PATH_PROG(LEXPATH, lex, no)
if test "$LEXPATH" = "no"; then
AC_MSG_ERROR([*** Unable to locate lex.])
fi
fi
AC_PROG_YACC
if test "$YACC" = "yacc"; then
AC_PATH_PROG(YACCPATH, yacc, no)
if test "$YACCPATH" = "no"; then
AC_MSG_ERROR([*** Unable to locate yacc.])
fi
fi
AC_PROG_RANLIB
AC_CHECK_PROGS(AR, ar)
AC_CHECK_PROGS(ENV, env)
AC_PATH_PROG(PERL, perl, no)
AC_HEADER_STDC
#AC_CHECK_HEADERS(curses.h limits.h termio.h termios.h unistd.h values.h)
AC_CHECK_HEADERS(limits.h termio.h termios.h unistd.h values.h f2c.h g2c.h)
AC_CHECK_HEADERS(sys/ioctl.h sys/mtio.h sys/resource.h sys/time.h)
AC_CHECK_HEADERS(sys/timeb.h sys/types.h sys/utsname.h)
AC_CHECK_HEADERS(libintl.h iconv.h)
AC_CHECK_HEADERS(langinfo.h)
AC_HEADER_TIME
AC_TYPE_OFF_T
AC_TYPE_UID_T
AC_CANONICAL_HOST
case $host_os in
*cygwin* ) CYGWIN=yes;;
* ) CYGWIN=no;;
esac
AC_CHECK_FUNCS(ftime gethostname gettimeofday lseek nice time uname)
AC_CHECK_FUNCS(seteuid setpriority setreuid setruid)
AC_CHECK_FUNCS(drand48)
AC_CHECK_FUNCS(putenv setenv)
AC_CHECK_FUNCS(nanosleep)
if test "$cross_compiling" != "yes" ; then
AC_FUNC_SETPGRP
else
CROSS_COMPILING=1
AC_SUBST(CROSS_COMPILING)
fi
AC_MSG_CHECKING(for long long int)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[long long int x;]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LONG_LONG_INT, 1, [define if "long long int" is available])
],[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(for int64_t)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], [[int64_t x;]])],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_INT64_T, 1, [define if "int64_t" is available])
],[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(for W11)
case "$enable_w11" in
yes|no) AC_MSG_RESULT("$enable_w11") ;;
*) AC_MSG_ERROR([*** You must answer yes or no.]) ;;
esac
USE_X11=
USE_W11=
XLIB=
XTLIB=
if test "$enable_w11" = "yes" ; then
X_CFLAGS=-I${SRCDIR}/display/drivers/windows/libW11
X_LIBS='-L$(LIBDIR)'
AC_SUBST(X_CFLAGS)
AC_SUBST(X_LIBS)
USE_W11="1"
USE_X11="1"
XLIB=-lX11
CFLAGS="$CFLAGS -D__W98__"
else
AC_PATH_XTRA
if test "$no_x" != "yes"; then
USE_X11="1"
XLIB=-lX11
XTLIB=-lXt
fi
fi
AC_SUBST(XLIB)
AC_SUBST(XTLIB)
AC_SUBST(USE_X11)
# Note that some systems (FreeBSD for example) need an extra library for
# cuserid
ac_save_libs="$LIBS"
LIBS=""
AC_SEARCH_LIBS(cuserid,[compat])
DBMIEXTRALIB="$LIBS"
LIBS="$ac_save_libs"
AC_SUBST(DBMIEXTRALIB)
AC_CHECK_FUNCS(asprintf)
AC_SUBST(HAVE_ASPRINTF)
# Test if mathlib needs -lm flag or is included with libc
AC_CHECK_FUNC(atan, MATHLIB=, [
AC_CHECK_LIB(m, atan, MATHLIB=-lm, [
AC_MSG_ERROR([*** Failed check for math library.])
])])
AC_SUBST(MATHLIB)
AC_CHECK_FUNC(dlsym, DLLIB=, [
AC_CHECK_LIB(dl, dlsym, DLLIB=-ldl, [
DLLIB=
])])
AC_SUBST(DLLIB)
AC_CHECK_FUNC(iconv, ICONVLIB=, [
AC_CHECK_LIB(iconv, iconv, ICONVLIB=-liconv, [
AC_CHECK_LIB(giconv, iconv, ICONVLIB=-lgiconv, [
AC_CHECK_FUNC(libiconv, ICONVLIB=, [
AC_CHECK_LIB(iconv, libiconv, ICONVLIB=-liconv, [
AC_CHECK_LIB(giconv, libiconv, ICONVLIB=-lgiconv, [
AC_MSG_WARN([*** Unable to locate iconv() function.])
ICONVLIB=
])])])])])])
AC_SUBST(ICONVLIB)
have_socket=1
AC_CHECK_FUNC(socket, SOCKLIB=, [
AC_CHECK_LIB(socket, socket, SOCKLIB=-lsocket, [
have_socket=0
AC_MSG_WARN([*** Unable to locate socket() function.])
])])
AC_SUBST(SOCKLIB)
if test "$have_socket" = 1 ; then
HAVE_SOCKET=1
AC_DEFINE(HAVE_SOCKET, 1, [define if socket() exists])
else
HAVE_SOCKET=
fi
AC_SUBST(HAVE_SOCKET)
# Mandatory zlib dependency
ZLIBLIBPATH=
ZLIBINCPATH=
ZLIB=
# With zlib includes directory
LOC_CHECK_INC_PATH(zlib,zlib,ZLIBINCPATH)
LOC_CHECK_INCLUDES(zlib.h,zlib,$ZLIBINCPATH)
# With zlib library directory
LOC_CHECK_LIB_PATH(zlib,zlib,ZLIBLIBPATH)
LOC_CHECK_LIBS(z,deflate,zlib,$ZLIBLIBPATH,ZLIB,,,)
#
AC_SUBST(ZLIBINCPATH)
AC_SUBST(ZLIBLIBPATH)
AC_SUBST(ZLIB)
# Done checking zlib
# bzip2 support
BZIP2LIBPATH=
BZIP2INCPATH=
BZIP2LIB=
LOC_CHECK_USE(bzlib,bzlib,USE_BZIP2)
if test -n "$USE_BZIP2"; then
# With bzip2 includes directory
LOC_CHECK_INC_PATH(bzlib,bzlib,BZIP2INCPATH)
LOC_CHECK_INCLUDES(bzlib.h,bzlib,$BZIP2INCPATH)
# With bzip2 library directory
LOC_CHECK_LIB_PATH(bzlib,bzlib,BZIP2LIBPATH)
LOC_CHECK_LIBS(bz2,BZ2_bzBuffToBuffCompress,bzlib,$BZIP2LIBPATH,BZIP2LIB,,,)
#
fi # $USE_BZIP2
AC_SUBST(BZIP2INCPATH)
AC_SUBST(BZIP2LIBPATH)
AC_SUBST(BZIP2LIB)
# Done checking bzip2
# zstd support
ZSTDLIBPATH=
ZSTDINCPATH=
ZSTDLIB=
LOC_CHECK_USE(zstd,zstd,USE_ZSTD)
if test -n "$USE_ZSTD"; then
# With zstd includes directory
LOC_CHECK_INC_PATH(zstd,zstd,ZSTDINCPATH)
LOC_CHECK_INCLUDES(zstd.h,zstd,$ZSTDINCPATH)
# With zstd library directory
LOC_CHECK_LIB_PATH(zstd,zstd,ZSTDLIBPATH)
LOC_CHECK_LIBS(zstd,ZSTD_compress,zstd,$ZSTDLIBPATH,ZSTDLIB,,,)
#
fi # $USE_ZSTD
AC_SUBST(ZSTDINCPATH)
AC_SUBST(ZSTDLIBPATH)
AC_SUBST(ZSTDLIB)
# Done checking zstd
# Mandatory PROJ dependency
PROJINC=
PROJLIB=
PROJSHARE=
PROJ4API=0
PROJMAJOR=4
# With PROJ includes directory
LOC_CHECK_INC_PATH(proj,External PROJ,PROJINC)
# PROJ version check: if proj.h exists, it must be proj 5+
LOC_CHECK_INCLUDES(proj.h,External PROJ,$PROJINC,PROJ4API=1)
if test $PROJ4API = 0 ; then
LOC_CHECK_VERSION_INT(proj.h,PROJ_VERSION_MAJOR,External PROJ major,proj_ver_major,$PROJINC,0)
LOC_CHECK_VERSION_INT(proj.h,PROJ_VERSION_MINOR,External PROJ minor,proj_ver_minor,$PROJINC,0)
LOC_CHECK_VERSION_INT(proj.h,PROJ_VERSION_PATCH,External PROJ patch,proj_ver_patch,$PROJINC,0)
AC_MSG_RESULT([found PROJ version "${proj_ver_major}.${proj_ver_minor}.${proj_ver_patch}"])
PROJMAJOR=${proj_ver_major}
# minimum required PROJ 5+ version to use the new PROJ API: 5.1.0
if test ${proj_ver_major} = 5 && test `expr ${proj_ver_minor} \< 1` = 1 ; then
AC_MSG_WARN([At least PROJ version "5.1.0" is required for the new API ])
PROJ4API=1
fi
else
LOC_CHECK_VERSION_INT(proj_api.h,PJ_VERSION,External PROJ.4,proj_ver,$PROJINC,0)
if test `expr ${proj_ver} \>= 600` = 1 ; then
PROJMAJOR=6
elif test `expr ${proj_ver} \>= 500` = 1 ; then
PROJMAJOR=5
elif test `expr ${proj_ver} \>= 400` = 1 ; then
PROJMAJOR=4
fi
AC_MSG_RESULT([found PROJ version "${proj_ver}"])
fi
if test $PROJ4API = 0 ; then
AC_MSG_RESULT([using new PROJ version 5+ API])
# With PROJ library directory
LOC_CHECK_LIB_PATH(proj,External PROJ,PROJLIB)
LOC_CHECK_LIBS(proj,proj_pj_info,External PROJ,$PROJLIB,PROJLIB,,,)
else
AC_MSG_RESULT([using old PROJ version 4 API])
AC_DEFINE(USE_PROJ4API, 1, [define if using old PROJ version 4 API])
LOC_CHECK_INCLUDES(proj_api.h,External PROJ,$PROJINC)
# PROJ version check for v4.x
if test "$cross_compiling" = yes; then
AC_MSG_WARN([*** Cannot check PROJ.4 version (cross-compiling).])
else
LOC_CHECK_VERSION_INT(proj_api.h,PJ_VERSION,External PROJ.4,proj_ver,$PROJINC,0)
if test `expr ${proj_ver} \< 446` = 1 ; then
AC_MSG_ERROR([*** PROJ.4.4.6 or later is required.])
fi
fi
# With PROJ library directory
LOC_CHECK_LIB_PATH(proj,External PROJ.4,PROJLIB)
LOC_CHECK_LIBS(proj,pj_get_def,External PROJ.4,$PROJLIB,PROJLIB,,,)
fi
# With PROJ share directory
LOC_CHECK_SHARE_PATH(proj,External PROJ,PROJSHARE)
if test -z "$PROJSHARE" ; then
AC_MSG_WARN([*** External PROJ directory not specified; default will be used])
PROJSHARE=/usr/share/proj
fi
# check if share/proj/epsg exists only for PROJ < 6
if test `expr ${PROJMAJOR} \< 6` = 1 ; then
# LOC_CHECK_SHARE does not work when cross compiling
if test "$cross_compiling" = "yes" ; then
AC_MSG_CHECKING([for epsg])
AC_MSG_RESULT([unknown (cross-compiling)])
else
LOC_CHECK_SHARE(epsg,External PROJ,$PROJSHARE,[
AC_MSG_WARN([*** Unable to locate PROJ data files.])
])
fi
fi
AC_SUBST(PROJINC)
AC_SUBST(PROJLIB)
AC_SUBST(PROJSHARE)
# Done checking PROJ
# Enable regex option
LOC_CHECK_USE(regex,regex,USE_REGEX)
REGEXINCPATH=
REGEXLIBPATH=
REGEXLIB=
if test -n "$USE_REGEX"; then
# With regex includes directory
LOC_CHECK_INC_PATH(regex,regex,REGEXINCPATH)
LOC_CHECK_INCLUDES(regex.h,regex,$REGEXINCPATH)
# With regex library directory
LOC_CHECK_LIB_PATH(regex,regex,REGEXLIBPATH)
LOC_CHECK_FUNC(regcomp,regex functions,REGEXLIB,,,,,[
LOC_CHECK_LIBS(regex,regcomp,regex,$REGEXLIBPATH,REGEXLIB,,,)
])
fi # $USE_REGEX
AC_SUBST(REGEXINCPATH)
AC_SUBST(REGEXLIBPATH)
AC_SUBST(REGEXLIB)
AC_SUBST(USE_REGEX)
# Done checking regex
# Enable Readline option
LOC_CHECK_USE(readline,Readline,USE_READLINE)
READLINEINCPATH=
READLINELIBPATH=
READLINELIB=
HISTORYLIB=
if test -n "$USE_READLINE"; then
# With Readline includes directory
LOC_CHECK_INC_PATH(readline,Readline,READLINEINCPATH)
LOC_CHECK_INCLUDES(readline/readline.h,Readline,$READLINEINCPATH)
LOC_CHECK_INCLUDES(readline/history.h,Readline,$READLINEINCPATH)
# With Readline library directory
LOC_CHECK_LIB_PATH(readline,Readline,READLINELIBPATH)
LOC_CHECK_LIBS(readline,readline,Readline,$READLINELIBPATH,READLINELIB,,,)
LOC_CHECK_LIBS(history,add_history,History,$READLINELIBPATH,HISTORYLIB,,,)
fi # $USE_READLINE
AC_SUBST(READLINEINCPATH)
AC_SUBST(READLINELIBPATH)
AC_SUBST(READLINELIB)
AC_SUBST(HISTORYLIB)
# Done checking Readline
# PNG option
AC_MSG_CHECKING(whether to use PNG)
PNGLIB=
PNGINC=
USE_PNG=
if test "`basename xx/$with_libpng`" = "libpng-config" ; then
LIBPNG_CONFIG="$with_libpng"
fi
if test "$with_libpng" = "no" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
AC_PATH_PROG(LIBPNG_CONFIG, libpng-config, no)
if test "$LIBPNG_CONFIG" = "no" ; then
AC_MSG_ERROR([*** couldn't find libpng-config])
fi
if test "$LIBPNG_CONFIG" != "" ; then
PNGLIB=`"$LIBPNG_CONFIG" --static --ldflags`
PNGINC=`"$LIBPNG_CONFIG" --cflags`
USE_PNG=1
fi
PNG=
ac_save_libs="$LIBS"
ac_save_cflags="$CFLAGS"
LIBS="$LIBS $PNGLIB"
CFLAGS="$CFLAGS $PNGINC"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <png.h>]], [[png_read_image(NULL, NULL);]])],[],[
AC_TRY_LINK([#include <png.h>],[png_read_image(NULL, NULL);],PNGLIB="$PNGLIB",[
AC_MSG_ERROR([*** Unable to locate libpng library.])
])
])
LIBS=${ac_save_libs}
CFLAGS=${ac_save_cflags}
AC_DEFINE(HAVE_PNG_H, 1, [Define to 1 if you have the <png.h> header file.])
fi
AC_SUBST(PNGLIB)
AC_SUBST(PNGINC)
AC_SUBST(USE_PNG)
# GDAL option
AC_MSG_CHECKING(whether to use GDAL)
GDAL_LIBS=
GDAL_CFLAGS=
USE_GDAL=
USE_OGR=
if test "`basename xx/$with_gdal`" = "gdal-config" ; then
GDAL_CONFIG="$with_gdal"
fi
if test "$with_gdal" = "no" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
AC_PATH_PROG(GDAL_CONFIG, gdal-config, no)
if test "$GDAL_CONFIG" = "no" ; then
AC_MSG_ERROR([*** couldn't find gdal-config])
fi
if test "$GDAL_CONFIG" != "" ; then
GDAL_LIBS=`"$GDAL_CONFIG" --libs`
GDAL_DEP_LIBS=`"$GDAL_CONFIG" --dep-libs`
GDAL_CFLAGS=`"$GDAL_CONFIG" --cflags`
USE_GDAL=1
if test `"$GDAL_CONFIG" --ogr-enabled` = "yes" ; then
AC_DEFINE(HAVE_OGR, 1, [define if OGR is to be used])
USE_OGR=1
fi
fi
GDAL=
ac_save_libs="$LIBS"
ac_save_cflags="$CFLAGS"
LIBS="$LIBS $GDAL_LIBS"
CFLAGS="$CFLAGS $GDAL_CFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gdal.h>]], [[GDALOpen("foo", GA_ReadOnly);]])],[],[
LIBS="$LIBS $GDAL_DEP_LIBS"
AC_TRY_LINK([#include <gdal.h>],[GDALOpen("foo", GA_ReadOnly);],GDAL_LIBS="$GDAL_LIBS $GDAL_DEP_LIBS",[
AC_MSG_ERROR([*** Unable to locate GDAL library.])
])
])
LIBS=${ac_save_libs}
CFLAGS=${ac_save_cflags}
AC_DEFINE(HAVE_GDAL, 1, [define if GDAL is to be used])
fi
AC_SUBST(GDAL_LIBS)
AC_SUBST(GDAL_CFLAGS)
AC_SUBST(USE_GDAL)
AC_SUBST(USE_OGR)
# libLAS option
AC_MSG_CHECKING(whether to use libLAS)
LIBLAS_LIBS=
LIBLAS_CFLAGS=
USE_LIBLAS=
if test "`basename xx/$with_liblas`" = "liblas-config" ; then
LIBLAS_CONFIG="$with_liblas"
fi
if test "$with_liblas" = "no" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
AC_PATH_PROG(LIBLAS_CONFIG, liblas-config, no)
if test "$LIBLAS_CONFIG" = "no" ; then
AC_MSG_ERROR([*** couldn't find liblas-config])
fi
if test "$LIBLAS_CONFIG" != "" ; then
LIBLAS_LIBS=`"$LIBLAS_CONFIG" --libs`