-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathaclocal.m4
1647 lines (1511 loc) · 48.2 KB
/
aclocal.m4
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
AC_DEFUN([LOC_CHECK_USE],[
AC_MSG_CHECKING(whether to use $2)
AC_MSG_RESULT("$with_$1")
case "$with_$1" in
"no") $3= ;;
"yes") $3="1" ;;
*) AC_MSG_ERROR([*** You must answer yes or no.]) ;;
esac
])
AC_DEFUN([LOC_CHECK_INC_PATH],[
AC_MSG_CHECKING(for location of $2 includes)
case "$with_$1_includes" in
y | ye | yes | n | no)
AC_MSG_ERROR([*** You must supply a directory to --with-$1-includes.])
;;
esac
AC_MSG_RESULT($with_$1_includes)
if test -n "$with_$1_includes" ; then
for dir in $with_$1_includes; do
if test -d "$dir"; then
$3="$$3 -I$dir"
else
AC_MSG_ERROR([*** $2 includes directory $dir does not exist.])
fi
done
fi
])
AC_DEFUN([LOC_CHECK_LIB_PATH],[
AC_MSG_CHECKING(for location of $2 library)
case "$with_$1_libs" in
y | ye | yes | n | no)
AC_MSG_ERROR([*** You must supply a directory to --with-$1-libs.])
;;
esac
AC_MSG_RESULT($with_$1_libs)
if test -n "$with_$1_libs"; then
for dir in $with_$1_libs; do
if test -d "$dir"; then
$3="$$3 -L$dir"
else
AC_MSG_ERROR([*** $2 library directory $dir does not exist.])
fi
done
fi
])
AC_DEFUN([LOC_CHECK_FRAMEWORK_PATH],[
AC_MSG_CHECKING(for location of $2 framework)
case "$with_$1_framework" in
y | ye | yes | n | no)
AC_MSG_ERROR([*** You must supply a directory to --with-$1-framework.])
;;
esac
AC_MSG_RESULT($with_$1_framework)
if test -n "$with_$1_framework"; then
if test -d $with_$1_framework; then
$3="$$3 -F$with_$1_framework"
else
AC_MSG_ERROR([*** $2 framework directory $dir does not exist.])
fi
fi
])
AC_DEFUN([LOC_CHECK_SHARE_PATH],[
AC_MSG_CHECKING(for location of $2 data files)
case "$with_$1_share" in
y | ye | yes | n | no)
AC_MSG_ERROR([*** You must supply a directory to --with-$1-share.])
;;
esac
AC_MSG_RESULT($with_$1_share)
if test -n "$with_$1_share" ; then
if test -d "$with_$1_share"; then
$3="$with_$1_share"
else
AC_MSG_ERROR([*** $2 data directory $dir does not exist.])
fi
fi
])
AC_DEFUN([LOC_CHECK_LDFLAGS],[
AC_MSG_CHECKING(for $2 linking flags)
case "$with_$1_ldflags" in
y | ye | yes | n | no)
AC_MSG_ERROR([*** You must supply a directory to --with-$1-ldflags.])
;;
esac
AC_MSG_RESULT($with_$1_ldflags)
$3="$$3 $with_$1_ldflags"
])
AC_DEFUN([LOC_CHECK_INCLUDES],[
ac_save_cppflags="$CPPFLAGS"
CPPFLAGS="$3 $CPPFLAGS"
AC_CHECK_HEADERS($1, [], ifelse($4,[],[
AC_MSG_ERROR([*** Unable to locate $2 includes.])
], $4))
CPPFLAGS=$ac_save_cppflags
])
dnl $1 = library
dnl $2 = header
dnl $3 = function call
dnl $4 = descriptive name
dnl $5 = LDFLAGS initialiser
dnl $6 = result variable
dnl $7 = mandatory dependencies (not added to $5)
dnl $8 = mandatory dependencies (added to $5)
dnl $9 = ACTION-IF-NOT-FOUND
define(LOC_CHECK_LINK,[
ac_save_ldflags="$LDFLAGS"
ac_save_libs="$LIBS"
AC_MSG_CHECKING(for $4 library)
LDFLAGS="$5 $LDFLAGS"
LIBS="-l$1 $7 $8"
AC_TRY_LINK([$2],[$3],[
AC_MSG_RESULT(found)
$6="$$6 -l$1 $8"
],[
ifelse($9,[],[
AC_MSG_ERROR([*** Unable to locate $4 library.])
],$9)
])
LIBS=${ac_save_libs}
LDFLAGS=${ac_save_ldflags}
])
dnl autoconf undefines "shift", so use "builtin([shift], ...)"
define(LOC_SHIFT1,[builtin([shift],$*)])
define(LOC_SHIFT2,[LOC_SHIFT1(LOC_SHIFT1($*))])
define(LOC_SHIFT4,[LOC_SHIFT2(LOC_SHIFT2($*))])
define(LOC_SHIFT8,[LOC_SHIFT4(LOC_SHIFT4($*))])
define(LOC_SHIFT9,[LOC_SHIFT1(LOC_SHIFT8($*))])
dnl $1 = library
dnl $2 = function
dnl $3 = descriptive name
dnl $4 = LDFLAGS initialiser
dnl $5 = result variable
dnl $6 = mandatory dependencies (not added to $5)
dnl $7 = mandatory dependencies (added to $5)
dnl $8 = ACTION-IF-NOT-FOUND
dnl $9+ = optional dependencies
define(LOC_CHECK_LIBS_0,[
AC_CHECK_LIB($1, $2, $5="$$5 -l$1 $7",[
[$8]
],$6 $7)
])
define(LOC_CHECK_LIBS_1,[
ifelse($9,[],
LOC_CHECK_LIBS_0($1,$2,,,$5,$6,$7,$8),
[
LOC_CHECK_LIBS_1($1,$2,,,$5,$6,$7,
LOC_CHECK_LIBS_1($1,$2,,,$5,$6,$7 $9,$8,LOC_SHIFT9($*)),
LOC_SHIFT9($*))
]
)
])
define(LOC_CHECK_LIBS,[
ac_save_ldflags="$LDFLAGS"
LDFLAGS="$4 $LDFLAGS"
LOC_CHECK_LIBS_1($1,$2,,,$5,$6,$7,
LDFLAGS=${ac_save_ldflags}
ifelse($8,[],[
AC_MSG_ERROR([*** Unable to locate $3 library.])
],$8),LOC_SHIFT8($*))
LDFLAGS=${ac_save_ldflags}
])
dnl $1 = function
dnl $2 = descriptive name
dnl $3 = result variable
dnl $4 = LIBS initialiser (added to $3)
dnl $5 = LDFLAGS initialiser (not added to $3)
dnl $6 = LIBS initialiser (not added to $3)
dnl $7 = ACTION-IF-FOUND
dnl $8 = ACTION-IF-NOT-FOUND
define(LOC_CHECK_FUNC,[
ac_save_libs="$LIBS"
ac_save_ldflags="$LDFLAGS"
LIBS="$4 $6 $LIBS"
LDFLAGS="$5 $LDFLAGS"
AC_CHECK_FUNC($1,[
ifelse($7,[],[
$3="$$3 $4"
],$7)
],[
ifelse($8,[],[
ifelse($2,[],
[AC_MSG_ERROR([*** Unable to locate $1.])],
[AC_MSG_ERROR([*** Unable to locate $2.])]
)
],$8)
])
LIBS=${ac_save_libs}
LDFLAGS=${ac_save_ldflags}
])
AC_DEFUN([LOC_CHECK_VERSION_STRING],[
AC_MSG_CHECKING($3 version)
ac_save_cppflags="$CPPFLAGS"
CPPFLAGS="$5 $CPPFLAGS"
AC_TRY_RUN([
#include <stdio.h>
#include <$1>
int main(void) {
FILE *fp = fopen("conftestdata","w");
fputs($2, fp);
return 0;
}
],
[ $4=`cat conftestdata`
AC_MSG_RESULT($$4)],
[ AC_MSG_ERROR([*** Could not determine $3 version.]) ],
[ $4=$6
AC_MSG_RESULT([unknown (cross-compiling)]) ])
CPPFLAGS=$ac_save_cppflags
])
AC_DEFUN([LOC_CHECK_SHARE],[
AC_CHECK_FILE($3/$1, [], ifelse($4,[],[
AC_MSG_ERROR([*** Unable to locate $2 data files.])
], $4))
])
AC_DEFUN([LOC_CHECK_VERSION_INT],[
AC_MSG_CHECKING($3 version)
ac_save_cppflags="$CPPFLAGS"
CPPFLAGS="$5 $CPPFLAGS"
AC_TRY_RUN([
#include <stdio.h>
#include <$1>
int main(void) {
FILE *fp = fopen("conftestdata","w");
fprintf(fp, "%d", $2);
return 0;
}
],
[ $4=`cat conftestdata`
AC_MSG_RESULT($$4)],
[ AC_MSG_ERROR([*** Could not determine $3 version.]) ],
[ $4=$6
AC_MSG_RESULT([unknown (cross-compiling)]) ])
CPPFLAGS=$ac_save_cppflags
])
dnl autoconf undefines "eval", so use "builtin([eval], ...)"
AC_DEFUN([LOC_PAD],[$1[]ifelse(builtin([eval],len($1) > 23),1,[
],substr([ ],len($1)))])
AC_DEFUN([LOC_ARG_WITH],[
AC_ARG_WITH($1,
LOC_PAD([ --with-$1])[support $2 functionality (default: ]ifelse([$3],,yes,[$3])[)],,
[with_]patsubst([$1], -, _)[=]ifelse([$3],,yes,[$3]))
])
AC_DEFUN([LOC_ARG_WITH_INC],[
AC_ARG_WITH($1-includes,
LOC_PAD([ --with-$1-includes=DIRS])[$2 include files are in DIRS])
])
AC_DEFUN([LOC_ARG_WITH_LIB],[
AC_ARG_WITH($1-libs,
LOC_PAD([ --with-$1-libs=DIRS])[$2 library files are in DIRS])
])
AC_DEFUN([LOC_ARG_WITH_LDFLAGS],[
AC_ARG_WITH($1-ldflags,
LOC_PAD([ --with-$1-ldflags=FLAGS])[$2 needs FLAGS when linking])
])
AC_DEFUN([LOC_ARG_WITH_SHARE],[
AC_ARG_WITH($1-share,
LOC_PAD([ --with-$1-share=DIR])[$2 data files are in DIR])
])
AC_DEFUN([LOC_ARG_WITH_FRAMEWORK],[
AC_ARG_WITH($1-framework,
LOC_PAD([ --with-$1-framework=DIR])[$2 framework is in DIR])
])
AC_DEFUN([LOC_OPTIONAL],[
AC_MSG_CHECKING(whether to build $1)
if test -n "$USE_$2" ; then
AC_MSG_RESULT(yes)
BUILD_$3="$4"
else
AC_MSG_RESULT(no)
BUILD_$3=
fi
AC_SUBST(BUILD_$3)
])
dnl checks for complete floating-point support (infinity, NaN)
define(LOC_FP_TEST,[
#include <float.h>
int main(void) {
double one = 1.0;
double zero = 0.0;
if (one/zero > DBL_MAX) /* infinity */
if (zero/zero != zero/zero) /* NaN */
return 0;
return 1;
}
])
AC_DEFUN([LOC_CHECK_FP_INF_NAN],[
AC_MSG_CHECKING([for full floating-point support]$1)
AC_TRY_RUN(LOC_FP_TEST,
[ AC_MSG_RESULT(yes)
$2],
[ AC_MSG_RESULT(no)
$3],
[ AC_MSG_RESULT([unknown (cross-compiling)])
$4]
)
])
dnl check whether the compiler supports the -mieee switch
AC_DEFUN([LOC_CHECK_CC_MIEEE],[
AC_MSG_CHECKING(whether "cc -mieee" works)
ac_save_cflags=${CFLAGS}
CFLAGS="$CFLAGS -mieee"
AC_TRY_COMPILE(,,
[ AC_MSG_RESULT(yes)
IEEEFLAG="-mieee"],
[ AC_MSG_RESULT(no)])
CFLAGS=${ac_save_cflags}
])
AC_DEFUN([LOC_MSG],[
echo "$1"
])
AC_DEFUN([LOC_PAD_26],[substr([ ],len($1))])
AC_DEFUN([LOC_YES_NO],[if test -n "${$1}" ; then echo yes ; else echo no ; fi])
AC_DEFUN([LOC_MSG_USE],[
[echo " $1:]LOC_PAD_26($1)`LOC_YES_NO($2)`"])
AC_DEFUN(LOC_EXEEXT,
[AC_REQUIRE([AC_CYGWIN])
AC_REQUIRE([AC_MINGW32])
AC_MSG_CHECKING([for executable suffix])
AC_CACHE_VAL(ac_cv_exeext,
[if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
ac_cv_exeext=.exe
else
ac_cv_exeext=no
fi])
EXEEXT=""
test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
AC_MSG_RESULT(${ac_cv_exeext})
dnl Setting ac_exeext will implicitly change the ac_link command.
ac_exeext=$EXEEXT
AC_SUBST(EXEEXT)])
#------------------------------------------------------------------------
# SC_ENABLE_SHARED --
#
# Allows the building of shared libraries
#
# Arguments:
# none
#
# Results:
#
# Adds the following arguments to configure:
# --enable-shared=yes|no
#
# Defines the following vars:
# STATIC_BUILD Used for building import/export libraries
# on Windows.
#
# Sets the following vars:
# SHARED_BUILD Value of 1 or 0
#------------------------------------------------------------------------
AC_DEFUN([SC_ENABLE_SHARED], [
AC_MSG_CHECKING([how to build libraries])
AC_ARG_ENABLE(shared,
[ --enable-shared build and link with shared libraries [--enable-shared]],
[shared_ok=$enableval], [shared_ok=yes])
if test "${enable_shared+set}" = set; then
enableval="$enable_shared"
shared_ok=$enableval
else
shared_ok=yes
fi
if test "$shared_ok" = "yes" ; then
AC_MSG_RESULT([shared])
SHARED_BUILD=1
GRASS_LIB_PREFIX='$(SHLIB_PREFIX)'
GRASS_LIB_SUFFIX='$(SHLIB_SUFFIX)'
GRASS_LIBRARY_TYPE='shlib'
else
AC_MSG_RESULT([static])
SHARED_BUILD=0
AC_DEFINE(STATIC_BUILD)
GRASS_LIB_PREFIX='$(STLIB_PREFIX)'
GRASS_LIB_SUFFIX='$(STLIB_SUFFIX)'
GRASS_LIBRARY_TYPE='stlib'
fi
AC_SUBST(GRASS_LIB_PREFIX)
AC_SUBST(GRASS_LIB_SUFFIX)
AC_SUBST(GRASS_LIBRARY_TYPE)
])
#--------------------------------------------------------------------
# SC_CONFIG_CFLAGS
#
# Try to determine the proper flags to pass to the compiler
# for building shared libraries and other such nonsense.
#
# Arguments:
# none
#
# Results:
#
# Defines and substitutes the following vars:
#
# LDFLAGS - Flags to pass to the compiler when linking object
# files into an executable application binary such
# as tclsh.
# LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
# that tell the run-time dynamic linker where to look
# for shared libraries such as libtcl.so. Depends on
# the variable LIB_RUNTIME_DIR in the Makefile. Could
# be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
# CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
# that tell the run-time dynamic linker where to look
# for shared libraries such as libtcl.so. Depends on
# the variable LIB_RUNTIME_DIR in the Makefile.
# MAKE_LIB - Command to execute to build the a library;
# differs when building shared or static.
# MAKE_STUB_LIB -
# Command to execute to build a stub library.
# INSTALL_LIB - Command to execute to install a library;
# differs when building shared or static.
# INSTALL_STUB_LIB -
# Command to execute to install a stub library.
# STLIB_LD - Base command to use for combining object files
# into a static library.
# SHLIB_CFLAGS - Flags to pass to cc when compiling the components
# of a shared library (may request position-independent
# code, among other things).
# SHLIB_LD - Base command to use for combining object files
# into a shared library.
# SHLIB_LD_FLAGS -Flags to pass when building a shared library. This
# differes from the SHLIB_CFLAGS as it is not used
# when building object files or executables.
# SHLIB_LD_LIBS - Dependent libraries for the linker to scan when
# creating shared libraries. This symbol typically
# goes at the end of the "ld" commands that build
# shared libraries. The value of the symbol is
# "${LIBS}" if all of the dependent libraries should
# be specified when creating a shared library. If
# dependent libraries should not be specified (as on
# SunOS 4.x, where they cause the link to fail, or in
# general if Tcl and Tk aren't themselves shared
# libraries), then this symbol has an empty string
# as its value.
# SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable
# extensions. An empty string means we don't know how
# to use shared libraries on this platform.
# GRASS_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS
# for the build of Tcl and Tk, but not recorded in the
# tclConfig.sh, since they are only used for the build
# of Tcl and Tk.
# Examples: MacOS X records the library version and
# compatibility version in the shared library. But
# of course the Tcl version of this is only used for Tcl.
# LIB_SUFFIX - Specifies everything that comes after the "libfoo"
# in a static or shared library name, using the $LIB_VER variable
# to put the version in the right place. This is used
# by platforms that need non-standard library names.
# Examples: ${LIB_VER}.so.1.1 on NetBSD, since it needs
# to have a version after the .so, and ${LIB_VER}.a
# on AIX, since a shared library needs to have
# a .a extension whereas shared objects for loadable
# extensions have a .so extension. Defaults to
# ${LIB_VER}${SHLIB_SUFFIX}.
# GRASS_NEEDS_EXP_FILE -
# 1 means that an export file is needed to link to a
# shared library.
# GRASS_EXP_FILE - The name of the installed export / import file which
# should be used to link to the Tcl shared library.
# Empty if Tcl is unshared.
# GRASS_BUILD_EXP_FILE -
# The name of the built export / import file which
# should be used to link to the Tcl shared library.
# Empty if Tcl is unshared.
# GRASS_LIBS -
# Libs to use when linking Tcl shell or some other
# shell that includes Tcl libs.
# CFLAGS_DEBUG -
# Flags used when running the compiler in debug mode
# CFLAGS_OPTIMIZE -
# Flags used when running the compiler in optimize mode
# EXTRA_CFLAGS
#
#--------------------------------------------------------------------
AC_DEFUN([SC_CONFIG_CFLAGS], [
# Step 0.a: Enable 64 bit support?
AC_MSG_CHECKING([if 64bit support is requested])
AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)],,enableval="no")
if test "$enableval" = "yes"; then
do64bit=yes
else
do64bit=no
fi
AC_MSG_RESULT($do64bit)
# Step 0.b: Enable Solaris 64 bit VIS support?
AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
AC_ARG_ENABLE(64bit-vis,[ --enable-64bit-vis enable 64bit Sparc VIS support],,enableval="no")
if test "$enableval" = "yes"; then
# Force 64bit on with VIS
do64bit=yes
do64bitVIS=yes
else
do64bitVIS=no
fi
AC_MSG_RESULT($do64bitVIS)
# Step 1: set the variable "system" to hold the name and version number
# for the system. This can usually be done via the "uname" command, but
# there are a few systems, like Next, where this doesn't work.
AC_MSG_CHECKING([system version (for dynamic loading)])
if test -f /usr/lib/NextStep/software_version; then
system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
else
system=`uname -s`-`uname -r`
if test "$?" -ne 0 ; then
AC_MSG_RESULT([unknown (can't find uname command)])
system=unknown
else
# Special check for weird MP-RAS system (uname returns weird
# results, and the version is kept in special file).
if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
system=MP-RAS-`awk '{print $3}' /etc/.relid`
fi
if test "`uname -s`" = "AIX" ; then
system=AIX-`uname -v`.`uname -r`
fi
AC_MSG_RESULT($system)
fi
fi
# Step 2: check for existence of -ldl library. This is needed because
# Linux can use either -ldl or -ldld for dynamic loading.
AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
# Require ranlib early so we can override it in special cases below.
AC_REQUIRE([AC_PROG_RANLIB])
# Step 3: set configuration options based on system name and version.
do64bit_ok=no
EXTRA_CFLAGS=""
GRASS_EXPORT_FILE_SUFFIX=""
UNSHARED_LIB_SUFFIX=""
GRASS_TRIM_DOTS='`echo ${LIB_VER} | tr -d .`'
ECHO_VERSION='`echo ${LIB_VER}`'
GRASS_LIB_VERSIONS_OK=ok
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE=-O
if test "$GCC" = "yes" ; then
CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
else
CFLAGS_WARNING=""
fi
GRASS_NEEDS_EXP_FILE=0
GRASS_BUILD_EXP_FILE=""
GRASS_EXP_FILE=""
dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
dnl AC_CHECK_TOOL(AR, ar)
AC_CHECK_PROG(AR, ar, ar)
if test "${AR}" = "" ; then
AC_MSG_ERROR([Required archive tool 'ar' not found on PATH.])
fi
STLIB_LD='${AR} cr'
LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
PLAT_OBJS=""
case $system in
AIX-5.*)
if test "${GRASS_THREADS}" = "1" -a "$GCC" != "yes" ; then
# AIX requires the _r compiler when gcc isn't being used
if test "${CC}" != "cc_r" ; then
CC=${CC}_r
fi
AC_MSG_RESULT(Using $CC for compiling with threads)
fi
LIBS="$LIBS -lc"
# AIX-5 uses ELF style dynamic libraries
SHLIB_CFLAGS=""
# Note: need the LIBS below, otherwise Tk won't find Tcl's
# symbols when dynamically loaded into tclsh.
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".so"
LDFLAGS=""
LD_LIBRARY_PATH_VAR="LIBPATH"
# Check to enable 64-bit flags for compiler/linker
if test "$do64bit" = "yes" ; then
if test "$GCC" = "yes" ; then
AC_MSG_WARN("64bit mode not supported with GCC on $system")
else
do64bit_ok=yes
EXTRA_CFLAGS="-q64"
LDFLAGS="-q64"
RANLIB="${RANLIB} -X64"
AR="${AR} -X64"
SHLIB_LD_FLAGS="-b64"
fi
fi
if test "`uname -m`" = "ia64" ; then
# AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
SHLIB_LD="/usr/ccs/bin/ld -G -z text"
# AIX-5 has dl* in libc.so
if test "$GCC" = "yes" ; then
CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
else
CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
fi
LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
else
#SHLIB_LD="${SRCDIR}/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry ${SHLIB_LD_FLAGS}"
SHLIB_LD="$CC -shared"
CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
GRASS_NEEDS_EXP_FILE=1
GRASS_EXPORT_FILE_SUFFIX='${LIB_VER}.exp'
fi
;;
AIX-*)
if test "${GRASS_THREADS}" = "1" -a "$GCC" != "yes" ; then
# AIX requires the _r compiler when gcc isn't being used
if test "${CC}" != "cc_r" ; then
CC=${CC}_r
fi
AC_MSG_RESULT(Using $CC for compiling with threads)
fi
LIBS="$LIBS -lc"
SHLIB_CFLAGS=""
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".so"
LDFLAGS=""
CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
LD_LIBRARY_PATH_VAR="LIBPATH"
GRASS_NEEDS_EXP_FILE=1
GRASS_EXPORT_FILE_SUFFIX='${LIB_VER}.exp'
# Check to enable 64-bit flags for compiler/linker
if test "$do64bit" = "yes" ; then
if test "$GCC" = "yes" ; then
AC_MSG_WARN("64bit mode not supported with GCC on $system")
else
do64bit_ok=yes
EXTRA_CFLAGS="-q64"
LDFLAGS="-q64"
RANLIB="${RANLIB} -X64"
AR="${AR} -X64"
SHLIB_LD_FLAGS="-b64"
fi
fi
#SHLIB_LD="${SRCDIR}/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry ${SHLIB_LD_FLAGS}"
SHLIB_LD="$CC -shared"
# On AIX <=v4 systems, libbsd.a has to be linked in to support
# non-blocking file IO. This library has to be linked in after
# the MATH_LIBS or it breaks the pow() function. The way to
# insure proper sequencing, is to add it to the tail of MATH_LIBS.
# This library also supplies gettimeofday.
#
# AIX does not have a timezone field in struct tm. When the AIX
# bsd library is used, the timezone global and the gettimeofday
# methods are to be avoided for timezone deduction instead, we
# deduce the timezone by comparing the localtime result on a
# known GMT value.
AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
if test $libbsd = yes; then
MATH_LIBS="$MATH_LIBS -lbsd"
AC_DEFINE(USE_DELTA_FOR_TZ)
fi
;;
BeOS*)
SHLIB_CFLAGS="-fPIC"
SHLIB_LD="${CC} -nostart"
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".so"
LDFLAGS=""
#-----------------------------------------------------------
# Check for inet_ntoa in -lbind, for BeOS (which also needs
# -lsocket, even if the network functions are in -lnet which
# is always linked to, for compatibility.
#-----------------------------------------------------------
AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
;;
BSD/OS-2.1*|BSD/OS-3*)
SHLIB_CFLAGS=""
SHLIB_LD="shlicc -r"
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".so"
LDFLAGS=""
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
BSD/OS-4.*)
SHLIB_CFLAGS="-export-dynamic -fPIC"
SHLIB_LD="cc -shared"
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".so"
LDFLAGS="-export-dynamic"
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
dgux*)
SHLIB_CFLAGS="-K PIC"
SHLIB_LD="cc -G"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
LDFLAGS=""
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
HP-UX-*.11.*)
# Use updated header definitions where possible
AC_DEFINE(_XOPEN_SOURCE) # Use the XOPEN network library
AC_DEFINE(_XOPEN_SOURCE_EXTENDED) # Use the XOPEN network library
LIBS="$LIBS -lxnet" # Use the XOPEN network library
SHLIB_SUFFIX=".sl"
AC_CHECK_LIB(dld, shl_load, shared_ok=yes, shared_ok=no)
if test "$shared_ok" = yes; then
SHLIB_CFLAGS="+z"
SHLIB_LD="ld -b"
SHLIB_LD_LIBS='${LIBS}'
LDFLAGS="-Wl,-E"
CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
LD_LIBRARY_PATH_VAR="SHLIB_PATH"
fi
# Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
#EXTRA_CFLAGS="+DAportable"
# Check to enable 64-bit flags for compiler/linker
if test "$do64bit" = "yes" ; then
if test "$GCC" = "yes" ; then
hpux_arch=`gcc -dumpmachine`
case $hpux_arch in
hppa64*)
# 64-bit gcc in use. Fix flags for GNU ld.
do64bit_ok=yes
SHLIB_LD="gcc -shared"
SHLIB_LD_LIBS=""
LD_SEARCH_FLAGS=''
CC_SEARCH_FLAGS=''
;;
*)
AC_MSG_WARN("64bit mode not supported with GCC on $system")
;;
esac
else
do64bit_ok=yes
if test "`uname -m`" = "ia64" ; then
EXTRA_CFLAGS="+DD64"
LDFLAGS="+DD64 $LDFLAGS"
else
EXTRA_CFLAGS="+DA2.0W"
LDFLAGS="+DA2.0W $LDFLAGS"
fi
fi
fi
;;
HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
SHLIB_SUFFIX=".sl"
AC_CHECK_LIB(dld, shl_load, shared_ok=yes, shared_ok=no)
if test "$shared_ok" = yes; then
SHLIB_CFLAGS="+z"
SHLIB_LD="ld -b"
SHLIB_LD_LIBS=""
LDFLAGS="-Wl,-E"
CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
LD_LIBRARY_PATH_VAR="SHLIB_PATH"
fi
;;
IRIX-4.*)
SHLIB_CFLAGS="-G 0"
SHLIB_SUFFIX=".a"
SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
SHLIB_LD_LIBS='${LIBS}'
LDFLAGS="-Wl,-D,08000000"
CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
SHARED_LIB_SUFFIX='${LIB_VER}.a'
;;
IRIX-5.*)
SHLIB_CFLAGS=""
SHLIB_LD="ld -shared -rdata_shared"
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".so"
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
EXTRA_CFLAGS=""
LDFLAGS=""
;;
IRIX-6.2)
SHLIB_CFLAGS=""
SHLIB_LD="ld -shared -rdata_shared"
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".so"
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
;;
IRIX-6.*|IRIX64-6.5*)
SHLIB_CFLAGS=""
SHLIB_LD="ld -n32 -shared -rdata_shared"
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".so"
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
if test "$GCC" = "yes" ; then
EXTRA_CFLAGS="-mabi=n32"
LDFLAGS="-mabi=n32"
else
case $system in
IRIX-6.3)
# Use to build 6.2 compatible binaries on 6.3.
EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS"
;;
*)
EXTRA_CFLAGS="-n32"
;;
esac
LDFLAGS="-n32"
fi
;;
IRIX64-6.*)
SHLIB_CFLAGS=""
SHLIB_LD="ld -n32 -shared -rdata_shared"
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".so"
LDFLAGS=""
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
# Check to enable 64-bit flags for compiler/linker
if test "$do64bit" = "yes" ; then
if test "$GCC" = "yes" ; then
AC_MSG_WARN([64bit mode not supported by gcc])
else
do64bit_ok=yes
SHLIB_LD="ld -64 -shared -rdata_shared"
EXTRA_CFLAGS="-64"
LDFLAGS="-64"
fi
fi
;;
Linux*)
SHLIB_CFLAGS="-fPIC"
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".so"
CFLAGS_OPTIMIZE=-O2
# egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
# when you inline the string and math operations. Turn this off to
# get rid of the warnings.
#CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
if test "$have_dl" = yes; then
SHLIB_LD="${CC} -shared"
LDFLAGS="-Wl,--export-dynamic"
CC_SEARCH_FLAGS='-Wl,-rpath-link,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
else
AC_CHECK_HEADER(dld.h, [
SHLIB_LD="ld -shared"
LDFLAGS=""
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""])
fi
if test "`uname -m`" = "alpha" ; then
EXTRA_CFLAGS="-mieee"
fi
# The combo of gcc + glibc has a bug related
# to inlining of functions like strtod(). The
# -fno-builtin flag should address this problem
# but it does not work. The -fno-inline flag
# is kind of overkill but it works.
# Disable inlining only when one of the
# files in compat/*.c is being linked in.
if test x"${USE_COMPAT}" != x ; then
EXTRA_CFLAGS="${EXTRA_CFLAGS} -fno-inline"
fi
# XIM peeking works under XFree86.
AC_DEFINE(PEEK_XCLOSEIM)
;;
GNU*)
SHLIB_CFLAGS="-fPIC"
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".so"
if test "$have_dl" = yes; then
SHLIB_LD="${CC} -shared"
LDFLAGS="-Wl,--export-dynamic"
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
else
AC_CHECK_HEADER(dld.h, [
SHLIB_LD="ld -shared"
LDFLAGS=""
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""])
fi
if test "`uname -m`" = "alpha" ; then
EXTRA_CFLAGS="-mieee"
fi
;;
CYGWIN*)
SHLIB_CFLAGS=""
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".dll"
SHLIB_LD="${CC} -shared"
LDFLAGS="-Wl,--export-dynamic"
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
LD_LIBRARY_PATH_VAR="PATH"
;;
MINGW* | MSYS*)
SHLIB_CFLAGS=""
SHLIB_LD_LIBS='${LIBS}'
SHLIB_SUFFIX=".dll"
SHLIB_LD="${CC} -shared"
LDFLAGS="-Wl,--export-dynamic,--enable-runtime-pseudo-reloc"
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
LD_LIBRARY_PATH_VAR="PATH"
;;
MP-RAS-02*)
SHLIB_CFLAGS="-K PIC"
SHLIB_LD="cc -G"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
LDFLAGS=""
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""
;;
MP-RAS-*)
SHLIB_CFLAGS="-K PIC"
SHLIB_LD="cc -G"
SHLIB_LD_LIBS=""
SHLIB_SUFFIX=".so"
LDFLAGS="-Wl,-Bexport"
CC_SEARCH_FLAGS=""
LD_SEARCH_FLAGS=""