@@ -174,8 +174,9 @@ case $host_cpu in
174174 ;;
175175esac
176176
177- # Check for C compiler vendor. we assume that all compilers (CC, CXX, MPICC and
178- # MPICXX) have the same vender and the same version.
177+ # Check for C compiler vendor. We assume that all compilers (CC, CXX, MPICC and
178+ # MPICXX) have the same vender and the same version. Clang most likely works
179+ # as GCC.
179180vendors="
180181intel: __ICC,__ECC,__INTEL_COMPILER
181182gnu: __GNUC__
@@ -679,17 +680,20 @@ AC_SUBST([MPI_STATIC_LDFLAGS])
679680# Check for native/universal build
680681AC_ARG_ENABLE ( [ native] ,
681682 [ AS_HELP_STRING ( [ --enable-native] ,
682- [ tune for the compiling machine (release versions) @<:@ default=check @:>@ ] ) ] ,
683+ [ tune for the compiling machine (release versions) @<:@ default=yes @:>@ ] ) ] ,
683684 [ AS_IF ( [ test "x$enableval" = xno || test "x$cross_compiling" = xyes] ,
684685 [ enable_native=no] , [ enable_native=yes] ) ] ,
685686 [ enable_native=yes] )
686687
687688# Check for profiling option
688689AC_ARG_ENABLE ( [ profile] ,
689- [ AS_HELP_STRING ( [ --enable-profile] ,
690- [ build with profiling (release versions) @<:@ default=no@:>@ ] ) ] ,
690+ [ AS_HELP_STRING ( [ --enable-profile@<:@ =PROFILER @:>@ ] ,
691+ [ build with profiling (release versions) @<:@ default=no@:>@ PROFILER: gprof (default) or gperftools ] ) ] ,
691692 [ AS_IF ( [ test "x$enableval" = xyes] ,
692- [ enable_profile=yes] , [ enable_profile=no] ) ] ,
693+ [ enable_profile=gprof] ,
694+ [ AS_IF ( [ test "x$enableval" = xgprof || test "x$enableval" = xgperftools] ,
695+ [ enable_profile=$enableval] ,
696+ [ enable_profile=no] ) ] ) ] ,
693697 [ enable_profile=no] )
694698
695699# Check for coverage option
@@ -703,7 +707,7 @@ AC_ARG_ENABLE([coverage],
703707# Check for sanitizers
704708AC_ARG_ENABLE ( [ sanitize] ,
705709 [ AS_HELP_STRING ( [ --enable-sanitize@<:@ =CHECKS@:>@ ] ,
706- [ enable sanitizers (debugging versions) @<:@ default=no@:>@ ] ) ] ,
710+ [ enable sanitizers (debugging versions) @<:@ default=no@:>@ Optionally CHECKS will be passed via the compiler sanitizer option ] ) ] ,
707711 [ AS_IF ( [ test "x$enable_debug" != xyes] ,
708712 [ enable_sanitize=no] ) ] ,
709713 [ enable_sanitize=no] )
@@ -713,13 +717,15 @@ AC_ARG_VAR([COMPILEFLAGS], [Compiler flags for release versions])
713717AC_ARG_VAR ( [ LINKFLAGS] , [ Linker flags for release versions] )
714718AC_ARG_VAR ( [ DEBUGCOMPILEFLAGS] , [ Compiler flags for debugging versions] )
715719AC_ARG_VAR ( [ DEBUGLINKFLAGS] , [ Linker flags for debugging versions] )
720+ TOOL_LIBS=
721+ DEBUGTOOL_LIBS=
716722
717723my_test_COMPILEFLAGS=${COMPILEFLAGS+set}
718724if test "$my_test_COMPILEFLAGS" != set; then
719725 if test "x$vendor" = xgnu; then
720726 # We don't use -pedantic option because of horrible warnings.
721727 COMPILEFLAGS="-Wall -Wextra -Wpadded -O3"
722- if test "x$enable_profile" != xyes ; then
728+ if test "x$enable_profile" != xgprof ; then
723729 # -pg conflicts with -fomit-frame-pointer.
724730 COMPILEFLAGS="$COMPILEFLAGS -fomit-frame-pointer"
725731 fi
@@ -746,19 +752,26 @@ if test "$my_test_COMPILEFLAGS" != set; then
746752 fi
747753 fi
748754 # Profiling option.
749- if test "x$enable_profile" = xyes ; then
755+ if test "x$enable_profile" = xgprof ; then
750756 COMPILEFLAGS="$COMPILEFLAGS -g -pg"
757+ elif test "x$enable_profile" = xgperftools; then
758+ COMPILEFLAGS="$COMPILEFLAGS -g"
759+ TOOL_LIBS="$TOOL_LIBS -lprofiler"
751760 fi
752761 elif test "x$vendor" = xintel; then
753762 # NOTE: -fast option includes -static and may cause an error in linking.
754763 COMPILEFLAGS="-Wall -ipo -O3 -no-prec-div"
755764 if test "x$enable_native" = xyes; then
756765 COMPILEFLAGS="$COMPILEFLAGS -xHost"
757766 fi
758- enable_profile=false
767+ if test "x$enable_profile" != xno; then
768+ enable_profile=unavailable
769+ fi
759770 else
760771 COMPILEFLAGS=-O2
761- enable_profile=false
772+ if test "x$enable_profile" != xno; then
773+ enable_profile=unavailable
774+ fi
762775 fi
763776fi
764777my_test_LINKFLAGS=${LINKFLAGS+set}
@@ -768,8 +781,8 @@ if test "$my_test_LINKFLAGS" != set; then
768781 # warns the option is obsolete and being ignored, it causes an internal
769782 # error "atom not found in symbolIndex...".
770783 LINKFLAGS=
771- elif test "x$vendor" = xgnu && test "x$enable_profile" = xyes ; then
772- # gprof doesn't work with -s .
784+ elif test "x$enable_profile" != xno && test "x$enable_profile" != xunavailable ; then
785+ # Profilers needs symbol tables .
773786 LINKFLAGS=
774787 else
775788 LINKFLAGS=-s
@@ -843,12 +856,20 @@ if test "$my_test_DEBUGCOMPILEFLAGS" != set && test "x$enable_debug" = xyes; the
843856 fi
844857 elif test "x$vendor" = xintel; then
845858 DEBUGCOMPILEFLAGS='-g3 -Wall -O0'
846- enable_coverage=no
847- enable_sanitize=no
859+ if test "x$enable_coverage" != xno; then
860+ enable_coverage=unavailable
861+ fi
862+ if test "x$enable_sanitize" != xno; then
863+ enable_sanitize=unavailable
864+ fi
848865 else
849866 DEBUGCOMPILEFLAGS=-g
850- enable_coverage=no
851- enable_sanitize=no
867+ if test "x$enable_coverage" != xno; then
868+ enable_coverage=unavailable
869+ fi
870+ if test "x$enable_sanitize" != xno; then
871+ enable_sanitize=unavailable
872+ fi
852873 fi
853874fi
854875my_test_DEBUGLINKFLAGS=${DEBUGLINKFLAGS+set}
@@ -880,6 +901,9 @@ if test "$my_test_DEBUGLINKFLAGS" != set && test "x$enable_debug" = xyes; then
880901 fi
881902fi
882903
904+ AC_SUBST ( [ TOOL_LIBS] )
905+ AC_SUBST ( [ DEBUGTOOL_LIBS] )
906+
883907# Check for doxygen
884908AC_PATH_PROG ( DOXYGEN , doxygen , "" )
885909AM_CONDITIONAL(CONFIG_DOXYGEN, [ test "x$DOXYGEN" != x] )
@@ -977,12 +1001,18 @@ if test "x$build_form" = xyes; then
9771001 fi
9781002 opts="${opts}statically linked"
9791003 fi
980- if test "x$enable_profile" = xyes ; then
1004+ if test "x$enable_profile" = xgprof ; then
9811005 if test "x$opts" != x; then
9821006 opts="${opts}, "
9831007 fi
9841008 opts="${opts}gprof"
9851009 fi
1010+ if test "x$enable_profile" = xgperftools; then
1011+ if test "x$opts" != x; then
1012+ opts="${opts}, "
1013+ fi
1014+ opts="${opts}gperftools"
1015+ fi
9861016 if test "x$opts" != x; then
9871017 opts=" (${opts})"
9881018 fi
@@ -1023,12 +1053,18 @@ if test "x$build_tform" = xyes; then
10231053 fi
10241054 opts="${opts}statically linked"
10251055 fi
1026- if test "x$enable_profile" = xyes ; then
1056+ if test "x$enable_profile" = xgprof ; then
10271057 if test "x$opts" != x; then
10281058 opts="${opts}, "
10291059 fi
10301060 opts="${opts}gprof"
10311061 fi
1062+ if test "x$enable_profile" = xgperftools; then
1063+ if test "x$opts" != x; then
1064+ opts="${opts}, "
1065+ fi
1066+ opts="${opts}gperftools"
1067+ fi
10321068 if test "x$opts" != x; then
10331069 opts=" (${opts})"
10341070 fi
@@ -1069,12 +1105,18 @@ if test "x$build_parform" = xyes; then
10691105 fi
10701106 opts="${opts}statically linked"
10711107 fi
1072- if test "x$enable_profile" = xyes ; then
1108+ if test "x$enable_profile" = xgprof ; then
10731109 if test "x$opts" != x; then
10741110 opts="${opts}, "
10751111 fi
10761112 opts="${opts}gprof"
10771113 fi
1114+ if test "x$enable_profile" = xgperftools; then
1115+ if test "x$opts" != x; then
1116+ opts="${opts}, "
1117+ fi
1118+ opts="${opts}gperftools"
1119+ fi
10781120 if test "x$opts" != x; then
10791121 opts=" (${opts})"
10801122 fi
0 commit comments