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 --disable-static-ips-actions do not include ips actions in binary
27 --disable-static-inspectors do not include inspectors in binary
28 --disable-static-loggers do not include loggers in binary
29 --disable-static-ips-options do not include ips options in binary
30 --disable-static-search-engines do not include search engines in binary
31 --disable-static-codecs do not include codecs in binary
32 --disable-static-piglets do not include piglets in binary
33 --enable-valgrind Only use if you are testing with valgrind.
34 --enable-shell enable command line shell support
35 --enable-linux-smp-stats Enable statistics reporting through proc
36 --enable-debug-msgs Enable debug printing options (bugreports and developers only)
37 --enable-large-pcap Enable support for pcaps larger than 2 GB
38 --enable-address-sanitizer Enable address sanitizer support
39 --enable-code-coverage Whether to enable code coverage support
40 --enable-debug Enable debugging options (bugreports and developers only)
41 --enable-gdb Enable gdb debugging information
42 --enable-gprof-profile Enable gprof profiling options (developers only)
43 --disable-corefiles Prevent Snort from generating core files
44 --enable-unit-tests Build unit tests
45 --enable-piglet Build piglet test capability
46 --disable-static-daq Link static DAQ modules.
49 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
50 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
51 --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use
53 --with-gnu-ld assume the C compiler uses GNU ld [default=no]
54 --with-sysroot=DIR Search for dependent libraries within DIR
55 (or the compiler's sysroot if not specified).
56 --with-pcap-includes=DIR libpcap include directory
57 --with-pcap-libraries=DIR libpcap library directory
58 --with-luajit-includes=DIR luajit include directory
59 --with-luajit-libraries=DIR luajit library directory
60 --with-pcre-includes=DIR libpcre include directory
61 --with-pcre-libraries=DIR libpcre library directory
62 --with-openssl-includes=DIR openssl include directory
63 --with-openssl-library=LIB openssl library library - NOT THE DIRECTORY
64 --with-crypto-library=LIB openssl crypto library - NOT THE DIRECTORY
65 --with-dnet-includes=DIR libdnet include directory
66 --with-dnet-libraries=DIR libdnet library directory
67 --with-daq-includes=DIR DAQ include directory
68 --with-daq-libraries=DIR DAQ library directory
69 --with-hyperscan-includes=DIR libhs include directory
70 --with-hyperscan-libraries=DIR libhs library directory
72 Some influential environment variables:
73 SIGNAL_SNORT_RELOAD=<value>
74 set the SIGNAL_SNORT_RELOAD value
75 SIGNAL_SNORT_DUMP_STATS<value>
76 set the SIGNAL_SNORT_DUMP_STATS value
77 SIGNAL_SNORT_ROTATE_STATS<value>
78 set the SIGNAL_SNORT_ROTATE_STATS value
79 SIGNAL_SNORT_READ_ATTR_TBL<value>
80 set the SIGNAL_SNORT_READ_ATTR_TBL value
83 sourcedir
="$( cd "$
( dirname "$0" )" && pwd )"
85 # Function to append a CMake cache entry definition to the
86 # CMakeCacheEntries variable
87 # $1 is the cache entry variable name
88 # $2 is the cache entry variable type
89 # $3 is the cache entry variable value
90 append_cache_entry
() {
91 CMakeCacheEntries
="$CMakeCacheEntries -D $1:$2=$3"
94 check_and_append_cache_entry
() {
96 append_cache_entry
$1 $2 $3
99 echo "the $1 variable, which is specified using a --with-* options,"
100 echo "requires an absolute path to the library. Could not stat the"
110 prefix
=/usr
/local
/snort
112 append_cache_entry CMAKE_INSTALL_PREFIX PATH
$prefix
116 while [ $# -ne 0 ]; do
118 -*=*) optarg
=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
131 CMakeGenerator
="$optarg"
135 append_cache_entry CMAKE_INSTALL_PREFIX PATH
$optarg
137 --disable-static-codecs)
138 append_cache_entry STATIC_CODECS BOOL false
140 --enable-static-codecs)
141 append_cache_entry STATIC_CODECS BOOL true
143 --disable-static-inspectors)
144 append_cache_entry STATIC_INSPECTORS BOOL false
146 --enable-static-inspectors)
147 append_cache_entry STATIC_INSPECTORS BOOL true
149 --disable-static-loggers)
150 append_cache_entry STATIC_LOGGERS BOOL false
152 --enable-static-loggers)
153 append_cache_entry STATIC_LOGGERS BOOL true
155 --disable-static-ips-options)
156 append_cache_entry STATIC_IPS_OPTIONS BOOL false
158 --enable-static-ips-actions)
159 append_cache_entry STATIC_IPS_ACTIONS BOOL true
161 --disable-static-ips-actions)
162 append_cache_entry STATIC_IPS_ACTIONS BOOL false
164 --enable-static-ips-options)
165 append_cache_entry STATIC_IPS_OPTIONS BOOL true
167 --disable-static-search-engines)
168 append_cache_entry STATIC_SEARCH_ENGINES BOOL false
170 --enable-static-search-engines)
171 append_cache_entry STATIC_SEARCH_ENGINES BOOL true
173 --disable-static-piglets)
174 append_cache_entry STATIC_PIGLETS BOOL false
176 --enable-static-piglets)
177 append_cache_entry STATIC_PIGLETS BOOL true
179 --disable-static-daq)
180 append_cache_entry ENABLE_STATIC_DAQ BOOL false
183 append_cache_entry ENABLE_STATIC_DAQ BOOL true
186 append_cache_entry ENABLE_PTHREAD BOOL false
189 append_cache_entry ENABLE_PTHREAD BOOL true
191 --disable-debug-msgs)
192 append_cache_entry ENABLE_DEBUG_MSGS BOOL false
195 append_cache_entry ENABLE_DEBUG_MSGS BOOL true
198 append_cache_entry ENABLE_GDB BOOL false
201 append_cache_entry ENABLE_GDB BOOL true
203 --disable-gprof-profile)
204 append_cache_entry ENABLE_PROFILE BOOL false
206 --enable-gprof-profile)
207 append_cache_entry ENABLE_PROFILE BOOL true
210 append_cache_entry ENABLE_DEBUG BOOL false
213 append_cache_entry ENABLE_DEBUG BOOL true
216 append_cache_entry ENABLE_COREFILES BOOL false
219 append_cache_entry ENABLE_COREFILES BOOL true
221 --disable-large-pcap)
222 append_cache_entry ENABLE_LARGE_PCAP BOOL false
225 append_cache_entry ENABLE_LARGE_PCAP BOOL true
227 --enable-address-sanitizer)
228 append_cache_entry ENABLE_ADDRESS_SANITIZER BOOL true
230 --disable-address-sanitizer)
231 append_cache_entry ENABLE_ADDRESS_SANITIZER BOOL false
233 --enable-code-coverage)
234 append_cache_entry ENABLE_CODE_COVERAGE BOOL true
236 --disable-code-coverage)
237 append_cache_entry ENABLE_CODE_COVERAGE BOOL false
240 append_cache_entry ENABLE_SHELL BOOL true
243 append_cache_entry ENABLE_SHELL BOOL false
245 --disable-unit-tests)
246 append_cache_entry BUILD_UNIT_TESTS BOOL false
249 append_cache_entry BUILD_UNIT_TESTS BOOL true
252 append_cache_entry BUILD_PIGLET BOOL false
255 append_cache_entry BUILD_PIGLET BOOL true
258 append_cache_entry MAKE_HTML_DOC BOOL false
261 append_cache_entry MAKE_HTML_DOC BOOL true
264 append_cache_entry MAKE_PDF_DOC BOOL false
267 append_cache_entry MAKE_PDF_DOC BOOL true
269 --with-openssl-includes=*)
270 append_cache_entry OPENSSL_INCLUDE_DIR PATH
$optarg
272 --with-openssl-library=*)
273 check_and_append_cache_entry OPENSSL_SSL_LIBRARY FILEPATH
$optarg
275 --with-crypto-library=*)
276 check_and_append_cache_entry OPENSSL_CRYPTO_LIBRARY FILEPATH
$optarg
278 --with-pcap-includes=*)
279 append_cache_entry PCAP_INCLUDE_DIR PATH
$optarg
281 --with-pcap-libraries=*)
282 append_cache_entry PCAP_LIBRARIES_DIR PATH
$optarg
284 --with-luajit-includes=*)
285 append_cache_entry LUAJIT_INCLUDE_DIR PATH
$optarg
287 --with-luajit-libraries=*)
288 append_cache_entry LUAJIT_LIBRARIES_DIR PATH
$optarg
290 --with-pcre-includes=*)
291 append_cache_entry PCRE_INCLUDE_DIR PATH
$optarg
293 --with-pcre-libraries=*)
294 append_cache_entry PCRE_LIBRARIES_DIR PATH
$optarg
296 --with-dnet-includes=*)
297 append_cache_entry DNET_INCLUDE_DIR PATH
$optarg
299 --with-dnet-libraries=*)
300 append_cache_entry DNET_LIBRARIES_DIR PATH
$optarg
302 --with-daq-includes=*)
303 append_cache_entry DAQ_INCLUDE_DIR PATH
$optarg
305 --with-daq-libraries=*)
306 append_cache_entry DAQ_LIBRARIES_DIR PATH
$optarg
308 # Currently unsupported
309 # --with-intel-soft-cpm-includes=*)
310 # append_cache_entry INTEL_SOFT_CPM_INCLUDE_DIR PATH $optarg
312 # --with-intel-soft-cpm-libraries=*)
313 # append_cache_entry INTEL_SOFT_CPM_LIBRARIES_DIR PATH $optarg
315 --with-hyperscan-includes=*)
316 append_cache_entry HS_INCLUDE_DIR PATH
$optarg
318 --with-hyperscan-libraries=*)
319 append_cache_entry HS_LIBRARIES_DIR PATH
$optarg
322 append_cache_entry FLEX_EXECUTABLE PATH
$optarg
325 append_cache_entry BISON_EXECUTABLE PATH
$optarg
327 SIGNAL_SNORT_RELOAD
=*)
328 append_cache_entry SIGNAL_SNORT_RELOAD STRING
$optarg
330 SIGNAL_SNORT_DUMP_STATS
=*)
331 append_cache_entry SIGNAL_SNORT_DUMP_STATS STRING
$optarg
333 SIGNAL_SNORT_ROTATE_STATS
=*)
334 append_cache_entry SIGNAL_SNORT_ROTATE_STATS STRING
$optarg
336 SIGNAL_SNORT_READ_ATTR_TBL
=*)
337 append_cache_entry SIGNAL_SNORT_READ_ATTR_TBL STRING
$optarg
340 echo "Invalid option '$1'. Try $0 --help to see available options."
347 if [ -d $builddir ]; then
348 # If build directory exists, check if it has a CMake cache
349 if [ -f $builddir/CMakeCache.txt
]; then
350 # If the CMake cache exists, delete it so that this configuration
351 # is not tainted by a previous one
352 rm -f $builddir/CMakeCache.txt
355 # Create build directory
359 echo "Build Directory : $builddir"
360 echo "Source Directory: $sourcedir"
364 [ "$CMakeGenerator" ] && gen
+=" -G $CMakeGenerator"
367 -DCOMPILE_DEFINITIONS:STRING
="$CPPFLAGS" \
368 -DCMAKE_CXX_FLAGS:STRING
="$CXXFLAGS $CPPFLAGS" \
369 -DCMAKE_C_FLAGS:STRING
="$CFLAGS $CPPFLAGS" \
370 $CMakeCacheEntries $sourcedir
372 echo "# This is the command used to configure this build" > config.status
373 echo $command >> config.status
374 chmod u
+x config.status