2 # Convenience wrapper for easily viewing/setting options that
3 # the project's CMake scripts will recognize
7 # check for `cmake` command
8 type cmake
> /dev
/null
2>&1 ||
{
10 This package requires CMake, please install it first, then you may
11 use this configure script to access CMake equivalent functionality.\
17 Usage: $0 [OPTION]... [VAR=VALUE]...
19 --builddir= The build directory
20 --generator= run cmake --help for a list of generators
21 --prefix= Snort++ installation prefix
24 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
25 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
26 --enable-code-coverage Whether to enable code coverage support
27 --enable-hardened-build Detect and use compile-time hardening options
28 --enable-pie Attempt to produce a position-independent executable
29 --disable-safec do not use libsafec bounds checking even if available
30 --disable-static-ips-actions
31 do not include ips actions in binary
32 --disable-static-inspectors
33 do not include inspectors in binary
34 --disable-static-loggers
35 do not include loggers in binary
36 --disable-static-ips-options
37 do not include ips options in binary
38 --disable-static-search-engines
39 do not include search engines in binary
40 --disable-static-codecs do not include codecs in binary
41 --enable-shell enable command line shell support
42 --enable-large-pcap enable support for pcaps larger than 2 GB
43 --disable-stdlog do not prefer file descriptor 3 over stdout for alerts
44 --enable-tsc-clock use timestamp counter register clock (x86 only)
45 --enable-debug-msgs enable debug printing options (bugreports and
47 --enable-debug enable debugging options (bugreports and developers
49 --enable-gdb enable gdb debugging information
50 --enable-gprof-profile enable gprof profiling options (developers only)
51 --disable-corefiles prevent Snort from generating core files
52 --enable-address-sanitizer
53 enable address sanitizer support
54 --enable-thread-sanitizer
55 enable thread sanitizer support
56 --enable-unit-tests build unit tests
57 --enable-piglet build piglet test harness
58 --disable-static-daq link static DAQ modules
59 --disable-html-docs don't create the HTML documentation
60 --disable-pdf-docs don't create the PDF documentation
63 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
64 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
65 --with-pcap-includes=DIR
66 libpcap include directory
67 --with-pcap-libraries=DIR
68 libpcap library directory
69 --with-luajit-includes=DIR
70 luajit include directory
71 --with-luajit-libraries=DIR
72 luajit library directory
73 --with-pcre-includes=DIR
74 libpcre include directory
75 --with-pcre-libraries=DIR
76 libpcre library directory
77 --with-dnet-includes=DIR
78 libdnet include directory
79 --with-dnet-libraries=DIR
80 libdnet library directory
81 --with-daq-includes=DIR DAQ include directory
82 --with-daq-libraries=DIR
84 --with-openssl=DIR openssl installation root directory
85 --with-hyperscan-includes=DIR
86 libhs include directory
87 --with-hyperscan-libraries=DIR
88 libhs library directory
89 --with-flatbuffers-includes=DIR
90 flatbuffers include directory
91 --with-flatbuffers-libraries=DIR
92 flatbuffers library directory
94 Some influential environment variables:
95 SIGNAL_SNORT_RELOAD=<value>
96 set the SIGNAL_SNORT_RELOAD value
97 SIGNAL_SNORT_DUMP_STATS<value>
98 set the SIGNAL_SNORT_DUMP_STATS value
99 SIGNAL_SNORT_ROTATE_STATS<value>
100 set the SIGNAL_SNORT_ROTATE_STATS value
101 SIGNAL_SNORT_READ_ATTR_TBL<value>
102 set the SIGNAL_SNORT_READ_ATTR_TBL value
105 sourcedir
="$( cd "$
( dirname "$0" )" && pwd )"
107 # Function to append a CMake cache entry definition to the
108 # CMakeCacheEntries variable
109 # $1 is the cache entry variable name
110 # $2 is the cache entry variable type
111 # $3 is the cache entry variable value
112 append_cache_entry
() {
113 CMakeCacheEntries
="$CMakeCacheEntries -D $1:$2=$3"
116 check_and_append_cache_entry
() {
118 append_cache_entry
$1 $2 $3
121 echo "the $1 variable, which is specified using a --with-* options,"
122 echo "requires an absolute path to the library. Could not stat the"
132 prefix
=/usr
/local
/snort
134 append_cache_entry CMAKE_INSTALL_PREFIX PATH
$prefix
138 while [ $# -ne 0 ]; do
140 -*=*) optarg
=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
153 CMakeGenerator
="$optarg"
157 append_cache_entry CMAKE_INSTALL_PREFIX PATH
$optarg
159 --enable-code-coverage)
160 append_cache_entry ENABLE_CODE_COVERAGE BOOL true
162 --disable-code-coverage)
163 append_cache_entry ENABLE_CODE_COVERAGE BOOL false
165 --enable-hardened-build)
166 append_cache_entry ENABLE_HARDENED_BUILD BOOL true
168 --disable-hardened-build)
169 append_cache_entry ENABLE_HARDENED_BUILD BOOL false
172 append_cache_entry ENABLE_PIE BOOL true
175 append_cache_entry ENABLE_PIE BOOL false
178 append_cache_entry ENABLE_SAFEC BOOL false
181 append_cache_entry ENABLE_SAFEC BOOL true
183 --disable-static-ips-actions)
184 append_cache_entry STATIC_IPS_ACTIONS BOOL false
186 --enable-static-ips-actions)
187 append_cache_entry STATIC_IPS_ACTIONS BOOL true
189 --disable-static-inspectors)
190 append_cache_entry STATIC_INSPECTORS BOOL false
192 --enable-static-inspectors)
193 append_cache_entry STATIC_INSPECTORS BOOL true
195 --disable-static-loggers)
196 append_cache_entry STATIC_LOGGERS BOOL false
198 --enable-static-loggers)
199 append_cache_entry STATIC_LOGGERS BOOL true
201 --disable-static-ips-options)
202 append_cache_entry STATIC_IPS_OPTIONS BOOL false
204 --enable-static-ips-options)
205 append_cache_entry STATIC_IPS_OPTIONS BOOL true
207 --disable-static-search-engines)
208 append_cache_entry STATIC_SEARCH_ENGINES BOOL false
210 --enable-static-search-engines)
211 append_cache_entry STATIC_SEARCH_ENGINES BOOL true
213 --disable-static-codecs)
214 append_cache_entry STATIC_CODECS BOOL false
216 --enable-static-codecs)
217 append_cache_entry STATIC_CODECS BOOL true
220 append_cache_entry ENABLE_SHELL BOOL true
223 append_cache_entry ENABLE_SHELL BOOL false
226 append_cache_entry ENABLE_LARGE_PCAP BOOL true
229 append_cache_entry ENABLE_STDLOG BOOL false
232 append_cache_entry ENABLE_TSC_CLOCK BOOL true
234 --disable-large-pcap)
235 append_cache_entry ENABLE_LARGE_PCAP BOOL false
238 append_cache_entry ENABLE_DEBUG_MSGS BOOL true
240 --disable-debug-msgs)
241 append_cache_entry ENABLE_DEBUG_MSGS BOOL false
244 append_cache_entry ENABLE_DEBUG BOOL true
247 append_cache_entry ENABLE_DEBUG BOOL false
250 append_cache_entry ENABLE_GDB BOOL true
253 append_cache_entry ENABLE_GDB BOOL false
255 --enable-gprof-profile)
256 append_cache_entry ENABLE_PROFILE BOOL true
258 --disable-gprof-profile)
259 append_cache_entry ENABLE_PROFILE BOOL false
262 append_cache_entry ENABLE_COREFILES BOOL false
265 append_cache_entry ENABLE_COREFILES BOOL true
267 --enable-address-sanitizer)
268 append_cache_entry ENABLE_ADDRESS_SANITIZER BOOL true
270 --disable-address-sanitizer)
271 append_cache_entry ENABLE_ADDRESS_SANITIZER BOOL false
273 --enable-thread-sanitizer)
274 append_cache_entry ENABLE_THREAD_SANITIZER BOOL true
276 --disable-thread-sanitizer)
277 append_cache_entry ENABLE_THREAD_SANITIZER BOOL false
280 append_cache_entry ENABLE_UNIT_TESTS BOOL true
282 --disable-unit-tests)
283 append_cache_entry ENABLE_UNIT_TESTS BOOL false
286 append_cache_entry ENABLE_PIGLET BOOL true
289 append_cache_entry ENABLE_PIGLET BOOL false
291 --disable-static-daq)
292 append_cache_entry ENABLE_STATIC_DAQ BOOL false
295 append_cache_entry ENABLE_STATIC_DAQ BOOL true
298 append_cache_entry MAKE_HTML_DOC BOOL false
301 append_cache_entry MAKE_HTML_DOC BOOL true
304 append_cache_entry MAKE_PDF_DOC BOOL false
307 append_cache_entry MAKE_PDF_DOC BOOL true
309 --with-pcap-includes=*)
310 append_cache_entry PCAP_INCLUDE_DIR PATH
$optarg
312 --with-pcap-libraries=*)
313 append_cache_entry PCAP_LIBRARIES_DIR PATH
$optarg
315 --with-luajit-includes=*)
316 append_cache_entry LUAJIT_INCLUDE_DIR_HINT PATH
$optarg
318 --with-luajit-libraries=*)
319 append_cache_entry LUAJIT_LIBRARIES_DIR_HINT PATH
$optarg
321 --with-pcre-includes=*)
322 append_cache_entry PCRE_INCLUDE_DIR_HINT PATH
$optarg
324 --with-pcre-libraries=*)
325 append_cache_entry PCRE_LIBRARIES_DIR_HINT PATH
$optarg
327 --with-dnet-includes=*)
328 append_cache_entry DNET_INCLUDE_DIR_HINT PATH
$optarg
330 --with-dnet-libraries=*)
331 append_cache_entry DNET_LIBRARIES_DIR_HINT PATH
$optarg
333 --with-daq-includes=*)
334 append_cache_entry DAQ_INCLUDE_DIR_HINT PATH
$optarg
336 --with-daq-libraries=*)
337 append_cache_entry DAQ_LIBRARIES_DIR_HINT PATH
$optarg
340 append_cache_entry OPENSSL_ROOT_DIR PATH
$optarg
342 --with-hyperscan-includes=*)
343 append_cache_entry HS_INCLUDE_DIR PATH
$optarg
345 --with-hyperscan-libraries=*)
346 append_cache_entry HS_LIBRARIES_DIR PATH
$optarg
348 --with-flatbuffers-includes=*)
349 append_cache_entry FLATBUFFERS_INCLUDE_DIR_HINT PATH
$optarg
351 --with-flatbuffers-libraries=*)
352 append_cache_entry FLATBUFFERS_LIBRARIES_DIR_HINT PATH
$optarg
354 SIGNAL_SNORT_RELOAD
=*)
355 append_cache_entry SIGNAL_SNORT_RELOAD STRING
$optarg
357 SIGNAL_SNORT_DUMP_STATS
=*)
358 append_cache_entry SIGNAL_SNORT_DUMP_STATS STRING
$optarg
360 SIGNAL_SNORT_ROTATE_STATS
=*)
361 append_cache_entry SIGNAL_SNORT_ROTATE_STATS STRING
$optarg
363 SIGNAL_SNORT_READ_ATTR_TBL
=*)
364 append_cache_entry SIGNAL_SNORT_READ_ATTR_TBL STRING
$optarg
367 echo "Invalid option '$1'. Try $0 --help to see available options."
374 if [ -d $builddir ]; then
375 # If build directory exists, check if it has a CMake cache
376 if [ -f $builddir/CMakeCache.txt
]; then
377 # If the CMake cache exists, delete it so that this configuration
378 # is not tainted by a previous one
379 rm -f $builddir/CMakeCache.txt
382 # Create build directory
386 echo "Build Directory : $builddir"
387 echo "Source Directory: $sourcedir"
391 [ "$CMakeGenerator" ] && gen
+=" -G $CMakeGenerator"
394 -DCMAKE_CXX_FLAGS:STRING
="$CXXFLAGS $CPPFLAGS" \
395 -DCMAKE_C_FLAGS:STRING
="$CFLAGS $CPPFLAGS" \
396 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
397 $CMakeCacheEntries $sourcedir
399 echo "# This is the command used to configure this build" > config.status
400 echo $command >> config.status
401 chmod u
+x config.status