]>
Commit | Line | Data |
---|---|---|
dfd930a1 JI |
1 | #! /bin/sh |
2 | ||
3 | prefix="@prefix@" | |
4 | exec_prefix="@exec_prefix@" | |
5 | includedir="@includedir@" | |
6 | libdir="@libdir@" | |
7 | LIBS="@LIBS@ @RUST_LDADD@" | |
8 | ||
9 | shared_lib="-lsuricata" | |
10 | static_lib="-lsuricata_c -lsuricata_rust" | |
11 | ||
12 | enable_non_bundled_htp="@enable_non_bundled_htp@" | |
13 | ||
14 | lib="$shared_lib" | |
15 | ||
16 | show_libs="no" | |
17 | show_cflags="no" | |
18 | use_static="no" | |
19 | ||
20 | if [ "$#" = 0 ]; then | |
21 | echo "usage: suricata-config [--cflags] [--libs] [--static]" | |
22 | exit 0 | |
23 | fi | |
24 | ||
25 | while [ "$#" != 0 ] | |
26 | do | |
27 | case "$1" in | |
28 | --libs) | |
29 | show_libs="yes" | |
30 | ;; | |
31 | --cflags) | |
32 | show_cflags="yes" | |
33 | ;; | |
34 | --static) | |
35 | lib="$static_lib" | |
36 | use_status="yes" | |
37 | ;; | |
38 | esac | |
39 | shift | |
40 | done | |
41 | ||
42 | # If --static wasn't provided, use the static library if the shared | |
43 | # library is not available. | |
44 | if [ "$use_static" = "no" ]; then | |
45 | if ! test -e "$libdir/libsuricata.so"; then | |
46 | lib="$static_lib" | |
47 | fi | |
48 | fi | |
49 | ||
50 | # If we're using a bundled htp, add it to the libs as well. It will | |
51 | # already be present if we're use a non-bundled libhtp. | |
52 | if [ "$enable_non_bundled_htp" = "no" ]; then | |
53 | lib="${lib} -lhtp" | |
54 | fi | |
55 | ||
56 | output="" | |
57 | ||
58 | if [ "$show_cflags" = "yes" ]; then | |
59 | output="${output} -DHAVE_CONFIG_H -I$includedir/suricata" | |
60 | fi | |
61 | ||
62 | if [ "$show_libs" = "yes" ]; then | |
63 | output="${output} -L$libdir $lib $LIBS" | |
64 | fi | |
65 | ||
66 | echo "$output" |