forked from dataseries/Lintel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeConfig.txt
259 lines (213 loc) · 9.66 KB
/
CMakeConfig.txt
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
#
# (c) Copyright 2008, Hewlett-Packard Development Company, LP
#
# See the file named COPYING for license details
#
# All of the options and dependencies for the various cmake sub-bits
INCLUDE(LintelCMakeUtil)
LINTEL_RPATH_CONFIG()
#### Default build type
IF(NOT CMAKE_BUILD_TYPE)
MESSAGE("WARNING: you did not set a CMAKE_BUILD_TYPE; assuming RelWithDebInfo")
SET(CMAKE_BUILD_TYPE RelWithDebInfo)
ENDIF(NOT CMAKE_BUILD_TYPE)
#### OS specific bits
IF(WIN32)
ADD_DEFINITIONS(/DSYS_NT)
INCLUDE_DIRECTORIES(${Lintel_SOURCE_DIR}/include/Lintel/windows)
ELSE(WIN32)
ADD_DEFINITIONS(-DSYS_POSIX)
ENDIF(WIN32)
IF("${LINTEL_SYSTEM_TYPE}" STREQUAL "Linux")
SET(PROCESS_STATISTICS_DEFAULT On)
ELSE("${LINTEL_SYSTEM_TYPE}" STREQUAL "Linux")
SET(PROCESS_STATISTICS_DEFAULT Off)
ENDIF("${LINTEL_SYSTEM_TYPE}" STREQUAL "Linux")
OPTION(WITH_PROCESS_STATISTICS "Build the process-statistics module in lintel"
${PROCESS_STATISTICS_DEFAULT})
##### Required bits
INCLUDE(FindBoost)
IF(NOT Boost_FOUND)
MESSAGE(FATAL_ERROR "ERROR: Could NOT find the Boost includes and libraries")
ENDIF(NOT Boost_FOUND)
INCLUDE(LintelFind)
SET(BOOST_THREAD_FIND_REQUIRED ON)
LINTEL_BOOST_EXTRA(BOOST_THREAD boost/thread/tss.hpp "boost_thread boost_thread-mt")
##### Optional bits
LINTEL_WITH_PROGRAM(PERL perl)
LINTEL_WITH_PROGRAM(GNUPLOT gnuplot)
LINTEL_WITH_PROGRAM(PSTOPNM pstopnm)
LINTEL_WITH_PROGRAM(PNMSCALE pnmscale)
LINTEL_WITH_PROGRAM(PNMTOPNG pnmtopng)
LINTEL_WITH_PROGRAM(SSH ssh)
SET(SFDISK_EXTRA_PATHS /sbin /usr/sbin)
LINTEL_WITH_PROGRAM(SFDISK sfdisk)
LINTEL_WITH_PROGRAM(SGINFO sginfo)
LINTEL_WITH_PERL_MODULE(PERL_DATA_SHOWTABLE Data::ShowTable)
LINTEL_WITH_PERL_MODULE(PERL_DBI DBI)
LINTEL_WITH_PERL_MODULE(PERL_DBD_MYSQL DBD::mysql)
LINTEL_WITH_PERL_MODULE(PERL_DIGEST_HMAC Digest::HMAC)
LINTEL_WITH_PERL_MODULE(PERL_BSD_RESOURCE BSD::Resource)
LINTEL_WITH_PERL_MODULE(PERL_TIME_HIRES Time::HiRes)
IF(0)
ELSEIF(PERL_ENABLED AND GNUPLOT_ENABLED AND PSTOPNM_ENABLED AND PNMSCALE_ENABLED
AND PNMTOPNG_ENABLED AND PERL_TIME_HIRES_ENABLED)
SET(MERCURY_PLOT_ENABLED ON)
IF (NOT PERL_DATA_SHOWTABLE_ENABLED)
MESSAGE(" missing Data::ShowTable module, mercury-plot functionality will be reduced")
ENDIF (NOT PERL_DATA_SHOWTABLE_ENABLED)
ELSE(0)
MESSAGE("mercury-plot will NOT be built. Could not find all of: perl(${PERL_ENABLED}), gnuplot(${GNUPLOT_ENABLED}),")
MESSAGE(" pstopnm(${PSTOPNM_ENABLED}), pnmscale(${PNMSCALE_ENABLED}), pnmtopng(${PNMTOPNG_ENABLED}), Time::HiRes(${PERL_TIME_HIRES})")
SET(MERCURY_PLOT_ENABLED OFF)
ENDIF(0)
IF(0)
ELSEIF(PERL_ENABLED AND PERL_DBI_ENABLED AND PERL_DBD_MYSQL_ENABLED)
SET(LINTEL_DBI_ENABLED ON)
ELSE(0)
MESSAGE("Lintel::DBI will NOT be built. Could not find all of perl(${PERL_ENABLED}),")
MESSAGE(" DBI module (${PERL_DBI_ENABLED}), DBD::mysql module ($PERL_DBD_MYSQL_ENABLED)")
SET(LINTEL_DBI_ENABLED OFF)
ENDIF(0)
OPTION(WITH_PERL_BINARY_MODULES "Build the perl binary modules?" On)
OPTION(ENABLE_STDIO64 "Enable 64 bit stdio bits")
# Package for detecting if we are in a virtual machine...
# Home page: http://et.redhat.com/~rjones/virt-what/
# Source and RPMs: http://et.redhat.com/~rjones/virt-what/files/
OPTION(ENABLE_CLOCK_TEST "Enable the cycle-counter clock test; has trouble in virtual machines" ON)
### Library type
OPTION(BUILD_SHARED_LIBS "Should we build shared libraries" ON)
IF(BUILD_SHARED_LIBS)
SET(LIBRARY_TYPE SHARED)
ELSE(BUILD_SHARED_LIBS)
SET(LIBRARY_TYPE STATIC)
ENDIF(BUILD_SHARED_LIBS)
### Documentation
INCLUDE(LintelDocs)
LINTEL_DOCS_CONFIG("Lintel")
LINTEL_POD2MAN_SETUP()
### Threads
INCLUDE(FindThreads)
OPTION(WITH_THREADS "Try to build with thread (pthread right now) support?" On)
IF(CMAKE_HAVE_THREADS_LIBRARY AND CMAKE_HAVE_PTHREAD_H AND WITH_THREADS)
SET(THREADS_ENABLED ON)
ELSE(CMAKE_HAVE_THREADS_LIBRARY AND CMAKE_HAVE_PTHREAD_H AND WITH_THREADS)
SET(THREADS_ENABLED OFF)
ENDIF(CMAKE_HAVE_THREADS_LIBRARY AND CMAKE_HAVE_PTHREAD_H AND WITH_THREADS)
IF(WITH_THREADS AND NOT THREADS_ENABLED)
MESSAGE("WITH_THREADS on, but could not find pthread includes/libraries.")
MESSAGE(" LintelPThread library will be skipped.")
ENDIF(WITH_THREADS AND NOT THREADS_ENABLED)
IF(WITH_THREADS AND THREADS_ENABLED)
IF(HAS_PTHREAD_ISLOCKED)
SET(PTHREAD_ISLOCKED_QUIET ON)
ELSE(HAS_PTHREAD_ISLOCKED)
MESSAGE("Determining expression for PThreadMutex::isLocked()")
IF(0)
ELSEIF("${LINTEL_SYSTEM_TYPE}" STREQUAL "HP-UX")
SET(TMP_HAS_PTHREAD_ISLOCKED 1)
SET(TMP_PTHREAD_ISLOCKED_EXPR "((char *)&m)[67] == 0")
ELSEIF("${LINTEL_SYSTEM_TYPE}" STREQUAL "Linux")
LINTEL_TRY_RUN(LINUX_ISLOCKED_1 config/linux-islocked-1.cpp
CMAKE_FLAGS -DLINK_LIBRARIES=-lpthread)
LINTEL_TRY_RUN(LINUX_ISLOCKED_2 config/linux-islocked-2.cpp
CMAKE_FLAGS -DLINK_LIBRARIES=-lpthread)
LINTEL_TRY_RUN(LINUX_ISLOCKED_3 config/linux-islocked-3.cpp
CMAKE_FLAGS -DLINK_LIBRARIES=-lpthread)
IF(0)
ELSEIF(LINUX_ISLOCKED_1)
SET(TMP_HAS_PTHREAD_ISLOCKED 1)
SET(TMP_PTHREAD_ISLOCKED_EXPR "m.__m_lock.__status != 0")
ELSEIF(LINUX_ISLOCKED_2)
SET(TMP_HAS_PTHREAD_ISLOCKED 1)
SET(TMP_PTHREAD_ISLOCKED_EXPR "m.__data.__lock != 0")
ELSEIF(LINUX_ISLOCKED_3)
SET(TMP_HAS_PTHREAD_ISLOCKED 1)
SET(TMP_PTHREAD_ISLOCKED_EXPR "m.__m_reserved != 0")
ELSE(0)
SET(TMP_HAS_PTHREAD_ISLOCKED 0)
ENDIF(0)
ELSE(0)
SET(TMP_HAS_PTHREAD_ISLOCKED 0)
ENDIF(0)
SET(HAS_PTHREAD_ISLOCKED ${TMP_HAS_PTHREAD_ISLOCKED} CACHE INTERNAL
"do we have islocked" FORCE)
SET(PTHREAD_ISLOCKED_EXPR "${TMP_PTHREAD_ISLOCKED_EXPR}" CACHE INTERNAL
"what expression calculates islocked?" FORCE)
ENDIF(HAS_PTHREAD_ISLOCKED)
IF(HAS_PTHREAD_ISLOCKED)
IF(NOT PTHREAD_ISLOCKED_QUIET)
MESSAGE(" Success, using ${PTHREAD_ISLOCKED_EXPR}")
ENDIF(NOT PTHREAD_ISLOCKED_QUIET)
ELSE(HAS_PTHREAD_ISLOCKED)
MESSAGE(" Unable to figure out how to determine if a mutex is locked")
ENDIF(HAS_PTHREAD_ISLOCKED)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/include/Lintel/PThread.hpp.in
${CMAKE_CURRENT_BINARY_DIR}/include/Lintel/PThread.hpp
@ONLY)
# Eric Anderson has no idea why the below seems to be needed, but without it, tests like
# simplemutex,lintel-perl fail even though libLintel and simplemutex are both build with the
# -pthread option that is specified by the FindThreads.cmake module.
IF ("${LINTEL_SYSTEM_TYPE}" STREQUAL "OpenBSD")
FIND_LIBRARY(OPENBSD_PTHREAD pthread)
SET(CMAKE_THREAD_LIBS_INIT ${CMAKE_THREAD_LIBS_INIT} ${OPENBSD_PTHREAD})
ENDIF ("${LINTEL_SYSTEM_TYPE}" STREQUAL "OpenBSD")
ENDIF(WITH_THREADS AND THREADS_ENABLED)
### LibXML2
INCLUDE(FindLibXml2)
OPTION(WITH_LIBXML2 "Use the libxml2 library if it is found?" On)
IF(LIBXML2_FOUND AND WITH_LIBXML2)
SET(LIBXML2_ENABLED ON)
ELSE(LIBXML2_FOUND AND WITH_LIBXML2)
SET(LIBXML2_ENABLED OFF)
ENDIF(LIBXML2_FOUND AND WITH_LIBXML2)
IF(WITH_LIBXML2 AND NOT LIBXML2_ENABLED)
MESSAGE("WITH_LIBXML2 on, but could not find libxml2 includes/libraries.")
MESSAGE(" XMLUtil and LintelLogXML will be skipped.")
ENDIF(WITH_LIBXML2 AND NOT LIBXML2_ENABLED)
### Latex
INCLUDE(FindLATEX)
FIND_PROGRAM(PS2PDF14_CONVERTER
NAMES ps2pdf14
PATHS ${MIKTEX_BINARY_PATH} /usr/bin
)
OPTION(WITH_LATEX "Include the latex rebuild script (requires latex, bibtex, dvips, ps2pdf14)" On)
IF(WITH_LATEX)
IF(LATEX_COMPILER AND BIBTEX_COMPILER AND DVIPS_CONVERTER AND PS2PDF14_CONVERTER)
SET(LATEX_ENABLED ON)
ELSE(LATEX_COMPILER AND BIBTEX_COMPILER AND DVIPS_CONVERTER AND PS2PDF14_CONVERTER)
SET(LATEX_ENABLED OFF)
ENDIF(LATEX_COMPILER AND BIBTEX_COMPILER AND DVIPS_CONVERTER AND PS2PDF14_CONVERTER)
IF(LATEX_ENABLED)
MACRO(CHECK_P_THING thing)
EXECUTE_PROCESS(COMMAND ${DVIPS_CONVERTER} -P ${thing}
OUTPUT_VARIABLE dvips_${thing}_out ERROR_VARIABLE dvips_${thing}_err)
IF(dvips_${thing}_err MATCHES "no config file for .${thing}.")
SET(DVIPS_P_${thing})
ELSE(dvips_${thing}_err MATCHES "no config file for .${thing}.")
SET(DVIPS_P_${thing} "-P ${thing}")
ENDIF(dvips_${thing}_err MATCHES "no config file for .${thing}.")
ENDMACRO(CHECK_P_THING thing)
CHECK_P_THING(pdf)
CHECK_P_THING(cmz)
CHECK_P_THING(amz)
IF(NOT DVIPS_P_pdf)
MESSAGE("WARNING: Can not find config file for pdf, disabling latex")
SET(LATEX_ENABLED NO)
ENDIF(NOT DVIPS_P_pdf)
ENDIF(LATEX_ENABLED)
IF(NOT LATEX_ENABLED)
MESSAGE("WITH_LATEX on, but could not find latex, bibtex, dvips, ps2pdf14")
ENDIF(NOT LATEX_ENABLED)
ENDIF(WITH_LATEX)
## Boost optional bits
# TODO: figure out how to extend this to also do versioning,
# boost 1.32 doesn't have enough of program options for us to work.
LINTEL_BOOST_EXTRA(BOOST_PROGRAM_OPTIONS boost/program_options.hpp
"boost_program_options boost_program_options-mt")
IF(NOT BOOST_PROGRAM_OPTIONS_LIBRARIES)
MESSAGE("Unable to find boost/program_options.hpp; will not build Lintel/ProgramOptions")
ENDIF(NOT BOOST_PROGRAM_OPTIONS_LIBRARIES)
LINTEL_BOOST_EXTRA(BOOST_MAKE_UNSIGNED boost/type_traits/make_unsigned.hpp None)
# TODO: if we are forced onto program_options-mt, then we should really be
# putting that into LintelPThread since we just forced thread linking.