forked from open-mpi/hwloc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhwloc.m4
1364 lines (1239 loc) · 53 KB
/
hwloc.m4
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 -*- Autoconf -*-
dnl
dnl Copyright © 2009-2016 Inria. All rights reserved.
dnl Copyright © 2009-2012, 2015-2017 Université Bordeaux
dnl Copyright © 2004-2005 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright © 2004-2012 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright © 2004-2008 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright © 2006-2017 Cisco Systems, Inc. All rights reserved.
dnl Copyright © 2012 Blue Brain Project, BBP/EPFL. All rights reserved.
dnl Copyright © 2012 Oracle and/or its affiliates. All rights reserved.
dnl See COPYING in top-level directory.
# Main hwloc m4 macro, to be invoked by the user
#
# Expects two or three paramters:
# 1. Configuration prefix
# 2. What to do upon success
# 3. What to do upon failure
# 4. If non-empty, print the announcement banner
#
AC_DEFUN([HWLOC_SETUP_CORE],[
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([AC_CANONICAL_TARGET])
AC_REQUIRE([AC_PROG_CC])
AS_IF([test "x$4" != "x"],
[cat <<EOF
###
### Configuring hwloc core
###
EOF])
# If no prefix was defined, set a good value
m4_ifval([$1],
[m4_define([hwloc_config_prefix],[$1/])],
[m4_define([hwloc_config_prefix], [])])
# Unless previously set to "standalone" mode, default to embedded
# mode
AS_IF([test "$hwloc_mode" = ""], [hwloc_mode=embedded])
AC_MSG_CHECKING([hwloc building mode])
AC_MSG_RESULT([$hwloc_mode])
# Get hwloc's absolute top builddir (which may not be the same as
# the real $top_builddir, because we may be building in embedded
# mode).
HWLOC_startdir=`pwd`
if test x"hwloc_config_prefix" != "x" -a ! -d "hwloc_config_prefix"; then
mkdir -p "hwloc_config_prefix"
fi
if test x"hwloc_config_prefix" != "x"; then
cd "hwloc_config_prefix"
fi
HWLOC_top_builddir=`pwd`
AC_SUBST(HWLOC_top_builddir)
# Get hwloc's absolute top srcdir (which may not be the same as
# the real $top_srcdir, because we may be building in embedded
# mode). First, go back to the startdir incase the $srcdir is
# relative.
cd "$HWLOC_startdir"
cd "$srcdir"/hwloc_config_prefix
HWLOC_top_srcdir="`pwd`"
AC_SUBST(HWLOC_top_srcdir)
# Go back to where we started
cd "$HWLOC_startdir"
AC_MSG_NOTICE([hwloc builddir: $HWLOC_top_builddir])
AC_MSG_NOTICE([hwloc srcdir: $HWLOC_top_srcdir])
if test "$HWLOC_top_builddir" != "$HWLOC_top_srcdir"; then
AC_MSG_NOTICE([Detected VPATH build])
fi
# Get the version of hwloc that we are installing
AC_MSG_CHECKING([for hwloc version])
HWLOC_VERSION="`$HWLOC_top_srcdir/config/hwloc_get_version.sh $HWLOC_top_srcdir/VERSION`"
if test "$?" != "0"; then
AC_MSG_ERROR([Cannot continue])
fi
HWLOC_RELEASE_DATE="`$HWLOC_top_srcdir/config/hwloc_get_version.sh $HWLOC_top_srcdir/VERSION --release-date`"
AC_SUBST(HWLOC_VERSION)
AC_DEFINE_UNQUOTED([HWLOC_VERSION], ["$HWLOC_VERSION"],
[The library version, always available, even in embedded mode, contrary to VERSION])
AC_SUBST(HWLOC_RELEASE_DATE)
AC_MSG_RESULT([$HWLOC_VERSION])
# Debug mode?
AC_MSG_CHECKING([if want hwloc maintainer support])
hwloc_debug=
# Unconditionally disable debug mode in embedded mode; if someone
# asks, we can add a configure-time option for it. Disable it
# now, however, because --enable-debug is not even added as an
# option when configuring in embedded mode, and we wouldn't want
# to hijack the enclosing application's --enable-debug configure
# switch.
AS_IF([test "$hwloc_mode" = "embedded"],
[hwloc_debug=0
hwloc_debug_msg="disabled (embedded mode)"])
AS_IF([test "$hwloc_debug" = "" -a "$enable_debug" = "yes"],
[hwloc_debug=1
hwloc_debug_msg="enabled"])
AS_IF([test "$hwloc_debug" = ""],
[hwloc_debug=0
hwloc_debug_msg="disabled"])
# Grr; we use #ifndef for HWLOC_DEBUG! :-(
AH_TEMPLATE(HWLOC_DEBUG, [Whether we are in debugging mode or not])
AS_IF([test "$hwloc_debug" = "1"], [AC_DEFINE([HWLOC_DEBUG])])
AC_MSG_RESULT([$hwloc_debug_msg])
# We need to set a path for header, etc files depending on whether
# we're standalone or embedded. this is taken care of by HWLOC_EMBEDDED.
AC_MSG_CHECKING([for hwloc directory prefix])
AC_MSG_RESULT(m4_ifval([$1], hwloc_config_prefix, [(none)]))
# Note that private/config.h *MUST* be listed first so that it
# becomes the "main" config header file. Any AC-CONFIG-HEADERS
# after that (hwloc/config.h) will only have selective #defines
# replaced, not the entire file.
AC_CONFIG_HEADERS(hwloc_config_prefix[include/private/autogen/config.h])
AC_CONFIG_HEADERS(hwloc_config_prefix[include/hwloc/autogen/config.h])
# What prefix are we using?
AC_MSG_CHECKING([for hwloc symbol prefix])
AS_IF([test "$hwloc_symbol_prefix_value" = ""],
[AS_IF([test "$with_hwloc_symbol_prefix" = ""],
[hwloc_symbol_prefix_value=hwloc_],
[hwloc_symbol_prefix_value=$with_hwloc_symbol_prefix])])
AC_DEFINE_UNQUOTED(HWLOC_SYM_PREFIX, [$hwloc_symbol_prefix_value],
[The hwloc symbol prefix])
# Ensure to [] escape the whole next line so that we can get the
# proper tr tokens
[hwloc_symbol_prefix_value_caps="`echo $hwloc_symbol_prefix_value | tr '[:lower:]' '[:upper:]'`"]
AC_DEFINE_UNQUOTED(HWLOC_SYM_PREFIX_CAPS, [$hwloc_symbol_prefix_value_caps],
[The hwloc symbol prefix in all caps])
AC_MSG_RESULT([$hwloc_symbol_prefix_value])
# Give an easy #define to know if we need to transform all the
# hwloc names
AH_TEMPLATE([HWLOC_SYM_TRANSFORM], [Whether we need to re-define all the hwloc public symbols or not])
AS_IF([test "$hwloc_symbol_prefix_value" = "hwloc_"],
[AC_DEFINE([HWLOC_SYM_TRANSFORM], [0])],
[AC_DEFINE([HWLOC_SYM_TRANSFORM], [1])])
# GCC specifics.
if test "x$GCC" = "xyes"; then
HWLOC_GCC_CFLAGS="-Wall -Wmissing-prototypes -Wundef"
HWLOC_GCC_CFLAGS="$HWLOC_GCC_CFLAGS -Wpointer-arith -Wcast-align"
fi
# Enample system extensions for O_DIRECTORY, fdopen, fssl, etc.
AH_VERBATIM([USE_HPUX_SYSTEM_EXTENSIONS],
[/* Enable extensions on HP-UX. */
#ifndef _HPUX_SOURCE
# undef _HPUX_SOURCE
#endif
])
AC_DEFINE([_HPUX_SOURCE], [1], [Are we building for HP-UX?])
AC_LANG_PUSH([C])
# Check to see if we're producing a 32 or 64 bit executable by
# checking the sizeof void*. Note that AC CHECK_SIZEOF even works
# when cross compiling (!), according to the AC 2.64 docs. This
# check is needed because on some systems, you can instruct the
# compiler to specifically build 32 or 64 bit executables -- even
# though the $target may indicate something different.
AC_CHECK_SIZEOF([void *])
#
# List of components to be built, either statically or dynamically.
# To be enlarged below.
#
hwloc_components="noos xml synthetic xml_nolibxml"
#
# Check OS support
#
AC_MSG_CHECKING([which OS support to include])
case ${target} in
powerpc64-bgq-linux*) # must be before Linux
AC_DEFINE(HWLOC_BGQ_SYS, 1, [Define to 1 on BlueGene/Q])
hwloc_bgq=yes
AC_MSG_RESULT([bgq])
hwloc_components="$hwloc_components bgq"
;;
*-*-linux*)
AC_DEFINE(HWLOC_LINUX_SYS, 1, [Define to 1 on Linux])
hwloc_linux=yes
AC_MSG_RESULT([Linux])
hwloc_components="$hwloc_components linux"
if test "x$enable_io" != xno; then
hwloc_components="$hwloc_components linuxio"
AC_DEFINE(HWLOC_HAVE_LINUXIO, 1, [Define to 1 if building the Linux I/O component])
hwloc_linuxio_happy=yes
if test x$enable_pci != xno; then
AC_DEFINE(HWLOC_HAVE_LINUXPCI, 1, [Define to 1 if enabling Linux-specific PCI discovery in the Linux I/O component])
hwloc_linuxpci_happy=yes
fi
fi
;;
*-*-irix*)
AC_DEFINE(HWLOC_IRIX_SYS, 1, [Define to 1 on Irix])
hwloc_irix=yes
AC_MSG_RESULT([IRIX])
# no irix component yet
;;
*-*-darwin*)
AC_DEFINE(HWLOC_DARWIN_SYS, 1, [Define to 1 on Darwin])
hwloc_darwin=yes
AC_MSG_RESULT([Darwin])
hwloc_components="$hwloc_components darwin"
;;
*-*-solaris*)
AC_DEFINE(HWLOC_SOLARIS_SYS, 1, [Define to 1 on Solaris])
hwloc_solaris=yes
AC_MSG_RESULT([Solaris])
hwloc_components="$hwloc_components solaris"
;;
*-*-aix*)
AC_DEFINE(HWLOC_AIX_SYS, 1, [Define to 1 on AIX])
hwloc_aix=yes
AC_MSG_RESULT([AIX])
hwloc_components="$hwloc_components aix"
;;
*-*-hpux*)
AC_DEFINE(HWLOC_HPUX_SYS, 1, [Define to 1 on HP-UX])
hwloc_hpux=yes
AC_MSG_RESULT([HP-UX])
hwloc_components="$hwloc_components hpux"
;;
*-*-mingw*|*-*-cygwin*)
AC_DEFINE(HWLOC_WIN_SYS, 1, [Define to 1 on WINDOWS])
hwloc_windows=yes
AC_MSG_RESULT([Windows])
hwloc_components="$hwloc_components windows"
;;
*-*-*freebsd*)
AC_DEFINE(HWLOC_FREEBSD_SYS, 1, [Define to 1 on *FREEBSD])
hwloc_freebsd=yes
AC_MSG_RESULT([FreeBSD])
hwloc_components="$hwloc_components freebsd"
;;
*-*-*netbsd*)
AC_DEFINE(HWLOC_NETBSD_SYS, 1, [Define to 1 on *NETBSD])
hwloc_netbsd=yes
AC_MSG_RESULT([NetBSD])
hwloc_components="$hwloc_components netbsd"
;;
*)
AC_MSG_RESULT([Unsupported! ($target)])
AC_DEFINE(HWLOC_UNSUPPORTED_SYS, 1, [Define to 1 on unsupported systems])
AC_MSG_WARN([***********************************************************])
AC_MSG_WARN([*** hwloc does not support this system.])
AC_MSG_WARN([*** hwloc will *attempt* to build (but it may not work).])
AC_MSG_WARN([*** hwloc run-time results may be reduced to showing just one processor,])
AC_MSG_WARN([*** and binding will not be supported.])
AC_MSG_WARN([*** You have been warned.])
AC_MSG_WARN([*** Pausing to give you time to read this message...])
AC_MSG_WARN([***********************************************************])
sleep 10
;;
esac
#
# Check CPU support
#
AC_MSG_CHECKING([which CPU support to include])
case ${target} in
i*86-*-*|x86_64-*-*|amd64-*-*)
case ${ac_cv_sizeof_void_p} in
4)
AC_DEFINE(HWLOC_X86_32_ARCH, 1, [Define to 1 on x86_32])
hwloc_x86_32=yes
HWLOC_MS_LIB_ARCH=X86
AC_MSG_RESULT([x86_32])
;;
8)
AC_DEFINE(HWLOC_X86_64_ARCH, 1, [Define to 1 on x86_64])
hwloc_x86_64=yes
HWLOC_MS_LIB_ARCH=X64
AC_MSG_RESULT([x86_64])
;;
*)
AC_DEFINE(HWLOC_X86_64_ARCH, 1, [Define to 1 on x86_64])
hwloc_x86_64=yes
HWLOC_MS_LIB_ARCH=X64
AC_MSG_RESULT([unknown -- assuming x86_64])
;;
esac
;;
*)
AC_MSG_RESULT([unknown])
;;
esac
AC_SUBST(HWLOC_MS_LIB_ARCH)
AC_CHECK_SIZEOF([unsigned long])
AC_DEFINE_UNQUOTED([HWLOC_SIZEOF_UNSIGNED_LONG], $ac_cv_sizeof_unsigned_long, [The size of `unsigned long', as computed by sizeof])
AC_CHECK_SIZEOF([unsigned int])
AC_DEFINE_UNQUOTED([HWLOC_SIZEOF_UNSIGNED_INT], $ac_cv_sizeof_unsigned_int, [The size of `unsigned int', as computed by sizeof])
#
# Check for compiler attributes and visibility
#
_HWLOC_C_COMPILER_VENDOR([hwloc_c_vendor])
_HWLOC_CHECK_ATTRIBUTES
_HWLOC_CHECK_VISIBILITY
HWLOC_CFLAGS="$HWLOC_FLAGS $HWLOC_VISIBILITY_CFLAGS"
AS_IF([test "$HWLOC_VISIBILITY_CFLAGS" != ""],
[AC_MSG_WARN(["$HWLOC_VISIBILITY_CFLAGS" has been added to the hwloc CFLAGS])])
# Make sure the compiler returns an error code when function arg
# count is wrong, otherwise sched_setaffinity checks may fail.
HWLOC_STRICT_ARGS_CFLAGS=
hwloc_args_check=0
AC_MSG_CHECKING([whether the C compiler rejects function calls with too many arguments])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
extern int one_arg(int x);
int foo(void) { return one_arg(1, 2); }
]])],
[AC_MSG_RESULT([no])],
[hwloc_args_check=1
AC_MSG_RESULT([yes])])
AC_MSG_CHECKING([whether the C compiler rejects function calls with too few arguments])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
extern int two_arg(int x, int y);
int foo(void) { return two_arg(3); }
]])],
[AC_MSG_RESULT([no])],
[hwloc_args_check=`expr $hwloc_args_check + 1`
AC_MSG_RESULT([yes])])
AS_IF([test "$hwloc_args_check" != "2"],[
AC_MSG_WARN([Your C compiler does not consider incorrect argument counts to be a fatal error.])
case "$hwloc_c_vendor" in
ibm)
HWLOC_STRICT_ARGS_CFLAGS="-qhalt=e"
;;
intel)
HWLOC_STRICT_ARGS_CFLAGS="-we140"
;;
*)
HWLOC_STRICT_ARGS_CFLAGS=FAIL
AC_MSG_WARN([Please report this warning and configure using a different C compiler if possible.])
;;
esac
AS_IF([test "$HWLOC_STRICT_ARGS_CFLAGS" != "FAIL"],[
AC_MSG_WARN([Configure will append '$HWLOC_STRICT_ARGS_CFLAGS' to the value of CFLAGS when needed.])
AC_MSG_WARN([Alternatively you may configure with a different compiler.])
])
])
#
# Now detect support
#
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([dirent.h])
AC_CHECK_HEADERS([strings.h])
AC_CHECK_HEADERS([ctype.h])
AC_CHECK_FUNCS([strncasecmp], [
_HWLOC_CHECK_DECL([strncasecmp], [
AC_DEFINE([HWLOC_HAVE_DECL_STRNCASECMP], [1], [Define to 1 if function `strncasecmp' is declared by system headers])
])
])
AC_CHECK_FUNCS([strftime])
AC_CHECK_FUNCS([setlocale])
AC_CHECK_HEADER([stdint.h], [
AC_DEFINE([HWLOC_HAVE_STDINT_H], [1], [Define to 1 if you have the <stdint.h> header file.])
])
AC_CHECK_HEADERS([sys/mman.h])
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0601"
AC_CHECK_TYPES([KAFFINITY,
PROCESSOR_CACHE_TYPE,
CACHE_DESCRIPTOR,
LOGICAL_PROCESSOR_RELATIONSHIP,
RelationProcessorPackage,
SYSTEM_LOGICAL_PROCESSOR_INFORMATION,
GROUP_AFFINITY,
PROCESSOR_RELATIONSHIP,
NUMA_NODE_RELATIONSHIP,
CACHE_RELATIONSHIP,
PROCESSOR_GROUP_INFO,
GROUP_RELATIONSHIP,
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX,
PSAPI_WORKING_SET_EX_BLOCK,
PSAPI_WORKING_SET_EX_INFORMATION,
PROCESSOR_NUMBER],
[],[],[[#include <windows.h>]])
CPPFLAGS="$old_CPPFLAGS"
AC_CHECK_LIB([gdi32], [main],
[HWLOC_LIBS="-lgdi32 $HWLOC_LIBS"
AC_DEFINE([HAVE_LIBGDI32], 1, [Define to 1 if we have -lgdi32])])
AC_CHECK_LIB([user32], [PostQuitMessage], [hwloc_have_user32="yes"])
AC_CHECK_HEADER([windows.h], [
AC_DEFINE([HWLOC_HAVE_WINDOWS_H], [1], [Define to 1 if you have the `windows.h' header.])
])
AC_CHECK_HEADERS([sys/lgrp_user.h], [
AC_CHECK_LIB([lgrp], [lgrp_init],
[HWLOC_LIBS="-llgrp $HWLOC_LIBS"
AC_DEFINE([HAVE_LIBLGRP], 1, [Define to 1 if we have -llgrp])
AC_CHECK_DECLS([lgrp_latency_cookie],,,[[#include <sys/lgrp_user.h>]])
])
])
AC_CHECK_HEADERS([kstat.h], [
AC_CHECK_LIB([kstat], [main],
[HWLOC_LIBS="-lkstat $HWLOC_LIBS"
AC_DEFINE([HAVE_LIBKSTAT], 1, [Define to 1 if we have -lkstat])])
])
AC_CHECK_DECLS([fabsf], [
AC_CHECK_LIB([m], [fabsf],
[HWLOC_LIBS="-lm $HWLOC_LIBS"])
], [], [[#include <math.h>]])
AC_CHECK_HEADERS([picl.h], [
AC_CHECK_LIB([picl], [picl_initialize],
[HWLOC_LIBS="-lpicl $HWLOC_LIBS"])])
AC_CHECK_DECLS([_SC_NPROCESSORS_ONLN,
_SC_NPROCESSORS_CONF,
_SC_NPROC_ONLN,
_SC_NPROC_CONF,
_SC_PAGESIZE,
_SC_PAGE_SIZE,
_SC_LARGE_PAGESIZE],,[:],[[#include <unistd.h>]])
AC_HAVE_HEADERS([mach/mach_host.h])
AC_HAVE_HEADERS([mach/mach_init.h], [
AC_CHECK_FUNCS([host_info])
])
AC_CHECK_HEADERS([sys/param.h])
AC_CHECK_HEADERS([sys/sysctl.h], [
AC_CHECK_DECLS([CTL_HW, HW_NCPU],,,[[
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <sys/sysctl.h>
]])
],,[
AC_INCLUDES_DEFAULT
#if HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
])
AC_CHECK_DECLS([strtoull], [], [AC_CHECK_FUNCS([strtoull])], [AC_INCLUDES_DEFAULT])
# Needed for Windows in private/misc.h
AC_CHECK_TYPES([ssize_t])
AC_CHECK_DECLS([snprintf], [], [], [AC_INCLUDES_DEFAULT])
AC_CHECK_DECLS([strcasecmp], [], [], [AC_INCLUDES_DEFAULT])
# strdup and putenv are declared in windows headers but marked deprecated
AC_CHECK_DECLS([_strdup], [], [], [AC_INCLUDES_DEFAULT])
AC_CHECK_DECLS([_putenv], [], [], [AC_INCLUDES_DEFAULT])
# Could add mkdir and access for hwloc-gather-cpuid.c on Windows
# Do a full link test instead of just using AC_CHECK_FUNCS, which
# just checks to see if the symbol exists or not. For example,
# the prototype of sysctl uses u_int, which on some platforms
# (such as FreeBSD) is only defined under __BSD_VISIBLE, __USE_BSD
# or other similar definitions. So while the symbols "sysctl" and
# "sysctlbyname" might still be available in libc (which autoconf
# checks for), they might not be actually usable.
AC_TRY_LINK([
#include <stdio.h>
#include <sys/types.h>
#include <sys/sysctl.h>
],
[return sysctl(NULL,0,NULL,NULL,NULL,0);],
AC_DEFINE([HAVE_SYSCTL],[1],[Define to '1' if sysctl is present and usable]))
AC_TRY_LINK([
#include <stdio.h>
#include <sys/types.h>
#include <sys/sysctl.h>
],
[return sysctlbyname(NULL,NULL,NULL,NULL,0);],
AC_DEFINE([HAVE_SYSCTLBYNAME],[1],[Define to '1' if sysctlbyname is present and usable]))
AC_CHECK_DECLS([getprogname], [], [], [AC_INCLUDES_DEFAULT])
AC_CHECK_DECLS([getexecname], [], [], [AC_INCLUDES_DEFAULT])
AC_CHECK_DECLS([GetModuleFileName], [], [], [#include <windows.h>])
# program_invocation_name and __progname may be available but not exported in headers
AC_MSG_CHECKING([for program_invocation_name])
AC_TRY_LINK([
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
#include <errno.h>
#include <stdio.h>
extern char *program_invocation_name;
],[
return printf("%s\n", program_invocation_name);
],
[AC_DEFINE([HAVE_PROGRAM_INVOCATION_NAME], [1], [Define to '1' if program_invocation_name is present and usable])
AC_MSG_RESULT([yes])
],[AC_MSG_RESULT([no])])
AC_MSG_CHECKING([for __progname])
AC_TRY_LINK([
#include <stdio.h>
extern char *__progname;
],[
return printf("%s\n", __progname);
],
[AC_DEFINE([HAVE___PROGNAME], [1], [Define to '1' if __progname is present and usable])
AC_MSG_RESULT([yes])
],[AC_MSG_RESULT([no])])
case ${target} in
*-*-mingw*|*-*-cygwin*)
hwloc_pid_t=HANDLE
hwloc_thread_t=HANDLE
;;
*)
hwloc_pid_t=pid_t
AC_CHECK_TYPES([pthread_t], [hwloc_thread_t=pthread_t], [:], [[#include <pthread.h>]])
;;
esac
AC_DEFINE_UNQUOTED(hwloc_pid_t, $hwloc_pid_t, [Define this to the process ID type])
if test "x$hwloc_thread_t" != "x" ; then
AC_DEFINE_UNQUOTED(hwloc_thread_t, $hwloc_thread_t, [Define this to the thread ID type])
fi
_HWLOC_CHECK_DECL([sched_setaffinity], [
AC_DEFINE([HWLOC_HAVE_SCHED_SETAFFINITY], [1], [Define to 1 if glibc provides a prototype of sched_setaffinity()])
AS_IF([test "$HWLOC_STRICT_ARGS_CFLAGS" = "FAIL"],[
AC_MSG_WARN([Support for sched_setaffinity() requires a C compiler which])
AC_MSG_WARN([considers incorrect argument counts to be a fatal error.])
AC_MSG_ERROR([Cannot continue.])
])
AC_MSG_CHECKING([for old prototype of sched_setaffinity])
hwloc_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $HWLOC_STRICT_ARGS_CFLAGS"
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
#include <sched.h>
static unsigned long mask;
]], [[ sched_setaffinity(0, (void*) &mask); ]])],
[AC_DEFINE([HWLOC_HAVE_OLD_SCHED_SETAFFINITY], [1], [Define to 1 if glibc provides the old prototype (without length) of sched_setaffinity()])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
CFLAGS=$hwloc_save_CFLAGS
], , [[
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
#include <sched.h>
]])
AC_MSG_CHECKING([for working CPU_SET])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#include <sched.h>
cpu_set_t set;
]], [[ CPU_ZERO(&set); CPU_SET(0, &set);]])],
[AC_DEFINE([HWLOC_HAVE_CPU_SET], [1], [Define to 1 if the CPU_SET macro works])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
AC_MSG_CHECKING([for working CPU_SET_S])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#include <sched.h>
cpu_set_t *set;
]], [[
set = CPU_ALLOC(1024);
CPU_ZERO_S(CPU_ALLOC_SIZE(1024), set);
CPU_SET_S(CPU_ALLOC_SIZE(1024), 0, set);
CPU_FREE(set);
]])],
[AC_DEFINE([HWLOC_HAVE_CPU_SET_S], [1], [Define to 1 if the CPU_SET_S macro works])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
AC_MSG_CHECKING([for working syscall with 6 parameters])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#include <unistd.h>
#include <sys/syscall.h>
]], [[syscall(0, 1, 2, 3, 4, 5, 6);]])],
[AC_DEFINE([HWLOC_HAVE_SYSCALL], [1], [Define to 1 if function `syscall' is available with 6 parameters])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
AC_PATH_PROGS([HWLOC_MS_LIB], [lib])
AC_ARG_VAR([HWLOC_MS_LIB], [Path to Microsoft's Visual Studio `lib' tool])
AC_PATH_PROG([BASH], [bash])
AC_CHECK_FUNCS([ffs], [
_HWLOC_CHECK_DECL([ffs],[
AC_DEFINE([HWLOC_HAVE_DECL_FFS], [1], [Define to 1 if function `ffs' is declared by system headers])
])
AC_DEFINE([HWLOC_HAVE_FFS], [1], [Define to 1 if you have the `ffs' function.])
if ( $CC --version | grep gccfss ) >/dev/null 2>&1 ; then
dnl May be broken due to
dnl https://forums.oracle.com/forums/thread.jspa?threadID=1997328
dnl TODO: a more selective test, since bug may be version dependent.
dnl We can't use AC_TRY_LINK because the failure does not appear until
dnl run/load time and there is currently no precedent for AC_TRY_RUN
dnl use in hwloc. --PHH
dnl For now, we're going with "all gccfss compilers are broken".
dnl Better to be safe and correct; it's not like this is
dnl performance-critical code, after all.
AC_DEFINE([HWLOC_HAVE_BROKEN_FFS], [1],
[Define to 1 if your `ffs' function is known to be broken.])
fi
])
AC_CHECK_FUNCS([ffsl], [
_HWLOC_CHECK_DECL([ffsl],[
AC_DEFINE([HWLOC_HAVE_DECL_FFSL], [1], [Define to 1 if function `ffsl' is declared by system headers])
])
AC_DEFINE([HWLOC_HAVE_FFSL], [1], [Define to 1 if you have the `ffsl' function.])
])
AC_CHECK_FUNCS([fls], [
_HWLOC_CHECK_DECL([fls],[
AC_DEFINE([HWLOC_HAVE_DECL_FLS], [1], [Define to 1 if function `fls' is declared by system headers])
])
AC_DEFINE([HWLOC_HAVE_FLS], [1], [Define to 1 if you have the `fls' function.])
])
AC_CHECK_FUNCS([flsl], [
_HWLOC_CHECK_DECL([flsl],[
AC_DEFINE([HWLOC_HAVE_DECL_FLSL], [1], [Define to 1 if function `flsl' is declared by system headers])
])
AC_DEFINE([HWLOC_HAVE_FLSL], [1], [Define to 1 if you have the `flsl' function.])
])
AC_CHECK_FUNCS([clz], [
_HWLOC_CHECK_DECL([clz],[
AC_DEFINE([HWLOC_HAVE_DECL_CLZ], [1], [Define to 1 if function `clz' is declared by system headers])
])
AC_DEFINE([HWLOC_HAVE_CLZ], [1], [Define to 1 if you have the `clz' function.])
])
AC_CHECK_FUNCS([clzl], [
_HWLOC_CHECK_DECL([clzl],[
AC_DEFINE([HWLOC_HAVE_DECL_CLZL], [1], [Define to 1 if function `clzl' is declared by system headers])
])
AC_DEFINE([HWLOC_HAVE_CLZL], [1], [Define to 1 if you have the `clzl' function.])
])
AS_IF([test "$hwloc_c_vendor" != "android"], [AC_CHECK_FUNCS([openat], [hwloc_have_openat=yes])])
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_FUNCS([getpagesize memalign posix_memalign])
AC_CHECK_HEADERS([sys/utsname.h])
AC_CHECK_FUNCS([uname])
dnl Don't check for valgrind in embedded mode because this may conflict
dnl with the embedder projects also checking for it.
dnl We only use Valgrind to nicely disable the x86 backend with a warning,
dnl but we can live without it in embedded mode (it auto-disables itself
dnl because of invalid CPUID outputs).
dnl Non-embedded checks usually go to hwloc_internal.m4 but this one is
dnl is really for the core library.
AS_IF([test "$hwloc_mode" != "embedded"],
[AC_CHECK_HEADERS([valgrind/valgrind.h])
AC_CHECK_DECLS([RUNNING_ON_VALGRIND],,[:],[[#include <valgrind/valgrind.h>]])
],[
AC_DEFINE([HAVE_DECL_RUNNING_ON_VALGRIND], [0], [Embedded mode; just assume we do not have Valgrind support])
])
AC_CHECK_HEADERS([pthread_np.h])
AC_CHECK_DECLS([pthread_setaffinity_np],,[:],[[
#include <pthread.h>
#ifdef HAVE_PTHREAD_NP_H
# include <pthread_np.h>
#endif
]])
AC_CHECK_DECLS([pthread_getaffinity_np],,[:],[[
#include <pthread.h>
#ifdef HAVE_PTHREAD_NP_H
# include <pthread_np.h>
#endif
]])
AC_CHECK_FUNC([sched_setaffinity], [hwloc_have_sched_setaffinity=yes])
AC_CHECK_HEADERS([sys/cpuset.h],,,[[#include <sys/param.h>]])
AC_CHECK_FUNCS([cpuset_setaffinity])
AC_SEARCH_LIBS([pthread_getthrds_np], [pthread],
AC_DEFINE([HWLOC_HAVE_PTHREAD_GETTHRDS_NP], 1, `Define to 1 if you have pthread_getthrds_np')
)
AC_CHECK_FUNCS([cpuset_setid])
# Linux libudev support
if test "x$enable_libudev" != xno; then
AC_CHECK_HEADERS([libudev.h], [
AC_CHECK_LIB([udev], [udev_device_new_from_subsystem_sysname], [
HWLOC_LIBS="$HWLOC_LIBS -ludev"
AC_DEFINE([HWLOC_HAVE_LIBUDEV], [1], [Define to 1 if you have libudev.])
])
])
fi
# PCI support via libpciaccess. NOTE: we do not support
# libpci/pciutils because that library is GPL and is incompatible
# with our BSD license.
hwloc_pciaccess_happy=no
if test "x$enable_io" != xno && test "x$enable_pci" != xno; then
hwloc_pciaccess_happy=yes
HWLOC_PKG_CHECK_MODULES([PCIACCESS], [pciaccess], [pci_slot_match_iterator_create], [pciaccess.h], [:], [hwloc_pciaccess_happy=no])
# Only add the REQUIRES if we got pciaccess through pkg-config.
# Otherwise we don't know if pciaccess.pc is installed
AS_IF([test "$hwloc_pciaccess_happy" = "yes"], [HWLOC_PCIACCESS_REQUIRES=pciaccess])
# Just for giggles, if we didn't find a pciaccess pkg-config,
# just try looking for its header file and library.
AS_IF([test "$hwloc_pciaccess_happy" != "yes"],
[AC_CHECK_HEADER([pciaccess.h],
[AC_CHECK_LIB([pciaccess], [pci_slot_match_iterator_create],
[hwloc_pciaccess_happy=yes
HWLOC_PCIACCESS_LIBS="-lpciaccess"])
])
])
AS_IF([test "$hwloc_pciaccess_happy" = "yes"],
[hwloc_components="$hwloc_components pci"
hwloc_pci_component_maybeplugin=1])
fi
# If we asked for pci support but couldn't deliver, fail
AS_IF([test "$enable_pci" = "yes" -a "$hwloc_pciaccess_happy" = "no"],
[AC_MSG_WARN([Specified --enable-pci switch, but could not])
AC_MSG_WARN([find appropriate support])
AC_MSG_ERROR([Cannot continue])])
# don't add LIBS/CFLAGS/REQUIRES yet, depends on plugins
# OpenCL support
hwloc_opencl_happy=no
if test "x$enable_io" != xno && test "x$enable_opencl" != "xno"; then
hwloc_opencl_happy=yes
AC_CHECK_HEADERS([CL/cl_ext.h], [
AC_CHECK_LIB([OpenCL], [clGetDeviceIDs], [HWLOC_OPENCL_LIBS="-lOpenCL"], [hwloc_opencl_happy=no])
], [hwloc_opencl_happy=no])
fi
AC_SUBST(HWLOC_OPENCL_LIBS)
# Check if required extensions are available
if test "x$hwloc_opencl_happy" = "xyes"; then
tmp_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $HWLOC_OPENCL_CFLAGS"
tmp_save_LIBS="$LIBS"
LIBS="$LIBS $HWLOC_OPENCL_LIBS"
AC_CHECK_DECLS([CL_DEVICE_TOPOLOGY_AMD],[hwloc_opencl_amd_happy=yes],[:],[[#include <CL/cl_ext.h>]])
CFLAGS="$tmp_save_CFLAGS"
LIBS="$tmp_save_LIBS"
# We can't do anything without CL_DEVICE_TOPOLOGY_AMD so far, so disable OpenCL entirely if not found
test "x$hwloc_opencl_amd_happy" != "xyes" && hwloc_opencl_happy=no
fi
# If we asked for opencl support but couldn't deliver, fail
AS_IF([test "$enable_opencl" = "yes" -a "$hwloc_opencl_happy" = "no"],
[AC_MSG_WARN([Specified --enable-opencl switch, but could not])
AC_MSG_WARN([find appropriate support])
AC_MSG_ERROR([Cannot continue])])
if test "x$hwloc_opencl_happy" = "xyes"; then
AC_DEFINE([HWLOC_HAVE_OPENCL], [1], [Define to 1 if you have the `OpenCL' library.])
AC_SUBST([HWLOC_HAVE_OPENCL], [1])
hwloc_components="$hwloc_components opencl"
hwloc_opencl_component_maybeplugin=1
else
AC_SUBST([HWLOC_HAVE_OPENCL], [0])
fi
# don't add LIBS/CFLAGS/REQUIRES yet, depends on plugins
# CUDA support
hwloc_have_cuda=no
hwloc_have_cudart=no
if test "x$enable_io" != xno && test "x$enable_cuda" != "xno"; then
AC_CHECK_HEADERS([cuda.h], [
AC_MSG_CHECKING(if CUDA_VERSION >= 3020)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <cuda.h>
#ifndef CUDA_VERSION
#error CUDA_VERSION undefined
#elif CUDA_VERSION < 3020
#error CUDA_VERSION too old
#endif]], [[int i = 3;]])],
[AC_MSG_RESULT(yes)
AC_CHECK_LIB([cuda], [cuInit],
[AC_DEFINE([HAVE_CUDA], 1, [Define to 1 if we have -lcuda])
hwloc_have_cuda=yes])],
[AC_MSG_RESULT(no)])])
AC_CHECK_HEADERS([cuda_runtime_api.h], [
AC_MSG_CHECKING(if CUDART_VERSION >= 3020)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <cuda_runtime_api.h>
#ifndef CUDART_VERSION
#error CUDART_VERSION undefined
#elif CUDART_VERSION < 3020
#error CUDART_VERSION too old
#endif]], [[int i = 3;]])],
[AC_MSG_RESULT(yes)
AC_CHECK_LIB([cudart], [cudaGetDeviceProperties], [
HWLOC_CUDA_LIBS="-lcudart"
AC_SUBST(HWLOC_CUDA_LIBS)
hwloc_have_cudart=yes
AC_DEFINE([HWLOC_HAVE_CUDART], [1], [Define to 1 if you have the `cudart' SDK.])
])
])
])
AS_IF([test "$enable_cuda" = "yes" -a "$hwloc_have_cudart" = "no"],
[AC_MSG_WARN([Specified --enable-cuda switch, but could not])
AC_MSG_WARN([find appropriate support])
AC_MSG_ERROR([Cannot continue])])
if test "x$hwloc_have_cudart" = "xyes"; then
hwloc_components="$hwloc_components cuda"
hwloc_cuda_component_maybeplugin=1
fi
fi
# don't add LIBS/CFLAGS yet, depends on plugins
# NVML support
hwloc_nvml_happy=no
if test "x$enable_io" != xno && test "x$enable_nvml" != "xno"; then
hwloc_nvml_happy=yes
AC_CHECK_HEADERS([nvml.h], [
AC_CHECK_LIB([nvidia-ml], [nvmlInit], [HWLOC_NVML_LIBS="-lnvidia-ml"], [hwloc_nvml_happy=no])
], [hwloc_nvml_happy=no])
fi
if test "x$hwloc_nvml_happy" = "xyes"; then
tmp_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $HWLOC_NVML_CFLAGS"
tmp_save_LIBS="$LIBS"
LIBS="$LIBS $HWLOC_NVML_LIBS"
AC_CHECK_DECLS([nvmlDeviceGetMaxPcieLinkGeneration],,[:],[[#include <nvml.h>]])
CFLAGS="$tmp_save_CFLAGS"
LIBS="$tmp_save_LIBS"
fi
AC_SUBST(HWLOC_NVML_LIBS)
# If we asked for nvml support but couldn't deliver, fail
AS_IF([test "$enable_nvml" = "yes" -a "$hwloc_nvml_happy" = "no"],
[AC_MSG_WARN([Specified --enable-nvml switch, but could not])
AC_MSG_WARN([find appropriate support])
AC_MSG_ERROR([Cannot continue])])
if test "x$hwloc_nvml_happy" = "xyes"; then
AC_DEFINE([HWLOC_HAVE_NVML], [1], [Define to 1 if you have the `NVML' library.])
AC_SUBST([HWLOC_HAVE_NVML], [1])
hwloc_components="$hwloc_components nvml"
hwloc_nvml_component_maybeplugin=1
else
AC_SUBST([HWLOC_HAVE_NVML], [0])
fi
# don't add LIBS/CFLAGS/REQUIRES yet, depends on plugins
# X11 support
AC_PATH_XTRA
CPPFLAGS_save=$CPPFLAGS
LIBS_save=$LIBS
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
LIBS="$LIBS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS"
AC_CHECK_HEADERS([X11/Xlib.h],
[AC_CHECK_LIB([X11], [XOpenDisplay],
[
# the GL backend just needs XOpenDisplay
hwloc_enable_X11=yes
# lstopo needs more
AC_CHECK_HEADERS([X11/Xutil.h],
[AC_CHECK_HEADERS([X11/keysym.h],
[AC_DEFINE([HWLOC_HAVE_X11_KEYSYM], [1], [Define to 1 if X11 headers including Xutil.h and keysym.h are available.])
HWLOC_X11_CPPFLAGS="$X_CFLAGS"
AC_SUBST([HWLOC_X11_CPPFLAGS])
HWLOC_X11_LIBS="$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
AC_SUBST([HWLOC_X11_LIBS])])
], [], [#include <X11/Xlib.h>])
])
])
CPPFLAGS=$CPPFLAGS_save
LIBS=$LIBS_save
# GL Support
hwloc_gl_happy=no
if test "x$enable_io" != xno && test "x$enable_gl" != "xno"; then
hwloc_gl_happy=yes
AS_IF([test "$hwloc_enable_X11" != "yes"],
[AC_MSG_WARN([X11 not found; GL disabled])
hwloc_gl_happy=no])
AC_CHECK_HEADERS([NVCtrl/NVCtrl.h], [
AC_CHECK_LIB([XNVCtrl], [XNVCTRLQueryTargetAttribute], [:], [hwloc_gl_happy=no], [-lXext])
], [hwloc_gl_happy=no])
if test "x$hwloc_gl_happy" = "xyes"; then
AC_DEFINE([HWLOC_HAVE_GL], [1], [Define to 1 if you have the GL module components.])
HWLOC_GL_LIBS="-lXNVCtrl -lXext -lX11"
AC_SUBST(HWLOC_GL_LIBS)
# FIXME we actually don't know if xext.pc and x11.pc are installed
# since we didn't look for Xext and X11 using pkg-config
HWLOC_GL_REQUIRES="xext x11"
hwloc_have_gl=yes
hwloc_components="$hwloc_components gl"
hwloc_gl_component_maybeplugin=1
else
AS_IF([test "$enable_gl" = "yes"], [
AC_MSG_WARN([Specified --enable-gl switch, but could not])
AC_MSG_WARN([find appropriate support])
AC_MSG_ERROR([Cannot continue])
])
fi
fi
# don't add LIBS/CFLAGS yet, depends on plugins
# libxml2 support
hwloc_libxml2_happy=
if test "x$enable_libxml2" != "xno"; then
HWLOC_PKG_CHECK_MODULES([LIBXML2], [libxml-2.0], [xmlNewDoc], [libxml/parser.h],
[hwloc_libxml2_happy=yes],
[hwloc_libxml2_happy=no])
fi
if test "x$hwloc_libxml2_happy" = "xyes"; then
HWLOC_LIBXML2_REQUIRES="libxml-2.0"
AC_DEFINE([HWLOC_HAVE_LIBXML2], [1], [Define to 1 if you have the `libxml2' library.])
AC_SUBST([HWLOC_HAVE_LIBXML2], [1])
hwloc_components="$hwloc_components xml_libxml"
hwloc_xml_libxml_component_maybeplugin=1
else
AC_SUBST([HWLOC_HAVE_LIBXML2], [0])
AS_IF([test "$enable_libxml2" = "yes"],
[AC_MSG_WARN([--enable-libxml2 requested, but libxml2 was not found])
AC_MSG_ERROR([Cannot continue])])
fi
# don't add LIBS/CFLAGS/REQUIRES yet, depends on plugins
# Try to compile the x86 cpuid inlines
if test "x$enable_cpuid" != "xno"; then
AC_MSG_CHECKING([for x86 cpuid])
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$HWLOC_top_srcdir/include"
# We need hwloc_uint64_t but we can't use autogen/config.h before configure ends.
# So pass #include/#define manually here for now.
CPUID_CHECK_HEADERS=
CPUID_CHECK_DEFINE=
if test "x$hwloc_windows" = xyes; then
X86_CPUID_CHECK_HEADERS="#include <windows.h>"
X86_CPUID_CHECK_DEFINE="#define hwloc_uint64_t DWORDLONG"
else
X86_CPUID_CHECK_DEFINE="#define hwloc_uint64_t uint64_t"
if test "x$ac_cv_header_stdint_h" = xyes; then
X86_CPUID_CHECK_HEADERS="#include <stdint.h>"
fi
fi
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
$X86_CPUID_CHECK_HEADERS
$X86_CPUID_CHECK_DEFINE
#define __hwloc_inline
#include <private/cpuid-x86.h>
]], [[
if (hwloc_have_x86_cpuid()) {
unsigned eax = 0, ebx, ecx = 0, edx;
hwloc_x86_cpuid(&eax, &ebx, &ecx, &edx);
printf("highest x86 cpuid %x\n", eax);
return 0;
}
]])],
[AC_MSG_RESULT([yes])
AC_DEFINE(HWLOC_HAVE_X86_CPUID, 1, [Define to 1 if you have x86 cpuid])
hwloc_have_x86_cpuid=yes],
[AC_MSG_RESULT([no])])
if test "x$hwloc_have_x86_cpuid" = xyes; then
hwloc_components="$hwloc_components x86"
fi
CPPFLAGS="$old_CPPFLAGS"
fi
# Components require pthread_mutex, see if it needs -lpthread
hwloc_pthread_mutex_happy=no
# Try without explicit -lpthread first
AC_CHECK_FUNC([pthread_mutex_lock],
[hwloc_pthread_mutex_happy=yes
HWLOC_LIBS_PRIVATE="$HWLOC_LIBS_PRIVATE -lpthread"
],
[AC_MSG_CHECKING([for pthread_mutex_lock with -lpthread])
# Try again with explicit -lpthread, but don't use AC_CHECK_FUNC to avoid the cache
tmp_save_LIBS=$LIBS