Index: include/hwloc.h =================================================================== --- include/hwloc.h (revision 3177) +++ include/hwloc.h (working copy) @@ -181,10 +181,11 @@ * any structure. */ - HWLOC_OBJ_MISC /**< \brief Miscellaneous objects. + HWLOC_OBJ_MISC, /**< \brief Miscellaneous objects. * Objects without particular meaning, that can e.g. be * added by the application for its own use. */ + HWLOC_OBJ_MAX /**< \private Sentinel value */ } hwloc_obj_type_t; /** \brief Compare the depth of two object types Index: include/private/debug.h =================================================================== --- include/private/debug.h (revision 3177) +++ include/private/debug.h (working copy) @@ -14,7 +14,22 @@ #include #ifdef HWLOC_DEBUG -#define hwloc_debug(s, ...) fprintf(stderr, s, ##__VA_ARGS__) +#include +#include +#endif + +static inline void hwloc_debug(const char *s __hwloc_attribute_unused, ...) +{ +#ifdef HWLOC_DEBUG + va_list ap; + + va_start(s, ap); + vfprintf(stderr, s, ap); + va_end(ap); +#endif +} + +#ifdef HWLOC_DEBUG #define hwloc_debug_bitmap(fmt, bitmap) do { \ char *s= hwloc_bitmap_printf_value(bitmap); \ fprintf(stderr, fmt, s); \ @@ -31,7 +46,6 @@ free(s); \ } while (0) #else -#define hwloc_debug(s, ...) do { } while(0) #define hwloc_debug_bitmap(s, bitmap) do { } while(0) #define hwloc_debug_1arg_bitmap(s, arg1, bitmap) do { } while(0) #define hwloc_debug_2args_bitmap(s, arg1, arg2, bitmap) do { } while(0) Index: src/topology-darwin.c =================================================================== --- src/topology-darwin.c (revision 3177) +++ src/topology-darwin.c (working copy) @@ -106,10 +106,20 @@ if (!sysctlbyname("hw.cacheconfig", NULL, &size, NULL, 0)) { unsigned n = size / sizeof(uint32_t); - uint64_t cacheconfig[n]; - uint32_t cacheconfig32[n]; - uint64_t cachesize[n]; + uint64_t *cacheconfig = NULL; + uint64_t *cachesize = NULL; + uint32_t *cacheconfig32 = NULL; + cacheconfig = malloc(sizeof(uint64_t) * n * 2); + if (NULL == cacheconfig) { + goto out; + } + cachesize = cacheconfig + n; + cacheconfig32 = malloc(sizeof(uint32_t) * n); + if (NULL == cacheconfig32) { + goto out; + } + if ((!sysctlbyname("hw.cacheconfig", cacheconfig, &size, NULL, 0))) { /* Yeech. Darwin seemingly has changed from 32bit to 64bit integers for * cacheconfig, with apparently no way for detection. Assume the machine @@ -178,8 +188,16 @@ } } } + out: + if (NULL != cacheconfig) { + free(cacheconfig); + } + if (NULL != cacheconfig32) { + free(cacheconfig32); + } } + /* add PU objects */ hwloc_setup_pu_level(topology, nprocs); Index: src/topology-x86.c =================================================================== --- src/topology-x86.c (revision 3177) +++ src/topology-x86.c (working copy) @@ -270,7 +270,7 @@ static void summarize(hwloc_topology_t topology, struct procinfo *infos, unsigned nbprocs) { hwloc_bitmap_t complete_cpuset = hwloc_bitmap_alloc(); - unsigned i, j, one, level; + unsigned i, j, l, one, level; for (i = 0; i < nbprocs; i++) if (infos[i].present) { @@ -375,7 +375,6 @@ /* Look for caches */ /* First find max level */ level = 0; - unsigned l; for (i = 0; i < nbprocs; i++) for (j = 0; j < infos[i].numcaches; j++) if (infos[i].cache[j].level > level) @@ -461,12 +460,17 @@ unsigned i; unsigned highest_cpuid; unsigned highest_ext_cpuid; - struct procinfo infos[nbprocs]; + struct procinfo *infos = NULL; enum cpuid_type cpuid_type = unknown; if (!hwloc_have_cpuid()) return; + infos = malloc(sizeof(struct procinfo) * nbprocs); + if (NULL == infos) { + return; + } + eax = 0x00; hwloc_cpuid(&eax, &ebx, &ecx, &edx); highest_cpuid = eax; @@ -476,8 +480,9 @@ cpuid_type = amd; hwloc_debug("highest cpuid %x, cpuid type %u\n", highest_cpuid, cpuid_type); - if (highest_cpuid < 0x01) - return; + if (highest_cpuid < 0x01) { + goto free; + } eax = 0x80000000; hwloc_cpuid(&eax, &ebx, &ecx, &edx); @@ -500,7 +505,7 @@ topology->set_thisthread_cpubind(topology, orig_cpuset, 0); hwloc_bitmap_free(orig_cpuset); summarize(topology, infos, nbprocs); - return; + goto free; } } if (topology->get_thisproc_cpubind && topology->set_thisproc_cpubind) { @@ -516,10 +521,15 @@ topology->set_thisproc_cpubind(topology, orig_cpuset, 0); hwloc_bitmap_free(orig_cpuset); summarize(topology, infos, nbprocs); - return; + goto free; } } #endif hwloc_add_object_info(topology->levels[0][0], "Backend", "x86"); + + free: + if (NULL != infos) { + free(infos); + } } Index: src/topology-linux.c =================================================================== --- src/topology-linux.c (revision 3177) +++ src/topology-linux.c (working copy) @@ -573,8 +573,11 @@ hwloc_linux_get_pid_cpubind(hwloc_topology_t topology, pid_t pid, hwloc_bitmap_t hwloc_set, int flags) { hwloc_bitmap_t tidset = hwloc_bitmap_alloc(); - hwloc_bitmap_t cpusets[2] = { hwloc_set, tidset }; + hwloc_bitmap_t cpusets[2]; int ret; + + cpusets[0] = hwloc_set; + cpusets[1] = tidset; ret = hwloc_linux_foreach_proc_tid(topology, pid, hwloc_linux_foreach_proc_tid_get_cpubind_cb, (void*) cpusets, flags); @@ -902,8 +905,11 @@ hwloc_linux_get_pid_lastcpuexec(hwloc_topology_t topology, pid_t pid, hwloc_bitmap_t hwloc_set, int flags) { hwloc_bitmap_t tidset = hwloc_bitmap_alloc(); - hwloc_bitmap_t cpusets[2] = { hwloc_set, tidset }; + hwloc_bitmap_t cpusets[2]; int ret; + + cpusets[0] = hwloc_set; + cpusets[1] = tidset; ret = hwloc_linux_foreach_proc_tid(topology, pid, hwloc_linux_foreach_proc_tid_get_lastcpuexec_cb, (void*) cpusets, flags); @@ -1926,15 +1932,20 @@ return; } - /* For convenience, put these declarations inside a block. Saves us - from a bunch of mallocs, particularly with the 2D array. */ + /* For convenience, put these declarations inside a block. */ { hwloc_obj_t * nodes = calloc(nbnodes, sizeof(hwloc_obj_t)); float * distances = calloc(nbnodes*nbnodes, sizeof(float)); - unsigned nonsparse_physical_indexes[nbnodes]; + unsigned *nonsparse_physical_indexes = + calloc(nbnodes, sizeof(unsigned)); unsigned index_; + if (NULL == nonsparse_physical_indexes || + NULL == distances || NULL == nodes) { + goto out; + } + /* Get node indexes now. We need them in order since Linux groups * sparse distances but keep them in order in the sysfs distance files. */ @@ -1985,6 +1996,11 @@ topology->os_distances[HWLOC_OBJ_NODE].nbobjs = nbnodes; topology->os_distances[HWLOC_OBJ_NODE].objs = nodes; topology->os_distances[HWLOC_OBJ_NODE].distances = distances; + +out: + if (NULL != nonsparse_physical_indexes) { + free(nonsparse_physical_indexes); + } } *found = nbnodes; @@ -1995,18 +2011,25 @@ static void * hwloc_read_raw(const char *p, const char *p1, size_t *bytes_read, int root_fd) { - char fname[strlen(p) + 1 + strlen(p1) + 1]; + char *fname = NULL; char *ret = NULL; struct stat fs; + int file = -1; + unsigned len; - snprintf(fname, sizeof(fname), "%s/%s", p, p1); + len = strlen(p) + 1 + strlen(p1) + 1; + fname = malloc(len); + if (NULL == fname) { + return NULL; + } + snprintf(fname, len, "%s/%s", p, p1); - int file = hwloc_open(fname, root_fd); - if (-1 == file) - return NULL; + file = hwloc_open(fname, root_fd); + if (-1 == file) { + goto out; + } if (fstat(file, &fs)) { - close(file); - return NULL; + goto out; } ret = (char *) malloc(fs.st_size); @@ -2020,7 +2043,12 @@ *bytes_read = cb; } } + + out: close(file); + if (NULL != fname) { + free(fname); + } return ret; } @@ -2119,6 +2147,7 @@ /* d-tlb-size - ignore, always 0 on power6 */ /* i-cache-* and i-tlb-* represent instruction cache, ignore */ uint32_t d_cache_line_size = 0, d_cache_size = 0; + struct hwloc_obj *c = NULL; hwloc_read_unit32be(cpu, "d-cache-line-size", &d_cache_line_size, topology->backend_params.sysfs.root_fd); @@ -2128,7 +2157,7 @@ if ( (0 == d_cache_line_size) && (0 == d_cache_size) ) return; - struct hwloc_obj *c = hwloc_alloc_setup_object(HWLOC_OBJ_CACHE, -1); + c = hwloc_alloc_setup_object(HWLOC_OBJ_CACHE, -1); c->attr->cache.depth = level; c->attr->cache.linesize = d_cache_line_size; c->attr->cache.size = d_cache_size; @@ -2144,35 +2173,46 @@ static void look_powerpc_device_tree(struct hwloc_topology *topology) { - device_tree_cpus_t cpus = { .n = 0, .p = NULL, .allocated = 0 }; + device_tree_cpus_t cpus; const char ofroot[] = "/proc/device-tree/cpus"; unsigned int i; - int root_fd = topology->backend_params.sysfs.root_fd; DIR *dt = hwloc_opendir(ofroot, root_fd); + struct dirent *dirent; + + cpus.n = 0; + cpus.p = NULL; + cpus.allocated = 0; + if (NULL == dt) return; - struct dirent *dirent; while (NULL != (dirent = readdir(dt))) { + struct stat statbuf; + int err; + char *cpu; + char *device_type; + uint32_t reg = -1, l2_cache = -1, phandle = -1; + unsigned len; if ('.' == dirent->d_name[0]) continue; - char cpu[sizeof(ofroot) + 1 + strlen(dirent->d_name) + 1]; - snprintf(cpu, sizeof(cpu), "%s/%s", ofroot, dirent->d_name); - struct stat statbuf; - int err; + len = sizeof(ofroot) + 1 + strlen(dirent->d_name) + 1; + cpu = malloc(len); + if (NULL == cpu) { + return; + } + snprintf(cpu, len, "%s/%s", ofroot, dirent->d_name); err = hwloc_stat(cpu, &statbuf, root_fd); if (err < 0 || !S_ISDIR(statbuf.st_mode)) continue; - char *device_type = hwloc_read_str(cpu, "device_type", root_fd); + device_type = hwloc_read_str(cpu, "device_type", root_fd); if (NULL == device_type) continue; - uint32_t reg = -1, l2_cache = -1, phandle = -1; hwloc_read_unit32be(cpu, "reg", ®, root_fd); if (hwloc_read_unit32be(cpu, "next-level-cache", &l2_cache, root_fd) == -1) hwloc_read_unit32be(cpu, "l2-cache", &l2_cache, root_fd); @@ -2205,10 +2245,11 @@ if (NULL == cpuset) { hwloc_debug("%s has no \"reg\" property, skipping\n", cpu); } else { + struct hwloc_obj *core = NULL; add_device_tree_cpus_node(&cpus, cpuset, l2_cache, phandle, dirent->d_name); /* Add core */ - struct hwloc_obj *core = hwloc_alloc_setup_object(HWLOC_OBJ_CORE, reg); + core = hwloc_alloc_setup_object(HWLOC_OBJ_CORE, reg); core->cpuset = hwloc_bitmap_dup(cpuset); hwloc_insert_object_by_cpuset(topology, core); @@ -2219,6 +2260,7 @@ } free(device_type); } + free(cpu); } closedir(dt); @@ -2242,20 +2284,28 @@ /* Scan L2/L3/... caches */ for (i = 0; i < cpus.n; ++i) { + unsigned int level = 2; + hwloc_bitmap_t cpuset; /* Skip real CPUs */ if (NULL != cpus.p[i].cpuset) continue; /* Calculate cache level and CPU mask */ - unsigned int level = 2; - hwloc_bitmap_t cpuset = hwloc_bitmap_alloc(); + cpuset = hwloc_bitmap_alloc(); if (0 == look_powerpc_device_tree_discover_cache(&cpus, cpus.p[i].phandle, &level, cpuset)) { + char *cpu; + unsigned len; - char cpu[sizeof(ofroot) + 1 + strlen(cpus.p[i].name) + 1]; - snprintf(cpu, sizeof(cpu), "%s/%s", ofroot, cpus.p[i].name); + len = sizeof(ofroot) + 1 + strlen(cpus.p[i].name) + 1; + cpu = malloc(len); + if (NULL == cpu) { + return; + } + snprintf(cpu, len, "%s/%s", ofroot, cpus.p[i].name); try_add_cache_from_device_tree_cpu(topology, cpu, level, cpuset); + free(cpu); } hwloc_bitmap_free(cpuset); } @@ -2278,6 +2328,7 @@ DIR *dir; int i,j; FILE *fd; + unsigned caches_added; cpuset = hwloc_bitmap_alloc(); @@ -2330,7 +2381,7 @@ hwloc_debug_1arg_bitmap("found %d cpu topologies, cpuset %s\n", hwloc_bitmap_weight(cpuset), cpuset); - unsigned caches_added = 0; + caches_added = 0; hwloc_bitmap_foreach_begin(i, cpuset) { struct hwloc_obj *sock, *core, *thread; @@ -2489,8 +2540,9 @@ hwloc_bitmap_t online_cpuset) { FILE *fd; - char str[strlen(PHYSID)+1+9+1+1]; + char *str = NULL; char *endptr; + unsigned len; unsigned proc_physids[HWLOC_NBMAXCPUS]; unsigned osphysids[HWLOC_NBMAXCPUS]; unsigned proc_coreids[HWLOC_NBMAXCPUS]; @@ -2528,8 +2580,10 @@ cpuset = hwloc_bitmap_alloc(); /* Just record information and count number of sockets and cores */ + len = strlen(PHYSID) + 1 + 9 + 1 + 1; + str = malloc(len); hwloc_debug("%s", "\n\n * Topology extraction from /proc/cpuinfo *\n\n"); - while (fgets(str,sizeof(str),fd)!=NULL) + while (fgets(str,len,fd)!=NULL) { # define getprocnb_begin(field, var) \ if ( !strncmp(field,str,strlen(field))) \ @@ -2595,6 +2649,7 @@ } } fclose(fd); + free(str); if (processor == (unsigned long) -1) { hwloc_bitmap_free(cpuset); Index: src/topology.c =================================================================== --- src/topology.c (revision 3177) +++ src/topology.c (working copy) @@ -279,28 +279,23 @@ HWLOC_TYPE_EQUAL }; -static const unsigned obj_type_order[] = { - [HWLOC_OBJ_SYSTEM] = 0, - [HWLOC_OBJ_MACHINE] = 1, - [HWLOC_OBJ_GROUP] = 2, - [HWLOC_OBJ_NODE] = 3, - [HWLOC_OBJ_SOCKET] = 4, - [HWLOC_OBJ_CACHE] = 5, - [HWLOC_OBJ_CORE] = 6, - [HWLOC_OBJ_PU] = 7, - [HWLOC_OBJ_MISC] = 8, -}; +/* Can't (safely) initialize this array statically without C99 syntax + (since it relies on ordering by enum names, not necessarily 0 .. N + ordering). It is therefore initialized down in + hwloc_topology_init(). */ +static int orders_initialized = 0; +static unsigned obj_type_order[HWLOC_OBJ_MAX]; static const hwloc_obj_type_t obj_order_type[] = { - [0] = HWLOC_OBJ_SYSTEM, - [1] = HWLOC_OBJ_MACHINE, - [2] = HWLOC_OBJ_GROUP, - [3] = HWLOC_OBJ_NODE, - [4] = HWLOC_OBJ_SOCKET, - [5] = HWLOC_OBJ_CACHE, - [6] = HWLOC_OBJ_CORE, - [7] = HWLOC_OBJ_PU, - [8] = HWLOC_OBJ_MISC + HWLOC_OBJ_SYSTEM, + HWLOC_OBJ_MACHINE, + HWLOC_OBJ_GROUP, + HWLOC_OBJ_NODE, + HWLOC_OBJ_SOCKET, + HWLOC_OBJ_CACHE, + HWLOC_OBJ_CORE, + HWLOC_OBJ_PU, + HWLOC_OBJ_MISC, }; static unsigned __hwloc_attribute_const @@ -1723,6 +1718,21 @@ struct hwloc_topology *topology; int i; + /* Setup ordering arrays */ + if (!orders_initialized) { + obj_type_order[HWLOC_OBJ_SYSTEM] = 0; + obj_type_order[HWLOC_OBJ_MACHINE] = 1; + obj_type_order[HWLOC_OBJ_GROUP] = 2; + obj_type_order[HWLOC_OBJ_NODE] = 3; + obj_type_order[HWLOC_OBJ_SOCKET] = 4; + obj_type_order[HWLOC_OBJ_CACHE] = 5; + obj_type_order[HWLOC_OBJ_CORE] = 6; + obj_type_order[HWLOC_OBJ_PU] = 7; + obj_type_order[HWLOC_OBJ_MISC] = 8; + + orders_initialized = 1; + } + topology = malloc (sizeof (struct hwloc_topology)); if(!topology) return -1; Index: src/bind.c =================================================================== --- src/bind.c (revision 3177) +++ src/bind.c (working copy) @@ -491,8 +491,8 @@ void * hwloc_alloc_membind_nodeset(hwloc_topology_t topology, size_t len, hwloc_const_nodeset_t nodeset, hwloc_membind_policy_t policy, int flags) { + void *p; nodeset = hwloc_fix_membind(topology, nodeset); - void *p; if (!nodeset) goto fallback; if (flags & HWLOC_MEMBIND_MIGRATE) { Index: src/distances.c =================================================================== --- src/distances.c (revision 3177) +++ src/distances.c (working copy) @@ -183,9 +183,9 @@ { hwloc_obj_type_t type; for(type = HWLOC_OBJ_SYSTEM; type < HWLOC_OBJ_TYPE_MAX; type++) { - char envname[64]; + char *env, envname[64]; snprintf(envname, sizeof(envname), "HWLOC_%s_DISTANCES", hwloc_obj_type_string(type)); - char *env = getenv(envname); + env = getenv(envname); if (env) hwloc_get_type_distances_from_string(topology, type, env); } @@ -360,19 +360,20 @@ float *_distances, unsigned *groupids) { - float (*distances)[nbobjs][nbobjs] = (float (*)[nbobjs][nbobjs])_distances; float min_distance = FLT_MAX; unsigned groupid = 1; unsigned i,j,k; unsigned skipped = 0; +#define DISTANCE(i, j) _distances[i * nbobjs + j] + memset(groupids, 0, nbobjs*sizeof(*groupids)); /* find the minimal distance */ for(i=0; itype)); - if (nbobjs <= 2) - return; + if (nbobjs <= 2) { + return; + } + groupids = malloc(sizeof(unsigned) * nbobjs); + if (NULL == groupids) { + return; + } + nbgroups = hwloc_setup_group_from_min_distance(nbobjs, _distances, groupids); - if (!nbgroups) - return; + if (!nbgroups) { + goto outter_free; + } - /* For convenience, put these declarations inside a block. Saves us - from a bunch of mallocs, particularly with the 2D array. */ + /* For convenience, put these declarations inside a block. It's a + crying shame we can't use C99 syntax here, and have to do a bunch + of mallocs. :-( */ { - hwloc_obj_t groupobjs[nbgroups]; - unsigned groupsizes[nbgroups]; - float groupdistances[nbgroups][nbgroups]; + hwloc_obj_t *groupobjs = NULL; + unsigned *groupsizes = NULL; + float *groupdistances = NULL; + + groupobjs = malloc(sizeof(hwloc_obj_t) * nbgroups); + groupsizes = malloc(sizeof(unsigned) * nbgroups); + groupdistances = malloc(sizeof(float) * nbgroups * nbgroups); + if (NULL == groupobjs || NULL == groupsizes || NULL == groupdistances) { + goto inner_free; + } /* create new Group objects and record their size */ - memset(groupsizes, 0, sizeof(groupsizes)); + memset(&(groupsizes[0]), 0, sizeof(groupsizes[0]) * nbgroups); for(i=0; ios_index); for(j=0; jbackend_params.synthetic.id[level]++); @@ -286,6 +288,8 @@ break; case HWLOC_OBJ_PU: break; + case HWLOC_OBJ_MAX: + break; } return first_cpu; Index: utils/lstopo-draw.c =================================================================== --- utils/lstopo-draw.c (revision 3177) +++ utils/lstopo-draw.c (working copy) @@ -742,6 +742,7 @@ case HWLOC_OBJ_PU: return pu_draw; case HWLOC_OBJ_GROUP: return group_draw; case HWLOC_OBJ_MISC: return misc_draw; + case HWLOC_OBJ_MAX: return misc_draw; } return NULL; } Index: utils/Makefile.am =================================================================== --- utils/Makefile.am (revision 3177) +++ utils/Makefile.am (working copy) @@ -1,8 +1,10 @@ # Copyright © 2009-2010 INRIA # Copyright © 2009-2010 Université Bordeaux 1 -# Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved. +# Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved. +# +# See COPYING in top-level directory. -AM_CFLAGS = $(HWLOC_CFLAGS) +AM_CFLAGS = $(HWLOC_CFLAGS) $(HWLOC_C99_FLAGS) AM_CPPFLAGS = $(HWLOC_CPPFLAGS) AM_LDFLAGS = $(HWLOC_LDFLAGS) @@ -27,7 +29,7 @@ if HWLOC_HAVE_WINDOWS lstopo_SOURCES += lstopo-windows.c endif -lstopo_CFLAGS = $(HWLOC_CAIRO_CFLAGS) $(HWLOC_XML_CFLAGS) +lstopo_CFLAGS = $(HWLOC_CAIRO_CFLAGS) $(HWLOC_XML_CFLAGS) $(HWLOC_C99_FLAGS) lstopo_LDADD = $(LDADD) $(HWLOC_CAIRO_LIBS) $(HWLOC_XML_LIBS) -lm $(HWLOC_TERMCAP_LIBS) $(HWLOC_X11_LIBS) hwloc_calc_SOURCES = hwloc-calc.c hwloc-calc.h Index: config/hwloc_internal.m4 =================================================================== --- config/hwloc_internal.m4 (revision 3177) +++ config/hwloc_internal.m4 (working copy) @@ -10,7 +10,9 @@ dnl Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, dnl University of Stuttgart. All rights reserved. dnl Copyright © 2010 INRIA -dnl Copyright © 2006-2010 Cisco Systems, Inc. All rights reserved. +dnl Copyright © 2006-2011 Cisco Systems, Inc. All rights reserved. +dnl +dnl See COPYING in top-level directory. #----------------------------------------------------------------------- @@ -208,6 +210,18 @@ hwloc_build_utils=yes + # The utils require C99 support + hwloc_CC_save=$CC + hwloc_CFLAGS_save=$CFLAGS + AC_PROG_CC_C99 + AS_IF([test "$ac_cv_prog_cc_c99" = no], + [AC_MSG_WARN([C99 support is required by the hwloc utils]) + AC_MSG_ERROR([Cannot continue])]) + HWLOC_C99_FLAGS=`echo $CC | sed -e "s;^$hwloc_CC_save;;"` + AC_SUBST(HWLOC_C99_FLAGS) + CC=$hwloc_CC_save + CFLAGS=$hwloc_CFLAGS_save + # Cairo support if test "x$enable_cairo" != "xno"; then HWLOC_PKG_CHECK_MODULES([CAIRO], [cairo], [cairo_fill], [:], [enable_cairo=no]) Index: config/hwloc.m4 =================================================================== --- config/hwloc.m4 (revision 3177) +++ config/hwloc.m4 (working copy) @@ -134,27 +134,6 @@ [AC_DEFINE([HWLOC_SYM_TRANSFORM], [0])], [AC_DEFINE([HWLOC_SYM_TRANSFORM], [1])]) - # - # Define C flags - # - - # hwloc uses C99 style, so ensure that we can figure out which - # compiler flags will drive this. - hwloc_CC_save=$CC - hwloc_CFLAGS_save=$CFLAGS - AC_PROG_CC_C99 - AS_IF([test x"$ac_cv_prog_cc_c99" = xno], - [AC_WARN([C99 support is required by hwloc]) - $3], - [HWLOC_SETUP_CORE_AFTER_C99($1, $2, $3, $4)]) -]) - -dnl Same order of parameters form HWLOC-SETUP-CORE -AC_DEFUN([HWLOC_SETUP_CORE_AFTER_C99],[ - hwloc_CC_c99_flags=`echo $CC | sed -e "s;^$hwloc_CC_save;;"` - CC=$hwloc_CC_save - CFLAGS=$hwloc_CFLAGS_save - # GCC specifics. if test "x$GCC" = "xyes"; then HWLOC_GCC_CFLAGS="-Wall -Wmissing-prototypes -Wundef" @@ -559,7 +538,6 @@ # Setup HWLOC's C, CPP, and LD flags, and LIBS AC_SUBST(HWLOC_REQUIRES) - HWLOC_CFLAGS="$hwloc_CC_c99_flags $HWLOC_CFLAGS" AC_SUBST(HWLOC_CFLAGS) HWLOC_CPPFLAGS='-I$(HWLOC_top_srcdir)/include -I$(HWLOC_top_builddir)/include' AC_SUBST(HWLOC_CPPFLAGS)