Merge branch 'master' into pc_mem_stats
[dyninst.git] / cmake / platform_unix.cmake
1 set (PLATFORM $ENV{PLATFORM})
2
3 set (VALID_PLATFORMS
4     amd64-unknown-freebsd7.2 
5     i386-unknown-freebsd7.2 
6     i386-unknown-linux2.4 
7     ppc32_linux 
8     ppc64_linux 
9     x86_64-unknown-linux2.4
10     ppc64_bgq_ion
11     )
12
13 if (NOT PLATFORM)
14 set (INVALID_PLATFORM true)
15 else()
16 list (FIND VALID_PLATFORMS ${PLATFORM} PLATFORM_FOUND)
17   if (PLATFORM_FOUND EQUAL -1)
18   set (INVALID_PLATFORM true)
19   endif()
20 endif()
21
22
23 if (INVALID_PLATFORM)
24 # Try to set it automatically
25 execute_process (COMMAND ${DYNINST_ROOT}/scripts/sysname
26                  OUTPUT_VARIABLE SYSNAME_OUT
27                  )
28 execute_process (COMMAND ${DYNINST_ROOT}/scripts/dynsysname ${SYSNAME_OUT}
29                  OUTPUT_VARIABLE DYNSYSNAME_OUT
30                  )
31 string (REPLACE "\n" "" PLATFORM ${DYNSYSNAME_OUT})
32 message ("-- Attempting to automatically identify platform: ${PLATFORM}")
33 endif()
34
35 list (FIND VALID_PLATFORMS ${PLATFORM} PLATFORM_FOUND)
36
37 if (PLATFORM_FOUND EQUAL -1)
38 message (FATAL_ERROR "Error: unknown platform ${PLATFORM}; please set the PLATFORM environment variable to one of the following options: ${VALID_PLATFORMS}")
39 endif()
40