-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigureChecks.cmake
More file actions
2933 lines (2571 loc) · 97.2 KB
/
ConfigureChecks.cmake
File metadata and controls
2933 lines (2571 loc) · 97.2 KB
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
include(CheckCSourceCompiles)
include(CheckCSourceRuns)
include(CheckIncludeFiles)
include(CheckTypeSize)
include(CMakePushCheckState)
include(CheckStructHasMember)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(CheckVariableExists)
include(cmake/PlatformTest.cmake)
include(TestBigEndian)
message(STATUS "The system name is ${CMAKE_SYSTEM_NAME}")
message(STATUS "The system processor is ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "The system version is ${CMAKE_SYSTEM_VERSION}")
# Find any dependencies
if(USE_SYSTEM_BZip2)
find_package(BZip2) # https://cmake.org/cmake/help/latest/module/FindBZip2.html
endif()
message(STATUS "BZIP2_INCLUDE_DIR=${BZIP2_INCLUDE_DIR}")
message(STATUS "BZIP2_LIBRARIES=${BZIP2_LIBRARIES}")
if(USE_SYSTEM_Curses)
find_package(Curses) # https://cmake.org/cmake/help/latest/module/FindCurses.html
find_library(PANEL_LIBRARY NAMES panel)
set(PANEL_LIBRARIES ${PANEL_LIBRARY})
if(WITH_STATIC_DEPENDENCIES)
find_library(TINFO_LIBRARY NAMES tinfo)
find_library(GPM_LIBRARY NAMES gpm)
endif()
endif()
message(STATUS "CURSES_LIBRARIES=${CURSES_LIBRARIES}")
message(STATUS "PANEL_LIBRARIES=${PANEL_LIBRARIES}")
if(WITH_STATIC_DEPENDENCIES)
message(STATUS "TINFO_LIBRARY=${TINFO_LIBRARY}")
message(STATUS "GPM_LIBRARY=${GPM_LIBRARY}")
endif()
if(USE_SYSTEM_EXPAT)
find_package(EXPAT) # https://cmake.org/cmake/help/latest/module/FindEXPAT.html
endif()
message(STATUS "EXPAT_LIBRARIES=${EXPAT_LIBRARIES}")
message(STATUS "EXPAT_INCLUDE_DIRS=${EXPAT_INCLUDE_DIRS}")
if(USE_SYSTEM_LibFFI)
find_path(LibFFI_INCLUDE_DIR ffi.h)
find_library(LibFFI_LIBRARY NAMES ffi libffi)
message(STATUS "LibFFI_INCLUDE_DIR=${LibFFI_INCLUDE_DIR}")
message(STATUS "LibFFI_LIBRARY=${LibFFI_LIBRARY}")
endif()
if(IS_PY3 AND USE_SYSTEM_LIBMPDEC)
find_library(LIBMPDEC_LIBRARY NAMES mpdec libmpdec)
set(LIBMPDEC_LIBRARIES ${LIBMPDEC_LIBRARY})
message(STATUS "LIBMPDEC_LIBRARIES=${LIBMPDEC_LIBRARIES}")
endif()
if(USE_SYSTEM_OpenSSL)
find_package(OpenSSL 0.9.7) # https://cmake.org/cmake/help/latest/module/FindOpenSSL.html
message(STATUS "OPENSSL_LIBRARIES=${OPENSSL_LIBRARIES}")
message(STATUS "OPENSSL_INCLUDE_DIR=${OPENSSL_INCLUDE_DIR}")
endif()
if(USE_SYSTEM_TCL)
find_package(TCL)
endif()
if(UNIX)
# Only needed by _tkinter
find_package(X11)
endif()
if(USE_SYSTEM_ZLIB)
find_package(ZLIB) # https://cmake.org/cmake/help/latest/module/FindZLIB.html
message(STATUS "ZLIB_INCLUDE_DIRS=${ZLIB_INCLUDE_DIRS}")
message(STATUS "ZLIB_LIBRARIES=${ZLIB_LIBRARIES}")
endif()
if(USE_SYSTEM_DB)
find_path(DB_INCLUDE_PATH db.h)
find_library(DB_LIBRARY NAMES db-4.8)
message(STATUS "DB_INCLUDE_PATH=${DB_INCLUDE_PATH}")
message(STATUS "DB_LIBRARY=${DB_LIBRARY}")
endif()
if(USE_SYSTEM_GDBM)
find_path(GDBM_INCLUDE_PATH gdbm.h)
find_library(GDBM_LIBRARY gdbm)
find_library(GDBM_COMPAT_LIBRARY gdbm_compat)
find_path(NDBM_INCLUDE_PATH ndbm.h)
if(NDBM_INCLUDE_PATH)
set(NDBM_TAG NDBM)
else()
find_path(GDBM_NDBM_INCLUDE_PATH gdbm/ndbm.h)
if(GDBM_NDBM_INCLUDE_PATH)
set(NDBM_TAG GDBM_NDBM)
else()
find_path(GDBM_DASH_NDBM_INCLUDE_PATH gdbm-ndbm.h)
if(GDBM_DASH_NDBM_INCLUDE_PATH)
set(NDBM_TAG GDBM_DASH_NDBM)
endif()
endif()
endif()
endif()
message(STATUS "GDBM_INCLUDE_PATH=${GDBM_INCLUDE_PATH}")
message(STATUS "GDBM_LIBRARY=${GDBM_LIBRARY}")
message(STATUS "GDBM_COMPAT_LIBRARY=${GDBM_COMPAT_LIBRARY}")
message(STATUS "NDBM_TAG=${NDBM_TAG}")
message(STATUS "<NDBM_TAG>_INCLUDE_PATH=${${NDBM_TAG}_INCLUDE_PATH}")
find_path(LZMA_INCLUDE_PATH lzma.h)
find_library(LZMA_LIBRARY lzma)
message(STATUS "LZMA_INCLUDE_PATH=${LZMA_INCLUDE_PATH}")
message(STATUS "LZMA_LIBRARY=${LZMA_LIBRARY}")
if(USE_SYSTEM_READLINE)
if(USE_LIBEDIT)
find_path(READLINE_INCLUDE_PATH editline/readline.h)
find_library(READLINE_LIBRARY edit)
else()
find_path(READLINE_INCLUDE_PATH readline/readline.h)
find_library(READLINE_LIBRARY readline)
endif()
endif()
message(STATUS "READLINE_INCLUDE_PATH=${READLINE_INCLUDE_PATH}")
message(STATUS "READLINE_LIBRARY=${READLINE_LIBRARY}")
if(DEFINED SQLITE3_INCLUDE_PATH)
message(AUTHOR_WARNING "Setting SQLITE3_INCLUDE_PATH is deprecated. SQLite3_INCLUDE_DIR should be set instead.")
set(SQLite3_INCLUDE_DIR ${SQLITE3_INCLUDE_PATH})
endif()
if(DEFINED SQLITE3_LIBRARY)
message(AUTHOR_WARNING "Setting SQLITE3_LIBRARY is deprecated. SQLite3_LIBRARY should be set instead.")
set(SQLite3_LIBRARY ${SQLITE3_LIBRARY})
endif()
if(USE_SYSTEM_SQLite3)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.14")
find_package(SQLite3) # https://cmake.org/cmake/help/latest/module/FindSQLite3.html
else()
find_path(SQLite3_INCLUDE_DIR sqlite3.h)
find_library(SQLite3_LIBRARY sqlite3)
endif()
endif()
set(SQLite3_INCLUDE_DIRS ${SQLite3_INCLUDE_DIR})
set(SQLite3_LIBRARIES ${SQLite3_LIBRARY})
message(STATUS "SQLite3_INCLUDE_DIRS=${SQLite3_INCLUDE_DIRS}")
message(STATUS "SQLite3_LIBRARIES=${SQLite3_LIBRARIES}")
find_path(TIRPC_RPC_INCLUDE_PATH rpc.h PATHS "/usr/include/tirpc/rpc")
find_library(TIRPC_LIBRARY tirpc)
find_library(UUID_LIBRARY uuid)
if(WIN32)
set(M_LIBRARIES )
set(HAVE_LIBM 1)
# From PC/pyconfig.h:
# This is a manually maintained version used for the Watcom,
# Borland and Microsoft Visual C++ compilers. It is a
# standard part of the Python distribution.
else()
if(IS_PY3)
set(_msg "Checking WITH_HASH_ALGORITHM option")
message(STATUS "${_msg}")
if(WITH_HASH_ALGORITHM STREQUAL "default")
set(Py_HASH_ALGORITHM 0)
elseif(WITH_HASH_ALGORITHM STREQUAL "siphash24")
set(Py_HASH_ALGORITHM 1)
elseif(WITH_HASH_ALGORITHM STREQUAL "fnv")
set(Py_HASH_ALGORITHM 2)
else()
message(FATAL_ERROR "Unknown hash algorithm '${Py_HASH_ALGORITHM}'")
endif()
message(STATUS "${_msg} [${WITH_HASH_ALGORITHM}]")
# ABI version string for Python extension modules. This appears between the
# periods in shared library file names, e.g. foo.<SOABI>.so. It is calculated
# from the following attributes which affect the ABI of this Python build (in
# this order):
#
# * The Python implementation (always 'cpython-' for us)
# * The major and minor version numbers
# * --with-pydebug (adds a 'd')
#
# Thus for example, Python 3.2 built with wide unicode, pydebug, and pymalloc,
# would get a shared library ABI version tag of 'cpython-32dmu' and shared
# libraries would be named 'foo.cpython-32dmu.so'.
#
# In Python 3.2 and older, --with-wide-unicode added a 'u' flag.
# In Python 3.7 and older, --with-pymalloc added a 'm' flag.
set(_msg "Checking ABIFLAGS")
set(ABIFLAGS )
if(Py_DEBUG)
set(ABIFLAGS "${ABIFLAGS}d")
endif()
if(WITH_PYMALLOC AND PY_VERSION VERSION_LESS "3.8")
set(ABIFLAGS "${ABIFLAGS}m")
endif()
message(STATUS "${_msg} - ${ABIFLAGS}")
set(_msg "Checking SOABI")
try_run(PLATFORM_RUN PLATFORM_COMPILE
${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/platform.c
RUN_OUTPUT_VARIABLE PLATFORM_TRIPLET)
if(NOT PLATFORM_COMPILE)
message(FATAL_ERROR "We could not determine the platform. Please clean the ${CMAKE_PROJECT_NAME} environment and try again...")
endif()
set(SOABI "cpython-${PY_VERSION_MAJOR}${PY_VERSION_MINOR}${ABIFLAGS}-${PLATFORM_TRIPLET}")
message(STATUS "${_msg} - ${SOABI}")
endif()
if(PY_VERSION VERSION_GREATER_EQUAL "3.8")
# Alternative SOABI used in debug build to load C extensions built in release mode
# Release and debug (Py_DEBUG) ABI are compatible, but not Py_TRACE_REFS ABI
if(Py_DEBUG AND NOT WITH_TRACE_REFS)
string(REPLACE "d" "" ALT_ABIFLAGS "${ABIFLAGS}")
set(ALT_SOABI "cpython-${PY_VERSION_MAJOR}${PY_VERSION_MINOR}${ALT_ABIFLAGS}-${PLATFORM_TRIPLET}")
endif()
endif()
macro(ADD_COND var cond item)
if(${cond})
set(${var} ${${var}} ${item})
endif()
endmacro()
set(CMAKE_REQUIRED_DEFINITIONS )
# Convenient macro allowing to conditonally update CMAKE_REQUIRED_DEFINITIONS
macro(set_required_def var value)
set(${var} ${value})
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D${var}=${value}")
endmacro()
# Emulate AC_HEADER_DIRENT
check_include_files(dirent.h HAVE_DIRENT_H)
if(NOT HAVE_DIRENT_H)
check_include_files(sys/ndir.h HAVE_SYS_NDIR_H)
set(CMAKE_EXTRA_INCLUDE_FILES "sys/dir.h")
check_type_size(DIR HAVE_SYS_DIR_H)
check_include_files(ndir.h HAVE_NDIR_H)
endif()
if(IS_PY3)
check_symbol_exists("dirfd" "sys/types.h;dirent.h" HAVE_DIRFD)
endif()
check_include_files(alloca.h HAVE_ALLOCA_H) # libffi and cpython
check_include_files(asm/types.h HAVE_ASM_TYPES_H)
check_include_files(arpa/inet.h HAVE_ARPA_INET_H)
check_include_files(bluetooth/bluetooth.h HAVE_BLUETOOTH_BLUETOOTH_H)
check_include_files(bluetooth.h HAVE_BLUETOOTH_H)
check_include_files(conio.h HAVE_CONIO_H)
check_include_files(crypt.h HAVE_CRYPT_H)
check_include_files(curses.h HAVE_CURSES_H)
check_include_files(direct.h HAVE_DIRECT_H)
check_include_files(dlfcn.h HAVE_DLFCN_H) # libffi and cpython
check_include_files(errno.h HAVE_ERRNO_H)
check_include_files(fcntl.h HAVE_FCNTL_H)
check_include_files(fpu_control.h HAVE_FPU_CONTROL_H)
check_include_files(grp.h HAVE_GRP_H)
check_include_files(ieeefp.h HAVE_IEEEFP_H)
check_include_files(inttypes.h HAVE_INTTYPES_H) # libffi and cpython
check_include_files(io.h HAVE_IO_H)
check_include_files(langinfo.h HAVE_LANGINFO_H)
check_include_files(libintl.h HAVE_LIBINTL_H)
check_include_files(libutil.h HAVE_LIBUTIL_H)
check_include_files(linux/tipc.h HAVE_LINUX_TIPC_H)
check_include_files(locale.h HAVE_LOCALE_H)
check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
set(LINUX_NETLINK_HEADERS)
add_cond(LINUX_NETLINK_HEADERS HAVE_ASM_TYPES_H asm/types.h)
add_cond(LINUX_NETLINK_HEADERS HAVE_SYS_SOCKET_H sys/socket.h)
set(LINUX_NETLINK_HEADERS ${LINUX_NETLINK_HEADERS} linux/netlink.h)
check_include_files("${LINUX_NETLINK_HEADERS}" HAVE_LINUX_NETLINK_H)
if(IS_PY3)
set(LINUX_QRTR_HEADERS)
add_cond(LINUX_QRTR_HEADERS HAVE_ASM_TYPES_H asm/types.h)
add_cond(LINUX_QRTR_HEADERS HAVE_SYS_SOCKET_H sys/socket.h)
set(LINUX_QRTR_HEADERS ${LINUX_QRTR_HEADERS} linux/qrtr.h)
check_include_files("${LINUX_QRTR_HEADERS}" HAVE_LINUX_QRTR_H)
# On Linux, can.h and can/raw.h require sys/socket.h
set(LINUX_CAN_HEADERS)
add_cond(LINUX_CAN_HEADERS HAVE_SYS_SOCKET_H sys/socket.h)
check_include_files("${LINUX_CAN_HEADERS};linux/can.h" HAVE_LINUX_CAN_H)
check_include_files("${LINUX_CAN_HEADERS};linux/can/bcm.h" HAVE_LINUX_CAN_BCM_H)
check_include_files("${LINUX_CAN_HEADERS};linux/can/j1939.h" HAVE_LINUX_CAN_J1939_H)
check_include_files("${LINUX_CAN_HEADERS};linux/can/raw.h" HAVE_LINUX_CAN_RAW_H)
set(LINUX_VM_SOCKETS_HEADERS)
add_cond(LINUX_VM_SOCKETS_HEADERS HAVE_SYS_SOCKET_H sys/socket.h)
check_include_files("${LINUX_VM_SOCKETS_HEADERS};linux/vm_sockets.h" HAVE_LINUX_VM_SOCKETS_H)
endif()
check_include_files(mach-o/dyld.h HAVE_MACH_O_DYLD_H)
check_include_files(memory.h HAVE_MEMORY_H) # libffi and cpython
check_include_files(minix/config.h HAVE_MINIX_CONFIG_H)
check_include_files(ncurses.h HAVE_NCURSES_H)
check_include_files(ncurses/panel.h HAVE_NCURSES_PANEL_H)
check_include_files(netdb.h HAVE_NETDB_H)
check_include_files(netinet/in.h HAVE_NETINET_IN_H)
check_include_files(netpacket/packet.h HAVE_NETPACKET_PACKET_H)
check_include_files(panel.h HAVE_PANEL_H)
check_include_files(poll.h HAVE_POLL_H)
check_include_files(process.h HAVE_PROCESS_H)
check_include_files(pthread.h HAVE_PTHREAD_H)
check_include_files(pty.h HAVE_PTY_H)
check_include_files(pwd.h HAVE_PWD_H)
check_include_files("stdio.h;readline/readline.h" HAVE_READLINE_READLINE_H)
check_include_files(semaphore.h HAVE_SEMAPHORE_H)
check_include_files(shadow.h HAVE_SHADOW_H)
check_include_files(signal.h HAVE_SIGNAL_H)
check_include_files(spawn.h HAVE_SPAWN_H)
check_include_files(stdint.h HAVE_STDINT_H) # libffi and cpython
check_include_files(stdlib.h HAVE_STDLIB_H) # libffi and cpython
check_include_files(strings.h HAVE_STRINGS_H) # libffi and cpython
check_include_files(string.h HAVE_STRING_H) # libffi and cpython
check_include_files(stropts.h HAVE_STROPTS_H)
check_include_files(sysexits.h HAVE_SYSEXITS_H)
check_include_files(sys/audioio.h HAVE_SYS_AUDIOIO_H)
check_include_files(sys/bsdtty.h HAVE_SYS_BSDTTY_H)
check_include_files(sys/epoll.h HAVE_SYS_EPOLL_H)
check_include_files(sys/event.h HAVE_SYS_EVENT_H)
check_include_files(sys/file.h HAVE_SYS_FILE_H)
check_include_files(sys/loadavg.h HAVE_SYS_LOADAVG_H)
check_include_files(sys/lock.h HAVE_SYS_LOCK_H)
check_include_files(sys/sysmacros.h HAVE_SYS_SYSMACROS_H)
check_include_files(sys/mkdev.h HAVE_SYS_MKDEV_H)
check_include_files(sys/mman.h HAVE_SYS_MMAN_H) # libffi and cpython
check_include_files(sys/modem.h HAVE_SYS_MODEM_H)
check_include_files(sys/param.h HAVE_SYS_PARAM_H)
check_include_files(sys/poll.h HAVE_SYS_POLL_H)
check_include_files(sys/random.h HAVE_SYS_RANDOM_H)
check_include_files(sys/resource.h HAVE_SYS_RESOURCE_H)
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
check_include_files(sys/statvfs.h HAVE_SYS_STATVFS_H)
check_include_files(sys/stat.h HAVE_SYS_STAT_H) # libffi and cpython
check_include_files(sys/timeb.h HAVE_SYS_TIMEB_H)
check_include_files(sys/termio.h HAVE_SYS_TERMIO_H)
check_include_files(sys/times.h HAVE_SYS_TIMES_H)
check_include_files(sys/time.h HAVE_SYS_TIME_H)
check_include_files(sys/types.h HAVE_SYS_TYPES_H) # libffi and cpython
check_include_files(sys/un.h HAVE_SYS_UN_H)
check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H)
check_include_files(sys/wait.h HAVE_SYS_WAIT_H)
check_include_files(termios.h HAVE_TERMIOS_H)
check_include_files(term.h HAVE_TERM_H)
if(IS_PY2)
check_include_files(thread.h HAVE_THREAD_H)
endif()
check_include_files(unistd.h HAVE_UNISTD_H) # libffi and cpython
check_include_files(util.h HAVE_UTIL_H)
check_include_files(utime.h HAVE_UTIME_H)
check_include_files(wchar.h HAVE_WCHAR_H)
check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS) # libffi and cpython
check_include_files(stdarg.h HAVE_STDARG_PROTOTYPES)
if(IS_PY3)
check_include_files(endian.h HAVE_ENDIAN_H)
check_include_files(sched.h HAVE_SCHED_H)
check_include_files(linux/memfd.h HAVE_LINUX_MEMFD_H)
check_include_files(linux/random.h HAVE_LINUX_RANDOM_H)
check_include_files(sys/devpoll.h HAVE_SYS_DEVPOLL_H)
check_include_files(sys/endian.h HAVE_SYS_ENDIAN_H)
check_include_files(sys/ioctl.h HAVE_SYS_IOCTL_H)
check_include_files(sys/memfd.h HAVE_SYS_MEMFD_H)
check_include_files("sys/types.h;sys/kern_control.h" HAVE_SYS_KERN_CONTROL_H)
check_include_files(sys/sendfile.h HAVE_SYS_SENDFILE_H)
check_include_files(sys/syscall.h HAVE_SYS_SYSCALL_H)
check_include_files(sys/sys_domain.h HAVE_SYS_SYS_DOMAIN_H)
check_include_files(sys/uio.h HAVE_SYS_UIO_H)
check_include_files(sys/xattr.h HAVE_SYS_XATTR_H)
# On Darwin (OS X) net/if.h requires sys/socket.h to be imported first.
set(NET_IF_HEADERS stdio.h)
if(STDC_HEADERS)
set(NET_IF_HEADERS stdlib.h stddef.h)
else()
add_cond(NET_IF_HEADERS HAVE_STDLIB_H stdlib.h)
endif()
add_cond(NET_IF_HEADERS HAVE_SYS_SOCKET_H sys/socket.h)
list(APPEND NET_IF_HEADERS net/if.h)
check_include_files("${NET_IF_HEADERS}" HAVE_NET_IF_H)
endif()
find_file(HAVE_DEV_PTMX NAMES /dev/ptmx PATHS / NO_DEFAULT_PATH)
find_file(HAVE_DEV_PTC NAMES /dev/ptc PATHS / NO_DEFAULT_PATH)
message(STATUS "ptmx: ${HAVE_DEV_PTMX} ptc: ${HAVE_DEV_PTC}")
find_library(HAVE_LIBCURSES curses)
find_library(HAVE_LIBCRYPT crypt)
if(NOT DEFINED HAVE_LIBDL)
set(HAVE_LIBDL ${CMAKE_DL_LIBS} CACHE STRING "Name of library containing dlopen and dlcose.")
endif()
find_library(HAVE_LIBDLD dld)
find_library(HAVE_LIBINTL intl)
set(M_LIBRARIES )
check_function_exists("acosh" HAVE_BUILTIN_ACOSH)
if(HAVE_BUILTIN_ACOSH)
# Math functions are builtin the environment (e.g emscripten)
set(M_LIBRARIES )
set(HAVE_LIBM 1)
else()
find_library(HAVE_LIBM m)
set(M_LIBRARIES ${HAVE_LIBM})
endif()
find_library(HAVE_LIBNCURSES ncurses)
find_library(HAVE_LIBNSL nsl)
find_library(HAVE_LIBREADLINE readline)
if(IS_PY3)
find_library(HAVE_LIBSENDFILE sendfile)
endif()
find_library(HAVE_LIBTERMCAP termcap)
set(LIBUTIL_LIBRARIES )
set(LIBUTIL_EXPECTED 1)
if(CMAKE_SYSTEM MATCHES "VxWorks\\-7$")
set(LIBUTIL_EXPECTED 0)
set(HAVE_LIBUTIL 0)
endif()
if(LIBUTIL_EXPECTED)
check_function_exists("openpty" HAVE_BUILTIN_OPENPTY)
if(HAVE_BUILTIN_OPENPTY)
# Libutil functions are builtin the environment (e.g emscripten)
set(LIBUTIL_LIBRARIES )
set(HAVE_LIBUTIL 1)
else()
if(NOT DEFINED HAVE_LIBUTIL OR "${HAVE_LIBUTIL}" STREQUAL "")
find_library(HAVE_LIBUTIL util)
message(STATUS "Found libutil: ${HAVE_LIBUTIL}")
endif()
if(HAVE_LIBUTIL)
set(LIBUTIL_LIBRARIES ${HAVE_LIBUTIL})
endif()
endif()
if(NOT HAVE_LIBUTIL)
message(FATAL_ERROR "Could NOT find libutil (missing: HAVE_LIBUTIL)")
endif()
endif()
if(APPLE)
find_library(HAVE_LIBCOREFOUNDATION CoreFoundation)
find_library(HAVE_LIBSYSTEMCONFIGURATION SystemConfiguration)
endif()
if(WITH_THREAD OR PY_VERSION VERSION_GREATER_EQUAL "3.7")
set(CMAKE_HAVE_PTHREAD_H ${HAVE_PTHREAD_H}) # Skip checking for header a second time.
find_package(Threads)
if(CMAKE_HAVE_LIBC_CREATE)
set_required_def(_REENTRANT 1)
endif()
endif()
if(IS_PY3)
set(check_src ${PROJECT_BINARY_DIR}/CMakeFiles/ac_cv_lib_crypto_RAND_egd.c)
file(WRITE ${check_src} "/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern \"C\"
#endif
char RAND_egd ();
int main () { return RAND_egd (); }
")
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_LIBRARIES crypto)
python_platform_test(
HAVE_RAND_EGD
"Checking for RAND_egd in -lcrypto"
${check_src}
DIRECT
)
cmake_pop_check_state()
endif()
set_required_def(_POSIX_THREADS 1) # Define on Linux as it is required for threading
set_required_def(_POSIX_SOURCE 1) # Define on Linux in order for 'stat' and other things to work.
set_required_def(_GNU_SOURCE 1) # Define on Linux to activate all library features
set_required_def(_NETBSD_SOURCE 1) # Define on NetBSD to activate all library features
set_required_def(__BSD_VISIBLE 1) # Define on FreeBSD to activate all library features
set_required_def(_BSD_TYPES 1) # Define on Irix to enable u_int
set_required_def(_DARWIN_C_SOURCE 1) # Define on Darwin to activate all library features
set_required_def(_ALL_SOURCE 1) # Enable extensions on AIX 3, Interix.
set_required_def(_POSIX_PTHREAD_SEMANTICS 1) # Enable threading extensions on Solaris.
set_required_def(_TANDEM_SOURCE 1) # Enable extensions on HP NonStop.
set_required_def(__EXTENSIONS__ 1) # Defined on Solaris to see additional function prototypes.
if(HAVE_MINIX_CONFIG_H)
set_required_def(_POSIX_1_SOURCE 2) # Define to 2 if the system does not provide POSIX.1 features except with this defined.
set_required_def(_MINIX 1) # Define to 1 if on MINIX.
endif()
message(STATUS "Checking for XOPEN_SOURCE")
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
# disable features if it is defined, without any means to access these
# features as extensions. For these systems, we skip the definition of
# _XOPEN_SOURCE. Before adding a system to the list to gain access to
# some feature, make sure there is no alternative way to access this
# feature. Also, when using wildcards, make sure you have verified the
# need for not defining _XOPEN_SOURCE on all systems matching the
# wildcard, and that the wildcard does not include future systems
# (which may remove their limitations).
set(define_xopen_source 1)
# On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
# even though select is a POSIX function. Reported by J. Ribbens.
# Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
# In addition, Stefan Krah confirms that issue #1244610 exists through
# OpenBSD 4.6, but is fixed in 4.7.
if(CMAKE_SYSTEM MATCHES "OpenBSD\\-2\\."
OR CMAKE_SYSTEM MATCHES "OpenBSD\\-3\\."
OR CMAKE_SYSTEM MATCHES "OpenBSD\\-4\\.[0-6]$")
#OpenBSD/2.* | OpenBSD/3.* | OpenBSD/4.@<:@0123456@:>@
set(define_xopen_source 0)
# OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
# also defined. This can be overridden by defining _BSD_SOURCE
# As this has a different meaning on Linux, only define it on OpenBSD
set_required_def(_BSD_SOURCE 1) # Define on OpenBSD to activate all library features
elseif(CMAKE_SYSTEM MATCHES OpenBSD)
# OpenBSD/*
# OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
# also defined. This can be overridden by defining _BSD_SOURCE
# As this has a different meaning on Linux, only define it on OpenBSD
set_required_def(_BSD_SOURCE 1) # Define on OpenBSD to activate all library features
elseif(CMAKE_SYSTEM MATCHES "NetBSD\\-1\\.5$"
OR CMAKE_SYSTEM MATCHES "NetBSD\\-1\\.5\\."
OR CMAKE_SYSTEM MATCHES "NetBSD\\-1\\.6$"
OR CMAKE_SYSTEM MATCHES "NetBSD\\-1\\.6\\."
OR CMAKE_SYSTEM MATCHES "NetBSD\\-1\\.6[A-S]$")
# NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@
# Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
# _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
# Marc Recht
set(define_xopen_source 0)
elseif(CMAKE_SYSTEM MATCHES SunOS)
# SunOS/*)
# From the perspective of Solaris, _XOPEN_SOURCE is not so much a
# request to enable features supported by the standard as a request
# to disable features not supported by the standard. The best way
# for Python to use Solaris is simply to leave _XOPEN_SOURCE out
# entirely and define __EXTENSIONS__ instead.
set(define_xopen_source 0)
elseif(CMAKE_SYSTEM MATCHES "OpenUNIX\\-8\\.0\\.0$"
OR CMAKE_SYSTEM MATCHES "UnixWare\\-7\\.1\\.[0-4]$")
# OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@
# On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
# but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
# Reconfirmed for 7.1.4 by Martin v. Loewis.
set(define_xopen_source 0)
elseif(CMAKE_SYSTEM MATCHES "SCO_SV\\-3\\.2$")
# SCO_SV/3.2
# On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
# but used in struct sockaddr.sa_family. Reported by Tim Rice.
set(define_xopen_source 0)
elseif(CMAKE_SYSTEM MATCHES "FreeBSD\\-4\\.")
# FreeBSD/4.*
# On FreeBSD 4, the math functions C89 does not cover are never defined
# with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
set(define_xopen_source 0)
elseif(CMAKE_SYSTEM MATCHES "Darwin\\-[6789]\\."
OR CMAKE_SYSTEM MATCHES "Darwin\\-1[0-9]\\.")
# Darwin/@<:@6789@:>@.*)
# Darwin/1@<:@0-9@:>@.*
# On MacOS X 10.2, a bug in ncurses.h means that it craps out if
# _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
# identifies itself as Darwin/7.*
# On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
# disables platform specific features beyond repair.
# On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
# has no effect, don't bother defining them
set(define_xopen_source 0)
elseif(CMAKE_SYSTEM MATCHES "AIX\\-4$"
OR CMAKE_SYSTEM MATCHES "AIX\\-5\\.1$")
# On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
# used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
# or has another value. By not (re)defining it, the defaults come in place.
set(define_xopen_source 0)
elseif(CMAKE_SYSTEM MATCHES "QNX\\-6\\.3\\.2$")
# QNX/6.3.2
# On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
# defining NI_NUMERICHOST.
set(define_xopen_source 0)
elseif(CMAKE_SYSTEM MATCHES "VxWorks\\-7$")
# VxWorks-7
# On VxWorks-7, defining _XOPEN_SOURCE or _POSIX_C_SOURCE
# leads to a failure in select.h because sys/types.h fails
# to define FD_SETSIZE.
# Reported by Martin Oberhuber as V7COR-4651.
set(define_xopen_source 0)
endif()
if(define_xopen_source)
message(STATUS "Checking for XOPEN_SOURCE - yes")
set_required_def(_XOPEN_SOURCE_EXTENDED 1) # Define to activate Unix95-and-earlier features
if(IS_PY2)
set_required_def(_XOPEN_SOURCE 600) # Define to the level of X/Open that your system supports
set_required_def(_POSIX_C_SOURCE 200112L) # Define to activate features from IEEE Stds 1003.1-2001
else()
set_required_def(_XOPEN_SOURCE 700) # Define to the level of X/Open that your system supports
set_required_def(_POSIX_C_SOURCE 200809L) # Define to activate features from IEEE Stds 1003.1-2008
endif()
else()
message(STATUS "Checking for XOPEN_SOURCE - no")
endif()
message(STATUS "Checking for Large File Support")
set(use_lfs 1) # Consider disabling "lfs" if porting to Solaris (2.6 to 9) with gcc 2.95.
# See associated test in configure.in
if(use_lfs)
message(STATUS "Checking for Large File Support - yes")
if(CMAKE_SYSTEM MATCHES AIX)
set_required_def(_LARGE_FILES 1) # This must be defined on AIX systems to enable large file support.
endif()
set_required_def(_LARGEFILE_SOURCE 1) # This must be defined on some systems to enable large file support.
set_required_def(_FILE_OFFSET_BITS 64) # This must be set to 64 on some systems to enable large file support.
else()
message(STATUS "Checking for Large File Support - no")
endif()
# CMAKE_EXTRA_INCLUDE_FILES is used in CheckTypeSize
set(CMAKE_EXTRA_INCLUDE_FILES stdio.h)
add_cond(CMAKE_REQUIRED_LIBRARIES HAVE_LIBM "${M_LIBRARIES}")
add_cond(CMAKE_REQUIRED_LIBRARIES HAVE_LIBINTL ${HAVE_LIBINTL})
add_cond(CMAKE_REQUIRED_LIBRARIES HAVE_LIBUTIL "${LIBUTIL_LIBRARIES}")
add_cond(CMAKE_EXTRA_INCLUDE_FILES HAVE_WCHAR_H wchar.h)
TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
check_type_size(double SIZEOF_DOUBLE) # libffi and cpython
check_type_size(float SIZEOF_FLOAT)
check_type_size(fpos_t SIZEOF_FPOS_T)
check_type_size(int SIZEOF_INT)
check_type_size(long SIZEOF_LONG)
check_type_size("long double" SIZEOF_LONG_DOUBLE)
set(HAVE_LONG_DOUBLE ${SIZEOF_LONG_DOUBLE}) # libffi and cpython
check_type_size("long long" SIZEOF_LONG_LONG)
set(HAVE_LONG_LONG ${SIZEOF_LONG_LONG})
check_type_size(off_t SIZEOF_OFF_T)
check_type_size(pid_t SIZEOF_PID_T)
check_type_size(pthread_t SIZEOF_PTHREAD_T)
check_type_size(short SIZEOF_SHORT)
check_type_size(size_t SIZEOF_SIZE_T)
check_type_size(ssize_t HAVE_SSIZE_T)
check_type_size(time_t SIZEOF_TIME_T)
check_type_size(uintptr_t SIZEOF_UINTPTR_T)
set(HAVE_UINTPTR_T ${SIZEOF_UINTPTR_T})
check_type_size("void *" SIZEOF_VOID_P)
check_type_size(wchar_t SIZEOF_WCHAR_T)
check_type_size(_Bool SIZEOF__BOOL)
set(HAVE_C99_BOOL ${SIZEOF__BOOL})
# libffi specific: Check whether more than one size of the long double type is supported
# TODO
set(HAVE_LONG_DOUBLE_VARIANT 0)
# TODO Improve AIX support setting AIX_GENUINE_CPLUSPLUS and AIX_BUILDDATE
# See https://github.com/python-cmake-buildsystem/python-cmake-buildsystem/issues/296
set(AIX_GENUINE_CPLUSPLUS 0)
set(WITH_DYLD 0)
set(WITH_NEXT_FRAMEWORK 0)
if(APPLE)
set(WITH_DYLD 1)
set(WITH_NEXT_FRAMEWORK 0) # TODO: See --enable-framework option.
endif()
set(PYTHONFRAMEWORK "")
if(HAVE_LONG_LONG)
if(SIZEOF_OFF_T GREATER SIZEOF_LONG
AND (SIZEOF_LONG_LONG GREATER SIZEOF_OFF_T OR SIZEOF_LONG_LONG EQUAL SIZEOF_OFF_T))
set(HAVE_LARGEFILE_SUPPORT 1)
endif()
endif()
set(CFG_HEADERS )
add_cond(CFG_HEADERS HAVE_SYS_EPOLL_H sys/epoll.h)
add_cond(CFG_HEADERS HAVE_SYS_EVENT_H sys/event.h)
add_cond(CFG_HEADERS HAVE_SYS_RANDOM_H sys/random.h)
add_cond(CFG_HEADERS HAVE_SYS_SYSMACROS_H sys/sysmacros.h)
add_cond(CFG_HEADERS HAVE_SYS_TYPES_H sys/types.h)
add_cond(CFG_HEADERS HAVE_SYS_TIME_H sys/time.h)
add_cond(CFG_HEADERS HAVE_SYS_FILE_H sys/file.h)
add_cond(CFG_HEADERS HAVE_SYS_POLL_H sys/poll.h)
add_cond(CFG_HEADERS HAVE_SYS_STATVFS_H sys/statvfs.h)
add_cond(CFG_HEADERS HAVE_SYS_STAT_H sys/stat.h)
add_cond(CFG_HEADERS HAVE_SYS_LOCK_H sys/lock.h)
add_cond(CFG_HEADERS HAVE_SYS_TIMEB_H sys/timeb.h)
add_cond(CFG_HEADERS HAVE_SYS_TIMES_H sys/times.h)
add_cond(CFG_HEADERS HAVE_SYS_UIO_H sys/uio.h)
add_cond(CFG_HEADERS HAVE_SYS_UTSNAME_H sys/utsname.h)
add_cond(CFG_HEADERS HAVE_SYS_MMAN_H sys/mman.h)
add_cond(CFG_HEADERS HAVE_SYS_SOCKET_H sys/socket.h)
add_cond(CFG_HEADERS HAVE_SYS_WAIT_H sys/wait.h)
add_cond(CFG_HEADERS HAVE_PWD_H pwd.h)
add_cond(CFG_HEADERS HAVE_GRP_H grp.h)
add_cond(CFG_HEADERS HAVE_SHADOW_H shadow.h)
add_cond(CFG_HEADERS HAVE_INTTYPES_H inttypes.h)
add_cond(CFG_HEADERS HAVE_LOCALE_H locale.h)
add_cond(CFG_HEADERS HAVE_LIBINTL_H libintl.h)
add_cond(CFG_HEADERS HAVE_FCNTL_H fcntl.h)
add_cond(CFG_HEADERS HAVE_PTY_H pty.h)
add_cond(CFG_HEADERS HAVE_SIGNAL_H signal.h)
add_cond(CFG_HEADERS HAVE_STDINT_H stdint.h)
add_cond(CFG_HEADERS HAVE_STDLIB_H stdlib.h)
add_cond(CFG_HEADERS HAVE_STRING_H string.h)
add_cond(CFG_HEADERS HAVE_UTIL_H util.h)
add_cond(CFG_HEADERS HAVE_UNISTD_H unistd.h)
add_cond(CFG_HEADERS HAVE_UTIME_H utime.h)
add_cond(CFG_HEADERS HAVE_WCHAR_H wchar.h)
if(IS_PY3)
add_cond(CFG_HEADERS HAVE_DIRENT_H dirent.h)
add_cond(CFG_HEADERS HAVE_ENDIAN_H endian.h)
add_cond(CFG_HEADERS HAVE_LINUX_MEMFD_H linux/memfd.h)
add_cond(CFG_HEADERS HAVE_LINUX_WAIT_H linux/wait.h)
add_cond(CFG_HEADERS HAVE_MACH_O_DYLD_H mach-o/dyld.h)
add_cond(CFG_HEADERS HAVE_NET_IF_H net/if.h)
add_cond(CFG_HEADERS HAVE_SCHED_H sched.h)
add_cond(CFG_HEADERS HAVE_SYS_ENDIAN_H sys/endian.h)
add_cond(CFG_HEADERS HAVE_SYS_MEMFD_H sys/memfd.h)
add_cond(CFG_HEADERS HAVE_SYS_RESOURCE_H sys/resource.h)
add_cond(CFG_HEADERS HAVE_SYS_SENDFILE_H sys/sendfile.h)
add_cond(CFG_HEADERS HAVE_SYS_TIME_H sys/time.h)
endif()
if(HAVE_PTY_H)
set(CFG_HEADERS ${CFG_HEADERS} pty.h utmp.h)
endif()
set(CFG_HEADERS ${CFG_HEADERS} time.h stdio.h math.h)
check_symbol_exists(alarm "${CFG_HEADERS}" HAVE_ALARM)
check_symbol_exists(alloca "${CFG_HEADERS}" HAVE_ALLOCA) # libffi and cpython
check_symbol_exists(altzone "${CFG_HEADERS}" HAVE_ALTZONE)
check_symbol_exists(bind_textdomain_codeset "${CFG_HEADERS}" HAVE_BIND_TEXTDOMAIN_CODESET)
check_symbol_exists(chflags "${CFG_HEADERS}" HAVE_CHFLAGS)
check_symbol_exists(chown "${CFG_HEADERS}" HAVE_CHOWN)
check_symbol_exists(chroot "${CFG_HEADERS}" HAVE_CHROOT)
check_symbol_exists(clock "${CFG_HEADERS}" HAVE_CLOCK)
check_symbol_exists(confstr "${CFG_HEADERS}" HAVE_CONFSTR)
check_symbol_exists(ctermid "${CFG_HEADERS}" HAVE_CTERMID)
check_symbol_exists(ctermid_r "${CFG_HEADERS}" HAVE_CTERMID_R)
check_symbol_exists(dup2 "${CFG_HEADERS}" HAVE_DUP2)
check_symbol_exists(epoll_create "${CFG_HEADERS}" HAVE_EPOLL)
if(IS_PY3)
check_symbol_exists(epoll_create1 "${CFG_HEADERS}" HAVE_EPOLL_CREATE1)
endif()
check_symbol_exists(execv "${CFG_HEADERS}" HAVE_EXECV)
check_symbol_exists(fchdir "${CFG_HEADERS}" HAVE_FCHDIR)
check_symbol_exists(fchmod "${CFG_HEADERS}" HAVE_FCHMOD)
check_symbol_exists(fchown "${CFG_HEADERS}" HAVE_FCHOWN)
check_symbol_exists(fdatasync "${CFG_HEADERS}" HAVE_FDATASYNC)
check_symbol_exists(flock "${CFG_HEADERS}" HAVE_FLOCK)
if(NOT HAVE_FLOCK)
check_library_exists(bsd flock "" FLOCK_NEEDS_LIBBSD)
endif()
check_symbol_exists(fork "${CFG_HEADERS}" HAVE_FORK)
check_symbol_exists(forkpty "${CFG_HEADERS}" HAVE_FORKPTY)
check_symbol_exists(fpathconf "${CFG_HEADERS}" HAVE_FPATHCONF)
cmake_push_check_state()
set(CFG_HEADERS_SAVE ${CFG_HEADERS})
add_cond(CFG_HEADERS HAVE_FPU_CONTROL_H fpu_control.h)
check_symbol_exists(__fpu_control "${CFG_HEADERS}" HAVE___FPU_CONTROL)
if(NOT HAVE___FPU_CONTROL)
check_library_exists(ieee __fpu_control "" HAVE_LIBIEEE)
endif()
set(CFG_HEADERS ${CFG_HEADERS_SAVE})
cmake_pop_check_state()
check_symbol_exists(fseek64 "${CFG_HEADERS}" HAVE_FSEEK64)
check_symbol_exists(fseeko "${CFG_HEADERS}" HAVE_FSEEKO)
check_symbol_exists(fstatvfs "${CFG_HEADERS}" HAVE_FSTATVFS)
check_symbol_exists(fsync "${CFG_HEADERS}" HAVE_FSYNC)
check_symbol_exists(ftell64 "${CFG_HEADERS}" HAVE_FTELL64)
check_symbol_exists(ftello "${CFG_HEADERS}" HAVE_FTELLO)
check_symbol_exists(ftime "${CFG_HEADERS}" HAVE_FTIME)
check_symbol_exists(ftruncate "${CFG_HEADERS}" HAVE_FTRUNCATE)
if(IS_PY2)
check_symbol_exists(getcwd "${CFG_HEADERS}" HAVE_GETCWD)
endif()
check_symbol_exists(getc_unlocked "${CFG_HEADERS}" HAVE_GETC_UNLOCKED)
check_symbol_exists(getgroups "${CFG_HEADERS}" HAVE_GETGROUPS)
check_symbol_exists(getitimer "${CFG_HEADERS}" HAVE_GETITIMER)
check_symbol_exists(getloadavg "${CFG_HEADERS}" HAVE_GETLOADAVG)
check_symbol_exists(getlogin "${CFG_HEADERS}" HAVE_GETLOGIN)
check_symbol_exists(getpagesize "${CFG_HEADERS}" HAVE_GETPAGESIZE)
check_symbol_exists(getpgid "${CFG_HEADERS}" HAVE_GETPGID)
check_symbol_exists(getpgrp "${CFG_HEADERS}" HAVE_GETPGRP)
check_symbol_exists(getpid "${CFG_HEADERS}" HAVE_GETPID)
python_check_function(getpriority HAVE_GETPRIORITY)
check_symbol_exists(getpwent "${CFG_HEADERS}" HAVE_GETPWENT)
check_symbol_exists(getresgid "${CFG_HEADERS}" HAVE_GETRESGID)
check_symbol_exists(getresuid "${CFG_HEADERS}" HAVE_GETRESUID)
check_symbol_exists(getsid "${CFG_HEADERS}" HAVE_GETSID)
check_symbol_exists(getspent "${CFG_HEADERS}" HAVE_GETSPENT)
check_symbol_exists(getspnam "${CFG_HEADERS}" HAVE_GETSPNAM)
check_symbol_exists(gettimeofday "${CFG_HEADERS}" HAVE_GETTIMEOFDAY)
check_symbol_exists(getwd "${CFG_HEADERS}" HAVE_GETWD)
check_symbol_exists(hypot "${CFG_HEADERS}" HAVE_HYPOT)
check_symbol_exists(initgroups "${CFG_HEADERS}" HAVE_INITGROUPS)
check_symbol_exists(kill "${CFG_HEADERS}" HAVE_KILL)
check_symbol_exists(killpg "${CFG_HEADERS}" HAVE_KILLPG)
check_symbol_exists(kqueue "${CFG_HEADERS}" HAVE_KQUEUE)
check_symbol_exists(lchflags "${CFG_HEADERS}" HAVE_LCHFLAGS)
python_check_function(lchmod HAVE_LCHMOD)
check_symbol_exists(lchown "${CFG_HEADERS}" HAVE_LCHOWN)
check_symbol_exists(link "${CFG_HEADERS}" HAVE_LINK)
check_symbol_exists(lstat "${CFG_HEADERS}" HAVE_LSTAT)
check_symbol_exists(makedev "${CFG_HEADERS}" HAVE_MAKEDEV)
check_symbol_exists(memcpy "${CFG_HEADERS}" HAVE_MEMCPY) # libffi and cpython
check_symbol_exists(memmove "${CFG_HEADERS}" HAVE_MEMMOVE)
check_symbol_exists(mkfifo "${CFG_HEADERS}" HAVE_MKFIFO)
check_symbol_exists(mknod "${CFG_HEADERS}" HAVE_MKNOD)
check_symbol_exists(mktime "${CFG_HEADERS}" HAVE_MKTIME)
check_symbol_exists(mmap "${CFG_HEADERS}" HAVE_MMAP) # libffi and cpython
check_symbol_exists(mremap "${CFG_HEADERS}" HAVE_MREMAP)
check_symbol_exists(nice "${CFG_HEADERS}" HAVE_NICE)
check_symbol_exists(openpty "${CFG_HEADERS}" HAVE_OPENPTY)
check_symbol_exists(pathconf "${CFG_HEADERS}" HAVE_PATHCONF)
check_symbol_exists(pause "${CFG_HEADERS}" HAVE_PAUSE)
check_symbol_exists(plock "${CFG_HEADERS}" HAVE_PLOCK)
check_symbol_exists(poll "${CFG_HEADERS}" HAVE_POLL)
check_symbol_exists(putenv "${CFG_HEADERS}" HAVE_PUTENV)
check_symbol_exists(readlink "${CFG_HEADERS}" HAVE_READLINK)
check_symbol_exists(realpath "${CFG_HEADERS}" HAVE_REALPATH)
check_symbol_exists(select "${CFG_HEADERS}" HAVE_SELECT)
check_symbol_exists(setegid "${CFG_HEADERS}" HAVE_SETEGID)
check_symbol_exists(seteuid "${CFG_HEADERS}" HAVE_SETEUID)
check_symbol_exists(setgid "${CFG_HEADERS}" HAVE_SETGID)
check_symbol_exists(setgroups "${CFG_HEADERS}" HAVE_SETGROUPS)
check_symbol_exists(setitimer "${CFG_HEADERS}" HAVE_SETITIMER)
check_symbol_exists(setlocale "${CFG_HEADERS}" HAVE_SETLOCALE)
check_symbol_exists(setpgid "${CFG_HEADERS}" HAVE_SETPGID)
check_symbol_exists(setpgrp "${CFG_HEADERS}" HAVE_SETPGRP)
check_symbol_exists(setregid "${CFG_HEADERS}" HAVE_SETREGID)
check_symbol_exists(setreuid "${CFG_HEADERS}" HAVE_SETREUID)
check_symbol_exists(setresgid "${CFG_HEADERS}" HAVE_SETRESGID)
check_symbol_exists(setresuid "${CFG_HEADERS}" HAVE_SETRESUID)
check_symbol_exists(setsid "${CFG_HEADERS}" HAVE_SETSID)
check_symbol_exists(setuid "${CFG_HEADERS}" HAVE_SETUID)
check_symbol_exists(setvbuf "${CFG_HEADERS}" HAVE_SETVBUF)
check_symbol_exists(sigaction "${CFG_HEADERS}" HAVE_SIGACTION)
check_symbol_exists(siginterrupt "${CFG_HEADERS}" HAVE_SIGINTERRUPT)
check_symbol_exists(sigrelse "${CFG_HEADERS}" HAVE_SIGRELSE)
check_symbol_exists(snprintf "${CFG_HEADERS}" HAVE_SNPRINTF)
check_symbol_exists(socketpair "${CFG_HEADERS}" HAVE_SOCKETPAIR)
check_symbol_exists(statvfs "${CFG_HEADERS}" HAVE_STATVFS)
check_symbol_exists(strdup "${CFG_HEADERS}" HAVE_STRDUP)
check_symbol_exists(strftime "${CFG_HEADERS}" HAVE_STRFTIME)
check_symbol_exists(symlink "${CFG_HEADERS}" HAVE_SYMLINK)
check_symbol_exists(sysconf "${CFG_HEADERS}" HAVE_SYSCONF)
check_symbol_exists(tcgetpgrp "${CFG_HEADERS}" HAVE_TCGETPGRP)
check_symbol_exists(tcsetpgrp "${CFG_HEADERS}" HAVE_TCSETPGRP)
check_symbol_exists(tempnam "${CFG_HEADERS}" HAVE_TEMPNAM)
check_symbol_exists(timegm "${CFG_HEADERS}" HAVE_TIMEGM)
check_symbol_exists(times "${CFG_HEADERS}" HAVE_TIMES)
check_symbol_exists(tmpfile "${CFG_HEADERS}" HAVE_TMPFILE)
check_symbol_exists(tmpnam "${CFG_HEADERS}" HAVE_TMPNAM)
check_symbol_exists(tmpnam_r "${CFG_HEADERS}" HAVE_TMPNAM_R)
check_symbol_exists(truncate "${CFG_HEADERS}" HAVE_TRUNCATE)
check_symbol_exists(uname "${CFG_HEADERS}" HAVE_UNAME)
check_symbol_exists(unsetenv "${CFG_HEADERS}" HAVE_UNSETENV)
check_symbol_exists(utimes "${CFG_HEADERS}" HAVE_UTIMES)
check_symbol_exists(wait3 "${CFG_HEADERS}" HAVE_WAIT3)
check_symbol_exists(wait4 "${CFG_HEADERS}" HAVE_WAIT4)
check_symbol_exists(waitpid "${CFG_HEADERS}" HAVE_WAITPID)
check_symbol_exists(wcscoll "${CFG_HEADERS}" HAVE_WCSCOLL)
check_symbol_exists(_getpty "${CFG_HEADERS}" HAVE__GETPTY)
if(IS_PY3)
check_symbol_exists(accept4 "${CFG_HEADERS}" HAVE_ACCEPT4)
check_symbol_exists(copy_file_range "${CFG_HEADERS}" HAVE_COPY_FILE_RANGE)
check_symbol_exists(dup3 "${CFG_HEADERS}" HAVE_DUP3)
check_symbol_exists(_dyld_shared_cache_contains_path "${CFG_HEADERS}" HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH)
check_symbol_exists(explicit_bzero "${CFG_HEADERS}" HAVE_EXPLICIT_BZERO)
check_symbol_exists(explicit_memset "${CFG_HEADERS}" HAVE_EXPLICIT_MEMSET)
check_symbol_exists(faccessat "${CFG_HEADERS}" HAVE_FACCESSAT)
check_symbol_exists(fchmodat "${CFG_HEADERS}" HAVE_FCHMODAT)
check_symbol_exists(fchownat "${CFG_HEADERS}" HAVE_FCHOWNAT)
check_symbol_exists(fdwalk "${CFG_HEADERS}" HAVE_FDWALK)
check_symbol_exists(fexecve "${CFG_HEADERS}" HAVE_FEXECVE)
check_symbol_exists(fdopendir "${CFG_HEADERS}" HAVE_FDOPENDIR)
check_symbol_exists(fstatat "${CFG_HEADERS}" HAVE_FSTATAT)
check_symbol_exists(futimens "${CFG_HEADERS}" HAVE_FUTIMENS)
check_symbol_exists(futimes "${CFG_HEADERS}" HAVE_FUTIMES)
check_symbol_exists(futimesat "${CFG_HEADERS}" HAVE_FUTIMESAT)
check_symbol_exists(getentropy "${CFG_HEADERS}" HAVE_GETENTROPY)
python_check_function(getpriority HAVE_GETPRIORITY)
check_symbol_exists(getgrgid_r "${CFG_HEADERS}" HAVE_GETGRGID_R)
check_symbol_exists(getgrnam_r "${CFG_HEADERS}" HAVE_GETGRNAM_R)
check_symbol_exists(getgrouplist "${CFG_HEADERS}" HAVE_GETGROUPLIST)
check_symbol_exists(getpwnam_r "${CFG_HEADERS}" HAVE_GETPWNAM_R)
check_symbol_exists(getpwuid_r "${CFG_HEADERS}" HAVE_GETPWUID_R)
check_symbol_exists(htole64 "${CFG_HEADERS}" HAVE_HTOLE64)
check_symbol_exists(if_nameindex "${CFG_HEADERS}" HAVE_IF_NAMEINDEX)
check_symbol_exists(linkat "${CFG_HEADERS}" HAVE_LINKAT)
check_symbol_exists(lockf "${CFG_HEADERS}" HAVE_LOCKF)
check_symbol_exists(lutimes "${CFG_HEADERS}" HAVE_LUTIMES)
check_symbol_exists(madvise "${CFG_HEADERS}" HAVE_MADVISE)
check_symbol_exists(mbrtowc "${CFG_HEADERS}" HAVE_MBRTOWC)
check_symbol_exists(memfd_create "${CFG_HEADERS}" HAVE_MEMFD_CREATE)
check_symbol_exists(memrchr "${CFG_HEADERS}" HAVE_MEMRCHR)
check_symbol_exists(mkdirat "${CFG_HEADERS}" HAVE_MKDIRAT)
check_symbol_exists(mkfifoat "${CFG_HEADERS}" HAVE_MKFIFOAT)
check_symbol_exists(mknodat "${CFG_HEADERS}" HAVE_MKNODAT)
check_symbol_exists(openat "${CFG_HEADERS}" HAVE_OPENAT)
check_symbol_exists(pipe2 "${CFG_HEADERS}" HAVE_PIPE2)
check_symbol_exists(posix_fadvise "${CFG_HEADERS}" HAVE_POSIX_FADVISE)
check_symbol_exists(posix_fallocate "${CFG_HEADERS}" HAVE_POSIX_FALLOCATE)
check_symbol_exists(posix_spawn "${CFG_HEADERS}" HAVE_POSIX_SPAWN)
check_symbol_exists(posix_spawnp "${CFG_HEADERS}" HAVE_POSIX_SPAWNP)
check_symbol_exists(pread "${CFG_HEADERS}" HAVE_PREAD)
check_symbol_exists(preadv "${CFG_HEADERS}" HAVE_PREADV)
check_symbol_exists(preadv2 "${CFG_HEADERS}" HAVE_PREADV2)
check_symbol_exists(prlimit "${CFG_HEADERS}" HAVE_PRLIMIT)
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_LIBRARIES pthread)
check_symbol_exists(pthread_kill "${CFG_HEADERS}" HAVE_PTHREAD_KILL)
cmake_pop_check_state()
check_symbol_exists(pwrite "${CFG_HEADERS}" HAVE_PWRITE)
check_symbol_exists(pwritev "${CFG_HEADERS}" HAVE_PWRITEV)
check_symbol_exists(pwritev2 "${CFG_HEADERS}" HAVE_PWRITEV2)
check_symbol_exists(readlinkat "${CFG_HEADERS}" HAVE_READLINKAT)
check_symbol_exists(readv "${CFG_HEADERS}" HAVE_READV)
check_symbol_exists(renameat "${CFG_HEADERS}" HAVE_RENAMEAT)
check_symbol_exists(rtpSpawn "${CFG_HEADERS}" HAVE_RTPSPAWN)
check_symbol_exists(sched_rr_get_interval "${CFG_HEADERS}" HAVE_SCHED_RR_GET_INTERVAL)
check_symbol_exists(sched_setaffinity "${CFG_HEADERS}" HAVE_SCHED_SETAFFINITY)
check_symbol_exists(sched_setparam "${CFG_HEADERS}" HAVE_SCHED_SETPARAM)
check_symbol_exists(sched_setscheduler "${CFG_HEADERS}" HAVE_SCHED_SETSCHEDULER)
check_symbol_exists(sendfile "${CFG_HEADERS}" HAVE_SENDFILE)
check_symbol_exists(sethostname "${CFG_HEADERS}" HAVE_SETHOSTNAME)
check_symbol_exists(setpriority "${CFG_HEADERS}" HAVE_SETPRIORITY)