forked from HPCToolkit/hpctoolkit
-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
5454 lines (4422 loc) · 144 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 -*-Mode: autoconf;-*-
dnl * BeginRiceCopyright *****************************************************
dnl
dnl $HeadURL$
dnl $Id$
dnl
dnl --------------------------------------------------------------------------
dnl Part of HPCToolkit (hpctoolkit.org)
dnl
dnl Information about sources of support for research and development of
dnl HPCToolkit is at 'hpctoolkit.org' and in 'README.Acknowledgments'.
dnl --------------------------------------------------------------------------
dnl
dnl Copyright ((c)) 2002-2020, Rice University
dnl All rights reserved.
dnl
dnl Redistribution and use in source and binary forms, with or without
dnl modification, are permitted provided that the following conditions are
dnl met:
dnl
dnl * Redistributions of source code must retain the above copyright
dnl notice, this list of conditions and the following disclaimer.
dnl
dnl * Redistributions in binary form must reproduce the above copyright
dnl notice, this list of conditions and the following disclaimer in the
dnl documentation and/or other materials provided with the distribution.
dnl
dnl * Neither the name of Rice University (RICE) nor the names of its
dnl contributors may be used to endorse or promote products derived from
dnl this software without specific prior written permission.
dnl
dnl This software is provided by RICE and contributors "as is" and any
dnl express or implied warranties, including, but not limited to, the
dnl implied warranties of merchantability and fitness for a particular
dnl purpose are disclaimed. In no event shall RICE or contributors be
dnl liable for any direct, indirect, incidental, special, exemplary, or
dnl consequential damages (including, but not limited to, procurement of
dnl substitute goods or services; loss of use, data, or profits; or
dnl business interruption) however caused and on any theory of liability,
dnl whether in contract, strict liability, or tort (including negligence
dnl or otherwise) arising in any way out of the use of this software, even
dnl if advised of the possibility of such damage.
dnl
dnl ******************************************************* EndRiceCopyright *
dnl ##########################################################################
dnl
dnl File:
dnl $HeadURL$
dnl
dnl Description:
dnl autoconf input file for HPCToolkit.
dnl *Process with autoconf to produce configure*
dnl
dnl Modification history:
dnl 2004/03/03 - Nathan Tallent
dnl ...
dnl
dnl Organization:
dnl 1. Autoconf dependencies (autoconf version/automake version)
dnl 2. Special options that need to be checked before compiler tests
dnl 3. Basic prerequisites (compiler tests, tools, system, etc.)
dnl 4. Host-specific settings and tests
dnl 5. Process and test --with/--enable options (which may need the host-specific settings)
dnl 6. Generate output
dnl
dnl ##########################################################################
dnl--------------------------------------------------------------------------
dnl Autoconf dictionary:
dnl build : platform on which the package is configured and
dnl compiled. Defaults to the result of running config.guess.
dnl host : platform on which the package runs. Defaults to build.
dnl target: platform for which any compiler tools in the package
dnl produce code (rarely needed). Defaults to host.
dnl--------------------------------------------------------------------------
m4_include(config/hpc-cxxutils.m4)
#----------------------------------------------------------------------------
# Initialization:
#----------------------------------------------------------------------------
AC_INIT([hpctoolkit], [2020.07-develop],
[hpctoolkit],
[http://hpctoolkit.org/])
AC_COPYRIGHT([Copyright (c) 2002-2020, Rice University.
See the file README.License for details.])
AC_CONFIG_SRCDIR([src/include/hpctoolkit-config.h.in])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([config])
AC_MSG_NOTICE([INFO: from user: CC='${CC}' CFLAGS='${CFLAGS}'])
AC_MSG_NOTICE([INFO: from user: CXX='${CXX}' CXXFLAGS='${CXXFLAGS}'])
AC_MSG_NOTICE([INFO: from user: MPICC='${MPICC}'])
AC_MSG_NOTICE([INFO: from user: MPICXX='${MPICXX}'])
AC_MSG_NOTICE([INFO: from user: MPIF77='${MPIF77}'])
# NOTE: please update config/README.version
AC_PREREQ(2.69)
AM_INIT_AUTOMAKE(1.15.1)
LT_PREREQ([2.4.6])
AM_MAINTAINER_MODE()
AC_CANONICAL_BUILD()
AC_CANONICAL_HOST()
#----------------------------------------------------------------------------
# Setup
#----------------------------------------------------------------------------
# ${srcdir}, ${ac_top_srcdir}, ${ac_top_builddir}
hpctoolkit_top=`cd ${srcdir} && pwd`
hpctoolkit_build=`pwd`
HPCTOOLKIT_PLATFORM=`cd ${hpctoolkit_top}/config && ./hpcplatform`
AC_SUBST([HPCTOOLKIT_PLATFORM])
AC_DEFINE_UNQUOTED([HPCTOOLKIT_INSTALL_PREFIX],
["$prefix"], [HPCToolkit install prefix])
#-------------------------------------------------
# CONFIG_SITE
#-------------------------------------------------
# If CONFIG_SITE contains the path to a file, then autoconf sources
# that file to reset default values for libdir, etc. This may break
# our launch scripts by producing an install layout that they don't
# expect.
warn_config_site=no
if test -f "$CONFIG_SITE" ; then
AC_MSG_WARN([CONFIG_SITE is set in the environment])
warn_config_site=yes
fi
libdir='${exec_prefix}/lib'
#-------------------------------------------------
# Git and Spack versions
#-------------------------------------------------
# If this is a git repo, then try to identify the branch name and the
# date and hash of the last commit.
AC_MSG_CHECKING([for git version])
git_version='unknown (not a git repo)'
if test -d "${srcdir}/.git" ; then
mesg=`cd "$srcdir" && git log -n 1 --date=short 2>/dev/null`
if echo "$mesg" | grep -i commit >/dev/null ; then
git_hash=`echo "$mesg" | grep -i commit | head -1 | awk '{print $2}'`
git_hash=`expr "$git_hash" : '\(................\)'`
git_date=`echo "$mesg" | grep -i date | head -1 | awk '{print $2}'`
mesg=`cd "$srcdir" && git status 2>/dev/null | head -1`
if echo "$mesg" | grep -i branch >/dev/null ; then
git_branch=`echo "$mesg" | sed -e 's/^.*branch//i' | awk '{print $1}'`
elif echo "$mesg" | grep -i detach >/dev/null ; then
# detached commits don't have a branch name
git_branch=detached
else
git_branch=unknown
fi
git_version="$git_branch at $git_date ($git_hash)"
fi
fi
AC_MSG_RESULT([$git_version])
AC_DEFINE_UNQUOTED([HPCTOOLKIT_VERSION],
["${PACKAGE_VERSION}"],
[HPCToolkit version])
AC_DEFINE_UNQUOTED([HPCTOOLKIT_VERSION_STRING],
["A member of HPCToolkit, version ${PACKAGE_VERSION}"],
[HPCToolkit version string])
# If this is a spack build, then try to identify the spack spec.
AC_MSG_CHECKING([for spack spec])
spack_spec='unknown (not a spack build)'
if test "x$SPACK_SHORT_SPEC" != x ; then
spack_spec=`echo $SPACK_SHORT_SPEC | tr -d "'"`
fi
AC_MSG_RESULT([$spack_spec])
AC_DEFINE_UNQUOTED([HPCTOOLKIT_GIT_VERSION],
["$git_version"], [Git branch and commit hash, if known.])
AC_DEFINE_UNQUOTED([HPCTOOLKIT_SPACK_SPEC],
["$spack_spec"], [Spack version and variants, if known.])
#-------------------------------------------------
# is_cross_compile: non-empty string if cross-compiling
#-------------------------------------------------
is_cross_compile=""
if test "${build}" != "${host}" ; then
is_cross_compile=${host}
fi
#----------------------------------------------------------------------------
# Special Options that should be tested first
#----------------------------------------------------------------------------
#-------------------------------------------------
# enable-all-static
#-------------------------------------------------
# Add '-all-static' to LDFLAGS for hpcprof-mpi. This is needed when
# using an MPI compiler that builds a static hpcprof-mpi for the
# compute nodes.
#
# The old way was to set HPCPROFMPI_LT_LDFLAGS='-all-static', the new
# way is to use --enable-all-static.
AC_ARG_VAR([HPCPROFMPI_LT_LDFLAGS],
[old method to add ldflags to hpcprof-mpi, now use --enable-all-static
to build a static binary for the compute nodes])
AC_ARG_ENABLE([all-static],
[AS_HELP_STRING([--enable-all-static],
[needed when building a static hpcprof-mpi for the compute nodes
(default no)])],
[],
[enable_all_static=no])
if test "x$enable_all_static" = xyes ; then
HPCPROFMPI_LT_LDFLAGS="$HPCPROFMPI_LT_LDFLAGS -all-static"
fi
AC_MSG_NOTICE([HPCPROFMPI_LT_LDFLAGS: $HPCPROFMPI_LT_LDFLAGS])
#-------------------------------------------------
# enable-develop
#-------------------------------------------------
AC_MSG_CHECKING([whether DEVELOP mode is enabled])
OPT_ENABLE_DEVELOP=no
AC_ARG_ENABLE([develop],
AS_HELP_STRING([--enable-develop],
[Build development version (enable debugging)]),
[case "${enableval}" in
yes) OPT_ENABLE_DEVELOP="yes" ;;
no) OPT_ENABLE_DEVELOP="no" ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-develop]) ;;
esac],
[OPT_ENABLE_DEVELOP=no])
AC_MSG_RESULT([${OPT_ENABLE_DEVELOP}])
AM_CONDITIONAL(OPT_ENABLE_DEVELOP, test "${OPT_ENABLE_DEVELOP}" = "yes")
#-------------------------------------------------
# enable-strip-debug
#-------------------------------------------------
# Strip the debug section from the libraries used in hpcrun/hpclink so
# that our code does not appear in the viewer.
default=yes
if test "$OPT_ENABLE_DEVELOP" = yes ; then
default=no
fi
case "$host_cpu" in
*aarch* | *arm* ) default=no ;;
esac
AC_ARG_ENABLE([strip-debug],
[AS_HELP_STRING([--enable-strip-debug],
[strip the debug section from the hpcrun libraries
(default yes, unless --enable-develop is used)])],
[],
[enable_strip_debug="$default"])
case "$enable_strip_debug" in
no ) ;;
* ) enable_strip_debug=yes ;;
esac
AC_MSG_CHECKING([whether to strip debug section from hpcrun libraries])
AC_MSG_RESULT([$enable_strip_debug])
AM_CONDITIONAL(OPT_STRIP_HPCRUN_LIBS, [test "$enable_strip_debug" = yes])
#----------------------------------------------------------------------------
# Prerequisites: compilers, tools, system libraries
#----------------------------------------------------------------------------
# AC_PROG_CXX will set CXXFLAGS to something like -g -O2 if not
# already defined. We do not want this!
HPC_ENSURE_DEFINED_CXXFLAGS()
HPC_ENSURE_DEFINED_CFLAGS()
# Check for programs.
# Note: libtool makes PROG_RANLIB obsolete
AC_PROG_CXX(HPC_CXX_LIST)
AC_PROG_CC(HPC_CC_LIST)
AC_PROG_CC_C99()
if test "${ac_cv_prog_cc_c99}" = "no" ; then
AC_MSG_ERROR([${CC} ${CFLAGS} does not support C99 mode!])
fi
AM_PROG_CC_C_O()
# Note: this will set CC and CFLAGS if not already set
LT_INIT()
AC_SUBST([LIBTOOL_DEPS])
AM_PROG_AS()
AC_PROG_AWK
AC_PROG_SED
AC_PROG_CXXCPP()
AC_ARG_VAR([LD],
[ld program for binaries produced by CC, only needed if
autoconf fails to find a suitable program])
AC_PROG_INSTALL()
AC_MSG_NOTICE([INFO: post autoconf tests: CC='${CC}' CFLAGS='${CFLAGS}'])
AC_MSG_NOTICE([INFO: post autoconf tests: CXX='${CXX}' CXXFLAGS='${CXXFLAGS}'])
AC_MSG_NOTICE([INFO: post autoconf tests: MPICC='${MPICC}'])
AC_MSG_NOTICE([INFO: post autoconf tests: MPICXX='${MPICXX}'])
AC_MSG_NOTICE([INFO: post autoconf tests: MPIF77='${MPIF77}'])
#-------------------------------------------------
# C compiler checks
#-------------------------------------------------
AC_MSG_NOTICE([*** Using C comiler for tests ***])
AC_LANG([C])
# Check for header files
AC_HEADER_STDC()
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(inttypes.h)
AS_UNSET([ac_cv_header_unistd_h]) # retest for C++
AS_UNSET([ac_cv_header_inttypes_h]) # retest for C++
# Check for types
AC_CHECK_SIZEOF([void*])
AC_CHECK_TYPES([ushort, uint, ulong])
if test "${ac_cv_type_voidp}" = "yes" ; then
AC_DEFINE([HAVE_VOIDP_LANG_C], [1], [C compiler supports type "voidp"])
fi
if test "${ac_cv_type_ushort}" = "yes" ; then
AC_DEFINE([HAVE_USHORT_LANG_C], [1], [C compiler supports type "ushort"])
fi
if test "${ac_cv_type_uint}" = "yes" ; then
AC_DEFINE([HAVE_UINT_LANG_C], [1], [C compiler supports type "uint"])
fi
if test "${ac_cv_type_ulong}" = "yes" ; then
AC_DEFINE([HAVE_ULONG_LANG_C], [1], [C compiler supports type "ulong"])
fi
AS_UNSET([ac_cv_sizeof_voidp]) # retest for C++
AS_UNSET([ac_cv_type_ushort]) # retest for C++
AS_UNSET([ac_cv_type_uint]) # retest for C++
AS_UNSET([ac_cv_type_ulong]) # retest for C++
#-------------------------------------------------
# C++ compiler checks
#-------------------------------------------------
AC_MSG_NOTICE([*** Using C++ comiler for tests ***])
AC_LANG([C++])
# Check for header files
#AC_HEADER_STDC()
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(inttypes.h)
AC_CHECK_HEADERS(cxxabi.h)
HPC_CHECK_CXX_STDC_HEADERS()
# Check for types
AC_CHECK_SIZEOF([void*])
AC_CHECK_TYPES([ushort, uint, ulong])
host_sizeof_voidp="${ac_cv_sizeof_voidp}"
# Check pthread.h
HPC_CHECK_COMPILE_PTHREAD_H()
#-------------------------------------------------
# Check for multilib
#-------------------------------------------------
# NOTE: can this be made more elegant? This value should be used to
# automatically add/exclude lib32/lib64 paths below.
HAVE_OS_MULTILIB="no"
LIB_SEARCH_PATH="lib"
AC_MSG_CHECKING([for multilib platform])
case "${host}" in
x86_64*-*-linux* | mips64*-*-linux* | powerpc64*-*-linux*)
HAVE_OS_MULTILIB="yes"
LIB_SEARCH_PATH="lib lib64 lib32"
;;
esac
if test "${HAVE_OS_MULTILIB}" = "yes" ; then
AC_DEFINE([HAVE_OS_MULTILIB], [1], [HOST OS: 32 and 64 bit OS libraries])
fi
AC_MSG_RESULT([${HAVE_OS_MULTILIB} (searching: ${LIB_SEARCH_PATH})])
# Check for typedefs, structures, and compiler characteristics.
# -none thus far-
# Check for library functions.
# -none thus far-
#----------------------------------------------------------------------------
# Host-dependent configuration
# $host: $host_cpu-$host_vendor-$host_os
#----------------------------------------------------------------------------
HPC_DEF_CXXCMP()
#-------------------------------------------------
# set unwinder variable
#-------------------------------------------------
UNWINDER=no
#---------------------------------------
# set specific libunw variable
#---------------------------------------
USE_LIBUNW=no
#-------------------------------------------------
# Host-specific defines
#-------------------------------------------------
# NOTE: To see what macros gcc-like compilers define:
# gcc -dM -E - < /dev/null | sort
#
# FIXME: This should probably be split into separate CPU and OS
# sections.
HOST_OS=
HOST_CPU_MIPS=no
HOST_CPU_PPC=no
HOST_CPU_X86=no
HOST_CPU_X86_64=no
HOST_CPU_X86_FAMILY=no
HOST_CPU_IA64=no
HOST_CPU_AARCH64=no
case "${host}" in
# Linux
i386*-*-linux* | i686*-*-linux*)
# __i386 && __linux
HOST_OS="Linux"
HOST_CPU_X86=yes
HOST_CPU_X86_FAMILY=yes
UNWINDER=x86-family
AC_DEFINE([HOST_CPU_x86], [1], [HOST CPU: x86 (32-bit)])
AC_DEFINE([HOST_OS_LINUX], [1], [HOST OS: Linux])
;;
x86_64*-*-linux*)
# __x86_64 && __linux
HOST_OS="Linux"
if test "${host_sizeof_voidp}" = "4"; then
HOST_CPU_X86=yes
AC_DEFINE([HOST_CPU_x86], [1], [HOST CPU: x86 (32-bit)])
else
HOST_CPU_X86_64=yes
AC_DEFINE([HOST_CPU_x86_64], [1], [HOST CPU: x86-64])
fi
HOST_CPU_X86_FAMILY=yes
UNWINDER=x86-family
AC_DEFINE([HOST_OS_LINUX], [1], [HOST OS: Linux])
;;
ia64*-*-linux*)
# __ia64 && __linux
HOST_OS="Linux"
HOST_CPU_IA64=yes
UNWINDER=libunw
AC_DEFINE([HOST_CPU_IA64], [1], [HOST CPU: ia64 (itanium)])
AC_DEFINE([HOST_OS_LINUX], [], [])
;;
mips64*-*-linux*)
# __mips64 && __linux / _MIPS_SIM == _ABIN32 / _MIPS_SIM == _ABI64
HOST_OS="Linux"
HOST_CPU_MIPS=yes
UNWINDER=mips
AC_DEFINE([HOST_PLATFORM_MIPS64LE_LINUX], [1], [HOST platform: MIPS64LE_LINUX])
AC_DEFINE([HOST_OS_LINUX], [1], [HOST OS: Linux])
;;
powerpc64*-*-linux* | powerpc-*-linux*)
# []
HOST_OS="Linux"
HOST_CPU_PPC=yes
UNWINDER=ppc64
AC_DEFINE([HOST_OS_LINUX], [1], [HOST OS: Linux])
AC_DEFINE([HOST_CPU_PPC], [1], [HOST CPU: PowerPC (ppc)])
;;
# MacOS
powerpc*-*-darwin*)
# __ppc__ / __MACH__
HOST_OS="MacOS"
HOST_CPU_PPC=yes
UNWINDER=ppc64
AC_DEFINE([HOST_OS_MACOS], [1], [HOST OS: MacOS])
AC_DEFINE([HOST_CPU_PPC], [1], [HOST CPU: PowerPC (ppc)])
;;
i386*-*-darwin* | i686*-*-darwin*)
HOST_OS="MacOS"
HOST_CPU_X86=yes
UNWINDER=x86-family
AC_DEFINE([HOST_CPU_x86], [1], [HOST CPU: x86 (32-bit)])
AC_DEFINE([HOST_OS_MACOS], [1], [HOST OS: MacOS])
;;
x86_64*-*-darwin*)
HOST_OS="MacOS"
if test "${host_sizeof_voidp}" = "4"; then
HOST_CPU_X86=yes
AC_DEFINE([HOST_CPU_x86], [1], [HOST CPU: x86 (32-bit)])
else
HOST_CPU_X86_64=yes
AC_DEFINE([HOST_CPU_x86_64], [1], [HOST CPU: x86-64])
fi
HOST_CPU_X86_FAMILY=yes
UNWINDER=x86-family
AC_DEFINE([HOST_OS_MACOS], [1], [HOST OS: MacOS])
;;
# IRIX
mips*-*-irix*)
# __mips && __sgi && __unix
# _MIPS_ISA == _MIPS_ISA_MIPS1 | _MIPS_ISA == _MIPS_ISA_MIPS2
# _MIPS_ISA == _MIPS_ISA_MIPS3 | _MIPS_ISA == _MIPS_ISA_MIPS4
HOST_OS="IRIX"
HOST_CPU_MIPS=yes
UNWINDER=mips
AC_DEFINE([HOST_OS_IRIX], [1], [HOST OS: IRIX])
;;
# Solaris
sparc*-*-solaris*)
# __sparc && __sun && __unix
HOST_OS="Solaris"
AC_DEFINE([HOST_OS_SOLARIS], [1], [HOST OS: Solaris])
;;
# Tru64/OSF
alpha*-*-osf*)
# __alpha / __digital__ && __unix__
HOST_OS="Tru64"
AC_DEFINE([HOST_OS_TRU64], [1], [HOST OS: Tru64])
;;
# ARM 64-bit
aarch64*linux* )
HOST_OS="Linux"
HOST_CPU_AARCH64=yes
UNWINDER=libunw
AC_DEFINE([HOST_OS_LINUX], [1], [HOST OS: Linux])
AC_DEFINE([HOST_CPU_ARM64], [1], [HOST CPU: ARM 64 (aarch64])
;;
*)
AC_MSG_ERROR([HPCToolkit is not configured for HOST=${host}!])
;;
esac
HOST_CPU_K1OM=no
case "$host" in
*k1om* ) HOST_CPU_K1OM=yes ;;
esac
AM_CONDITIONAL([HOST_OS_LINUX], [test "${HOST_OS}" = Linux])
AM_CONDITIONAL([HOST_CPU_K1OM], [test "${HOST_CPU_K1OM}" = yes])
AM_CONDITIONAL([HOST_CPU_MIPS], [test "${HOST_CPU_MIPS}" = yes])
AM_CONDITIONAL([HOST_CPU_PPC], [test "${HOST_CPU_PPC}" = yes])
AM_CONDITIONAL([HOST_CPU_X86], [test "${HOST_CPU_X86}" = yes])
AM_CONDITIONAL([HOST_CPU_X86_64], [test "${HOST_CPU_X86_64}" = yes])
AM_CONDITIONAL([HOST_CPU_X86_FAMILY], [test "${HOST_CPU_X86_FAMILY}" = yes])
AM_CONDITIONAL([HOST_CPU_IA64], [test "$HOST_CPU_IA64" = yes])
AM_CONDITIONAL([HOST_CPU_AARCH64], [test "$HOST_CPU_AARCH64" = yes])
#-------------------------------------------------
# Host-specific compiler settings
#-------------------------------------------------
# FIXME: Now that we use libtool to build all HPCToolkit libraries, we
# may not need this HOST_AR stuff. (Remove from here and makefiles.)
# General settings for internal libraries
HOST_CFLAGS=""
HOST_CXXFLAGS=""
HOST_AR=""
HOST_LIBTREPOSITORY=""
HOST_LINK_NO_START_FILES="-nostartfiles"
# Specific settings for programs
HOST_HPCRUN_LDFLAGS=""
HOST_HPCSTRUCT_LDFLAGS="-lm"
HOST_HPCPROF_LDFLAGS="-lm"
HOST_HPCPROF_FLAT_LDFLAGS="-lm"
HOST_HPCPROFTT_LDFLAGS="-lm"
HOST_XPROF_LDFLAGS=""
my_demangle_ldflags=""
# Options: Default for GCC
if test "$OPT_ENABLE_DEVELOP" = "yes" ; then
my_opt_cflags="-g -O0 -Wall"
my_opt_cxxflags="-g -O0 -Wall"
else
# On some compilers, -g implies -O0. Make sure -O3 takes precedence!
my_opt_cflags="-g -O3 -Wall"
my_opt_cxxflags="-g -O3 -Wall"
fi
case "${host}" in
# Linux x86
i386*-*-linux* | i686*-*-linux* | x86_64*-*-linux*)
# GCC
if HPCcxxcmp([g++ c++]) ; then
if test "${host_sizeof_voidp}" = "4"; then
HOST_CXXFLAGS="-march=i486"
fi
fi
if HPCcccmp([gcc cc]) ; then
if test "${host_sizeof_voidp}" = "4"; then
HOST_CFLAGS="-march=i486"
fi
fi
# Intel compiler
if HPCcxxcmp([icpc ecpc]) ; then
# Silence the following warnings:
# remark #383: value copied to temporary, reference to temporary used
# remark #981: operands are evaluated in unspecified order
# remark #1572: FP equality and inequality comparisons are unreliable
HOST_CXXFLAGS="-wd383 -wd981 -wd1572"
fi
if HPCcccmp([icc ecc]) ; then
:
fi
# Pathscale compiler
if HPCcxxcmp([pathCC]) ; then
:
fi
if HPCcccmp([pathcc]) ; then
:
fi
# PGI compiler
if HPCcxxcmp([pgCC]) ; then
if test "$OPT_ENABLE_DEVELOP" = "yes" ; then
my_opt_cxxflags="-g -O0"
else
my_opt_cxxflags="-gopt -O2"
fi
fi
if HPCcccmp([pgcc]) ; then
if test "$OPT_ENABLE_DEVELOP" = "yes" ; then
my_opt_cflags="-g -O0 -c9x"
else
my_opt_cflags="-gopt -O3 -c9x"
fi
fi
;;
# Linux ia64
ia64*-*-linux*)
;;
# Linux mips
mips64*-*-linux*)
;;
# Linux power
powerpc64*-*-linux*)
# IBM compiler
;;
# IRIX
mips*-*-irix*)
# SGI MIPSpro
if HPCcxxcmp([CC]) ; then
HOST_CXXFLAGS="-64 -LANG:std"
HOST_AR="$CXX $CXXFLAGS ${HOST_CXXFLAGS} -ar -o"
fi
if HPCcccmp([cc]) ; then
HOST_CFLAGS="-64"
fi
# GCC
if HPCcxxcmp([g++ c++]) ; then
HOST_CXXFLAGS="-mabi=64"
fi
if HPCcccmp([gcc]) ; then
HOST_CFLAGS="-mabi=64"
fi
# SGI demangle
my_demangle_ldflags="-lmangle"
;;
# Solaris
sparc*-*-solaris*)
# Sun Forte/ONE
if HPCcxxcmp([CC]); then
if test "$OPT_ENABLE_DEVELOP" = "yes" ; then
my_opt_cxxflags="-g"
else
my_opt_cxxflags="-fast -g"
fi
HOST_AR="$CXX $CXXFLAGS -xar -o"
fi
if HPCcccmp([cc]); then
if test "$OPT_ENABLE_DEVELOP" = "yes" ; then
my_opt_cflags="-g"
else
my_opt_cflags="-fast -g"
fi
fi
# Sun demangle
my_demangle_ldflags="-ldemangle"
;;
# Tru64/OSF
alpha*-*-osf*)
# Compaq compiler
if HPCcxxcmp([cxx]); then
# Before using libtool, we had used local
# repositories and included template definitions in respective
# archives. However, libtool doesn't take kindly to including
# .o's and .lo's in the same archive. Thus, we now use a global
# repository, even though it means archives are not self-contained.
HOST_CXXFLAGS="-std strict_ansi -rtti -pt -ptr ${hpctoolkit_build}/cxx_trepository"
#old: HOST_LIBTREPOSITORY="./cxx_trepository/*.o"
if test "$OPT_ENABLE_DEVELOP" = "yes" ; then
my_opt_cxxflags="-gall"
else
my_opt_cxxflags="-g3 -O2"
fi
fi
if HPCcccmp([cc]); then
if test "$OPT_ENABLE_DEVELOP" = "yes" ; then
my_opt_cflags="-g"
else
my_opt_cflags="-g3 -O3"
fi
fi
# DEC demangle
my_demangle_ldflags="-lmld"
;;
*)
;;
esac
# Grab optimization flags
HOST_CFLAGS="${HOST_CFLAGS} ${my_opt_cflags}"
HOST_CXXFLAGS="${HOST_CXXFLAGS} ${my_opt_cxxflags}"
# Several programs need system's demangle option
HOST_HPCSTRUCT_LDFLAGS="${HOST_HPCSTRUCT_LDFLAGS} ${my_demangle_ldflags}"
HOST_HPCPROF_LDFLAGS="${HOST_HPCPROF_LDFLAGS} ${my_demangle_ldflags}"
HOST_XPROF_LDFLAGS="${HOST_XPROF_LDFLAGS} ${my_demangle_ldflags}"
# FIXME: Boost >= 1.55 misreads the features of the g++ k1om compiler,
# so we add these flags as a workaround. But this should be a compile
# test for the CXX compiler.
case "$host" in
*k1om* )
HOST_CXXFLAGS="$HOST_CXXFLAGS -DBOOST_NO_CXX11_ALLOCATOR"
HOST_CXXFLAGS="$HOST_CXXFLAGS -DBOOST_NO_CXX11_CONSTEXPR"
HOST_CXXFLAGS="$HOST_CXXFLAGS -DBOOST_NO_CXX11_VARIADIC_TEMPLATES"
;;
esac
# The stdatomic.h file misreads the features of the 4.7.0 gnu k1om
# compiler. It doesn't have the gnu __atomic_fetch_add() functions.
# We workaround the problem by resetting the minor number to 4.6 to
# more accurately reflect the features the compiler actually has.
case "$host" in
*k1om* )
HOST_CFLAGS="$HOST_CFLAGS -U__GNUC_MINOR__ -D__GNUC_MINOR__=6"
HOST_CXXFLAGS="$HOST_CXXFLAGS -U__GNUC_MINOR__ -D__GNUC_MINOR__=6"
;;
esac
#-------------------------------------------------
# Big or little endian and byteswap
#-------------------------------------------------
# Test if host is big or little endian with an option to override in
# the rare case that autoconf detects the wrong value.
AC_C_BIGENDIAN([default=big], [default=little], [default=none], [default=none])
AC_ARG_ENABLE([endian],
[AS_HELP_STRING([--enable-endian],
[host endianness (big, little), only needed if autoconf fails
to detect correctly])],
[host_endian="$enable_endian"],
[host_endian="$default"])
case "$host_endian" in
big )
AC_DEFINE([HOST_BIG_ENDIAN], [1], [Host is big endian.])
;;
little )
AC_DEFINE([HOST_LITTLE_ENDIAN], [1], [Host is little endian.])
;;
none )
AC_MSG_WARN([Unable to autodetect host endianness.])
AC_MSG_ERROR([Set --enable-endian to 'big' or 'little' and rerun configure.])
;;
* )
AC_MSG_WARN([Bad value for host endianness: $host_endian])
AC_MSG_ERROR([Set --enable-endian to 'big' or 'little' and rerun configure.])
;;
esac
AC_MSG_NOTICE([host endian: $host_endian])
# Test if <byteswap.h> exists and defines bswap_64. If yes, then it
# has assembly code for the fastest way to convert between big/little
# endian.
AC_LANG_PUSH([C++])
AC_LINK_IFELSE([
AC_LANG_SOURCE([[
#include <stdio.h>
#include <stdint.h>
#include <byteswap.h>
int main(int argc, char **argv)
{
uint64_t x = (uint64_t) argc;
uint64_t y = bswap_64(x);
return y > 2;
}
]])], [use_byteswap=yes], [use_byteswap=no])
AC_LANG_POP()
AC_MSG_NOTICE([use system byteswap.h: $use_byteswap])
if test "$use_byteswap" = yes ; then
AC_DEFINE([USE_SYSTEM_BYTESWAP], [1], [Use system byteswap.h])
fi
#-------------------------------------------------
# Utilities for compiler versions and paths
#-------------------------------------------------
# These tests only use GNU syntax. Intel, Clang, etc use a different
# format, but we don't really build with those.
# For example: gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2)
find_version()
{
ans='unknown non-gnu'
# strip any compiler flags, 'gcc -m64'
base=`echo $1 | awk '{ print $1 }'`
version=`$base --version 2>/dev/null`
echo "$version" | grep -i copyright >/dev/null
if test $? -eq 0 ; then
ans=`echo "$version" | head -1`
fi
echo "$ans"
}
find_path()
{
ans=
base=`echo $1 | awk '{ print $1 }'`
case "$base" in
/* ) ans="$base" ;;
* ) AC_PATH_PROG([ans], [$base], [no]) ;;
esac
if test "x$ans" = xno ; then
ans=unknown
fi
echo "$ans"
}
test_is_gnu()
{
base=`echo $1 | awk '{ print $1 }'`
version=`$base --version 2>/dev/null`
echo $version | grep -E -i -e 'copy.*free.*soft.*found' >/dev/null
return $?
}
#-------------------------------------------------
# C, C++ compiler versions and paths
#-------------------------------------------------
# Find path and version for CC/CXX, test if GNU, and check if recent
# enough version >= 5.x.
cc_is_gnu=yes
CC_VERSION=`find_version "$CC"`
CC_PATH=`find_path "$CC"`
AC_MSG_NOTICE([C compiler: $CC_VERSION])
AC_MSG_NOTICE([C path: $CC_PATH])
if test_is_gnu "$CC" ; then : ; else
AC_MSG_WARN([Not using the GNU C compiler.])
cc_is_gnu=no
fi
CXX_VERSION=`find_version "$CXX"`
CXX_PATH=`find_path "$CXX"`
AC_MSG_NOTICE([C++ compiler: $CXX_VERSION])
AC_MSG_NOTICE([C++ path: $CXX_PATH])
if test_is_gnu "$CXX" ; then : ; else
AC_MSG_WARN([Not using the GNU C++ compiler.])
cc_is_gnu=no
fi
warn_non_gnu=no
warn_non_gnu_mesg=
warn_old_gnu=no
warn_identify_compiler=no
warn_identify_compiler_mesg=
have_cc_version=no
# parse CC version: gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2)
if test "$cc_is_gnu" = yes ; then
ver=`echo $CC_VERSION | sed -e '[s/^[^)]*[)]//]' | awk '{print $1}'`
cc_major=`echo $ver | awk -F. '{print $1}'`
cc_minor=`echo $ver | awk -F. '{print $2}'`
if test "x$cc_minor" != x ; then
have_cc_version=yes
if test "$cc_major" -lt 5 ; then
AC_MSG_WARN([CC/CXX compiler too old for hpctoolkit])
AC_MSG_WARN([Use GNU version 5.x or later])
warn_old_gnu=yes
fi
else
AC_MSG_WARN([unable to identify CC/CXX compiler version: $CC_VERSION])
warn_identify_compiler=yes
warn_identify_compiler_mesg='CC/CXX'
fi
else
warn_non_gnu=yes
warn_non_gnu_mesg='CC/CXX'
fi