-
Notifications
You must be signed in to change notification settings - Fork 43
/
configure.ac
1749 lines (1612 loc) · 72.8 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
dnl--------------------------------------------------------------------
dnl The MB-system: configure.ac 12/7/2011
dnl
dnl Copyright (c) 2011-2023 by
dnl------------------------------------------------------------------------------
dnl The MB-system: CMakeLists.txt 27 June 2023
dnl
dnl Copyright (c) 2023-2024 by
dnl David W. Caress ([email protected])
dnl Monterey Bay Aquarium Research Institute
dnl Moss Landing, California, USA
dnl Dale N. Chayes
dnl Center for Coastal and Ocean Mapping
dnl University of New Hampshire
dnl Durham, New Hampshire, USA
dnl Christian dos Santos Ferreira
dnl MARUM
dnl University of Bremen
dnl Bremen Germany
dnl
dnl MB-System was created by Caress and Chayes in 1992 at the
dnl Lamont-Doherty Earth Observatory
dnl Columbia University
dnl Palisades, NY 10964
dnl
dnl See README.md file for copying and redistribution conditions.
dnl------------------------------------------------------------------------------
dnl--------------------------------------------------------------------
dnl Initialize and set version and version date
AC_INIT([mbsystem],[5.8.2],[http://listserver.mbari.org/sympa/arc/mbsystem],[mbsystem],[http://www.mbari.org/data/mbsystem/])
AS_ECHO([" "])
AS_ECHO(["------------------------------------------------------------------------------"])
AS_ECHO([" The MB-system: configure 12/7/2011"])
AS_ECHO([" "])
AS_ECHO([" Copyright (c) 2011-2024 by"])
AS_ECHO([" D. W. Caress ([email protected])"])
AS_ECHO([" and D. N. Chayes ([email protected])"])
AS_ECHO([" Lamont-Doherty Earth Observatory"])
AS_ECHO([" Palisades, NY 10964"])
AS_ECHO([" "])
AS_ECHO([" See README file for copying and redistribution conditions."])
AS_ECHO(["------------------------------------------------------------------------------"])
AS_ECHO([" "])
AS_ECHO([" The initial version of the MB-System autoconf-based build system"])
AS_ECHO([" was contributed by Bob Covill on 7 December 2011. Further"])
AS_ECHO([" refinement of the build system involved contributions from"])
AS_ECHO([" Bob Covill, Kurt Schwehr, Hamish Bowman, David Caress, and"])
AS_ECHO([" Christian Ferreira."])
AS_ECHO([" "])
AS_ECHO(["------------------------------------------------------------------------------"])
AS_ECHO([" To modify this build system..."])
AS_ECHO(["------------------------------------------------------------------------------"])
AS_ECHO([" "])
AS_ECHO([" Edit the file configure.ac in the top directory and the files"])
AS_ECHO([" Makefile.am in each directory under src. Then run the following sequence"])
AS_ECHO([" of commands:"])
AS_ECHO([" "])
AS_ECHO([" # Build libtool files for LT_INIT"])
AS_ECHO([" libtoolize --force --copy"])
AS_ECHO([" aclocal"])
AS_ECHO([" "])
AS_ECHO([" # Build custom header for configure"])
AS_ECHO([" autoheader"])
AS_ECHO([" automake --add-missing --include-deps"])
AS_ECHO([" autoconf"])
AS_ECHO([" "])
AS_ECHO([" # To update configure files use the following:"])
AS_ECHO([" autoupdate"])
AS_ECHO([" autoreconf --force --install --warnings=all"])
AS_ECHO([" "])
AS_ECHO([" When you run ./configure, a number of configure options are saved to a"])
AS_ECHO([" header file:"])
AS_ECHO([" ./src/mbio/mb_config.h"])
AS_ECHO([" This file has a template:"])
AS_ECHO([" ./src/mbio/mb_config.h.in"])
AS_ECHO([" This file is conditionally included by:"])
AS_ECHO([" ./src/mbio/mb_define.h"])
AS_ECHO([" which is in turn included by almost every MB-System C source file."])
AS_ECHO([" "])
AS_ECHO(["------------------------------------------------------------------------------"])
AS_ECHO([" To use the build system..."])
AS_ECHO(["------------------------------------------------------------------------------"])
AS_ECHO([" To generate the makefiles needed to build MB-System, run ./configure"])
AS_ECHO([" with the options appropriate for your situation. These options are"])
AS_ECHO([" listed here:"])
AS_ECHO([" --prefix=install - location for mbsystem (/usr/local) (optional)"])
AS_ECHO([" --with-netcdf-config - location of NetCDF config script nc-config (optional)"])
AS_ECHO([" --with-gdal-config - location of GDAL config script gdal-config (optional)"])
AS_ECHO([" --with-gmt-config - location of GMT config script gmt-config (optional)"])
AS_ECHO([" --with-proj-lib - location of PROJ libs (optional)"])
AS_ECHO([" --with-proj-include - location of PROJ headers (optional)"])
AS_ECHO([" --with-fftw-lib - location of FFTW3 libs (optional)"])
AS_ECHO([" --with-fftw-include - location of FFTW3 headers (optional)"])
AS_ECHO([" --with-motif-lib - location of Motif libs (optional)"])
AS_ECHO([" --with-motif-include - location of Motif headers (optional)"])
AS_ECHO([" --with-opengl-lib - location of OpenGL libs (optional)"])
AS_ECHO([" --with-opengl-include - location of OpenGL headers (optional)"])
AS_ECHO([" --with-otps-dir - location of OTPS installation (optional)"])
AS_ECHO([" --with-opencv-lib - location of OpenCV libs (optional)"])
AS_ECHO([" --with-opencv-include - location of OpenCV headers (optional)"])
AS_ECHO([" --with-vtk-include - location of VTK8.2+ headers (required if qt enabled, not functional yet)"])
AS_ECHO([" --with-vtk-lib - location of VTK8.2+ libraries (required if qt enabled, not functional yet)"])
AS_ECHO([" --enable-opencv - enable building tools using OpenCV (optional)"])
AS_ECHO([" --enable-mbtrn - enable building terrain relative navigation (TRN) tools (optional)"])
AS_ECHO([" --enable-mbtnav - enable building terrain relative navigation (TRN) tools (optional)"])
AS_ECHO([" --enable-rovtrn - enable building terrain relative navigation (TRN) ROV tools (optional)"])
AS_ECHO([" --enable-deprecated - enable building deprecated programs (optional)"])
AS_ECHO([" --disable-mbtools - disable building graphical tools (use with --enable-mbtrn and --enable-mbtnav)"])
AS_ECHO([" --enable-hardening - Enable compiler and linker options to frustrate memory corruption exploits (e.g. -fPIE and -pie) (optional)"])
AS_ECHO([" --enable-test - Enable building unit tests in test/ and third-party/"])
AS_ECHO([" --enable-qt - Enable building graphical tools using the Qt5 framework (Not functional yet)"])
AS_ECHO([" --with-debug - Set compiler flags to allow full debugging"])
AS_ECHO([" "])
AS_ECHO([" After configure you can run the make utility in the usual fashion"])
AS_ECHO([" make"])
AS_ECHO([" make install"])
AS_ECHO([" "])
AS_ECHO([" Some other useful make commands include: "])
AS_ECHO([" make clean (to clean up compiled code)"])
AS_ECHO([" make distclean (to clean up compiled code and configure output)"])
AS_ECHO([" make uninstall (to remove a previously installed version)"])
AS_ECHO(["------------------------------------------------------------------------------"])
AS_ECHO([" "])
dnl Check system arch
AC_CANONICAL_HOST
AS_ECHO([" "])
AS_ECHO(["------------------------------------------------------------------------------"])
AS_ECHO(["Configure will now attempt to construct the Makefiles required to build MB-System"])
AS_ECHO(["MB-System Version $PACKAGE_VERSION"])
AS_ECHO(["HOST System Type: ${host}"])
AS_ECHO(["Specified Installation Prefix: ${prefix}"])
AS_ECHO(["Default Installation Prefix: $ac_default_prefix"])
if test $prefix == "NONE" ; then
prefix=$ac_default_prefix
fi
AS_ECHO(["Used Installation Prefix: $prefix"])
AS_ECHO(["------------------------------------------------------------------------------"])
AS_ECHO([" "])
dnl Require automake 2.71 or later
AC_PREREQ([2.72])
dnl Disable warnings about unrecognized options
AC_DISABLE_OPTION_CHECKING
dnl Disable configure caching
define([AC_CACHE_LOAD], )
define([AC_CACHE_SAVE], )
AC_CONFIG_MACRO_DIR(m4)
AC_LANG(C)
dnl Require c++11
AX_CXX_COMPILE_STDCXX(11)
AM_INIT_AUTOMAKE([no-dist subdir-objects foreign])
AM_MAINTAINER_MODE
AC_CONFIG_HEADERS([src/mbio/mb_config.h])
dnl Handle option to enable debugging
AC_ARG_WITH(debug, [ --with-debug Set compiler flags to allow full debugging], [AC_DEFINE(WITH_DEBUG,1,0) AC_SUBST(WITH_DEBUG,1) CFLAGS="-O0 -g" CXXFLAGS="-O0 -g"])
dnl Check for programs
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_AWK
AM_PROG_AS
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_PROG_LN_S
AC_PROG_MAKE_SET
LT_INIT
AC_PROG_SED
AC_SUBST([LIBTOOL_DEPS])
LT_LIB_M
AM_PATH_PYTHON([3.6],, [:])
AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
dnl Check Endian size
BYTESWAP=no
AC_C_BIGENDIAN([BYTESWAP=no], [BYTESWAP=yes],
AC_MSG_ERROR(Unknown endian state),
AC_MSG_ERROR(Universial endianness not supported)
)
if test BYTESWAP == "no" ; then
AC_DEFINE(ENDIAN_BIG, 1, [Machine is bigendian, (Byteswapping off)])
else
AC_DEFINE(BYTESWAPPED, 1, [Machine is littleendian, (Byteswapping on)])
fi
dnl Check for math library
AC_CHECK_LIB(m,exp,,)
dnl Check for pthread library
AC_CHECK_LIB(pthread,pthread_create,,)
dnl Check for gsincos() and sincos() functions
AC_CHECK_FUNCS(gsincos sincos,,)
dnl check for signed char
AC_TYPE_INT8_T
dnl check for malloc header
AC_CHECK_HEADER(malloc.h, AC_DEFINE(HAVE_MALLOC_H, 1, [Have malloc.h]))
dnl Parse host_os from CANONICAL and deterimine
dnl if solaris flag required
case "${host_os}" in
solaris*|sunos*) CFLAGS="${CFLAGS} -DSUN" ;;
*) AS_ECHO(["Build does not require -DSUN CFLAG"]) ;;
esac
dnl check for win32 flag
case "${host_os}" in
*mingw32*|cygwin*)
# AC_DEFINE(WIN32, 1, [Turned on WIN32 define in config])
AS_ECHO(["Identified WIN32 but with Cygwin - no WIN32 define added to mb_config.h"])
;;
*)
AS_ECHO(["Not WIN32 system"])
;;
esac
dnl Check for RPC and XDR headers needed by MBIO library
dnl If the headers have been placed in /usr/include/tirpc/rpc then modify CFLAGS and CPPFLAGS first
AC_CHECK_FILE(/usr/include/tirpc/rpc/rpc.h, RPC_IN_TIRPC=yes, RPC_IN_TIRPC=no)
if test "$RPC_IN_TIRPC" = "yes" ; then
CPPFLAGS="$CPPFLAGS -I/usr/include/tirpc"
CFLAGS="$CFLAGS -I/usr/include/tirpc"
fi
AC_CHECK_HEADER(rpc/rpc.h, [AC_DEFINE(HAVE_RPC_RPC_H, 1, [Have rpc/rpc.h])] [GOT_RPC=yes], [GOT_RPC=no])
dnl Check for WIN32 libraries
# AC_CHECK_LIB(uuid, main)
# AC_CHECK_LIB(ole32, main)
# AC_CHECK_LIB(gw32c, main)
# AC_CHECK_LIB(wsock32, main)
# AC_CHECK_LIB(ws2_32, main)
dnl Look for library containing the XDR functions
AC_CHECK_FUNC(xdrmem_create, XDR_LIB=, [
AC_CHECK_LIB(sun, xdrmem_create, XDR_LIB=-lsun, [
AC_CHECK_LIB(nsl, xdrmem_create, XDR_LIB=-lnsl, [
AC_CHECK_LIB(rpclib, xdrmem_create, XDR_LIB=-lrpclib, [
AC_CHECK_LIB(xdr, xdrmem_create, XDR_LIB=-lxdr, [
AC_CHECK_LIB(tirpc, xdrmem_create, XDR_LIB=-ltirpc, [
AC_CHECK_LIB(portablexdr, xdrmem_create, XDR_LIB=-lportablexdr,
[AC_MSG_ERROR([*** Unable to locate XDR functions.])], -lws2_32 )
])
])
])
])
])
])
AC_SUBST(XDR_LIB)
dnl--------------------------------------------------------------------
dnl Set up to check compiler support for specific flags.
dnl There is no way to make clang's "argument unused" warning fatal,
dnl so when using check_cc_cxx_flag and check_link_flag modify CC, CXX,
dnl and LD to invoke the compiler through a wrapper script called
dnl ./flag-check.sh that greps for this message (and then restore
dnl CC, CXX, and LD when done).
dnl--------------------------------------------------------------------
AC_DEFUN([check_cc_cxx_flag], [AC_LANG_PUSH(C) AX_CHECK_COMPILE_FLAG([$1],
[AC_LANG_PUSH(C) AX_CHECK_COMPILE_FLAG([$1], [$2], [$3], [-Werror $4])
AC_LANG_POP(C)], [$3], [-Werror $4]) AC_LANG_POP(C)])
AC_DEFUN([check_link_flag], [AX_CHECK_LINK_FLAG([$1], [$2], [$3], [-Werror $4])])
dnl--------------------------------------------------------------------
dnl Enable compiler and linker options to frustrate memory corruption exploits
dnl including generating Position Independent Executables (PIE)
dnl using --enable-hardening
dnl--------------------------------------------------------------------
dnl HARDENING START
dnl This is taken from https://github.com/kmcallister/autoharden
dnl With some very small modifications (to remove C++ checking for instance)
dnl made by https://git.insomnia247.nl/irc/unreal4/blob/unreal40/configure.ac
dnl
# Save the raw compiler names.
saved_CC="$CC"
saved_CXX="$CXX"
saved_LD="$LD"
flag_wrap="./flag-check.sh"
CC="$flag_wrap $CC"
CXX="$flag_wrap $CXX"
LD="$flag_wrap $LD"
AC_ARG_ENABLE([hardening],
[AS_HELP_STRING([--enable-hardening],
[Enable compiler and linker options to frustrate memory corruption exploits @<:@yes@:>@])],
[hardening="$enableval"],
[hardening="no"])
HARDEN_CFLAGS=""
HARDEN_LDFLAGS=""
AS_ECHO(["Checking for hardening enabled.... $hardening"])
AS_IF([test x"$hardening" != x"no"], [
check_cc_cxx_flag([-fno-strict-overflow], [HARDEN_CFLAGS="$HARDEN_CFLAGS -fno-strict-overflow"])
# This one will likely succeed, even on platforms where it does nothing.
check_cc_cxx_flag([-D_FORTIFY_SOURCE=2], [HARDEN_CFLAGS="$HARDEN_CFLAGS -D_FORTIFY_SOURCE=2"])
check_cc_cxx_flag([-fstack-protector-all],
[check_link_flag([-fstack-protector-all],
[HARDEN_CFLAGS="$HARDEN_CFLAGS -fstack-protector-all"
check_cc_cxx_flag([-Wstack-protector], [HARDEN_CFLAGS="$HARDEN_CFLAGS -Wstack-protector"],
[], [-fstack-protector-all])
check_cc_cxx_flag([--param ssp-buffer-size=1], [HARDEN_CFLAGS="$HARDEN_CFLAGS --param ssp-buffer-size=1"],
[], [-fstack-protector-all])])])
# At the link step, we might want -pie (GCC) or -Wl,-pie (Clang on OS X)
#
# The linker checks also compile code, so we need to include -fPIE as well.
check_cc_cxx_flag([-fPIE],
[check_link_flag([-fPIE -pie],
[HARDEN_BINCFLAGS="-fPIE"
HARDEN_BINLDFLAGS="-pie"],
[check_link_flag([-fPIE -Wl,-pie],
[HARDEN_BINCFLAGS="-fPIE"
HARDEN_BINLDFLAGS="-Wl,-pie"])])])
check_link_flag([-Wl,-z,relro],
[HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-z,relro"
check_link_flag([-Wl,-z,now], [HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-z,now"])])
])
AC_SUBST([HARDEN_CFLAGS])
AC_SUBST([HARDEN_LDFLAGS])
AC_SUBST([HARDEN_BINCFLAGS])
AC_SUBST([HARDEN_BINLDFLAGS])
# End of flag tests.
CC="$saved_CC"
CXX="$saved_CXX"
LD="$saved_LD"
dnl HARDENING END
dnl--------------------------------------------------------------------
dnl Shared Data Section
dnl--------------------------------------------------------------------
dnl variables for shared data
mbsystemdatadir="$datadir/$PACKAGE"
AC_SUBST(mbsystemdatadir)
mbsystemhtmldir="$docdir/html"
AC_SUBST(mbsystemhtmldir)
dnl--------------------------------------------------------------------
dnl OTPS Section
dnl--------------------------------------------------------------------
dnl Use OTPS (OSU Tidal Prediction Software) location if specified with --with-otps-dir, use default otherwise
AS_ECHO(["Use OTPS (OSU Tidal Prediction Software) location if specified with --with-otps-dir, use default otherwise"])
OTPS_DIR="/usr/local/src/otps"
AC_ARG_WITH(otps_dir, [ --with-otps-dir=DIR Location of OSU Tidal Prediction Software], [OTPS_DIR=${withval}])
AC_SUBST(OTPS_DIR)
dnl--------------------------------------------------------------------
dnl PROJ Section
dnl--------------------------------------------------------------------
dnl Check for PROJ library libproj
AS_ECHO(["Check for PROJ library libproj"])
GOT_PROJ=no
FOUND_PROJ_LIB=no
FOUND_PROJ6=no
FOUND_PROJ4=no
AC_ARG_WITH(proj-lib, [ --with-proj-lib=DIR Location of PROJ library],
[proj_libdir="${withval}"] [GOT_PROJ=yes], [GOT_PROJ=no])
if test "$GOT_PROJ" = "yes" ; then
dnl PROJ library location specified: $proj_libdir - check if libproj is there...
AS_ECHO(["PROJ library location specified: $proj_libdir - check if libproj is there..."])
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -L$proj_libdir"
AC_CHECK_LIB([proj], [proj_normalize_for_visualization], [FOUND_PROJ_LIB=yes], [FOUND_PROJ_LIB=no], )
if test "$FOUND_PROJ_LIB" = "yes"; then
FOUND_PROJ6=yes
AS_ECHO(["Found PROJ library libproj from version 6.1 or later"])
else
AC_CHECK_LIB([proj], [pj_init_plus], [FOUND_PROJ_LIB=yes], [FOUND_PROJ_LIB=no], )
if test "$FOUND_PROJ_LIB" = "yes"; then
FOUND_PROJ4=yes
AS_ECHO(["Found PROJ library libproj with PROJ4 api available"])
fi
fi
if test "$FOUND_PROJ_LIB" = "no"; then
AC_MSG_ERROR([Did not find libproj according to --with-proj-lib - check the installation!])
fi
LDFLAGS="$save_LDFLAGS"
libproj_LIBS="-L$proj_libdir -R $proj_libdir -lproj"
libproj_LDFLAGS="-L$proj_libdir"
else
dnl Look for pkg-config PROJ package...
AS_ECHO(["Look for pkg-config PROJ package..."])
PKG_CHECK_MODULES([libproj], [proj], [FOUND_PROJ_PKG=yes], [FOUND_PROJ_PKG=no])
AC_CHECK_LIB([proj], [proj_normalize_for_visualization], [FOUND_PROJ_LIB=yes], [FOUND_PROJ_LIB=no], )
if test "$FOUND_PROJ_LIB" = "yes"; then
FOUND_PROJ6=yes
AS_ECHO(["Found PROJ library libproj from version 6.1 or later"])
else
AC_CHECK_LIB([proj], [pj_init_plus], [FOUND_PROJ_LIB=yes], [FOUND_PROJ_LIB=no], )
if test "$FOUND_PROJ_LIB" = "yes"; then
FOUND_PROJ4=yes
AS_ECHO(["Found PROJ library libproj with PROJ4 api available"])
fi
fi
dnl As of November 7 2021 there is different behavior on ARM than on Intel
dnl when building on MacOs. The PKG_CHECK_MODULES() macro will correctly find
dnl installation of proj using pkg-config. However, the AC_CHECK_LIB() macro
dnl works right on intel but not on ARM - it will fail to find either old or
dnl new proj functions on ARM (except it works right within homebrew...)
dnl Since the ARM case will always be using new proj, if the package is found
dnl and neither old nor new are identified, assume new. This complexity will
dnl hopefully not be needed always.
if test $FOUND_PROJ_PKG = "yes"; then
if test "$FOUND_PROJ_LIB" = "no"; then
dnl Proj pkg-config package exists, assume proj >= 6
FOUND_PROJ6=yes
FOUND_PROJ_LIB=yes
fi
else
if test "$FOUND_PROJ4" != "yes"; then
AC_MSG_ERROR([Did not find PROJ library pkg-config package...])
fi
fi
libproj_LIBS="-lproj"
libproj_LDFLAGS=""
fi
if test "$FOUND_PROJ_LIB" = "no" ; then
dnl Did not find PROJ library pkg-config package, looking in the other usual places...
AS_ECHO(["Did not find PROJ library pkg-config package, looking in the other usual places..."])
AC_CHECK_LIB([proj], [proj_normalize_for_visualization], [FOUND_PROJ_LIB=yes], [FOUND_PROJ_LIB=no],)
if test "$FOUND_PROJ_LIB" = "yes"; then
FOUND_PROJ6=yes
AS_ECHO(["Found PROJ library libproj from version 6.1 or later"])
else
AC_CHECK_LIB([proj], [pj_init_plus], [FOUND_PROJ_LIB=yes], [FOUND_PROJ_LIB=no], )
if test "$FOUND_PROJ_LIB" = "yes" ; then
FOUND_PROJ4=yes
AS_ECHO(["Found PROJ library libproj with PROJ4 api available"])
fi
fi
if test "$FOUND_PROJ_LIB" = "yes" ; then
libproj_LIBS="-lproj"
libproj_LDFLAGS=""
else
AS_ECHO(["Did not find PROJ library anywhere, use --with-proj-lib to set the location"])
AC_MSG_ERROR([Did not find PROJ library anywhere, use --with-proj-lib to set the location])
fi
fi
dnl Done checking for PROJ library libproj
AS_ECHO(["FOUND_PROJ_LIB:$FOUND_PROJ_LIB FOUND_PROJ4:$FOUND_PROJ4 FOUND_PROJ6:$FOUND_PROJ6"])
dnl Check if proj header location specified on the command line
AS_ECHO(["Check if proj header location specified on the command line"])
GOT_PROJ=no
FOUND_PROJ_HEADERS=no
AC_ARG_WITH(proj-include, [ --with-proj-include=DIR Location of PROJ headers],
[libproj_CPPFLAGS="-I${withval}"] [GOT_PROJ=yes], [GOT_PROJ=no])
if test "$GOT_PROJ" = "yes" ; then
dnl PROJ header location specified: $libproj_CPPFLAGS - check if proj.h or proj_api.h is there...
AS_ECHO(["PROJ header location specified: $libproj_CPPFLAGS - check if proj.h or proj_api.h is there..."])
else
dnl Looking for PROJ headers in the usual places...
AS_ECHO(["Looking for PROJ headers in the usual places..."])
fi
save_CPPFLAGS=$CPPFLAGS
save_CFLAGS=$CFLAGS
if test "$FOUND_PROJ4" = "yes" ; then
libproj_CPPFLAGS="$libproj_CPPFLAGS -DUSE_PROJ4_API"
dnl Only have PROJ 4 without geodesic calculations, will not build mbsvpselect...
AS_ECHO(["Only have PROJ 4 without geodesic calculations, will not build mbsvpselect..."])
fi
AM_CONDITIONAL([BUILD_MBSVPSELECT], [test $FOUND_PROJ6 = yes])
CPPFLAGS="$CPPFLAGS $libproj_CPPFLAGS"
CFLAGS="$CFLAGS $libproj_CPPFLAGS"
AC_CHECK_HEADER(proj.h, [FOUND_PROJ_HEADER_projh=yes], [FOUND_PROJ_HEADER_projh=no],)
FOUND_PROJ_HEADERS="no"
if test "$FOUND_PROJ_HEADER_projh" = "yes"; then
dnl Found PROJ6 headers
FOUND_PROJ_HEADERS="yes"
AS_ECHO(["Found PROJ 5/6 header proj.h"])
fi
AC_CHECK_HEADER(proj_api.h, [FOUND_PROJ_HEADER_proj_apih=yes], [FOUND_PROJ_HEADER_proj_apih=no],)
if test "$FOUND_PROJ_HEADER_proj_apih" = "yes"; then
FOUND_PROJ_HEADERS="yes"
AS_ECHO(["Found PROJ 4 header proj_api.h"])
fi
if test "$FOUND_PROJ_HEADERS" = "no" ; then
if test "$GOT_PROJ" = "yes" ; then
AS_ECHO(["Did not find PROJ headers according to --with-proj-include - check the installation!"])
AC_MSG_ERROR([Did not find PROJ headers according to --with-proj-include - check the installation!])
else
AS_ECHO(["Did not find PROJ headers anywhere, use --with-proj-include to set the location"])
AC_MSG_ERROR([Did not find PROJ headers anywhere, use --with-proj-include to set the location])
fi
fi
CPPFLAGS=$save_CPPFLAGS
CFLAGS=$save_CFLAGS
dnl Done checking for PROJ library libproj and PROJ headers
dnl Substitute PROJ library and header arguments
AC_SUBST([libproj_LIBS], [$libproj_LIBS])
AC_SUBST([libproj_CPPFLAGS], [$libproj_CPPFLAGS])
dnl--------------------------------------------------------------------
dnl NetCDF Section
dnl Use specified nc-config or look for nc-config in the path
dnl--------------------------------------------------------------------
dnl
if test "X$with_netcdf_config" != "X" ; then
NC_CONF="$with_netcdf_config/nc-config"
AC_MSG_CHECKING(for netCDF nc-config using --with-netcdf-config=$with_netcdf_config )
AC_MSG_RESULT($NC_CONF)
else
AC_PATH_PROG([NC_CONF], [nc-config] )
fi
if test -x "$NC_CONF" ; then
AC_MSG_CHECKING(for netCDF includes)
libnetcdf_CPPFLAGS=-I`$NC_CONF --includedir | sed -e 's/^-I//'`
AC_MSG_RESULT($libnetcdf_CPPFLAGS)
AC_MSG_CHECKING(for netCDF libs)
libnetcdf_LIBS=`$NC_CONF --libs`
AC_MSG_RESULT($libnetcdf_LIBS)
NETCDF_LIB=`echo $libnetcdf_LIBS | sed 's/^-L//;s/\ .*//'`
libnetcdf_LDFLAGS="-L$NETCDF_LIB"
else
if test "X$enable_netcdf" = "X" || test "$enable_netcdf" = "yes" ; then
AC_PATH_PROG([NETCDF], [ncdump], [/usr/local/netcdf/bin/ncdump])
NETCDF=`dirname $NETCDF`
NETCDF=`dirname $NETCDF`
else
NETCDF=$enable_netcdf
fi
AC_MSG_CHECKING(for netCDF include directory)
if test "X$NETCDF_INC" = "X"; then
NETCDF_INC=$NETCDF/include
fi
AC_MSG_RESULT($NETCDF_INC)
if test ! -f $NETCDF_INC/netcdf.h; then
AC_MSG_WARN([[netcdf.h cannot be found in $NETCDF_INC]])
fi
AC_MSG_CHECKING(for netCDF library directory)
if test "X$NETCDF_LIB" = "X"; then
NETCDF_LIB=$NETCDF/lib
fi
AC_MSG_RESULT($NETCDF_LIB)
if test ! -d $NETCDF_LIB; then
AC_MSG_WARN([[No such directory: $NETCDF_LIB]])
fi
libnetcdf_LIBS="-L$NETCDF_LIB -R $NETCDF_LIB -lnetcdf"
libnetcdf_LDFLAGS="-L$NETCDF_LIB"
libnetcdf_CPPFLAGS="-I$NETCDF_INC"
fi
if test ! -x "$NC_CONF" && test ! -d $NETCDF_LIB; then
AC_MSG_ERROR(["Did not find nc-config program or netCDF installation, use --with-nc-config to set the location"])
fi
dnl
dnl Done checking for netCDF headers and libraries
dnl Substitute netCDF library and header arguments
AC_SUBST([libnetcdf_LIBS], [$libnetcdf_LIBS])
AC_SUBST([libnetcdf_CPPFLAGS], [$libnetcdf_CPPFLAGS])
dnl--------------------------------------------------------------------
dnl GDAL Section
dnl We use gdal-config to set GDAL paths and settings
dnl--------------------------------------------------------------------
if test "X$with_gdal_config" != "X" ; then
GDAL_CONF="$with_gdal_config/gdal-config"
AC_MSG_CHECKING(for GDAL gdal-config using --with-gdal-config=$with_gdal_config )
AC_MSG_RESULT($GDAL_CONF)
else
AC_PATH_PROG([GDAL_CONF], [gdal-config])
fi
if test -x "$GDAL_CONF" ; then
AC_MSG_CHECKING(for GDAL includes)
GDAL_INC=`$GDAL_CONF --cflags`
AC_MSG_RESULT($GDAL_INC)
AC_MSG_CHECKING(for GDAL libs)
GDAL_LIB=`$GDAL_CONF --libs`
DEP_LIBS=`$GDAL_CONF --dep-libs`
AC_MSG_RESULT($GDAL_LIB)
GDAL_LIB_PATH=`echo $GDAL_LIB | sed 's/^-L//;s/\ .*//'`
libgdal_CPPFLAGS="$GDAL_INC"
libgdal_LIBS="-L$GDAL_LIB_PATH -R $GDAL_LIB_PATH -lgdal"
libgdal_LDFLAGS="-L$GDAL_LIB_PATH"
else
AS_ECHO(["Did not find gdal-config program, use --with-gdal-config to set the location"])
AC_MSG_ERROR(["Did not find gdal-config program, use --with-gdal-config to set the location"])
fi
dnl Substitute GDAL library and header arguments
AC_SUBST([libgdal_LIBS], [$libgdal_LIBS])
AC_SUBST([libgdal_CPPFLAGS], [$libgdal_CPPFLAGS])
AM_CONDITIONAL([HAVE_GDAL], [test -x "$GDAL_CONF"])
dnl--------------------------------------------------------------------
dnl GMT Section
dnl We use gmt-config to set GMT paths and settings
dnl--------------------------------------------------------------------
if test "X$with_gmt_config" != "X" ; then
GMT_CONF="$with_gmt_config/gmt-config"
AC_MSG_CHECKING(for GMT gmt-config using --with-gmt-config=$with_gmt_config )
AC_MSG_RESULT($GMT_CONF)
else
AC_PATH_PROG([GMT_CONF], [gmt-config])
fi
if test -x "$GMT_CONF" ; then
AC_MSG_CHECKING(for GMT version)
GMT_VERSION=`$GMT_CONF --version 2>/dev/null`
AC_MSG_RESULT($GMT_VERSION)
AC_MSG_CHECKING(GMT version >= 6.1.0)
AX_COMPARE_VERSION([$GMT_VERSION], [ge], [6.1.0], [GMT61PLUS=true], [GMT61PLUS=false])
AX_COMPARE_VERSION([$GMT_VERSION], [ge], [6.1.0], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no - $GMT_VERSION found])])
if [ $GMT61PLUS ] ; then
AS_ECHO(["GMT version >= 6.1.0, mbgrdtiff calls the grdimage module"])
else
AS_ECHO(["GMT version < 6.1.0, mbgrdtiff contructs image without calling the grdimage module"])
fi
AC_MSG_CHECKING(for GMT cflags)
GMT_CFLAGS=`$GMT_CONF --cflags 2>/dev/null`
AC_MSG_RESULT($GMT_CFLAGS)
AC_MSG_CHECKING(for GMT include directory)
GMT_INCLUDEDIR=`$GMT_CONF --includedir 2>/dev/null`
AC_MSG_RESULT($GMT_INCLUDEDIR)
AC_MSG_CHECKING(for GMT libs)
GMT_LIBS=`$GMT_CONF --libs 2>/dev/null`
AC_MSG_RESULT($GMT_LIBS)
AC_MSG_CHECKING(for GMT library directory)
GMT_LIBDIR=`$GMT_CONF --libdir 2>/dev/null`
AC_MSG_RESULT($GMT_LIBDIR)
AC_MSG_CHECKING(for GMT dependent libraries)
DEP_LIBS=`$GMT_CONF --dep-libs 2>/dev/null`
AC_MSG_RESULT($DEP_LIBS)
rpath="$GMT_LIBDIR"
AC_MSG_CHECKING(for 32/64-bit GMT installation)
bits=`$GMT_CONF --bits 2>/dev/null`
GCC_64="-m${bits}"
LDFLAGS="$LDFLAGS -m${bits}"
AC_MSG_RESULT(found ${bits}-bit)
AC_MSG_CHECKING(for GMT plugin location)
GMT_PLUGINDIR=`$GMT_CONF --plugindir 2>/dev/null`
AC_MSG_RESULT($GMT_PLUGINDIR)
libgmt_INCLUDEDIR="$GMT_INCLUDEDIR"
libgmt_CPPFLAGS="$GMT_CFLAGS"
libgmt_LIBS="$GMT_LIBS"
libgmt_LDFLAGS="$GMT_LIBS"
else
AS_ECHO(["Did not find gmt-config program, use --with-gmt-config to set the location"])
AC_MSG_ERROR(["Did not find gmt-config program, use --with-gmt-config to set the location"])
fi
dnl Substitute GMT library and header arguments
AC_SUBST([libgmt_LIBS], [$libgmt_LIBS])
AC_SUBST([libgmt_CPPFLAGS], [$libgmt_CPPFLAGS])
AC_SUBST([libgmt_INCLUDEDIR], [$libgmt_INCLUDEDIR])
AC_SUBST([libgmt_LDFLAGS], [$libgmt_LDFLAGS])
AC_SUBST(GMT_PLUGINDIR)
AM_CONDITIONAL([GMT61PLUS], [$GMT61PLUS])
dnl--------------------------------------------------------------------
dnl FFTW Section
dnl--------------------------------------------------------------------
dnl Check for FFTW library libfftw3
AS_ECHO(["Check for FFTW library libfftw3"])
GOT_FFTW=no
FFTW_SETTING=no
dnl First check if fftw location specified on the command line
AC_ARG_WITH(fftw-lib, [ --with-fftw-lib=DIR Location of FFTW library],
[fftw_libdir="${withval}"] [GOT_FFTW=yes], [GOT_FFTW=no])
if test "$GOT_FFTW" = "yes" ; then
dnl FFTW library location specified: $fftw_libdir - check if libfftw3 is there...
AS_ECHO(["FFTW library location specified: $fftw_libdir - check if libfftw3 is there..."])
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -L$fftw_libdir"
AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], [FFTW_SETTING=yes], [FFTW_SETTING=no], )
LDFLAGS="$save_LDFLAGS"
if test "$FFTW_SETTING" = "no"; then
AC_MSG_ERROR([Did not find libfftw3 according to --with-fftw-lib - check the installation!])
fi
libfftw_LIBS="-L$fftw_libdir -R $fftw_libdir -lfftw3"
libfftw_LDFLAGS="-L$fftw_libdir"
else
dnl Look for pkg-config FFTW package...
AS_ECHO(["Look for pkg-config FFTW package..."])
PKG_CHECK_MODULES([libfftw3], [fftw3], [GOT_FFTW=yes], [GOT_FFTW=no])
libfftw_LIBS="-lfftw3"
libfftw_LDFLAGS=""
fi
if test "$GOT_FFTW" = "no" ; then
dnl Did not find FFTW library pkg-config package, looking in the usual places...
AS_ECHO(["Did not find FFTW library pkg-config package, looking in the usual places..."])
AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], [FFTW_SETTING=yes], [FFTW_SETTING=no],)
if test "$FFTW_SETTING" = "yes" ; then
GOT_FFTW=yes
AS_ECHO(["Using pre-installed libfftw3..."])
libfftw_LIBS="-lfftw3"
libfftw_LDFLAGS=""
else
AS_ECHO(["Did not find FFTW library anywhere, use --with-fftw-lib to set the location"])
AC_MSG_ERROR([Did not find FFTW library anywhere, use --with-fftw-lib to set the location])
fi
fi
dnl Done checking for FFTW library libfftw3
dnl Check for FFTW headers
AS_ECHO(["Check for FFTW headers"])
GOT_FFTW=no
FFTW_SETTING=no
dnl First check if fftw3 location specified on the command line
AC_ARG_WITH(fftw-include, [ --with-fftw-include=DIR Location of FFTW headers],
[libfftw_CPPFLAGS="-I${withval}"] [GOT_FFTW=yes], [GOT_FFTW=no])
if test "$GOT_FFTW" = "yes" ; then
dnl FFTW header location specified: $libfftw_CPPFLAGS - check if fftw3.h is there...
AS_ECHO(["FFTW header location specified: $libfftw_CPPFLAGS - check if fftw3.h is there..."])
save_CPPFLAGS=$CPPFLAGS
save_CFLAGS=$CFLAGS
CPPFLAGS="$CPPFLAGS $libfftw_CPPFLAGS"
CFLAGS="$CFLAGS $libfftw_CPPFLAGS"
AC_CHECK_HEADER(fftw3.h, [FFTW_SETTING=yes], [FFTW_SETTING=no],)
CPPFLAGS=$save_CPPFLAGS
CFLAGS=$save_CFLAGS
if test "$FFTW_SETTING" = "no"; then
AC_MSG_ERROR([Did not find fftw3.h according to --with-fftw-include - check the installation!])
fi
else
dnl Looking for FFTW headers in the usual places...
AS_ECHO(["Looking for FFTW headers in the usual places..."])
AC_CHECK_HEADER(fftw3.h, [FFTW_SETTING=yes], [FFTW_SETTING=no])
if test "$FFTW_SETTING" = "yes" ; then
GOT_FFTW=yes
AS_ECHO(["Using pre-installed FFTW headers..."])
else
AS_ECHO(["Did not find FFTW headers anywhere, use --with-fftw-include to set the location"])
AC_MSG_ERROR([Did not find FFTW headers anywhere, use --with-fftw-include to set the location])
fi
fi
dnl Done checking for FFTW headers
dnl Substitute FFTW library and header arguments
if test "$GOT_FFTW" = "yes" ; then
AC_SUBST([fftw_app], [$USE_FFTW])
AC_SUBST([libfftw_LIBS], [$libfftw_LIBS])
AC_SUBST([libfftw_CPPFLAGS], [$libfftw_CPPFLAGS])
fi
AM_CONDITIONAL([BUILD_FFTW], [test "$GOT_FFTW" = yes])
dnl--------------------------------------------------------------------
dnl Build graphical tools?
dnl - optionally do not build X11/Motif and X11/Motif/OpenGL programs
dnl--------------------------------------------------------------------
dnl Check if the mbsys tools should be built
AS_ECHO(["Check if the graphical tools should be built"])
AC_ARG_ENABLE(mbtools, [AS_HELP_STRING([--disable-mbtools], [do not build graphical tools])],
[build_mbtools=no], [build_mbtools=yes])
if test "$build_mbtools" = "yes" ; then
dnl Building X11/Motif and X11/Motif/OpenGL programs
AS_ECHO(["Building graphical tools"])
AC_DEFINE(MB_GRAPHICAL_ENABLED, 1, [Build graphical tools])
else
dnl Not building X11/Motif and X11/Motif/OpenGL programs
AS_ECHO(["Not building graphical tools"])
fi
dnl--------------------------------------------------------------------
dnl X11/Motif Section
dnl--------------------------------------------------------------------
dnl Set default lack of X11, Motif, OpenGL
GOT_X11=no
GOT_MOTIF=no
GOT_OPENGL=no
dnl Only look for X11 and Motif if graphical tools should be built
if test "$build_mbtools" = "yes" ; then
dnl Check for X11 libraries libX11 libXt and X11 header file X11/Intrinsic.h
AS_ECHO(["Check for X11 libraries libX11 libXt and X11 header file X11/Intrinsic.h"])
AC_ARG_WITH(x11-lib, [ --with-x11-lib=DIR Location of X11 libraries],
[x11_libdir="${withval}"] [X11_LIB_SET=yes], [X11_LIB_SET=no])
if test "$X11_LIB_SET" = "yes" ; then
dnl X11 library location specified: $x11_libdir - check if libX11 and libXt are there...
AS_ECHO(["X11 library location specified: $x11_libdir - check if libX11 and libXt are there..."])
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -L$x11_libdir"
AC_CHECK_LIB([Xt], [XtAppMainLoop], [GOT_X11=yes], [GOT_X11=no])
if test "$GOT_X11" = "yes" ; then
AC_CHECK_LIB([X11], [XSendEvent], [GOT_X11=yes], [GOT_X11=no])
fi
LDFLAGS="$save_LDFLAGS"
if test "$GOT_X11" = "yes"; then
libx11_LIBS="-lXt -lX11"
libx11_LDFLAGS="-L$x11_libdir -R $x11_libdir"
fi
else
dnl X11 library location not specified - check for libX11 and libXt in the usual places...
AS_ECHO(["X11 library location not specified - check for libX11 and libXt in the usual places..."])
AC_CHECK_LIB([Xt], [XtAppMainLoop], [GOT_X11=yes], [GOT_X11=no])
if test "$GOT_X11" = "yes" ; then
AC_CHECK_LIB([X11], [XSendEvent], [GOT_X11=yes], [GOT_X11=no])
fi
if test "$GOT_X11" = "yes"; then
libx11_LIBS="-lXt -lX11"
libx11_LDFLAGS=" "
fi
fi
if test "$GOT_X11" = "yes"; then
AS_ECHO(["X11 libraries found!"])
else
AC_MSG_ERROR([Did not find libX11 or libXt - check the installation!])
fi
dnl If the X11 libraries are found then check for header files
if test "$GOT_X11" = "yes" ; then
AC_ARG_WITH(x11-include, [ --with-x11-include=DIR Location of X11 headers],
[x11_includedir="${withval}"] [X11_INCLUDE_SET=yes], [X11_INCLUDE_SET=no])
if test "$X11_INCLUDE_SET" = "yes" ; then
dnl X11 header location specified: $x11_includedir - check if X11/Intrinsic.h is there...
AS_ECHO(["X11 header location specified: $x11_includedir - check if X11/Intrinsic.h is there..."])
save_CPPFLAGS=$CPPFLAGS
save_CFLAGS=$CFLAGS
CPPFLAGS="$CPPFLAGS -I$x11_includedir"
CFLAGS="$CFLAGS -I$x11_includedir"
AC_CHECK_HEADER(X11/Intrinsic.h, [GOT_X11=yes], [GOT_X11=no],)
CPPFLAGS=$save_CPPFLAGS
CFLAGS=$save_CFLAGS
if test "$GOT_X11" = "yes"; then
libx11_CPPFLAGS="-I$x11_includedir"
fi
else
AC_CHECK_HEADER(X11/Intrinsic.h, [GOT_X11=yes], [GOT_X11=no],)
if test "$GOT_X11" = "yes"; then
libx11_CPPFLAGS=""
fi
fi
if test "$GOT_X11" = "yes"; then
AS_ECHO(["X11 headers found!"])
else
AC_MSG_ERROR([Did not find X11/Intrinsic.h - check the installation!])
fi
fi
if test "$GOT_X11" = "yes" ; then
dnl Check for Motif library libXm
AS_ECHO(["Check for Motif library libXm"])
AC_ARG_WITH(motif-lib, [ --with-motif-lib=DIR Location of MOTIF library],
[motif_libdir="${withval}"] [MOTIF_LIB_SET=yes], [MOTIF_LIB_SET=no])
if test "$MOTIF_LIB_SET" = "yes" ; then
dnl Motif library location specified: $motif_libdir - check if libXm is there...
AS_ECHO(["Motif library location specified: $motif_libdir - check if libXm is there..."])
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -L$motif_libdir"
AC_CHECK_LIB([Xm], [XmCreatePushButton], [GOT_MOTIF=yes], [GOT_MOTIF=no], )
LDFLAGS="$save_LDFLAGS"
if test "$GOT_MOTIF" = "yes"; then
libmotif_LIBS="-lXm"
libmotif_LDFLAGS="-L$motif_libdir -R $motif_libdir"
else
AC_MSG_ERROR(["Did not find libXm according to --with-motif-lib - check the installation!"])
fi
else
dnl First look for pkg-config OpenMotif entry...
AS_ECHO(["Look for pkg-config OpenMotif package..."])
PKG_CHECK_MODULES([libXm], [openmotif], [GOT_MOTIF=yes], [GOT_MOTIF=no])
if test "$GOT_MOTIF" = "yes"; then
AS_ECHO([Found libXm using pkg-config...])
libmotif_LIBS="-lXm"
libmotif_LDFLAGS=""
else
AS_ECHO(["Did not find libXm using pkg-config, looking in the usual places..."])
AC_CHECK_LIB([Xm], [XmCreatePushButton], [GOT_MOTIF=yes], [GOT_MOTIF=no],)
if test "$GOT_MOTIF" = "yes" ; then
AS_ECHO(["Found libXm!"])
libmotif_LIBS="-lXm"
libmotif_LDFLAGS=""
else
AC_MSG_ERROR(["Did not find Motif library anywhere, use --with-motif-lib to set the location"])
fi
fi
fi
if test "$GOT_MOTIF" = "yes" ; then
dnl Check for Motif headers
AS_ECHO(["Check for Motif headers"])
dnl First check if Motif location specified on the command line
AC_ARG_WITH(motif-include, [ --with-motif-include=DIR Location of Motif headers],
[motif_includedir="${withval}"] [MOTIF_INCLUDE_SET=yes], [MOTIF_INCLUDE_SET=no])
if test "$MOTIF_INCLUDE_SET" = "yes" ; then
dnl Motif header location specified: $motif_includedir - check if Xm/Xm.h is there...
AS_ECHO(["Motif header location specified: $motif_includedir - check if Xm/Xm.h is there..."])
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -I$motif_includedir"
AS_ECHO(["Looking for Motif headers: CPPFLAGS=$CPPFLAGS"])
AC_CHECK_HEADER(Xm/Xm.h, [GOT_MOTIF=yes], [GOT_MOTIF=no],)
AS_ECHO(["Done looking for Motif headers: GOT_MOTIF=$GOT_MOTIF"])
CPPFLAGS=$save_CPPFLAGS
if test "$GOT_MOTIF" = "yes"; then
libmotif_CPPFLAGS="-I$motif_includedir"
else
dnl Failed header check - try brute force check if Xm/Xm.h exists
AS_ECHO(["Failed header check - try brute force check if Xm/Xm.h exists"])
if test -f $motif_includedir/Xm/Xm.h ; then
libmotif_CPPFLAGS="-I$motif_includedir"
GOT_MOTIF=yes
else
AC_MSG_ERROR(["Did not find Xm/Xm.h according to --with-motif-include - check the installation!"])
fi
fi
else
dnl Looking for Motif headers in the usual places...
AS_ECHO(["Looking for Motif headers in the usual places..."])
AC_CHECK_HEADER(Xm/Xm.h, [GOT_MOTIF=yes], [GOT_MOTIF=no])
if test "$GOT_MOTIF" = "yes" ; then
libmotif_CPPFLAGS=""
else
AC_MSG_ERROR([Did not find Motif headers anywhere, use --with-motif-include to set the location])
fi
fi
fi
else
dnl Failed to find X11 libraries and headers - unable to build graphical tools
AS_ECHO(["Failed to find X11 libraries and headers - unable to build graphical tools"])
fi
dnl End looking for X11 and Motif if graphical tools to be built
fi
dnl Substitute Motif library and header arguments
AM_CONDITIONAL([BUILD_MOTIF], [test "$GOT_MOTIF" = yes])
AC_SUBST([libx11_LIBS], [$libx11_LIBS])
AC_SUBST([libx11_CPPFLAGS], [$libx11_CPPFLAGS])
AC_SUBST([libx11_LDFLAGS], [$libx11_LDFLAGS])
AC_SUBST([libmotif_LIBS], [$libmotif_LIBS])
AC_SUBST([libmotif_CPPFLAGS], [$libmotif_CPPFLAGS])
AC_SUBST([libmotif_LDFLAGS], [$libmotif_LDFLAGS])
dnl End check for Motif library and headers
dnl--------------------------------------------------------------------
dnl OpenGL Section
dnl--------------------------------------------------------------------
dnl Only look for OpenGL if graphical tools should be built and X11 and Motif have been found
if test "$build_mbtools" = "yes" ; then
dnl Check for OpenGL libraries libGL libGLU and header files GL/gl.h GL/glu.h GL/glx.h
AS_ECHO(["Check for OpenGL libraries libGL libGLU and header files GL/gl.h GL/glu.h GL/glx.h"])
GOT_OPENGL=no
OPENGL_SETTING=no
dnl Check for OpenGL libraries libGLU libGL
AS_ECHO(["Check for OpenGL libraries libGLU libGL"])
AC_ARG_WITH(opengl-lib, [ --with-opengl-lib=DIR Location of OpenGL library],
[opengl_libdir="${withval}"] [GOT_OPENGL=yes], [GOT_OPENGL=no])
if test "$GOT_OPENGL" = "yes" ; then
dnl OpenGL library location specified: $opengl_libdir - check if libGLU libGL is there...
AS_ECHO(["OpenGL library location specified: $opengl_libdir - check if libGL libGLU are there..."])
save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS -L$opengl_libdir"
AC_CHECK_LIB([GL], [glBegin], [OPENGL_SETTING=yes], [OPENGL_SETTING=no], )
if test "$OPENGL_SETTING" = "yes"; then
AC_CHECK_LIB([GLU], [gluScaleImage], [OPENGL_SETTING=yes], [OPENGL_SETTING=no], )
fi
LDFLAGS="$save_LDFLAGS"
if test "$OPENGL_SETTING" = "no"; then
AC_MSG_ERROR([Did not find libGLU libGL according to --with-opengl-lib - check the installation!])
fi
libopengl_LIBS="-L$opengl_libdir -lGL -lGLU"
libopengl_LDFLAGS="-L$opengl_libdir"
else
dnl Look for pkg-config OpenGL package...
AS_ECHO(["Look for pkg-config OpenGL package..."])
PKG_CHECK_MODULES([libGLU], [opengl], [GOT_OPENGL=yes], [GOT_OPENGL=no])
libopengl_LIBS="-lGL -lGLU"
libopengl_LDFLAGS=""
fi
if test "$GOT_OPENGL" = "no" ; then