This repository has been archived by the owner on Sep 29, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
executable file
·1213 lines (1083 loc) · 35.2 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl ***************************************************************
dnl gaul-devel/configure.in
dnl ***************************************************************
dnl
dnl GAUL - Genetic Algorithm Utility Library.
dnl Copyright ©2001-2006, Stewart Adcock <[email protected]>
dnl All rights reserved.
dnl
dnl The latest version of this program should be available at:
dnl http://gaul.sourceforge.net/
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version. Alternatively, if your project
dnl is incompatible with the GPL, I will probably agree to requests
dnl for permission to use the terms of any other license.
dnl
dnl This program is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY WHATSOEVER.
dnl
dnl A full copy of the GNU General Public License should be in the file
dnl "COPYING" provided with this distribution; if not, see:
dnl http://www.gnu.org/
dnl
dnl ***************************************************************
dnl
dnl To do: Consider use of AC_TRY_CFLAGS().
dnl use -axN with icc of P4,Mobile P4
dnl use -Wp64 -Wcheck with icc on Itanium
dnl Detect var-arg macros.
dnl
dnl ***************************************************************
#
# We require autoconf 2.57 or above
#
AC_PREREQ(2.57)
#
# init autoconf
#
AC_INIT(gaul-devel, 0.1850-0, [email protected])
# Specify a configuration file
AM_CONFIG_HEADER(config.h util/gaul/gaul_config.h)
AC_CANONICAL_SYSTEM
PACKAGE="gaul-devel"
GA_MAJOR_VERSION=0
GA_MINOR_VERSION=1850
GA_PATCH_VERSION=0
GA_VERSION=${GA_MAJOR_VERSION}.${GA_MINOR_VERSION}-${GA_PATCH_VERSION}
#
# libtool versioning
# libtool on some systems can't handle a minor version of
# >255, so we can't use this:
#LT_RELEASE=${GA_MAJOR_VERSION}.${GA_MINOR_VERSION}
#
GA_LT_MINOR_VERSION=50
LT_RELEASE=${GA_MAJOR_VERSION}.${GA_LT_MINOR_VERSION}
LT_CURRENT=0
LT_REVISION=${GA_PATCH_VERSION}
AC_SUBST(LT_RELEASE)
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
#
# Set some defines required to their default values.
# FIXME: should allow configuration-time modification for many of these.
#
AC_DEFINE_UNQUOTED(GA_MAJOR_VERSION, ${GA_MAJOR_VERSION}, [Major version number.])
AC_DEFINE_UNQUOTED(GA_MINOR_VERSION, ${GA_MINOR_VERSION}, [Minor version number.])
AC_DEFINE_UNQUOTED(GA_LT_MINOR_VERSION, ${GA_LT_MINOR_VERSION}, [Minor version number for libtool.])
AC_DEFINE_UNQUOTED(GA_PATCH_VERSION, ${GA_PATCH_VERSION}, [Patch level.])
AC_DEFINE_UNQUOTED(GA_UNAME_STRING, "`uname -a`", [Record compilation platform information.])
AC_DEFINE_UNQUOTED(GA_BUILD_DATE_STRING, "`date +%d/%m/%y`", [Record date of compilation.])
AC_DEFINE_UNQUOTED(GA_VERSION_STRING, "${GA_VERSION}", [Version string.])
# Initialise Automake.
AM_INIT_AUTOMAKE($PACKAGE, $GA_VERSION, [email protected])
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
# Initialize libtool.
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
# Initialize maintainer mode
#AM_MAINTAINER_MODE
#
# figure debugging default, prior to $ac_help setup
#
#
#AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)
#if test `expr $MINOR_VERSION \% 2` = 1 ; then
# debug_default=yes
#else
# debug_default=partial
#fi
#AC_DIVERT_POP()
#
dnl Debugging default.
debug_default=no
#
# declare --enable-* args and collect ac_help strings
#
AC_ARG_ENABLE(g,
[ --enable-g=[yes/no] compile with symbolic debug information. [default=yes]],,
enable_g=yes)
AC_ARG_ENABLE(ccoptim,
[ --enable-ccoptim=[yes/no] compile with guessed compiler optimisation flags. [default=yes]],,
enable_ccoptim=yes)
AC_ARG_ENABLE(debug,
[ --enable-debug=[no/minimum/yes] turn on debugging. [default=$debug_default]],,
enable_debug=$debug_default)
AC_ARG_ENABLE(memory_debug,
[ --enable-memory-debug=[yes/no] turn on memory access debugging. [default=no]],,
enable_memory_debug=no)
AC_ARG_ENABLE(ansi,
[ --enable-ansi=[yes/no] turn on strict ansi. [default=no]],,
enable_ansi=no)
AC_ARG_ENABLE(missing_prototypes,
[ --enable-missing-prototypes=[yes/no] turn on missing prototype checks. [default=no]],,
enable_missing_prototypes=no)
AC_ARG_ENABLE(pthread,
[ --enable-pthread=[yes/no] turn on multi-thread support using pthread. [default=yes]],,
enable_pthread=yes)
AC_ARG_ENABLE(openmp,
[ --enable-openmp=[yes/no] turn on multi-thread support using OpenMP. [default=no]],,
enable_openmp=no)
AC_ARG_ENABLE(parallel,
[ --enable-parallel=[yes/no] turn on auto-parallelisation for Intel's icc compiler. [default=no]],,
enable_parallel=no)
AC_ARG_ENABLE(mpi,
[ --enable-mpi=[yes/no] turn on MPI support. [default=no]],,
enable_mpi=no)
AC_ARG_ENABLE(slang,
[ --enable-slang=[yes/no] use S-Lang for scripting. [default=no]],,
enable_slang=no)
AC_ARG_ENABLE(prof,
[ --enable-profile=[yes/no] turn on profiling. [default=no]],,
enable_prof=no)
AC_ARG_ENABLE(efence,
[ --enable-efence=[yes/no] use Electric Fence for memory debugging. [default=no]],,
enable_efence=no)
AC_ARG_ENABLE(padding,
[ --enable-padding=[yes/no] use memory padding for overflow detection. [default=no]],,
enable_padding=no)
AC_ARG_ENABLE(memory_chunks,
[ --enable-memory-chunks=[yes/no] use memory chunk allocation routines. [default=yes]],,
enable_memory_chunks=yes)
AC_ARG_ENABLE(num_procs,
[ --enable-num-procs=[INT] default number of processes to spawn in MP code. [default=8]],,
enable_num_procs=8)
AC_ARG_ENABLE(num_threads,
[ --enable-num-threads=[INT] default number of threads to create in threaded code. [default=4]],,
enable_num_threads=4)
AC_ARG_ENABLE(w32_subset,
[ --enable-w32-subset=[yes/no] compile a subset of GAUL for windows. [default=no]],,
enable_w32_subset=no)
AC_MSG_CHECKING(for default number of processes to spawn in MP code)
AC_DEFINE_UNQUOTED(GA_DEFAULT_NUM_PROCESSES, ${enable_num_procs}, [Default number of processes.])
AC_MSG_RESULT(${enable_num_procs})
AC_MSG_CHECKING(for default number of threads to create in threaded code)
AC_DEFINE_UNQUOTED(GA_DEFAULT_NUM_THREADS, ${enable_num_threads}, [Default number of threads.])
AC_MSG_RESULT(${enable_num_threads})
#
# Check for pthreads
#
AC_MSG_CHECKING(whether to link to pthread library)
if test "x$enable_pthread" = "xyes"; then
AC_MSG_RESULT(yes)
WILL_USE_PTHREADS="yes"
HAVE_PTHREADS=1
LIBS="$LIBS -lpthread"
AC_CHECK_LIB(pthread, pthread_create,
[LIBS="$LIBS -lpthread"],
[AC_MSG_ERROR(GAUL requires the pthread library for full functionality. Install it or configure with '--enable-pthread=no' for reduced version.)])
AC_DEFINE([HAVE_PTHREADS], 1, [Whether libpthread is installed.])
else
AC_MSG_RESULT(no)
WILL_USE_PTHREADS="no"
HAVE_PTHREADS=0
fi
#
# Check for OpenMP
#
AC_MSG_CHECKING(whether to use OpenMP)
if test "x$enable_openmp" = "xyes"; then
AC_MSG_RESULT(yes)
WILL_USE_OPENMP="yes"
USE_OPENMP=1
AC_DEFINE([USE_OPENMP], 1, [Whether OpenMP should be used.])
else
AC_MSG_RESULT(no)
WILL_USE_OPENMP="no"
USE_OPENMP=0
fi
# A sanity check.
if test "x$WILL_USE_PTHREADS" = "xyes" && test "x$WILL_USE_OPENMP" = "xyes"; then
AC_MSG_ERROR(Can not simultaneously use OpenMP and pthreads for thread-level parallelisation.)
fi
# A sanity check.
if test "x$enable_parallel" = "xyes"; then
AC_MSG_CHECKING(whether to autoparallelise code)
if test "x$CC" = "xicc"; then
AC_MSG_RESULT(yes)
else
AC_MSG_ERROR(--enable-parallel=yes can only be used with Intel's icc compiler.)
fi
fi
#
# Setup MPI compilation
#
old_LIBS=$LIBS
old_CFLAGS=$CFLAGS
AC_MSG_CHECKING(whether to use MPI)
if test "x$enable_mpi" != "xyes"; then
AC_MSG_RESULT(no)
enable_mpi=no
MPIFLAGS=""
MPILIBS=""
WILL_USE_MPI="no"
HAVE_MPI=0
result=0
else
AC_MSG_RESULT(yes)
result=1
#
# Check for MPI version.
#
if test "x$MPIFLAGS" != "x" || test "x$MPILIBS" != "x"; then
# User defined the additional LIBS and CFLAGS stuff :-).
# "-lm" used in AC_CHECK_LIB as dummy library.
LIBS="$old_LIBS $MPILIBS"
CFLAGS="$old_CFLAGS $MPIFLAGS"
AC_CHECK_LIB(m, MPI_Init,,
[AC_MSG_ERROR(Unable to compile with specified MPI implementation. Check MPIFLAGS and MPILIBS environment variables, or configure with '--enable-mpi=no' to disable MPI use.)])
else
# User didn't define the additional LIBS and CFLAGS stuff, so we must try to guess it :-(
# AC_MSG_WARN([You are advised to specify requirements of your MPI implementation via the MPIFLAGS and MPILIBS environment variables.])
# Try LAM
AC_MSG_CHECKING(for LAM-MPI)
MPIFLAGS="-D_REENTRANT"
MPILIBS="-llammpio -llamf77mpi -lmpi -llam -lutil -lpthread"
LIBS="$old_LIBS $MPILIBS"
CFLAGS="$old_CFLAGS $MPIFLAGS"
AC_CHECK_LIB(mpi, MPI_Init,, [result=0])
if test result = 0; then
AC_MSG_RESULT(no)
# Try MPICH
AC_MSG_CHECKING(for MPICH)
result=1
MPIFLAGS="-DUSE_STDARG -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STDARG_H=1 -DUSE_STDARG=1 -DMALLOC_RET_VOID=1"
MPILIBS="-lmpich"
LIBS="$old_LIBS $MPILIBS"
CFLAGS="$old_CFLAGS $MPIFLAGS"
AC_CHECK_LIB(mpich, MPI_Init,, [result=0])
if test result = 0; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
else
AC_MSG_RESULT(yes)
fi
fi
if test ${result} = 0; then
WILL_USE_MPI="no"
HAVE_MPI=0
AC_MSG_ERROR(Unable to locate an installed MPI implementation. Manually set the MPIFLAGS and MPILIBS environment variables, or configure with '--enable-mpi=no' to disable MPI use.)
else
WILL_USE_MPI="yes"
HAVE_MPI=1
fi
fi
if test x$HAVE_MPI = x1
then
AC_DEFINE([HAVE_MPI], 1, [Whether to use MPI for parallel code.])
fi
# Reset CFLAGS and LIBS variables.
LIBS=$old_LIBS
CFLAGS=$old_CFLAGS
AC_MSG_CHECKING(whether to disable memory chunk allocation)
if test "x$enable_memory_chunks" = "xyes"; then
AC_MSG_RESULT(no)
MEMORY_CHUNKS_MIMIC=0
else
AC_MSG_RESULT(yes)
MEMORY_CHUNKS_MIMIC=1
AC_DEFINE( MEMORY_CHUNKS_MIMIC, 1, [Define to disable memory chunk allocation routines.])
fi
AC_MSG_CHECKING(whether to enable memory access debugging)
if test "x$enable_memory_debug" = "xyes"; then
AC_MSG_RESULT(yes - full profiling)
MEMORY_ALLOC_DEBUG=1
MEMORY_ALLOC_SAFE=0
AC_DEFINE([MEMORY_ALLOC_DEBUG], 1, [Whether to use debugging memory allocation routines.])
else
AC_MSG_RESULT(no - safe wrappers only)
MEMORY_ALLOC_DEBUG=0
MEMORY_ALLOC_SAFE=1
AC_DEFINE([MEMORY_ALLOC_SAFE], 1, [Whether to use safe memory allocation routines.])
fi
AC_MSG_CHECKING(whether to enable dumping of statistics)
if test "x$enable_stats" = "xyes"; then
AC_MSG_RESULT(yes)
result=1
else
AC_MSG_RESULT(no)
result=0
fi
AC_DEFINE_UNQUOTED(GA_WRITE_STATS, ${result}, [Whether to dump certian statistics.])
AC_MSG_CHECKING(whether to enable general GAUL debugging)
if test "x$enable_debug" = "xyes"; then
AC_MSG_RESULT(yes)
debug=2
else
if test "x$enable_debug" = "xno"; then
AC_MSG_RESULT(no)
debug=0
else
AC_MSG_RESULT(partial)
debug=1
fi
fi
AC_DEFINE_UNQUOTED( DEBUG, ${debug}, [Overall debugging level.])
AC_DEFINE_UNQUOTED( GA_DEBUG, ${debug}, [Core GAUL debugging level.])
#
# Whether to pad memory to detect overflows
#
AC_MSG_CHECKING(whether to pad memory to detect overflows)
if test "x$enable_padding" = "xyes"; then
AC_MSG_RESULT(yes)
AC_DEFINE([MEMORY_PADDING], 1, [Whether to pad memory.] )
else
AC_MSG_RESULT(no)
fi
#
# Whether we need to cripple GAUL so that it works with windows.
# This is always the case if MingW is being used.
#
AC_MSG_CHECKING(whether to cripple GAUL for windows)
case $target in
*-*-mingw*) enable_w32_subset="yes" ;;
esac
if test "x$enable_w32_subset" = "xyes"; then
AC_MSG_RESULT(yes)
AC_MSG_WARN([GAUL is crippled when compiled for windows. Please consider upgrading to a proper operating system.])
W32_CRIPPLED=1
AC_DEFINE([W32_CRIPPLED], 1, [Whether to cripple GAUL so it works on windows.])
else
AC_MSG_RESULT(no)
W32_CRIPPLED=0
fi
#
# Check for libm
#
AC_CHECK_LIB([m], [sqrt],
[ LIBS="-lm $LIBS" ])
#
# Check for S-Lang.
#
AC_MSG_CHECKING(whether to link S-Lang scripting engine)
if test "x$enable_slang" = "xyes"; then
AC_MSG_RESULT(yes)
WILL_USE_SLANG="yes"
HAVE_SLANG=1
LIBS="$LIBS -lslang -lm"
INCLUDES="$INCLUDES -I/usr/include/slang/" # FIXME: Need to detect slang.h location properly.
AC_CHECK_LIB(slang, SLang_init_slang,
[LIBS="$LIBS -lslang"],
[AC_MSG_ERROR(GAUL requires the S-Lang library for full functionality. see http://space.mit.edu/pub/davis/slang/ Or configure with '--enable-slang=no' for reduced version.)])
AC_DEFINE([HAVE_SLANG], 1, [Whether S-Lang is installed.])
else
AC_MSG_RESULT(no)
WILL_USE_SLANG="no"
HAVE_SLANG=0
fi
#
# Electric Fence has to be last library linked.
#
AC_MSG_CHECKING(whether to link Electric Fence for memory debugging)
if test "x$enable_efence" = "xyes"; then
AC_MSG_RESULT(yes)
AC_CHECK_LIB(efence, malloc, [LIBS="$LIBS -lefence"], [AC_MSG_ERROR(Unable to detect working Electric Fence installation)])
else
AC_MSG_RESULT(no)
fi
#
# USE_CHROMO_CHUNKS=1 produces a significant performance boost in many typical cases with the GNU gcc
# compiler, but a slight performance penalty with the Intel C/C++ compiler.
#
USE_CHROMO_CHUNKS=0
if test "xUSE_CHROMO_CHUNKS" = x1
then
AC_DEFINE([USE_CHROMO_CHUNKS], 1, [Whether to use memory chunk handling for chromosomes.])
fi
GA_NUM_PROCESSES_ENVVAR_STRING='"GA_NUM_PROCESSES"'
AC_DEFINE_UNQUOTED(GA_NUM_PROCESSES_ENVVAR_STRING, ${GA_NUM_PROCESSES_ENVVAR_STRING}, [Environment variable used to request processes.])
GA_NUM_THREADS_ENVVAR_STRING='"GA_NUM_THREADS"'
AC_DEFINE_UNQUOTED(GA_NUM_THREADS_ENVVAR_STRING, ${GA_NUM_THREADS_ENVVAR_STRING}, [Environment variable used to request threads.])
AC_SUBST(GA_MAJOR_VERSION)
AC_SUBST(GA_MINOR_VERSION)
AC_SUBST(GA_LT_MINOR_VERSION)
AC_SUBST(GA_PATCH_VERSION)
AC_SUBST(GA_VERSION)
AC_SUBST(GA_VERSION_STRING)
AC_SUBST(MPIFLAGS)
AC_SUBST(MPILIBS)
AC_SUBST(GA_UNAME_STRING)
AC_SUBST(GA_BUILD_DATE_STRING)
AC_SUBST(GA_NUM_PROCESSES_ENVVAR_STRING)
#
# Compiler specific switches.
#
if test "x$enable_ccoptim" = "xyes"; then
changequote(,)dnl
case $CC in
gcc)
# Optimisations etc. for the GNU gcc compiler.
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
if test "x$enable_g" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-g[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -g" ;;
esac
case " $CFLAGS " in
*[\ \ ]-O2[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -O2" ;;
esac
else
case " $CFLAGS " in
*[\ \ ]-O3[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -O3" ;;
esac
fi
if test "x$enable_prof" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-pg[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -pg" ;;
esac
fi
if test "x$enable_missing_prototypes" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-Wmissing-prototypes[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
esac
fi
if test "x$enable_ansi" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-ansi[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -ansi" ;;
esac
case " $CFLAGS " in
*[\ \ ]-pedantic[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -pedantic" ;;
esac
fi
;;
icc)
# Optimisations etc. for the Intel C++ compiler.
case " $CFLAGS " in
*[\ \ ]-w1[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -w2" ;;
esac
if test "x$enable_g" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-g[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -g" ;;
esac
case " $CFLAGS " in
*[\ \ ]-O2[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -O2" ;;
esac
else
case " $CFLAGS " in
*[\ \ ]-O3[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -O3" ;;
esac
fi
case " $CFLAGS " in
*[\ \ ]-ipo[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -ipo -ipo_obj" ;;
esac
if test "x$enable_openmp" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-openmp[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -openmp -openmp_report2" ;;
esac
fi
if test "x$enable_parallel" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-parallel[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -parallel -parthreshold50 -par_report3" ;;
esac
fi
if test "x$enable_prof" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-qp[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -qp" ;;
esac
fi
if test "x$enable_ansi" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-ansi[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -ansi" ;;
esac
fi
;;
ccc)
# Kludges etc. for the Compaq C Compiler
if test "x$enable_g" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-g[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -g3" ;;
esac
else
case " $CFLAGS " in
*[\ \ ]-O3[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -O3" ;;
esac
fi
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
case " $CFLAGS " in
*[\ \ ]-misalign[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -misalign" ;;
esac
;;
pgcc)
# The Portland Group C compiler.
# Note: Should consider use of -tp flags to specify processor type.
# I should also consider investigating the pgcc profiling options.
if test "x$enable_g" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-g[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -g" ;;
esac
else
case " $CFLAGS " in
*[\ \ ]-fast[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -fast" ;;
esac
fi
case " $CFLAGS " in
*[\ \ ]-Xa[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Xa" ;;
esac
;;
*)
# Could be any compiler!
# Kludges etc. for the Sun C Compiler.
if test "x$CC" = "xcc"; then
if test "x$target" = "xsparc-sun-solaris2.8"; then
if test "x$enable_ansi" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-ansi[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -ansi" ;;
esac
fi
fi
fi
;;
esac
changequote([,])dnl
fi
#
# Check type sizes.
#
AC_CHECK_SIZEOF(double, 4)
AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(void *, 4)
#
# Stuff.
#
AC_C_CONST
AC_STRUCT_TM
#
# Checks for header files.
#
AC_HEADER_STDC
AC_HEADER_TIME
AC_CHECK_HEADERS(pwd.h \
sys/select.h sys/signal.h \
sys/time.h sys/types.h sys/wait.h \
limits.h unistd.h \
string.h strings.h)
#
# Check for some library functions which, if missing, we have replacements for.
# NB/ Some further functions are checked below.
#
AC_CHECK_FUNCS(gethostname \
waitpid snooze \
memcpy memcmp \
min max \
index \
sincos \
strchr strcmp strcpy strpbrk strsep \
strcasecmp strncasecmp \
strdup strndup )
AC_CHECK_FUNCS(bcopy bcmp strlen strncmp strncpy memset usleep)
#
# Some dodgy work-arounds.
# Most of this is a bit kludgy. Proper fixes would be desirable...
#
# Fix defines for case that the Sun Forte C compiler is being used on Solaris.
if test "x$CC" = "xcc"; then
# Compiler is possibly Sun's Forte C, so check platform.
if test "x$target" = "xsparc-sun-solaris2.7"; then
AC_DEFINE( SUN_FORTE_C, 2.7, [Define if using Sun's Forte C Compiler] )
AC_DEFINE( HAVE_BCOPY,1,[Whether bcopy() is available] ) # Big problems!!!
AC_DEFINE( HAVE_BCMP,1,[Whether bcmp() is available] )
AC_DEFINE( HAVE_STRLEN,1,[Whether strlen() is available] )
AC_DEFINE( HAVE_STRNCMP,1,[Whether strncmp() is available] )
AC_DEFINE( HAVE_STRNCPY,1,[Whether strncpy() is available] )
AC_DEFINE( HAVE_MEMSET,1,[Whether memset() is available] )
AC_DEFINE( HAVE_USLEEP,1,[Whether usleep() is available] )
elif test "x$target" = "xsparc-sun-solaris2.8"; then
AC_DEFINE( SUN_FORTE_C, 2.8, [Define if using Sun's Forte C Compiler] )
else
AC_DEFINE( SUN_FORTE_C, 0, [Define if using Sun's Forte C Compiler] )
fi
else
# Don't recognise compiler as possibly being Sun's Forte C.
AC_DEFINE( SUN_FORTE_C, 0, [Define if using Sun's Forte C Compiler] )
fi
#
# Some processor specific stuff.
#
AC_MSG_CHECKING(whether to apply processor specific optimisations)
if test "x$enable_ccoptim" = "xyes"; then
case "$target" in
i586-*-*)
AC_MSG_RESULT(yes - i586)
case "$CC" in
icc)
case " $CFLAGS " in
*[\ \ ]-tpp[1-9\ \ ]*) ;;
# -axK
*) CFLAGS="$CFLAGS -tpp6" ;;
esac
;;
gcc)
case " $CFLAGS " in
*[\ \ ]-mcpu=*) ;;
*) CFLAGS="$CFLAGS -mcpu=pentium" ;;
esac
;;
esac
;;
i686-*-*)
AC_MSG_RESULT(yes - i686)
case "$CC" in
icc)
case " $CFLAGS " in
*[\ \ ]-tpp[1-9\ \ ]*) ;;
# -axW
*) CFLAGS="$CFLAGS -tpp7" ;;
esac
;;
gcc)
case " $CFLAGS " in
*[\ \ ]-mcpu=*) ;;
*) CFLAGS="$CFLAGS -mcpu=pentiumpro" ;;
esac
;;
esac
;;
*)
AC_MSG_RESULT(no - none defined for ${target})
;;
esac
else
AC_MSG_RESULT(no disabled)
fi
dnl GAUL_MEMORY_ALIGN_SIZE
dnl Determine memory alignment characteristics.
AC_MSG_CHECKING(memory alignment)
AC_CACHE_VAL(MEMORY_ALIGN_SIZE,
[AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf(f, "%d\n", (unsigned int) sizeof(long)>sizeof(void *)?sizeof(long):sizeof(void *));
exit(0);
}
], MEM_ALIGN_SIZE=`cat conftestval`, MEM_ALIGN_SIZE=4, MEM_ALIGN_SIZE=8)])
AC_MSG_RESULT(${MEM_ALIGN_SIZE})
AC_DEFINE_UNQUOTED(MEMORY_ALIGN_SIZE, ${MEM_ALIGN_SIZE}, [Memory alignment boundry characteristics.])
dnl GAUL_GNUMAKE_WARN
dnl Produce warning message if non-GNU make is detected.
temp=`make -version -f \dev\null 2>&1 | grep GNU`
if test "x$temp" = "x"; then
AC_MSG_WARN([You are advised to use GNU Make when compiling GAUL])
fi
dnl GAUL_DETECT_BOOL
dnl Determine native boolean stuff.
dnl 1) Check whether stdbool.h defines bool and true/false correctly.
dnl 2) Check whether compiler has built-in _Bool type.
AC_CACHE_CHECK([for working stdbool.h],
gaul_header_stdbool_h,
[AC_TRY_COMPILE([#include <stdbool.h>],
[bool blah = false;],
gaul_header_stdbool_h="yes", gaul_header_stdbool_h="no")])
if test "x$gaul_header_stdbool_h" = "xyes"; then
AC_DEFINE(HAVE_STDBOOL_H, 1, [Define if you have a working <stdbool.h> header file.])
fi
AC_CACHE_CHECK([for built-in _Bool type],
gaul__bool,
[AC_TRY_COMPILE(,
[_Bool blah = (_Bool)0;],
gaul__bool="yes", gaul__bool="no")])
if test "x$gaul__bool" = "xno" && test "x$gaul_header_stdbool_h" = "xyes"; then
AC_TRY_COMPILE([#include <stdbool.h>],
[_Bool blah = (_Bool)0;],
gaul__bool="yes", gaul__bool="no")
fi
if test "x$gaul__bool" = "xyes"; then
AC_DEFINE(HAVE__BOOL, 1, [Define if compiler has built-in _Bool type.])
fi
# Where the linker must look!
CFLAGS="$CFLAGS $INCLUDES"
#LIBS="$LIBS"
#LIBS="$LIBS $MPILIBS"
#
# Add code to config.status to generate a platform dependent configuration
# file for installation.
#
AC_OUTPUT_COMMANDS([
if ( test -n "$CONFIG_FILES" && test -n "$CONFIG_HEADERS" ); then
# If both these vars are non-empty, then config.status wasn't run by
# automake rules (which always set one or the other to empty).
CONFIG_OTHER=${CONFIG_OTHER-util/gaul/gaul_config.h}
fi
case "$CONFIG_OTHER" in
*util/gaul/gaul_config.h*)
outfile=util/gaul/gaul_config.h
stampfile=util/gaul/stamp-gaul_config
tmpfile=${outfile}.tmp
dirname="sed s,^.*/,,g"
echo creating $outfile
cat > $tmpfile << _EOF_
/********************************************************************
*
* DO NOT EDIT THIS FILE! It was automatically generated from:
* configure.in and `echo $outfile|$dirname`.in
* on host: `(hostname || uname -n) 2>/dev/null | sed 1q`
*
********************************************************************/
#ifndef GAUL_CONFIG_H_INCLUDED
#define GAUL_CONFIG_H_INCLUDED
_EOF_
cat ${srcdir}/${outfile}.in >> $tmpfile
echo "/* $outfile.in */" >> $tmpfile
# Add the code to include these headers only if autoconf has
# shown them to be present.
if test x$ac_cv_header_pwd_h = xyes; then
echo '#include <pwd.h>' >> $tmpfile
fi
if test x$ac_cv_header_sys_select_h = xyes; then
echo '#include <sys/select.h>' >> $tmpfile
fi
if test x$ac_cv_header_sys_signal_h = xyes; then
echo '#include <sys/signal.h>' >> $tmpfile
fi
if test x$ac_cv_header_sys_time_h = xyes; then
echo '#include <sys/time.h>' >> $tmpfile
fi
if test x$ac_cv_header_sys_types_h = xyes; then
echo '#include <sys/types.h>' >> $tmpfile
fi
if test x$ac_cv_header_sys_wait_h = xyes; then
echo '#include <sys/wait.h>' >> $tmpfile
fi
if test x$ac_cv_header_limits_h = xyes; then
echo '#include <limits.h>' >> $tmpfile
fi
if test x$ac_cv_header_unistd_h = xyes; then
echo '#include <unistd.h>' >> $tmpfile
fi
if test x$ac_cv_header_string_h = xyes; then
echo '#include <string.h>' >> $tmpfile
elif test x$ac_cv_header_strings_h = xyes; then
echo '#include <strings.h>' >> $tmpfile
fi
cat >> $tmpfile << _EOF_
#ifndef errno
/* Some sytems #define this! */
extern int errno;
#endif
_EOF_
if test "x$gaul_header_stdbool_h" = "xyes"; then
echo '#define HAVE_STDBOOL_H 1' >> $tmpfile
fi
if test "x$gaul__bool" = "xyes"; then
echo '#define HAVE__BOOL 1' >> $tmpfile
fi
cat >> $tmpfile << _EOF_
/*
* Explicitly tested functions for this platform:
*/
_EOF_
if test "x$ac_cv_func_memcpy" = "xyes"; then
echo '#define HAVE_MEMCPY 1' >> $tmpfile
else
echo '/* #undef HAVE_MEMCPY */' >> $tmpfile
fi
if test "x$ac_cv_func_min" = "xyes"; then
echo '#define HAVE_MIN 1' >> $tmpfile
else
echo '/* #undef HAVE_MIN */' >> $tmpfile
fi
if test "x$ac_cv_func_max" = "xyes"; then
echo '#define HAVE_MAX 1' >> $tmpfile
else
echo '/* #undef HAVE_MAX */' >> $tmpfile
fi
if test "x$ac_cv_func_sincos" = "xyes"; then
echo '#define HAVE_SINCOS 1' >> $tmpfile
else
echo '/* #undef HAVE_SINCOS */' >> $tmpfile
fi
if test "x$ac_cv_func_strdup" = "xyes"; then
echo '#define HAVE_STRDUP 1' >> $tmpfile
else
echo '/* #undef HAVE_STRDUP */' >> $tmpfile
fi
if test "x$ac_cv_func_strndup" = "xyes"; then
echo '#define HAVE_STRNDUP 1' >> $tmpfile
else
echo '/* #undef HAVE_STRNDUP */' >> $tmpfile
fi
if test "x$ac_cv_func_strcpy" = "xyes"; then
echo '#define HAVE_STRCPY 1' >> $tmpfile
else
echo '/* #undef HAVE_STRCPY */' >> $tmpfile
fi
if test "x$ac_cv_func_strncpy" = "xyes"; then
echo '#define HAVE_STRNCPY 1' >> $tmpfile
else
echo '/* #undef HAVE_STRNCPY */' >> $tmpfile
fi
if test "x$ac_cv_func_strcmp" = "xyes"; then
echo '#define HAVE_STRCMP 1' >> $tmpfile
else
echo '/* #undef HAVE_STRCMP */' >> $tmpfile
fi
if test "x$ac_cv_func_strncmp" = "xyes"; then
echo '#define HAVE_STRNCMP 1' >> $tmpfile
else
echo '/* #undef HAVE_STRNCMP */' >> $tmpfile
fi
if test "x$ac_cv_func_strlen" = "xyes"; then
echo '#define HAVE_STRLEN 1' >> $tmpfile
else
echo '/* #undef HAVE_STRLEN */' >> $tmpfile
fi
if test "x$ac_cv_func_strpbrk" = "xyes"; then
echo '#define HAVE_STRPBRK 1' >> $tmpfile
else
echo '/* #undef HAVE_STRPBRK */' >> $tmpfile
fi
if test "x$ac_cv_func_strsep" = "xyes"; then
echo '#define HAVE_STRSEP 1' >> $tmpfile
else
echo '/* #undef HAVE_STRSEP */' >> $tmpfile
fi
if test "x$ac_cv_func_strcasecmp" = "xyes"; then
echo '#define HAVE_STRCASECMP 1' >> $tmpfile
else
echo '/* #undef HAVE_STRCASECMP */' >> $tmpfile
fi
if test "x$ac_cv_func_strncasecmp" = "xyes"; then
echo '#define HAVE_STRNCASECMP 1' >> $tmpfile
else
echo '/* #undef HAVE_STRNCASECMP */' >> $tmpfile
fi
if test "x$ac_cv_func_usleep" = "xyes"; then
echo '#define HAVE_USLEEP 1' >> $tmpfile
else
echo '/* #undef HAVE_USLEEP */' >> $tmpfile
fi
if test "x$ac_cv_func_snooze" = "xyes"; then
echo '#define HAVE_SNOOZE 1' >> $tmpfile
else
echo '/* #undef HAVE_SNOOZE */' >> $tmpfile
fi
if test "x$ac_cv_func_index" = "xyes"; then
echo '#define HAVE_INDEX 1' >> $tmpfile