-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathadd_cmake_files_to_python2-5-2.patch
2456 lines (2456 loc) · 83.2 KB
/
add_cmake_files_to_python2-5-2.patch
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
diff --git a/CMake/CheckStructHasMember.cmake b/CMake/CheckStructHasMember.cmake
new file mode 100644
index 0000000..04fe6ed
--- /dev/null
+++ b/CMake/CheckStructHasMember.cmake
@@ -0,0 +1,42 @@
+# - Check if the given struct or class has the specified member variable
+# CHECK_STRUCT_HAS_MEMBER (STRUCT MEMBER HEADER VARIABLE)
+#
+# STRUCT - the name of the struct or class you are interested in
+# MEMBER - the member which existence you want to check
+# HEADER - the header(s) where the prototype should be declared
+# VARIABLE - variable to store the result
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+
+# Copyright (c) 2006, Alexander Neundorf, <[email protected]>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+INCLUDE(CheckCSourceCompiles)
+
+MACRO (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT)
+ SET(_INCLUDE_FILES)
+ FOREACH (it ${_HEADER})
+ SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
+ ENDFOREACH (it)
+
+ SET(_CHECK_STRUCT_MEMBER_SOURCE_CODE "
+${_INCLUDE_FILES}
+int main()
+{
+ ${_STRUCT}* tmp;
+ tmp->${_MEMBER};
+ return 0;
+}
+")
+ CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT})
+
+ENDMACRO (CHECK_STRUCT_HAS_MEMBER)
+
diff --git a/CMake/CheckTypeExists.cmake b/CMake/CheckTypeExists.cmake
new file mode 100644
index 0000000..6118276
--- /dev/null
+++ b/CMake/CheckTypeExists.cmake
@@ -0,0 +1,28 @@
+# - Check if the given struct or class has the specified member variable
+# CHECK_STRUCT_MEMBER (STRUCT MEMBER HEADER VARIABLE)
+#
+# STRUCT - the name of the struct or class you are interested in
+# MEMBER - the member which existence you want to check
+# HEADER - the header(s) where the prototype should be declared
+# VARIABLE - variable to store the result
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+
+# Copyright (c) 2006, Alexander Neundorf, <[email protected]>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+INCLUDE(CheckTypeSize)
+
+MACRO (CHECK_TYPE_EXISTS _TYPE _HEADER _RESULT)
+ SET(CMAKE_EXTRA_INCLUDE_FILES ${_HEADER})
+ CHECK_TYPE_SIZE(${_TYPE} ${_RESULT})
+ENDMACRO (CHECK_TYPE_EXISTS)
+
diff --git a/CMake/MacroPushRequiredVars.cmake b/CMake/MacroPushRequiredVars.cmake
new file mode 100644
index 0000000..650b566
--- /dev/null
+++ b/CMake/MacroPushRequiredVars.cmake
@@ -0,0 +1,47 @@
+# this module defines two macros:
+# MACRO_PUSH_REQUIRED_VARS()
+# and
+# MACRO_POP_REQUIRED_VARS()
+# use these if you call cmake macros which use
+# any of the CMAKE_REQUIRED_XXX variables
+#
+# Usage:
+# MACRO_PUSH_REQUIRED_VARS()
+# SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF)
+# CHECK_FUNCTION_EXISTS(...)
+# MACRO_POP_REQUIRED_VARS()
+
+# Copyright (c) 2006, Alexander Neundorf, <[email protected]>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+MACRO(MACRO_PUSH_REQUIRED_VARS)
+
+ IF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER)
+ SET(_PUSH_REQUIRED_VARS_COUNTER 0)
+ ENDIF(NOT DEFINED _PUSH_REQUIRED_VARS_COUNTER)
+
+ MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}+1")
+
+ SET(_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_INCLUDES})
+ SET(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS})
+ SET(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_LIBRARIES})
+ SET(_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER} ${CMAKE_REQUIRED_FLAGS})
+ENDMACRO(MACRO_PUSH_REQUIRED_VARS)
+
+MACRO(MACRO_POP_REQUIRED_VARS)
+
+# don't pop more than we pushed
+ IF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0")
+
+ SET(CMAKE_REQUIRED_INCLUDES ${_CMAKE_REQUIRED_INCLUDES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+ SET(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+ SET(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+ SET(CMAKE_REQUIRED_FLAGS ${_CMAKE_REQUIRED_FLAGS_SAVE_${_PUSH_REQUIRED_VARS_COUNTER}})
+
+ MATH(EXPR _PUSH_REQUIRED_VARS_COUNTER "${_PUSH_REQUIRED_VARS_COUNTER}-1")
+ ENDIF("${_PUSH_REQUIRED_VARS_COUNTER}" GREATER "0")
+
+ENDMACRO(MACRO_POP_REQUIRED_VARS)
+
diff --git a/CMake/TryRunResults-Python-bgl-gcc.cmake b/CMake/TryRunResults-Python-bgl-gcc.cmake
new file mode 100644
index 0000000..dcdfd79
--- /dev/null
+++ b/CMake/TryRunResults-Python-bgl-gcc.cmake
@@ -0,0 +1,39 @@
+# This file was generated by CMake because it detected TRY_RUN() commands
+# in crosscompiling mode. It will be overwritten by the next CMake run.
+# Copy it to a safe location, set the variables to appropriate values
+# and use it then to preset the CMake cache (using -C).
+
+
+# HAVE_BROKEN_NICE_EXITCODE
+# indicates whether the executable would have been able to run on its
+# target platform. If so, set HAVE_BROKEN_NICE_EXITCODE to
+# the exit code (in many cases 0 for success), otherwise enter "FAILED_TO_RUN".
+# The HAVE_BROKEN_NICE_COMPILED variable holds the build result for this TRY_RUN().
+#
+# Source file : /gpfs/gpfs0/home/gevecb/alex/src/python-svn/build-bgl/CMakeFiles/CMakeTmp/src.c
+# Executable : /gpfs/gpfs0/home/gevecb/alex/src/python-svn/build-bgl/cmTryCompileExec-HAVE_BROKEN_NICE_EXITCODE
+# Run arguments :
+# Called from: [2] /gpfs/gpfs0/home/gevecb/alex/src/python-svn/ConfigureChecks.cmake
+# [1] /gpfs/gpfs0/home/gevecb/alex/src/python-svn/CMakeLists.txt
+
+SET( HAVE_BROKEN_NICE_EXITCODE
+ "0"
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+
+# HAVE_BROKEN_POLL_EXITCODE
+# indicates whether the executable would have been able to run on its
+# target platform. If so, set HAVE_BROKEN_POLL_EXITCODE to
+# the exit code (in many cases 0 for success), otherwise enter "FAILED_TO_RUN".
+# The HAVE_BROKEN_POLL_COMPILED variable holds the build result for this TRY_RUN().
+#
+# Source file : /gpfs/gpfs0/home/gevecb/alex/src/python-svn/build-bgl/CMakeFiles/CMakeTmp/src.c
+# Executable : /gpfs/gpfs0/home/gevecb/alex/src/python-svn/build-bgl/cmTryCompileExec-HAVE_BROKEN_POLL_EXITCODE
+# Run arguments :
+# Called from: [2] /gpfs/gpfs0/home/gevecb/alex/src/python-svn/ConfigureChecks.cmake
+# [1] /gpfs/gpfs0/home/gevecb/alex/src/python-svn/CMakeLists.txt
+
+SET( HAVE_BROKEN_POLL_EXITCODE
+ "1"
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
diff --git a/CMake/TryRunResults-Python-catamount-gcc.cmake b/CMake/TryRunResults-Python-catamount-gcc.cmake
new file mode 100644
index 0000000..dcdfd79
--- /dev/null
+++ b/CMake/TryRunResults-Python-catamount-gcc.cmake
@@ -0,0 +1,39 @@
+# This file was generated by CMake because it detected TRY_RUN() commands
+# in crosscompiling mode. It will be overwritten by the next CMake run.
+# Copy it to a safe location, set the variables to appropriate values
+# and use it then to preset the CMake cache (using -C).
+
+
+# HAVE_BROKEN_NICE_EXITCODE
+# indicates whether the executable would have been able to run on its
+# target platform. If so, set HAVE_BROKEN_NICE_EXITCODE to
+# the exit code (in many cases 0 for success), otherwise enter "FAILED_TO_RUN".
+# The HAVE_BROKEN_NICE_COMPILED variable holds the build result for this TRY_RUN().
+#
+# Source file : /gpfs/gpfs0/home/gevecb/alex/src/python-svn/build-bgl/CMakeFiles/CMakeTmp/src.c
+# Executable : /gpfs/gpfs0/home/gevecb/alex/src/python-svn/build-bgl/cmTryCompileExec-HAVE_BROKEN_NICE_EXITCODE
+# Run arguments :
+# Called from: [2] /gpfs/gpfs0/home/gevecb/alex/src/python-svn/ConfigureChecks.cmake
+# [1] /gpfs/gpfs0/home/gevecb/alex/src/python-svn/CMakeLists.txt
+
+SET( HAVE_BROKEN_NICE_EXITCODE
+ "0"
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+
+# HAVE_BROKEN_POLL_EXITCODE
+# indicates whether the executable would have been able to run on its
+# target platform. If so, set HAVE_BROKEN_POLL_EXITCODE to
+# the exit code (in many cases 0 for success), otherwise enter "FAILED_TO_RUN".
+# The HAVE_BROKEN_POLL_COMPILED variable holds the build result for this TRY_RUN().
+#
+# Source file : /gpfs/gpfs0/home/gevecb/alex/src/python-svn/build-bgl/CMakeFiles/CMakeTmp/src.c
+# Executable : /gpfs/gpfs0/home/gevecb/alex/src/python-svn/build-bgl/cmTryCompileExec-HAVE_BROKEN_POLL_EXITCODE
+# Run arguments :
+# Called from: [2] /gpfs/gpfs0/home/gevecb/alex/src/python-svn/ConfigureChecks.cmake
+# [1] /gpfs/gpfs0/home/gevecb/alex/src/python-svn/CMakeLists.txt
+
+SET( HAVE_BROKEN_POLL_EXITCODE
+ "1"
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..79503b9
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,347 @@
+cmake_minimum_required(VERSION 2.4.5 FATAL_ERROR)
+
+project(Python)
+
+# user configurable options
+
+option(WITH_TSC "profile with the Pentium timestamp counter" 0)
+option(ENABLE_IPV6 "Enable IP v6" 1)
+option(WITH_DOC_STRINGS "Enable if you want documentation strings in extension modules" 1)
+option(Py_USING_UNICODE "Enable unicode support" 1)
+option(Py_DEBUG "Build debugging interpreter" 0)
+option(WITH_PYMALLOC "Define if you want to compile in Python-specific mallocs" 1)
+option(HAVE_LARGEFILE_SUPPORT "Large file support "1)
+option(WITH_THREAD "compile in rudimentary thread support" 1)
+
+set(PY_MAJOR 2)
+set(PY_MINOR 5)
+set(PY_PATCH 2)
+
+# do the configure checks
+
+include(ConfigureChecks.cmake)
+
+
+set(extraLibs)
+
+set(THREAD_SRC)
+if(WITH_THREAD)
+ if(HAVE_LIBPTHREAD)
+ set(THREAD_SRC Python/thread.c)
+ set(_REENTRANT 1)
+ set(extraLibs ${extraLibs} ${HAVE_LIBPTHREAD})
+ endif(HAVE_LIBPTHREAD)
+ if(WIN32)
+ set(THREAD_SRC Python/thread.c)
+ endif(WIN32)
+endif(WITH_THREAD)
+
+if(HAVE_LIBM)
+ set(extraLibs ${extraLibs} ${HAVE_LIBM})
+endif(HAVE_LIBM)
+
+if(HAVE_LIBUTIL)
+ set(extraLibs ${extraLibs} ${HAVE_LIBUTIL})
+endif(HAVE_LIBUTIL)
+
+set(DYNLOAD_SRC)
+if(HAVE_DYNAMIC_LOADING)
+ if(HAVE_LIBDL)
+ set(extraLibs ${extraLibs} ${HAVE_LIBDL})
+ set(DYNLOAD_SRC ${DYNLOAD_SRC} Python/dynload_shlib.c)
+ endif(HAVE_LIBDL)
+ if(WIN32)
+ set(DYNLOAD_SRC ${DYNLOAD_SRC} Python/dynload_win.c PC/import_nt.c PC/dl_nt.c)
+ endif(WIN32)
+ set(BUILD_LIBS_SHARED_DEFAULT TRUE)
+else(HAVE_DYNAMIC_LOADING)
+ set(BUILD_LIBS_SHARED_DEFAULT FALSE)
+endif(HAVE_DYNAMIC_LOADING)
+
+option(PYTHON_BUILD_LIB_SHARED "Build libpython shared" ${BUILD_LIBS_SHARED_DEFAULT})
+if(PYTHON_BUILD_LIB_SHARED)
+ set(LIB_BUILD_TYPE SHARED)
+else(PYTHON_BUILD_LIB_SHARED)
+ set(LIB_BUILD_TYPE STATIC)
+endif(PYTHON_BUILD_LIB_SHARED)
+
+set(MACHDEP_SRCS ) #TODO: configure
+
+set(SIGNAL_SRCS ) #TODO: configure
+
+set(MOD_SRCS )
+
+
+#####################################
+#
+# setup modules
+#
+#####################################
+
+set(STATIC_MODULES)
+set(DYNAMIC_MODULES)
+
+macro(ADD_PYTHON_MODULE _NAME _STATIC_SRCS)
+ option(MODULE_${_NAME}_ENABLE "Add module ${_NAME}" TRUE)
+
+ if(MODULE_${_NAME}_ENABLE)
+ option(MODULE_${_NAME}_SHARED "Add module ${_NAME} shared" ${BUILD_LIBS_SHARED_DEFAULT})
+ if(MODULE_${_NAME}_SHARED)
+ message(STATUS "Adding ${_NAME} as shared module")
+ set(DYNAMIC_MODULES ${DYNAMIC_MODULES} ${_NAME})
+ add_library(${_NAME} MODULE ${ARGN})
+ set_target_properties(${_NAME} PROPERTIES PREFIX "")
+ else(MODULE_${_NAME}_SHARED)
+ message(STATUS "Adding ${_NAME} as static module")
+ set(STATIC_MODULES ${STATIC_MODULES} ${_NAME})
+ set(${_STATIC_SRCS} ${${_STATIC_SRCS}} ${ARGN})
+ set(PY_STATIC_MODULES_INIT_FUNCTIONS "${PY_STATIC_MODULES_INIT_FUNCTIONS}extern void init${_NAME}(void);\n")
+ set(PY_STATIC_MODULES_INITTAB "${PY_STATIC_MODULES_INITTAB} {\"${_NAME}\", init${_NAME}},\n")
+ endif(MODULE_${_NAME}_SHARED)
+ endif(MODULE_${_NAME}_ENABLE)
+endmacro(ADD_PYTHON_MODULE)
+
+if(WITH_THREAD)
+ add_python_module(thread MOD_SRCS Modules/threadmodule.c)
+endif(WITH_THREAD)
+
+if(WIN32)
+ set(PY_POSIX_NAME nt)
+else(WIN32)
+ set(PY_POSIX_NAME posix)
+endif(WIN32)
+
+add_python_module(${PY_POSIX_NAME} MOD_SRCS Modules/posixmodule.c)
+#add_python_module(signal MOD_SRCS Modules/signalmodule.c)
+add_python_module(_codecs MOD_SRCS Modules/_codecsmodule.c)
+add_python_module(_sre MOD_SRCS Modules/_sre.c)
+add_python_module(_weakref MOD_SRCS Modules/_weakref.c)
+add_python_module(errno MOD_SRCS Modules/errnomodule.c)
+add_python_module(pwd MOD_SRCS Modules/pwdmodule.c)
+add_python_module(_symtable MOD_SRCS Modules/symtablemodule.c)
+add_python_module(xxsubtype MOD_SRCS Modules/xxsubtype.c)
+add_python_module(zipimport MOD_SRCS Modules/zipimport.c)
+
+option(BUILD_UNTESTED_MODULES "Build extra modules" FALSE)
+if(BUILD_UNTESTED_MODULES)
+ add_python_module(_bisect MOD_SRCS Modules/_bisectmodule.c )
+ add_python_module(_bsddb MOD_SRCS Modules/_bsddb.c )
+ add_python_module(_collections MOD_SRCS Modules/_collectionsmodule.c )
+ add_python_module(_csv MOD_SRCS Modules/_csv.c )
+ add_python_module(_elementtree MOD_SRCS Modules/_elementtree.c )
+ add_python_module(_functools MOD_SRCS Modules/_functoolsmodule.c )
+ add_python_module(_heapq MOD_SRCS Modules/_heapqmodule.c )
+ add_python_module(_hotshot MOD_SRCS Modules/_hotshot.c )
+ add_python_module(_locale MOD_SRCS Modules/_localemodule.c )
+ add_python_module(_lsprof MOD_SRCS Modules/_lsprof.c )
+ add_python_module(_random MOD_SRCS Modules/_randommodule.c )
+ add_python_module(_struct MOD_SRCS Modules/_struct.c )
+ add_python_module(array MOD_SRCS Modules/arraymodule.c )
+ add_python_module(binascii MOD_SRCS Modules/binascii.c )
+ add_python_module(cmath MOD_SRCS Modules/cmathmodule.c )
+ add_python_module(datetime MOD_SRCS Modules/datetimemodule.c )
+ add_python_module(dl MOD_SRCS Modules/dlmodule.c )
+ add_python_module(fcntl MOD_SRCS Modules/fcntlmodule.c )
+ add_python_module(grp MOD_SRCS Modules/grpmodule.c )
+ add_python_module(imageop MOD_SRCS Modules/imageop.c )
+ add_python_module(math MOD_SRCS Modules/mathmodule.c )
+ add_python_module(operator MOD_SRCS Modules/operator.c )
+ add_python_module(parser MOD_SRCS Modules/parsermodule.c )
+endif(BUILD_UNTESTED_MODULES)
+
+
+file(MAKE_DIRECTORY ${Python_BINARY_DIR}/Modules)
+if(WIN32)
+ configure_file(PC/pyconfig.h ${Python_BINARY_DIR}/pyconfig.h COPYONLY)
+else(WIN32)
+ configure_file(pyconfig.h.cmake ${Python_BINARY_DIR}/pyconfig.h @ONLY)
+endif(WIN32)
+configure_file(Modules/config.c.cmake ${CMAKE_CURRENT_BINARY_DIR}/Modules/modules-config.c @ONLY)
+file(WRITE ${Python_BINARY_DIR}/Modules/Setup "#created by cmake, do not edit\n")
+
+
+#####################################
+#
+# build python and libpython
+#
+#####################################
+
+set(P_SRCS Parser/acceler.c
+ Parser/grammar1.c
+ Parser/listnode.c
+ Parser/node.c
+ Parser/parser.c
+ Parser/parsetok.c
+ Parser/bitset.c
+ Parser/metagrammar.c
+ Parser/firstsets.c
+ Parser/grammar.c
+ Parser/pgen.c )
+
+set(PARSER_SRCS ${P_SRCS} Parser/myreadline.c Parser/tokenizer.c )
+
+set(OBJECT_SRCS Objects/abstract.c
+ Objects/boolobject.c
+ Objects/bufferobject.c
+ Objects/cellobject.c
+ Objects/classobject.c
+ Objects/cobject.c
+ Objects/codeobject.c
+ Objects/complexobject.c
+ Objects/descrobject.c
+ Objects/enumobject.c
+ Objects/exceptions.c
+ Objects/genobject.c
+ Objects/fileobject.c
+ Objects/floatobject.c
+ Objects/frameobject.c
+ Objects/funcobject.c
+ Objects/intobject.c
+ Objects/iterobject.c
+ Objects/listobject.c
+ Objects/longobject.c
+ Objects/dictobject.c
+ Objects/methodobject.c
+ Objects/moduleobject.c
+ Objects/object.c
+ Objects/obmalloc.c
+ Objects/rangeobject.c
+ Objects/setobject.c
+ Objects/sliceobject.c
+ Objects/stringobject.c
+ Objects/structseq.c
+ Objects/tupleobject.c
+ Objects/typeobject.c
+ Objects/weakrefobject.c
+ )
+
+if(Py_USING_UNICODE)
+ set(OBJECT_SRCS ${OBJECT_SRCS}
+ Objects/unicodeobject.c
+ Objects/unicodectype.c)
+endif(Py_USING_UNICODE)
+
+set(PYTHON_SRCS Python/Python-ast.c
+ Python/asdl.c
+ Python/ast.c
+ Python/bltinmodule.c
+ Python/ceval.c
+ Python/compile.c
+ Python/codecs.c
+ Python/errors.c
+ Python/frozen.c
+ Python/frozenmain.c
+ Python/future.c
+ Python/getargs.c
+ Python/getcompiler.c
+ Python/getcopyright.c
+ Python/getmtime.c
+ Python/getplatform.c
+ Python/getversion.c
+ Python/graminit.c
+ Python/import.c
+ Python/importdl.c
+ Python/marshal.c
+ Python/modsupport.c
+ Python/mystrtoul.c
+ Python/mysnprintf.c
+ Python/pyarena.c
+ Python/pyfpe.c
+ Python/pystate.c
+ Python/pythonrun.c
+ Python/structmember.c
+ Python/symtable.c
+ Python/sysmodule.c
+ Python/traceback.c
+ Python/getopt.c
+ Python/pystrtod.c
+ ${MACHDEP_SRCS}
+ ${THREAD_SRC}
+ ${DYNLOAD_SRC}
+ )
+
+set(MODULE_SRCS ${CMAKE_CURRENT_BINARY_DIR}/Modules/modules-config.c
+ Modules/getbuildinfo.c
+ Modules/_typesmodule.c
+ Modules/getpath.c
+ Modules/main.c
+ Modules/gcmodule.c
+ Modules/signalmodule.c
+ ${MOD_SRCS} )
+
+set_source_files_properties(Python/getplatform.c PROPERTIES COMPILE_FLAGS -DPLATFORM=\\"${PY_PLATFORM}\\")
+set_source_files_properties(Modules/getpath.c PROPERTIES COMPILE_FLAGS "-DPREFIX=\\\"${CMAKE_INSTALL_PREFIX}\\\" -DEXEC_PREFIX=\\\"${CMAKE_INSTALL_PREFIX}\\\" -DVERSION=\\\"${PY_MAJOR}.${PY_MINOR}\\\" -DVPATH=\\\"..\\\" -DPYTHONPATH=\\\":plat-${PY_PLATFORM}\\\" " )
+
+include_directories(Include ${Python_BINARY_DIR})
+if(WIN32)
+ include_directories(PC Python)
+ add_definitions(-DWIN32 -D_WINDOWS)
+endif(WIN32)
+
+add_definitions(-DPy_BUILD_CORE)
+
+if(NOT HAVE_HYPOT)
+ add_definitions(-DWITHOUT_COMPLEX)
+endif(NOT HAVE_HYPOT)
+
+
+add_library(pythonLib ${LIB_BUILD_TYPE}
+ ${PARSER_SRCS}
+ ${OBJECT_SRCS}
+ ${PYTHON_SRCS}
+ ${MODULE_SRCS}
+ ${SIGNAL_SRCS}
+ )
+
+target_link_libraries(pythonLib ${extraLibs})
+set_target_properties(pythonLib PROPERTIES OUTPUT_NAME python${PY_MAJOR}.${PY_MINOR})
+
+add_executable(python Modules/python.c )
+target_link_libraries(python pythonLib)
+
+#if(CMAKE_SYSTEM MATCHES BlueGene)
+# get_target_property(EXE_LOCATION python LOCATION)
+# configure_file(runcone.ksh.in ${CMAKE_CURRENT_BINARY_DIR}/runpy.ksh)
+#endif(CMAKE_SYSTEM MATCHES BlueGene)
+
+add_subdirectory(Lib)
+
+
+#####################################
+#
+# install rules
+#
+#####################################
+
+install(TARGETS python pythonLib
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
+
+# install the python headers
+file(GLOB pyHeaders ${Python_SOURCE_DIR}/Include/*.h )
+install(FILES ${Python_BINARY_DIR}/pyconfig.h ${pyHeaders} DESTINATION include/python${PY_MAJOR}.${PY_MINOR})
+
+# install the dynamic python modules
+if(DYNAMIC_MODULES)
+ install(TARGETS ${DYNAMIC_MODULES} DESTINATION lib/python${PY_MAJOR}.${PY_MINOR}/lib-dynload )
+endif(DYNAMIC_MODULES)
+
+# install the python config tool
+set(EXENAME ${CMAKE_INSTALL_PREFIX}/bin/python)
+configure_file(Misc/python-config.in ${CMAKE_CURRENT_BINARY_DIR}/python${PY_MAJOR}.${PY_MINOR}-config @ONLY)
+install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/python${PY_MAJOR}.${PY_MINOR}-config DESTINATION bin)
+
+# man pages
+install(FILES Misc/python.man DESTINATION man/man1 RENAME python.1)
+
+install(FILES LICENSE DESTINATION lib/python${PY_MAJOR}.${PY_MINOR} RENAME LICENSE.txt)
+
+
+#####################################
+#
+# setup packaging with CPack
+#
+#####################################
+
+include(PythonCPack.cmake)
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
new file mode 100644
index 0000000..1012a4f
--- /dev/null
+++ b/ConfigureChecks.cmake
@@ -0,0 +1,732 @@
+include(CheckCSourceCompiles)
+include(CheckCSourceRuns)
+include(CheckIncludeFiles)
+include(CheckTypeSize)
+include(CheckSymbolExists)
+include(CheckVariableExists)
+include(CMake/MacroPushRequiredVars.cmake)
+include(CMake/CheckStructHasMember.cmake)
+include(CMake/CheckTypeExists.cmake)
+
+if(WIN32)
+ set(HAVE_DYNAMIC_LOADING 1)
+
+else(WIN32)
+
+
+
+macro(ADD_COND var cond item)
+ if(${cond})
+ set(${var} ${${var}} ${item})
+ endif(${cond})
+endmacro(ADD_COND)
+
+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(curses.h HAVE_CURSES_H)
+check_include_files(direct.h HAVE_DIRECT_H)
+check_include_files(dirent.h HAVE_DIRENT_H)
+check_include_files(dlfcn.h HAVE_DLFCN_H)
+check_include_files(errno.h HAVE_ERRNO_H)
+check_include_files(fcntl.h HAVE_FCNTL_H)
+check_include_files(grp.h HAVE_GRP_H)
+check_include_files(inttypes.h HAVE_INTTYPES_H)
+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(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)
+
+check_include_files(memory.h HAVE_MEMORY_H)
+check_include_files(ncurses.h HAVE_NCURSES_H)
+check_include_files(ndir.h HAVE_NDIR_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(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(readline/readline.h HAVE_READLINE_READLINE_H)
+check_include_files(shadow.h HAVE_SHADOW_H)
+check_include_files(signal.h HAVE_SIGNAL_H)
+check_include_files(stdint.h HAVE_STDINT_H)
+check_include_files(stdlib.h HAVE_STDLIB_H)
+check_include_files(strings.h HAVE_STRINGS_H)
+check_include_files(string.h HAVE_STRING_H)
+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/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/mkdev.h HAVE_SYS_MKDEV_H)
+check_include_files(sys/mman.h HAVE_SYS_MMAN_H)
+check_include_files(sys/modem.h HAVE_SYS_MODEM_H)
+check_include_files(sys/ndir.h HAVE_SYS_NDIR_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/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)
+check_include_files(sys/timeb.h HAVE_SYS_TIMEB_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)
+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)
+check_include_files(thread.h HAVE_THREAD_H)
+check_include_files(unistd.h HAVE_UNISTD_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)
+
+check_include_files(stdarg.h HAVE_STDARG_PROTOTYPES)
+
+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_LIBDL dl)
+find_library(HAVE_LIBDLD dld)
+find_library(HAVE_LIBIEEE ieee)
+find_library(HAVE_LIBINTL intl)
+find_library(HAVE_LIBM m)
+find_library(HAVE_LIBNCURSES ncurses)
+find_library(HAVE_LIBPTHREAD pthread)
+find_library(HAVE_LIBREADLINE readline)
+find_library(HAVE_LIBRESOLV resolv)
+find_library(HAVE_LIBTERMCAP termcap)
+find_library(HAVE_LIBUTIL util)
+
+set(CMAKE_REQUIRED_DEFINITIONS -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 -D_BSD_TYPES=1 -DNETBSD_SOURCE=1 -D__BSD_VISIBLE=1)
+set(CMAKE_EXTRA_INCLUDE_FILES stdio.h)
+
+add_cond(CMAKE_REQUIRED_LIBRARIES HAVE_LIBM m)
+add_cond(CMAKE_REQUIRED_LIBRARIES HAVE_LIBINTL intl)
+add_cond(CMAKE_REQUIRED_LIBRARIES HAVE_LIBUTIL util)
+add_cond(CMAKE_EXTRA_INCLUDE_FILES HAVE_WCHAR_H wchar.h)
+
+check_type_size(double SIZEOF_DOUBLE)
+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 long" SIZEOF_LONG_LONG)
+set(HAVE_LONG_LONG ${SIZEOF_LONG_LONG})
+check_type_size(off_t SIZEOF_OFF_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})
+
+set(_LARGEFILE_SOURCE 1)
+set(_FILE_OFFSET_BITS 64)
+
+set(_NETBSD_SOURCE 1)
+set(__BSD_VISIBLE 1)
+set(_BSD_SOURCE 1)
+set(_BSD_TYPES 1)
+set(_GNU_SOURCE 1)
+set(_XOPEN_SOURCE 600)
+set(_XOPEN_SOURCE_EXTENDED 1)
+set(_POSIX_C_SOURCE 200112L)
+
+set(AIX_GENUINE_CPLUSPLUS 0)
+
+set(WITH_DYLD 0)
+set(WITH_NEXT_FRAMEWORK 0)
+if(APPLE)
+ set(WITH_DYLD 1)
+ set(WITH_NEXT_FRAMEWORK 1)
+endif(APPLE)
+
+
+set(CFG_HEADERS )
+
+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_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_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_SIGNAL_H signal.h)
+add_cond(CFG_HEADERS HAVE_STDLIB_H stdlib.h)
+add_cond(CFG_HEADERS HAVE_STRING_H string.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(HAVE_PTY_H)
+ set(CFG_HEADERS ${CFG_HEADERS} pty.h utmp.h)
+endif(HAVE_PTY_H)
+
+set(CFG_HEADERS ${CFG_HEADERS} time.h stdio.h math.h)
+
+check_symbol_exists(alarm "${CFG_HEADERS}" HAVE_ALARM)
+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(execv "${CFG_HEADERS}" HAVE_EXECV)
+check_symbol_exists(fchdir "${CFG_HEADERS}" HAVE_FCHDIR)
+check_symbol_exists(fdatasync "${CFG_HEADERS}" HAVE_FDATASYNC)
+check_symbol_exists(flock "${CFG_HEADERS}" HAVE_FLOCK)
+check_symbol_exists(fork "${CFG_HEADERS}" HAVE_FORK)
+check_symbol_exists(forkpty "${CFG_HEADERS}" HAVE_FORKPTY)
+check_symbol_exists(fpathconf "${CFG_HEADERS}" HAVE_FPATHCONF)
+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)
+check_symbol_exists(getcwd "${CFG_HEADERS}" HAVE_GETCWD)
+check_symbol_exists(getc_unlocked "${CFG_HEADERS}" HAVE_GETC_UNLOCKED)
+check_symbol_exists(getgroups "${CFG_HEADERS}" HAVE_GETGROUPS)
+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)
+check_symbol_exists(getpriority "${CFG_HEADERS}" HAVE_GETPRIORITY)
+check_symbol_exists(getpwent "${CFG_HEADERS}" HAVE_GETPWENT)
+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(kill "${CFG_HEADERS}" HAVE_KILL)
+check_symbol_exists(killpg "${CFG_HEADERS}" HAVE_KILLPG)
+check_symbol_exists(lchflags "${CFG_HEADERS}" HAVE_LCHFLAGS)
+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(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(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(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(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(strerror "${CFG_HEADERS}" HAVE_STRERROR)
+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)
+
+check_type_exists(DIR sys/dir.h HAVE_SYS_DIR_H)
+
+check_struct_has_member("struct stat" st_mtim.tv_nsec "${CFG_HEADERS}" HAVE_STAT_TV_NSEC)
+check_struct_has_member("struct stat" st_mtimensec "${CFG_HEADERS}" HAVE_STAT_TV_NSEC2)
+check_struct_has_member("struct stat" st_birthtime "${CFG_HEADERS}" HAVE_STRUCT_STAT_ST_BIRTHTIME)
+check_struct_has_member("struct stat" st_blksize "${CFG_HEADERS}" HAVE_STRUCT_STAT_ST_BLKSIZE)
+check_struct_has_member("struct stat" st_blocks "${CFG_HEADERS}" HAVE_STRUCT_STAT_ST_BLOCKS)
+set(HAVE_ST_BLOCKS ${HAVE_STRUCT_STAT_ST_BLOCKS})
+check_struct_has_member("struct stat" st_flags "${CFG_HEADERS}" HAVE_STRUCT_STAT_ST_FLAGS)
+check_struct_has_member("struct stat" st_gen "${CFG_HEADERS}" HAVE_STRUCT_STAT_ST_GEN)
+check_struct_has_member("struct stat" st_rdev "${CFG_HEADERS}" HAVE_STRUCT_STAT_ST_RDEV)
+
+
+#######################################################################
+#
+# time
+#
+#######################################################################
+check_struct_has_member("struct tm" tm_zone "${CFG_HEADERS}" HAVE_STRUCT_TM_TM_ZONE)
+check_struct_has_member("struct tm" tm_zone "${CFG_HEADERS}" HAVE_STRUCT_TM_TM_ZONE)
+set(HAVE_TM_ZONE ${HAVE_STRUCT_TM_TM_ZONE})
+
+if(NOT HAVE_STRUCT_TM_TM_ZONE)
+ check_variable_exists(tzname HAVE_TZNAME)
+else(NOT HAVE_STRUCT_TM_TM_ZONE)
+ set(HAVE_TZNAME 0)
+endif(NOT HAVE_STRUCT_TM_TM_ZONE)
+
+check_type_exists("struct tm" sys/time.h TM_IN_SYS_TIME)
+
+check_c_source_compiles("#include <sys/time.h>\n int main() {gettimeofday((struct timeval*)0,(struct timezone*)0);}" GETTIMEOFDAY_WITH_TZ)
+
+if(GETTIMEOFDAY_WITH_TZ)
+ set(GETTIMEOFDAY_NO_TZ 0)
+else(GETTIMEOFDAY_WITH_TZ)
+ set(GETTIMEOFDAY_NO_TZ 1)
+endif(GETTIMEOFDAY_WITH_TZ)
+
+#######################################################################
+#
+# unicode
+#
+#######################################################################
+
+#ucs2
+set(PY_UNICODE_TYPE "unsigned short")
+set(HAVE_USABLE_WCHAR_T 0)
+set(Py_UNICODE_SIZE 2)
+
+if ("${Py_UNICODE_SIZE}" STREQUAL "${SIZEOF_WCHAR_T}")
+ set(PY_UNICODE_TYPE wchar_t)
+ set(HAVE_USABLE_WCHAR_T 1)
+ message(STATUS "Using wchar_t for unicode")
+else ("${Py_UNICODE_SIZE}" STREQUAL "${SIZEOF_WCHAR_T}")
+
+ if ("${Py_UNICODE_SIZE}" STREQUAL "${SIZEOF_SHORT}")
+ set(PY_UNICODE_TYPE "unsigned short")
+ set(HAVE_USABLE_WCHAR_T 0)
+ message(STATUS "Using unsigned short for unicode")
+ else ("${Py_UNICODE_SIZE}" STREQUAL "${SIZEOF_SHORT}")
+
+ if ("${Py_UNICODE_SIZE}" STREQUAL "${SIZEOF_LONG}")
+ set(PY_UNICODE_TYPE "unsigned long")
+ set(HAVE_USABLE_WCHAR_T 0)
+ message(STATUS "Using unsigned long for unicode")
+ else ("${Py_UNICODE_SIZE}" STREQUAL "${SIZEOF_LONG}")
+
+ if(Py_USING_UNICODE)
+ message(SEND_ERROR "No usable unicode type found, disable Py_USING_UNICODE to be able to build Python")
+ else(Py_USING_UNICODE)
+ message(STATUS "No usable unicode type found")
+ endif(Py_USING_UNICODE)
+
+ endif("${Py_UNICODE_SIZE}" STREQUAL "${SIZEOF_LONG}")
+
+ endif("${Py_UNICODE_SIZE}" STREQUAL "${SIZEOF_SHORT}")
+
+endif("${Py_UNICODE_SIZE}" STREQUAL "${SIZEOF_WCHAR_T}")
+
+
+
+
+#######################################################################
+#
+# networking tests
+#
+#######################################################################
+macro_push_required_vars()
+set(CFG_HEADERS_SAVE ${CFG_HEADERS})
+add_cond(CFG_HEADERS HAVE_NETDB_H netdb.h)
+add_cond(CFG_HEADERS HAVE_NETDB_H netinet/in.h)
+add_cond(CFG_HEADERS HAVE_ARPA_INET_H arpa/inet.h)
+
+check_symbol_exists(gai_strerror "${CFG_HEADERS}" HAVE_GAI_STRERROR)
+check_symbol_exists(getaddrinfo "${CFG_HEADERS}" HAVE_GETADDRINFO)
+check_symbol_exists(gethostbyname "${CFG_HEADERS}" HAVE_GETHOSTBYNAME)
+#check_symbol_exists(gethostbyname_r "${CFG_HEADERS}" HAVE_GETHOSTBYNAME_R) # see end of file
+check_symbol_exists(getnameinfo "${CFG_HEADERS}" HAVE_GETNAMEINFO)
+check_symbol_exists(getpeername "${CFG_HEADERS}" HAVE_GETPEERNAME)
+check_symbol_exists(hstrerror "${CFG_HEADERS}" HAVE_HSTRERROR)
+check_symbol_exists(inet_aton "${CFG_HEADERS}" HAVE_INET_ATON)
+check_symbol_exists(inet_pton "${CFG_HEADERS}" HAVE_INET_PTON)
+
+check_type_exists("struct addrinfo" "${CFG_HEADERS}" HAVE_ADDRINFO)
+check_struct_has_member(sockaddr sa_len "${CFG_HEADERS}" HAVE_SOCKADDR_SA_LEN )
+check_type_exists("struct sockaddr_storage" "${CFG_HEADERS}" HAVE_SOCKADDR_STORAGE)
+