forked from pmodels/mpich
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autogen.sh
executable file
·1132 lines (993 loc) · 36 KB
/
autogen.sh
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
#! /bin/sh
##
## Copyright (C) by Argonne National Laboratory
## See COPYRIGHT in top-level directory
##
# Update all of the derived files
# For best performance, execute this in the top-level directory.
# There are some experimental features to allow it to be executed in
# subdirectories
#
# Eventually, we want to allow this script to be executed anywhere in the
# mpich tree. This is not yet implemented.
########################################################################
## Utility functions
########################################################################
recreate_tmp() {
rm -rf .tmp
mkdir .tmp 2>&1 >/dev/null
}
warn() {
echo "===> WARNING: $@"
}
error() {
echo "===> ERROR: $@"
}
echo_n() {
# "echo -n" isn't portable, must portably implement with printf
printf "%s" "$*"
}
# Assume Program's install-dir is <install-dir>/bin/<prog>.
# Given program name as the 1st argument,
# the install-dir is returned is returned in 2nd argument.
# e.g., ProgHomeDir libtoolize libtooldir.
ProgHomeDir() {
prog=$1
progpath="`which $prog`"
progbindir="`dirname $progpath`"
proghome=`(cd $progbindir/.. && pwd)`
eval $2=$proghome
}
# checking and patching submodules
check_submodule_presence() {
if test ! -f "$SRCROOTDIR/$1/configure.ac"; then
error "Submodule $1 is not checked out"
exit 1
fi
}
sync_external () {
srcdir=$1
destdir=$2
echo "syncing '$srcdir' --> '$destdir'"
# deletion prevents creating 'confdb/confdb' situation, also cleans
# stray files that may have crept in somehow
rm -rf "$destdir"
cp -pPR "$srcdir" "$destdir"
}
########################################################################
echo
echo "####################################"
echo "## Checking user environment"
echo "####################################"
echo
########################################################################
## Checks to make sure we are running from the correct location
########################################################################
echo_n "Verifying the location of autogen.sh... "
if [ ! -d maint -o ! -s maint/version.m4 ] ; then
echo "must execute at top level directory for now"
exit 1
fi
# Set the SRCROOTDIR to be used later and avoid "cd ../../"-like usage.
SRCROOTDIR=$PWD
echo "done"
########################################################################
## Initialize variables to default values (possibly from the environment)
########################################################################
# Default choices
do_bindings=yes
do_geterrmsgs=yes
do_getcvars=yes
do_f77=yes
do_build_configure=yes
do_genstates=no
do_atdir_check=no
do_atver_check=yes
do_subcfg_m4=yes
do_izem=yes
do_ofi=yes
do_ucx=yes
do_json=yes
do_yaksa=yes
export do_build_configure
# Allow MAKE to be set from the environment
MAKE=${MAKE-make}
# amdirs are the directories that make use of autoreconf
amdirs=". src/mpl"
autoreconf_args="-if"
export autoreconf_args
########################################################################
## Read the command-line arguments
########################################################################
# List of steps that we will consider (We do not include depend
# because the values for depend are not just yes/no)
AllSteps="geterrmsgs bindings f77 build_configure genstates getparms"
stepsCleared=no
for arg in "$@" ; do
case $arg in
-echo)
set -x
;;
-atdircheck=*)
val=`echo X$arg | sed -e 's/^X-atdircheck=//'`
case $val in
yes|YES|true|TRUE|1) do_atdir_check=yes ;;
no|NO|false|FALSE|0) do_atdir_check=no ;;
*) warn "unknown option: $arg."
esac
;;
-atvercheck=*)
val=`echo X$arg | sed -e 's/^X-atvercheck=//'`
case $val in
yes|YES|true|TRUE|1) do_atver_check=yes ;;
no|NO|false|FALSE|0) do_atver_check=no ;;
*) warn "unknown option: $arg."
esac
;;
-do=*|--do=*)
opt=`echo A$arg | sed -e 's/^A--*do=//'`
case $opt in
build-configure|configure) opt=build_configure ;;
esac
var=do_$opt
# Check that this opt is known
eval oldval=\$"$var"
if [ -z "$oldval" ] ; then
echo "-do=$opt is unrecognized"
exit 1
else
if [ $stepsCleared = no ] ; then
for step in $AllSteps ; do
var=do_$step
eval $var=no
done
stepsCleared=yes
fi
var=do_$opt
eval $var=yes
fi
;;
-verbose-autoreconf|--verbose-autoreconf)
autoreconf_args="-vif"
export autoreconf_args
;;
-with-genstates|--with-genstates)
do_genstates=yes
;;
-without-genstates|--without-genstates)
do_genstates=no
;;
-with-errmsgs|--with-errmsgs)
do_geterrmsgs=yes
;;
-without-errmsgs|--without-errmsgs)
do_geterrmsgs=no
;;
-with-bindings|--with-bindings)
do_bindings=yes
;;
-without-bindings|--without-bindings)
do_bindings=no
;;
-with-f77|--with-f77)
do_f77=yes
;;
-without-f77|--without-f77)
do_f77=no
;;
-with-autotools=*|--with-autotools=*)
autotoolsdir=`echo "A$arg" | sed -e 's/.*=//'`
;;
-without-izem|--without-izem)
do_izem=no
;;
-without-ofi|--without-ofi|-without-libfabric|--without-libfabric)
do_ofi=no
;;
-without-ucx|--without-ucx)
do_ucx=no
;;
-without-json|--without-json)
do_json=no
;;
-help|--help|-usage|--usage)
cat <<EOF
./autogen.sh [ --with-autotools=dir ] \\
[ -atdircheck=[yes|no] ] \\
[ -atvercheck=[yes|no] ] \\
[ --verbose-autoreconf ] \\
[ --do=stepname ] [ -distrib ]
Update the files in the MPICH build tree. This file builds the
configure files, creates the Makefile.in files, extracts the error
messages.
You can use --with-autotools=dir to specify a directory that
contains alternate autotools.
-atdircheck=[yes|no] specifies the enforcement of all autotools
should be installed in the same directory.
-atvercheck=[yes|no] specifies if the check for the version of
autotools should be carried out.
-distrib creates a distribution version of the Makefile.in files (no
targets for updating the Makefile.in from Makefile.sm or rebuilding the
autotools targets). This does not create the configure files because
some of those depend on rules in the Makefile.in in that directory.
Thus, to build all of the files for a distribution, run autogen.sh
twice, as in
autogen.sh && autogen.sh -distrib
Use --do=stepname to update only a single step. For example,
--do=build_configure only updates the configure scripts. The available
steps are:
EOF
for step in $AllSteps ; do
echo " $step"
done
exit 1
;;
*)
echo "unknown argument $arg"
exit 1
;;
esac
done
########################################################################
## Check for the location of autotools
########################################################################
if [ -n "$autotoolsdir" ] ; then
if [ -x $autotoolsdir/autoconf -a -x $autotoolsdir/autoheader ] ; then
autoconf=$autotoolsdir/autoconf
autoheader=$autotoolsdir/autoheader
autoreconf=$autotoolsdir/autoreconf
automake=$autotoolsdir/automake
autom4te=$autotoolsdir/autom4te
aclocal=$autotoolsdir/aclocal
if [ -x "$autotoolsdir/glibtoolize" ] ; then
libtoolize=$autotoolsdir/glibtoolize
else
libtoolize=$autotoolsdir/libtoolize
fi
AUTOCONF=$autoconf
AUTOHEADER=$autoheader
AUTORECONF=$autoreconf
AUTOMAKE=$automake
AUTOM4TE=$autom4te
ACLOCAL=$aclocal
LIBTOOLIZE=$libtoolize
export AUTOCONF
export AUTOHEADER
export AUTORECONF
export AUTOM4TE
export AUTOMAKE
export ACLOCAL
export LIBTOOLIZE
else
echo "could not find executable autoconf and autoheader in $autotoolsdir"
exit 1
fi
else
autoconf=${AUTOCONF:-autoconf}
autoheader=${AUTOHEADER:-autoheader}
autoreconf=${AUTORECONF:-autoreconf}
autom4te=${AUTOM4TE:-autom4te}
automake=${AUTOMAKE:-automake}
aclocal=${ACLOCAL:-aclocal}
if test -z "${LIBTOOLIZE+set}" && ( glibtoolize --version ) >/dev/null 2>&1 ; then
libtoolize=glibtoolize
else
libtoolize=${LIBTOOLIZE:-libtoolize}
fi
fi
ProgHomeDir $autoconf autoconfdir
ProgHomeDir $automake automakedir
ProgHomeDir $libtoolize libtooldir
echo_n "Checking if autotools are in the same location... "
if [ "$autoconfdir" = "$automakedir" -a "$autoconfdir" = "$libtooldir" ] ; then
same_atdir=yes
echo "yes, all in $autoconfdir"
else
same_atdir=no
echo "no"
echo " autoconf is in $autoconfdir"
echo " automake is in $automakedir"
echo " libtool is in $libtooldir"
# Emit a big warning message if $same_atdir = no.
warn "Autotools are in different locations. In rare occasion,"
warn "resulting configure or makefile may fail in some unexpected ways."
fi
########################################################################
## Check if autoreconf can be patched to work
## when autotools are not in the same location.
## This test needs to be done before individual tests of autotools
########################################################################
# If autotools are not in the same location, override autoreconf appropriately.
if [ "$same_atdir" != "yes" ] ; then
if [ -z "$libtooldir" ] ; then
ProgHomeDir $libtoolize libtooldir
fi
libtoolm4dir="$libtooldir/share/aclocal"
echo_n "Checking if $autoreconf accepts -I $libtoolm4dir... "
new_autoreconf_works=no
if [ -d "$libtoolm4dir" -a -f "$libtoolm4dir/libtool.m4" ] ; then
recreate_tmp
cat >.tmp/configure.ac <<_EOF
AC_INIT(foo,1.0)
AC_PROG_LIBTOOL
AC_OUTPUT
_EOF
AUTORECONF="$autoreconf -I $libtoolm4dir"
if (cd .tmp && $AUTORECONF -ivf >/dev/null 2>&1) ; then
new_autoreconf_works=yes
fi
rm -rf .tmp
fi
echo "$new_autoreconf_works"
# If autoreconf accepts -I <libtool's m4 dir> correctly, use -I.
# If not, run libtoolize before autoreconf (i.e. for autoconf <= 2.63)
# This test is more general than checking the autoconf version.
if [ "$new_autoreconf_works" != "yes" ] ; then
echo_n "Checking if $autoreconf works after an additional $libtoolize step... "
new_autoreconf_works=no
recreate_tmp
# Need AC_CONFIG_
cat >.tmp/configure.ac <<_EOF
AC_INIT(foo,1.0)
AC_CONFIG_AUX_DIR([m4])
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_LIBTOOL
AC_OUTPUT
_EOF
cat >.tmp/Makefile.am <<_EOF
ACLOCAL_AMFLAGS = -I m4
_EOF
AUTORECONF="eval $libtoolize && $autoreconf"
if (cd .tmp && $AUTORECONF -ivf >u.txt 2>&1) ; then
new_autoreconf_works=yes
fi
rm -rf .tmp
echo "$new_autoreconf_works"
fi
if [ "$new_autoreconf_works" = "yes" ] ; then
export AUTORECONF
autoreconf="$AUTORECONF"
else
# Since all autoreconf workarounds do not work, we need
# to require all autotools to be in the same directory.
do_atdir_check=yes
error "Since none of the autoreconf workaround works"
error "and autotools are not in the same directory, aborting..."
error "Updating autotools or putting all autotools in the same location"
error "may resolve the issue."
exit 1
fi
fi
########################################################################
## Verify autoconf version
########################################################################
echo_n "Checking for autoconf version... "
recreate_tmp
ver=2.67
# petsc.mcs.anl.gov's /usr/bin/autoreconf is version 2.65 which returns OK
# if configure.ac has AC_PREREQ() withOUT AC_INIT.
#
# ~/> hostname
# petsc
# ~> /usr/bin/autoconf --version
# autoconf (GNU Autoconf) 2.65
# ....
# ~/> cat configure.ac
# AC_PREREQ(2.68)
# ~/> /usr/bin/autoconf ; echo "rc=$?"
# configure.ac:1: error: Autoconf version 2.68 or higher is required
# configure.ac:1: the top level
# autom4te: /usr/bin/m4 failed with exit status: 63
# rc=63
# ~/> /usr/bin/autoreconf ; echo "rc=$?"
# rc=0
cat > .tmp/configure.ac<<EOF
AC_INIT
AC_PREREQ($ver)
AC_OUTPUT
EOF
if (cd .tmp && $autoreconf $autoreconf_args >/dev/null 2>&1 ) ; then
echo ">= $ver"
else
echo "bad autoconf installation"
cat <<EOF
You either do not have autoconf in your path or it is too old (version
$ver or higher required). You may be able to use
autoconf --version
Unfortunately, there is no standard format for the version output and
it changes between autotools versions. In addition, some versions of
autoconf choose among many versions and provide incorrect output).
EOF
exit 1
fi
########################################################################
## Verify automake version
########################################################################
echo_n "Checking for automake version... "
recreate_tmp
ver=1.15
cat > .tmp/configure.ac<<EOF
AC_INIT(testver,1.0)
AC_CONFIG_AUX_DIR([m4])
AC_CONFIG_MACRO_DIR([m4])
m4_ifdef([AM_INIT_AUTOMAKE],,[m4_fatal([AM_INIT_AUTOMAKE not defined])])
AM_INIT_AUTOMAKE([$ver foreign])
AC_MSG_RESULT([A message])
AC_OUTPUT([Makefile])
EOF
cat <<EOF >.tmp/Makefile.am
ACLOCAL_AMFLAGS = -I m4
EOF
if [ ! -d .tmp/m4 ] ; then mkdir .tmp/m4 >/dev/null 2>&1 ; fi
if (cd .tmp && $autoreconf $autoreconf_args >/dev/null 2>&1 ) ; then
echo ">= $ver"
else
echo "bad automake installation"
cat <<EOF
You either do not have automake in your path or it is too old (version
$ver or higher required). You may be able to use
automake --version
Unfortunately, there is no standard format for the version output and
it changes between autotools versions. In addition, some versions of
autoconf choose among many versions and provide incorrect output).
EOF
exit 1
fi
########################################################################
## Verify libtool version
########################################################################
echo_n "Checking for libtool version... "
recreate_tmp
ver=2.4.4
cat <<EOF >.tmp/configure.ac
AC_INIT(testver,1.0)
AC_CONFIG_AUX_DIR([m4])
AC_CONFIG_MACRO_DIR([m4])
m4_ifdef([LT_PREREQ],,[m4_fatal([LT_PREREQ not defined])])
LT_PREREQ($ver)
LT_INIT()
AC_MSG_RESULT([A message])
EOF
cat <<EOF >.tmp/Makefile.am
ACLOCAL_AMFLAGS = -I m4
EOF
if [ ! -d .tmp/m4 ] ; then mkdir .tmp/m4 >/dev/null 2>&1 ; fi
if (cd .tmp && $autoreconf $autoreconf_args >/dev/null 2>&1 ) ; then
echo ">= $ver"
else
echo "bad libtool installation"
cat <<EOF
You either do not have libtool in your path or it is too old
(version $ver or higher required). You may be able to use
libtool --version
Unfortunately, there is no standard format for the version output and
it changes between autotools versions. In addition, some versions of
autoconf choose among many versions and provide incorrect output).
EOF
exit 1
fi
########################################################################
## Checking for bash
########################################################################
echo_n "Checking for bash... "
if test "`which bash 2>&1 > /dev/null ; echo $?`" = "0" ;then
echo "done"
else
echo "bash not found" ;
exit 1;
fi
########################################################################
## Checking for UNIX find
########################################################################
echo_n "Checking for UNIX find... "
find ./maint -name 'configure.ac' > /dev/null 2>&1
if [ $? = 0 ] ; then
echo "done"
else
echo "not found (error)"
exit 1
fi
########################################################################
## Checking for UNIX patch
########################################################################
echo_n "Checking for UNIX patch... "
patch -v > /dev/null 2>&1
if [ $? = 0 ] ; then
echo "done"
else
echo "not found (error)"
exit 1
fi
########################################################################
## Checking if xargs rm -rf works
########################################################################
echo_n "Checking if xargs rm -rf works... "
if [ -d "`find ./maint -name __random_dir__`" ] ; then
error "found a directory named __random_dir__"
exit 1
else
mkdir ./maint/__random_dir__
find ./maint -name __random_dir__ | xargs rm -rf > /dev/null 2>&1
if [ $? = 0 ] ; then
echo "yes"
else
echo "no (error)"
rm -rf ./maint/__random_dir__
exit 1
fi
fi
########################################################################
## Check for Python 3
########################################################################
echo_n "Checking for Python 3... "
PYTHON=
if test 3 = `python -c 'import sys; print(sys.version_info[0])'`; then
PYTHON=python
fi
if test -z "$PYTHON" -a 3 = `python3 -c 'import sys; print(sys.version_info[0])'`; then
PYTHON=python3
fi
if test -z "$PYTHON" ; then
echo "not found"
exit 1
else
echo "$PYTHON"
fi
########################################################################
## Setup external packages
########################################################################
echo
echo "###########################################################"
echo "## Checking submodules"
echo "###########################################################"
echo
# hwloc is always required
check_submodule_presence modules/hwloc
# external packages that require autogen.sh to be run for each of them
externals="src/pm/hydra src/pm/hydra2 src/mpi/romio modules/hwloc test/mpi modules/json-c modules/yaksa"
if [ "yes" = "$do_izem" ] ; then
check_submodule_presence modules/izem
externals="${externals} modules/izem"
fi
if [ "yes" = "$do_ucx" ] ; then
check_submodule_presence modules/ucx
externals="${externals} modules/ucx"
fi
if [ "yes" = "$do_ofi" ] ; then
check_submodule_presence modules/libfabric
externals="${externals} modules/libfabric"
fi
if [ "yes" = "$do_json" ] ; then
check_submodule_presence "modules/json-c"
fi
if [ "yes" = "$do_yaksa" ] ; then
check_submodule_presence "modules/yaksa"
fi
########################################################################
# This used to be an optionally installed hook to help with git-svn
# versions of the old SVN repo. Now that we are using git, this is our
# mechanism that replaces relative svn:externals paths, such as for
# "confdb" and "mpl". The basic plan is to delete the destdir and then
# copy all of the files, warts and all, from the source directory to the
# destination directory.
echo
echo "####################################"
echo "## Replicating confdb (and similar)"
echo "####################################"
echo
confdb_dirs=
confdb_dirs="${confdb_dirs} src/mpi/romio/confdb"
confdb_dirs="${confdb_dirs} src/mpi/romio/mpl/confdb"
confdb_dirs="${confdb_dirs} src/mpl/confdb"
confdb_dirs="${confdb_dirs} src/pm/hydra/confdb"
confdb_dirs="${confdb_dirs} src/pm/hydra2/confdb"
confdb_dirs="${confdb_dirs} src/pm/hydra/mpl/confdb"
confdb_dirs="${confdb_dirs} src/pm/hydra2/mpl/confdb"
confdb_dirs="${confdb_dirs} test/mpi/confdb"
confdb_dirs="${confdb_dirs} test/mpi/dtpools/confdb"
# hydra's copies of mpl and hwloc
sync_external src/mpl src/pm/hydra/mpl
sync_external src/mpl src/pm/hydra2/mpl
# ROMIO's copy of mpl
sync_external src/mpl src/mpi/romio/mpl
# all the confdb directories, by various names
for destdir in $confdb_dirs ; do
sync_external confdb "$destdir"
done
# Copying hwloc to hydra
sync_external modules/hwloc src/pm/hydra/tools/topo/hwloc/hwloc
sync_external modules/hwloc src/pm/hydra2/libhydra/topo/hwloc/hwloc
# remove .git directories to avoid confusing git clean
rm -rf src/pm/hydra/tools/topo/hwloc/hwloc/.git
rm -rf src/pm/hydra2/libhydra/topo/hwloc/hwloc/.git
# a couple of other random files
if [ -f maint/version.m4 ] ; then
cp -pPR maint/version.m4 src/pm/hydra/version.m4
cp -pPR maint/version.m4 src/pm/hydra2/version.m4
cp -pPR maint/version.m4 src/mpi/romio/version.m4
cp -pPR maint/version.m4 test/mpi/version.m4
fi
# Now sanity check that some of the above sync was successful
f="aclocal_cc.m4"
for d in $confdb_dirs ; do
if [ -f "$d/$f" ] ; then :
else
error "expected to find '$f' in '$d'"
exit 1
fi
done
echo
echo
echo "###########################################################"
echo "## Autogenerating required files"
echo "###########################################################"
echo
########################################################################
## Building maint/Version
########################################################################
# build a substitute maint/Version script now that we store the single copy of
# this information in an m4 file for autoconf's benefit
echo_n "Generating a helper maint/Version... "
if $autom4te -l M4sugar maint/Version.base.m4 > maint/Version ; then
echo "done"
else
echo "error"
error "unable to correctly generate maint/Version shell helper"
fi
########################################################################
## Building the README
########################################################################
echo_n "Updating the README... "
. ./maint/Version
if [ -f README.vin ] ; then
sed -e "s/%VERSION%/${MPICH_VERSION}/g" -e "s/%LIBFABRIC_VERSION%/${LIBFABRIC_VERSION}/g" README.vin > README
echo "done"
else
echo "error"
error "README.vin file not present, unable to update README version number (perhaps we are running in a release tarball source tree?)"
fi
########################################################################
## Building subsys_include.m4
########################################################################
if [ "X$do_subcfg_m4" = Xyes ] ; then
echo_n "Creating subsys_include.m4... "
./maint/gen_subcfg_m4
echo "done"
fi
########################################################################
## Building ROMIO glue code
########################################################################
echo_n "Building ROMIO glue code... "
( cd src/glue/romio && chmod a+x ./all_romio_symbols && ./all_romio_symbols ../../mpi/romio/include/mpio.h.in )
echo "done"
########################################################################
## Building C interfaces
########################################################################
echo_n "generating MPI C functions..."
$PYTHON maint/gen_binding_c.py
echo "done"
########################################################################
## Building non-C interfaces
########################################################################
# Create the bindings if necessary
if [ $do_bindings = "yes" ] ; then
build_f77=no
build_f90=no
build_cxx=no
if [ $do_f77 = "yes" ] ; then
if [ ! -s src/binding/fortran/mpif_h/abortf.c ] ; then
build_f77=yes
elif find src/binding/fortran/mpif_h -name 'buildiface' -newer 'src/binding/fortran/mpif_h/abortf.c' >/dev/null 2>&1 ; then
build_f77=yes
fi
if [ ! -s src/binding/fortran/use_mpi/mpi_base.f90 ] ; then
build_f90=yes
elif find src/binding/fortran/use_mpi -name 'buildiface' -newer 'src/binding/fortran/use_mpi/mpi_base.f90' >/dev/null 2>&1 ; then
build_f90=yes
fi
build_f08=yes
fi
if [ $build_f77 = "yes" ] ; then
echo_n "Building Fortran 77 interface... "
( cd src/binding/fortran/mpif_h && chmod a+x ./buildiface && ./buildiface )
echo "done"
fi
if [ $build_f90 = "yes" ] ; then
echo_n "Building Fortran 90 interface... "
# Remove any copy of mpi_base.f90 (this is used to handle the
# Double precision vs. Real*8 option
rm -f src/binding/fortran/use_mpi/mpi_base.f90.orig
( cd src/binding/fortran/use_mpi && chmod a+x ./buildiface && ./buildiface )
( cd src/binding/fortran/use_mpi && ../mpif_h/buildiface -infile=cf90t.h -deffile=./cf90tdefs)
echo "done"
fi
if [ $build_f08 = "yes" ] ; then
echo_n "Building Fortran 08 interface... "
# Top-level files
( cd src/binding/fortran/use_mpi_f08 && chmod a+x ./buildiface && ./buildiface )
# generate src/binding/fortran/use_mpi_f08/wrappers_c/...
$PYTHON maint/gen_binding_f08.py
echo "done"
fi
if [ ! -s src/binding/cxx/mpicxx.h ] ; then
build_cxx=yes
elif find src/binding/cxx -name 'buildiface' -newer 'src/binding/cxx/mpicxx.h' >/dev/null 2>&1 ; then
build_cxx=yes
fi
if [ $build_cxx = "yes" ] ; then
echo_n "Building C++ interface... "
( cd src/binding/cxx && chmod a+x ./buildiface &&
./buildiface -nosep -initfile=./cxx.vlist )
echo "done"
fi
fi
########################################################################
## Extract error messages
########################################################################
# Capture the error messages
if [ $do_geterrmsgs = "yes" ] ; then
if [ -x maint/extracterrmsgs ] ; then
echo_n "Extracting error messages... "
rm -rf .tmp
rm -f .err
rm -f unusederr.txt
maint/extracterrmsgs -careful=unusederr.txt \
-skip=src/util/multichannel/mpi.c `cat maint/errmsgdirs` > \
.tmp 2>.err
# (error here is ok)
echo "done"
update_errdefs=yes
if [ -s .err ] ; then
cat .err
rm -f .err2
grep -v "Warning:" .err > .err2
if [ -s .err2 ] ; then
warn "Because of errors in extracting error messages, the file"
warn "src/mpi/errhan/defmsg.h was not updated."
error "Error message files in src/mpi/errhan were not updated."
rm -f .tmp .err .err2
exit 1
fi
rm -f .err .err2
else
# In case it exists but has zero size
rm -f .err
fi
if [ -s unusederr.txt ] ; then
warn "There are unused error message texts in src/mpi/errhan/errnames.txt"
warn "See the file unusederr.txt for the complete list"
fi
if [ -s .tmp -a "$update_errdefs" = "yes" ] ; then
mv .tmp src/mpi/errhan/defmsg.h
fi
if [ ! -s src/mpi/errhan/defmsg.h ] ; then
echo_n "Creating a dummy defmsg.h file... "
cat > src/mpi/errhan/defmsg.h <<EOF
typedef struct { const unsigned int sentinal1; const char *short_name, *long_name; const unsigned int sentinal2; } msgpair;
static const int generic_msgs_len = 0;
static msgpair generic_err_msgs[] = { {0xacebad03, 0, "no error catalog", 0xcb0bfa11}, };
static const int specific_msgs_len = 0;
static msgpair specific_err_msgs[] = { {0xacebad03,0,0,0xcb0bfa11}, };
#if MPICH_ERROR_MSG_LEVEL > MPICH_ERROR_MSG__NONE
#define MPIR_MAX_ERROR_CLASS_INDEX 54
static int class_to_index[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0 };
#endif
EOF
echo "done"
fi
fi
fi # do_geterrmsgs
########################################################################
## Build required scripts
########################################################################
echo
echo "------------------------------------"
echo "Initiating building required scripts"
# Build scripts such as genstates if necessary
ran_maint_configure=no
run_configure=no
# The information that autoconf uses is saved in the autom4te*.cache
# file; since this cache is not accurate, we delete it.
if [ ! -x maint/configure ] ; then
(cd maint && $autoconf && rm -rf autom4te*.cache )
elif find maint -name 'configure.ac' -newer 'maint/configure' >/dev/null 2>&1 ; then
# The above relies on the Unix find command
(cd maint && $autoconf && rm -rf autom4te*.cache)
fi
if [ ! -x maint/genstates ] ; then
run_configure=yes
fi
# The following relies on the Unix find command
if [ -s maint/genstates ] ; then
if find maint -name 'genstates.in' -newer 'maint/genstates' >/dev/null 2>&1 ; then
run_configure=yes
fi
else
run_configure=yes
fi
if [ "$run_configure" = "yes" ] ; then
(cd maint && ./configure)
ran_maint_configure=yes
fi
echo "Done building required scripts"
echo "------------------------------------"
echo
# Run some of the simple codes
echo_n "Creating the enumeration of logging states into src/include/mpiallstates.h... "
touch src/include/mpiallstates.h # silience build errors when do_genstates is disabled
if [ -x maint/extractstates -a $do_genstates = "yes" ] ; then
./maint/extractstates
fi
echo "done"
# new parameter code
echo_n "Extracting control variables (cvar) ... "
if test -x maint/extractcvars -a "$do_getcvars" = "yes" ; then
if ./maint/extractcvars --dirs="`cat maint/cvardirs`"; then
echo "done"
else
echo "failed"
error "unable to extract control variables"
exit 1
fi
else
echo "skipped"
fi
echo
echo
echo "###########################################################"
echo "## Generating configure files"
echo "###########################################################"
echo
########################################################################
## Running autotools on non-simplemake directories
########################################################################
if [ "$do_build_configure" = "yes" ] ; then
for external in $externals ; do
if [ -d "$external" -o -L "$external" ] ; then
echo "------------------------------------------------------------------------"
echo "running third-party initialization in $external"
(cd $external && ./autogen.sh) || exit 1
fi
done
for amdir in $amdirs ; do
if [ -d "$amdir" -o -L "$amdir" ] ; then
echo "------------------------------------------------------------------------"
echo "running $autoreconf in $amdir"
(cd $amdir && $autoreconf $autoreconf_args) || exit 1
# Patching ltmain.sh
if [ -f $amdir/confdb/ltmain.sh ] ; then
echo_n "Patching ltmain.sh for compatibility with Intel compiler options... "
patch -N -s -l $amdir/confdb/ltmain.sh maint/patches/optional/confdb/intel-compiler.patch