2 # Convenience wrapper for easily viewing/setting options that
3 # the project's CMake scripts will recognize
8 # check for `cmake` command
9 type cmake
> /dev
/null
2>&1 ||
{
11 This package requires CMake, please install it first, then you may
12 use this configure script to access CMake equivalent functionality.\
18 Usage: $0 [OPTION]... [VAR=VALUE]...
20 --builddir= The build directory
21 --generator= run cmake --help for a list of generators
22 --prefix= Snort++ installation prefix
25 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
26 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
27 --enable-code-coverage Whether to enable code coverage support
28 --enable-hardened-build Detect and use compile-time hardening options
29 --enable-pie Attempt to produce a position-independent executable
30 --disable-safec do not use libsafec bounds checking even if available
31 --disable-static-ips-actions
32 do not include ips actions in binary
33 --disable-static-inspectors
34 do not include inspectors in binary
35 --disable-static-loggers
36 do not include loggers in binary
37 --disable-static-ips-options
38 do not include ips options in binary
39 --disable-static-search-engines
40 do not include search engines in binary
41 --disable-static-codecs do not include codecs in binary
42 --enable-shell enable command line shell support
43 --enable-large-pcap enable support for pcaps larger than 2 GB
44 --enable-stdlog use file descriptor 3 instead of stdout for alerts
45 --enable-tsc-clock use timestamp counter register clock (x86 only)
46 --enable-debug-msgs enable debug printing options (bugreports and
48 --enable-debug enable debugging options (bugreports and developers
50 --disable-gdb disable gdb debugging information
51 --enable-gprof-profile enable gprof profiling options (developers only)
52 --disable-snort-profiler
53 disable snort performance profiling (cpu and memory) (developers only)
54 --enable-deep-profiling
55 enabled detailed snort performance profiling (developers only)
56 --disable-memory-manager
57 disable snort memory manager (developers only)
58 --disable-corefiles prevent Snort from generating core files
59 --enable-address-sanitizer
60 enable address sanitizer support
61 --enable-thread-sanitizer
62 enable thread sanitizer support
64 enable undefined behavior sanitizer support
66 enable using tcmalloc for dynamic memory management
67 --enable-appid-third-party
68 enable third party appid
69 --enable-unit-tests build unit tests
70 --enable-piglet build piglet test harness
71 --disable-static-daq link static DAQ modules
72 --disable-html-docs don't create the HTML documentation
73 --disable-pdf-docs don't create the PDF documentation
74 --disable-text-docs don't create the TEXT documentation
75 --disable-docs don't create documentation
78 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
79 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
80 --with-pcap-includes=DIR
81 libpcap include directory
82 --with-pcap-libraries=DIR
83 libpcap library directory
84 --with-luajit-includes=DIR
85 luajit include directory
86 --with-luajit-libraries=DIR
87 luajit library directory
88 --with-pcre-includes=DIR
89 libpcre include directory
90 --with-pcre-libraries=DIR
91 libpcre library directory
92 --with-dnet-includes=DIR
93 libdnet include directory
94 --with-dnet-libraries=DIR
95 libdnet library directory
96 --with-daq-includes=DIR DAQ include directory
97 --with-daq-libraries=DIR
99 --with-openssl=DIR openssl installation root directory
100 --with-hyperscan-includes=DIR
101 libhs include directory
102 --with-hyperscan-libraries=DIR
103 libhs library directory
104 --with-flatbuffers-includes=DIR
105 flatbuffers include directory
106 --with-flatbuffers-libraries=DIR
107 flatbuffers library directory
108 --with-uuid-includes=DIR
109 libuuid include directory
110 --with-uuid-libraries=DIR
111 libuuid library directory
113 Some influential environment variables:
114 SIGNAL_SNORT_RELOAD=<value>
115 set the SIGNAL_SNORT_RELOAD value
116 SIGNAL_SNORT_DUMP_STATS<value>
117 set the SIGNAL_SNORT_DUMP_STATS value
118 SIGNAL_SNORT_ROTATE_STATS<value>
119 set the SIGNAL_SNORT_ROTATE_STATS value
120 SIGNAL_SNORT_READ_ATTR_TBL<value>
121 set the SIGNAL_SNORT_READ_ATTR_TBL value
124 sourcedir
="$( cd "$
( dirname "$0" )" && pwd )"
126 # Function to append a CMake cache entry definition to the
127 # CMakeCacheEntries variable
128 # $1 is the cache entry variable name
129 # $2 is the cache entry variable type
130 # $3 is the cache entry variable value
131 append_cache_entry
() {
132 CMakeCacheEntries
="$CMakeCacheEntries -D $1:$2=$3"
137 prefix
=/usr
/local
/snort
139 append_cache_entry CMAKE_INSTALL_PREFIX PATH
$prefix
143 while [ $# -ne 0 ]; do
145 -*=*) optarg
=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
158 CMakeCacheEntries
="$CMakeCacheEntries -D$optarg"
161 CMakeGenerator
="$optarg"
165 append_cache_entry CMAKE_INSTALL_PREFIX PATH
$optarg
167 --enable-code-coverage)
168 append_cache_entry ENABLE_CODE_COVERAGE BOOL true
170 --disable-code-coverage)
171 append_cache_entry ENABLE_CODE_COVERAGE BOOL false
173 --enable-hardened-build)
174 append_cache_entry ENABLE_HARDENED_BUILD BOOL true
176 --disable-hardened-build)
177 append_cache_entry ENABLE_HARDENED_BUILD BOOL false
180 append_cache_entry ENABLE_PIE BOOL true
183 append_cache_entry ENABLE_PIE BOOL false
186 append_cache_entry ENABLE_SAFEC BOOL false
189 append_cache_entry ENABLE_SAFEC BOOL true
191 --disable-static-ips-actions)
192 append_cache_entry STATIC_IPS_ACTIONS BOOL false
194 --enable-static-ips-actions)
195 append_cache_entry STATIC_IPS_ACTIONS BOOL true
197 --disable-static-inspectors)
198 append_cache_entry STATIC_INSPECTORS BOOL false
200 --enable-static-inspectors)
201 append_cache_entry STATIC_INSPECTORS BOOL true
203 --disable-static-loggers)
204 append_cache_entry STATIC_LOGGERS BOOL false
206 --enable-static-loggers)
207 append_cache_entry STATIC_LOGGERS BOOL true
209 --disable-static-ips-options)
210 append_cache_entry STATIC_IPS_OPTIONS BOOL false
212 --enable-static-ips-options)
213 append_cache_entry STATIC_IPS_OPTIONS BOOL true
215 --disable-static-search-engines)
216 append_cache_entry STATIC_SEARCH_ENGINES BOOL false
218 --enable-static-search-engines)
219 append_cache_entry STATIC_SEARCH_ENGINES BOOL true
221 --disable-static-codecs)
222 append_cache_entry STATIC_CODECS BOOL false
224 --enable-static-codecs)
225 append_cache_entry STATIC_CODECS BOOL true
228 append_cache_entry ENABLE_SHELL BOOL true
231 append_cache_entry ENABLE_SHELL BOOL false
234 append_cache_entry ENABLE_LARGE_PCAP BOOL true
237 append_cache_entry ENABLE_STDLOG BOOL true
240 append_cache_entry ENABLE_TSC_CLOCK BOOL true
242 --disable-snort-profiler)
243 append_cache_entry DISABLE_SNORT_PROFILER BOOL true
245 --enable-deep-profiling)
246 append_cache_entry ENABLE_DEEP_PROFILING BOOL true
248 --disable-memory-manager)
249 append_cache_entry DISABLE_MEMORY_MANAGER BOOL true
251 --disable-large-pcap)
252 append_cache_entry ENABLE_LARGE_PCAP BOOL false
255 append_cache_entry ENABLE_DEBUG_MSGS BOOL true
257 --disable-debug-msgs)
258 append_cache_entry ENABLE_DEBUG_MSGS BOOL false
261 append_cache_entry ENABLE_DEBUG BOOL true
264 append_cache_entry ENABLE_DEBUG BOOL false
267 append_cache_entry ENABLE_GDB BOOL true
270 append_cache_entry ENABLE_GDB BOOL false
272 --enable-gprof-profile)
273 append_cache_entry ENABLE_PROFILE BOOL true
275 --disable-gprof-profile)
276 append_cache_entry ENABLE_PROFILE BOOL false
279 append_cache_entry ENABLE_COREFILES BOOL false
282 append_cache_entry ENABLE_COREFILES BOOL true
284 --enable-address-sanitizer)
285 append_cache_entry ENABLE_ADDRESS_SANITIZER BOOL true
287 --disable-address-sanitizer)
288 append_cache_entry ENABLE_ADDRESS_SANITIZER BOOL false
290 --enable-thread-sanitizer)
291 append_cache_entry ENABLE_THREAD_SANITIZER BOOL true
293 --disable-thread-sanitizer)
294 append_cache_entry ENABLE_THREAD_SANITIZER BOOL false
296 --enable-ub-sanitizer)
297 append_cache_entry ENABLE_UB_SANITIZER BOOL true
299 --disable-ub-sanitizer)
300 append_cache_entry ENABLE_UB_SANITIZER BOOL false
303 append_cache_entry ENABLE_TCMALLOC BOOL true
306 append_cache_entry ENABLE_TCMALLOC BOOL false
308 --enable-appid-third-party)
309 append_cache_entry ENABLE_APPID_THIRD_PARTY BOOL true
312 append_cache_entry ENABLE_UNIT_TESTS BOOL true
314 --disable-unit-tests)
315 append_cache_entry ENABLE_UNIT_TESTS BOOL false
318 append_cache_entry ENABLE_PIGLET BOOL true
321 append_cache_entry ENABLE_PIGLET BOOL false
323 --disable-static-daq)
324 append_cache_entry ENABLE_STATIC_DAQ BOOL false
327 append_cache_entry ENABLE_STATIC_DAQ BOOL true
330 append_cache_entry MAKE_HTML_DOC BOOL false
333 append_cache_entry MAKE_HTML_DOC BOOL true
336 append_cache_entry MAKE_PDF_DOC BOOL false
339 append_cache_entry MAKE_PDF_DOC BOOL true
342 append_cache_entry MAKE_TEXT_DOC BOOL false
345 append_cache_entry MAKE_TEXT_DOC BOOL true
348 append_cache_entry MAKE_DOC BOOL false
351 append_cache_entry MAKE_DOC BOOL true
353 --with-pcap-includes=*)
354 append_cache_entry PCAP_INCLUDE_DIR_HINT PATH
$optarg
356 --with-pcap-libraries=*)
357 append_cache_entry PCAP_LIBRARIES_DIR_HINT PATH
$optarg
359 --with-luajit-includes=*)
360 append_cache_entry LUAJIT_INCLUDE_DIR_HINT PATH
$optarg
362 --with-luajit-libraries=*)
363 append_cache_entry LUAJIT_LIBRARIES_DIR_HINT PATH
$optarg
365 --with-pcre-includes=*)
366 append_cache_entry PCRE_INCLUDE_DIR_HINT PATH
$optarg
368 --with-pcre-libraries=*)
369 append_cache_entry PCRE_LIBRARIES_DIR_HINT PATH
$optarg
371 --with-dnet-includes=*)
372 append_cache_entry DNET_INCLUDE_DIR_HINT PATH
$optarg
374 --with-dnet-libraries=*)
375 append_cache_entry DNET_LIBRARIES_DIR_HINT PATH
$optarg
377 --with-daq-includes=*)
378 append_cache_entry DAQ_INCLUDE_DIR_HINT PATH
$optarg
380 --with-daq-libraries=*)
381 append_cache_entry DAQ_LIBRARIES_DIR_HINT PATH
$optarg
384 append_cache_entry OPENSSL_ROOT_DIR PATH
$optarg
386 --with-hyperscan-includes=*)
387 append_cache_entry HS_INCLUDE_DIR PATH
$optarg
389 --with-hyperscan-libraries=*)
390 append_cache_entry HS_LIBRARIES_DIR PATH
$optarg
392 --with-flatbuffers-includes=*)
393 append_cache_entry FLATBUFFERS_INCLUDE_DIR_HINT PATH
$optarg
395 --with-flatbuffers-libraries=*)
396 append_cache_entry FLATBUFFERS_LIBRARIES_DIR_HINT PATH
$optarg
398 --with-uuid-includes=*)
399 append_cache_entry UUID_INCLUDE_DIR_HINT PATH
$optarg
401 --with-uuid-libraries=*)
402 append_cache_entry UUID_LIBRARIES_DIR_HINT PATH
$optarg
404 SIGNAL_SNORT_RELOAD
=*)
405 append_cache_entry SIGNAL_SNORT_RELOAD STRING
$optarg
407 SIGNAL_SNORT_DUMP_STATS
=*)
408 append_cache_entry SIGNAL_SNORT_DUMP_STATS STRING
$optarg
410 SIGNAL_SNORT_ROTATE_STATS
=*)
411 append_cache_entry SIGNAL_SNORT_ROTATE_STATS STRING
$optarg
413 SIGNAL_SNORT_READ_ATTR_TBL
=*)
414 append_cache_entry SIGNAL_SNORT_READ_ATTR_TBL STRING
$optarg
417 echo "Invalid option '$1'. Try $0 --help to see available options."
424 if [ -d $builddir ]; then
425 # If build directory exists, check if it has a CMake cache
426 if [ -f $builddir/CMakeCache.txt
]; then
427 # If the CMake cache exists, delete it so that this configuration
428 # is not tainted by a previous one
429 rm -f $builddir/CMakeCache.txt
432 # Create build directory
436 echo "Build Directory : $builddir"
437 echo "Source Directory: $sourcedir"
440 [ "$CMakeGenerator" ] && gen
="-G $CMakeGenerator"
443 -DCMAKE_CXX_FLAGS:STRING
="$CXXFLAGS $CPPFLAGS" \
444 -DCMAKE_C_FLAGS:STRING
="$CFLAGS $CPPFLAGS" \
445 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
446 $CMakeCacheEntries $sourcedir
448 echo "# This is the command used to configure this build" > config.status
449 echo $command >> config.status
450 chmod u
+x config.status