summaryrefslogtreecommitdiff
path: root/net/ntopng/files/patch-configure.ac.in
blob: aabc41845f908e23f7a92979bb6019b2f43d497c (plain) (blame)
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
--- configure.ac.in.orig	2025-04-29 17:01:16 UTC
+++ configure.ac.in
@@ -153,40 +153,8 @@ LIBPCAP=-lpcap
 MAKE=make
 BIN_PATH=/usr/bin
 LIBPCAP=-lpcap
+OS=`uname -or | cut -d '-' -f 1`
 
-if test $SYSTEM = "FreeBSD" || test $SYSTEM = "Darwin"; then
-   CFLAGS="${CFLAGS} -I/usr/local/include"
-   LDFLAGS="${LDFLAGS} -L/usr/local/lib"
-
-   dnl> https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
-   CC=clang
-   CXX="clang++ -fpie -fno-color-diagnostics $CLANG_STDLIB"
-   if test $SYSTEM = "FreeBSD"; then
-    MAKE=gmake
-    BIN_PATH=/usr/local/bin
-   else
-     dnl> Adds /opt if MacPorts is installed
-     if [ test -f /opt/local/bin/port ]; then
-       CFLAGS="${CFLAGS} -I/opt/local/include"
-       LDFLAGS="${LDFLAGS} -L/opt/local/lib"
-     fi
-   fi
-   dnl> CXX=clang++ -fsanitize=address -fsanitize-address-use-after-scope
-   OSXV=`sw_vers -productVersion`
-   if test $SYSTEM = "Darwin"; then
-     OS="macOS $OSXV"
-   else
-     OS=`uname -or | cut -d '-' -f 1`
-   fi
-   if test $MACHINE = "x86_64"; then
-      LDFLAGS="${LDFLAGS} -L/usr/local/opt/ntopng"
-      RES=`g++ -Wall -fno-color-diagnostics Prefs.cpp 2>&1 | grep "unrecognized command line option "|wc -l`
-      if test $RES -eq 0; then
-            CFLAGS="-fno-color-diagnostics $CFLAGS"
-      fi
-   fi
-fi
-
 dnl> Remove spaces
 OS="${OS#"${OS%%[![:space:]]*}"}"
 
@@ -233,24 +201,6 @@ fi
   LIBS="${LIBS} -lnetfilter_queue -lnfnetlink -lnetfilter_conntrack"
 fi
 
-if test -d "/usr/local/include"; then
-  CFLAGS="${CFLAGS} -I/usr/local/include"
-  CXXFLAGS="${CXXFLAGS} -I/usr/local/include"
-fi
-
-if test -d "/usr/local/lib"; then
-  LIBS="${LIBS} -L/usr/local/lib"
-fi
-
-if test -d /opt/local/include; then :
-  CFLAGS="${CFLAGS} -I/opt/local/include"
-  CXXFLAGS="${CXXFLAGS} -I/opt/local/include"
-fi
-
-if test -d /opt/local/lib; then :
-  LIBS="${LIBS} -L/opt/local/lib"
-fi
-
 if [ test -f /usr/bin/lsb_release ]; then
   CODENAME=`/usr/bin/lsb_release -c|cut -f 2`
   if test $CODENAME = "wheezy" ; then
@@ -313,15 +263,12 @@ AC_ARG_WITH(ndpi-includes,
       NDPI_CUST_INC="-I$withval -I$withval/../lib/third_party/include"
    ])
 
-if test -d /usr/local/include/ndpi ; then :
-   echo "WARNING: /usr/local/include/ndpi is present and might lead to compile errors"
-fi
-
-NDPI_INC=`echo $NDPI_CFLAGS | sed -e "s/[ ]*$//"`
-NDPI_LIB=
-NDPI_LIB_DEP=
-
-AC_MSG_CHECKING(for nDPI source)
+PKG_CHECK_MODULES([NDPI], [libndpi >= 2.0], [
+  NDPI_INC=`echo $NDPI_CFLAGS | sed -e "s/[ ]*$//"`
+  NDPI_LIB="$NDPI_LIBS"
+  NDPI_LIB_DEP=
+  ], [
+      AC_MSG_CHECKING(for nDPI source)
       if test -d "./nDPI" ; then :
          NDPI_HOME=./nDPI
       elif test -d "../nDPI" ; then :
@@ -346,8 +293,8 @@ AC_MSG_CHECKING(for nDPI source)
       else
          AC_MSG_RESULT(not found)
       fi
+  ])
 
-
 if test ! -z "$NDPI_CUST_INC" ; then :
   NDPI_INC=$NDPI_CUST_INC
 fi
@@ -370,44 +317,10 @@ AC_ARG_WITH(json-c-static,
     [PKG_CHECK_MODULES(JSON, json-c, [], [AC_MSG_ERROR(Please install libjson-c-dev package prerequisite)])]
 )
 
-if test -x /bin/freebsd-version; then
- FREEBSD_VERSION=`freebsd-version | cut -f 1 -d '.'`
-fi
+AC_DEFINE_UNQUOTED(NO_SSL_DL, 1, [has openssl])
+SSL_INC="-I%%SSL_INC%%"
+SSL_LIB="-L%%SSL_LIB%% -lssl -lcrypto"
 
-pkg-config --exists libssl
-if test "$?" -ne 1; then
-  AC_DEFINE_UNQUOTED(NO_SSL_DL, 1, [has openssl])
-  SSL_INC="`pkg-config --cflags libssl` -I/usr/include/openssl"
-  SSL_LIB="`pkg-config --libs libssl` -lssl -lcrypto"
-else
-  dnl Workaround for MacOS Brew
-  if test -d "/usr/local/Cellar/openssl@1.1"; then
-    AC_DEFINE_UNQUOTED(NO_SSL_DL, 1, [has openssl])
-    SSL_INC="-I/usr/local/Cellar/openssl@1.1/include"
-    SSL_LIB="-L/usr/local/Cellar/openssl@1.1/lib -lssl -lcrypto"
-  elif test -d "/usr/local/opt/openssl/lib"; then
-    AC_DEFINE_UNQUOTED(NO_SSL_DL, 1, [has openssl])
-    SSL_INC="-I/usr/local/opt/openssl/include"
-    SSL_LIB="-L/usr/local/opt/openssl/lib -lssl -lcrypto"
-  elif test -d "/opt/homebrew/Cellar/openssl@1.1"; then
-    AC_DEFINE_UNQUOTED(NO_SSL_DL, 1, [has openssl])
-    SSL_INC="-I/opt/homebrew/Cellar/openssl@1.1/include"
-    SSL_LIB="-L/opt/homebrew/Cellar/openssl@1.1 -lssl -lcrypto"
-  elif test -d "/usr/local/opt/openssl/lib"; then
-    AC_DEFINE_UNQUOTED(NO_SSL_DL, 1, [has openssl])
-    SSL_INC="-I/usr/local/opt/openssl/include"
-    SSL_LIB="-L/usr/local/opt/openssl/lib -lssl -lcrypto"
-  dnl Workaround for FreeBSD
-  elif test -f "/usr/lib/libssl.so"; then
-    AC_DEFINE_UNQUOTED(NO_SSL_DL, 1, [has openssl])
-    SSL_INC="-I/usr/include"
-    SSL_LIB="-L/usr/lib -lssl -lcrypto"
-  else
-    echo "Please install openssl-dev(el) package prerequisite"
-    exit -1
-  fi
-fi
-
 AC_MSG_CHECKING([PF_RING nBPF])
 NBPF_HOME=${PWD}/../PF_RING/userland/nbpf
 LIBNBPF=${NBPF_HOME}/libnbpf.a
@@ -544,16 +457,11 @@ AS_VAR_IF(with_hiredis, yes, [
     else
       pkg-config --exists hiredis
       if test "$?" -ne 1; then
-      HIREDIS_INC="`pkg-config --cflags hiredis` -I/usr/include/hiredis"
-      if test $SYSTEM = "FreeBSD" && $FREEBSD_VERSION != "15"; then
-	dnl> Note: on freebsd 15 .a is not installed
-        HIREDIS_LIB="/usr/local/lib/libhiredis.a"
-      else
+        HIREDIS_INC="`pkg-config --cflags hiredis`"
         HIREDIS_LIB="`pkg-config --libs hiredis`"
-      fi
       else
-      echo "Please install hiredis package prerequisite"
-      exit -1
+        echo "Please install hiredis package prerequisite"
+        exit -1
       fi
    fi
 ])
@@ -570,14 +478,14 @@ if test "${with_nedge+set}" != set; then
   fi
 
   if test $SYSTEM = "FreeBSD"; then
-     LIBPCAP="${PF_RING_HOME}/userland/libpcap/libpcap.a"
+     # Use pcap from base
   else
     if test -d ${PF_RING_HOME}; then
       AC_MSG_CHECKING(for PF_RING source installed in $PF_RING_HOME)
     fi
   fi
 
- if test -f "/usr/local/lib/libpfring.a" || test -f "/opt/pfring/lib/libpfring.a" || test -f "${PF_RING_HOME}/userland/lib/libpfring.a"; then
+ if test -f "%%LOCALBASE%%/lib/libpfring.a" || test -f "/opt/pfring/lib/libpfring.a" || test -f "${PF_RING_HOME}/userland/lib/libpfring.a"; then
   AC_DEFINE_UNQUOTED(HAVE_PF_RING, 1, [Native PF_RING support])
   if test -f "${PF_RING_HOME}/userland/lib/libpfring.a"; then
      echo "${PF_RING_HOME}/userland/libpcap/libpcap.a"
@@ -597,18 +505,18 @@ if test "${with_nedge+set}" != set; then
          CXXFLAGS="${CXXFLAGS} -I/opt/pfring/include"
          echo "Using PF_RING installed in /opt/pfring"
       else
-       if test -f "/usr/local/lib/libpfring.a"; then
-        if test -f "/usr/local/lib/libpcap.a"; then
-    	  LIBS="${LIBS} /usr/local/lib/libpfring.a"
-          echo "Using PF_RING installed in /usr/local/lib"
+       if test -f "%%LOCALBASE%%/lib/libpfring.a"; then
+        if test -f "%%LOCALBASE%%/lib/libpcap.a"; then
+    	  LIBS="${LIBS} %%LOCALBASE%%/lib/libpfring.a"
+          echo "Using PF_RING installed in %%LOCALBASE%%/lib"
 	  AC_CHECK_LIB([pcap], [pcap_open_live], pcap=true)
 	  if test x$pcap = x
 	  then
-	    echo "Found /usr/local/lib/libpfring.a but missing header files."
+	    echo "Found %%LOCALBASE%%/lib/libpfring.a but missing header files."
 	    exit 1
 	  fi
 	else
-	  echo "Found /usr/local/lib/libpfring.a  but missing libpcap.a in the same directory"
+	  echo "Found %%LOCALBASE%%/lib/libpfring.a  but missing libpcap.a in the same directory"
 	  echo "Please make sure you have installed your PF_RING libraries and try again"
 	  exit 1
         fi
@@ -789,11 +697,9 @@ else
   fi
 else
    dnl> FreeBSD
-   if test -f "/usr/local/lib/mysql/libmysqlclient.a"; then
-     MYSQL_LIB=/usr/local/lib/mysql/libmysqlclient.a
-     MYSQL_INC="-I /usr/local/include/mysql/"
+     MYSQL_LIB="-L%%LOCALBASE%%/lib/mysql -lmysqlclient"
+     MYSQL_INC="-I%%LOCALBASE%%/include/mysql"
      AC_DEFINE_UNQUOTED(HAVE_MYSQL, 1, [use mysql])
-   fi
 fi
 
 AC_CHECK_LIB([expat], [XML_ParserCreate], expat=true)
@@ -848,7 +754,7 @@ fi
   INSTALL_DIR=${ac_default_prefix}
 fi
 
-if test $SYSTEM = "Darwin"; then
+if test $SYSTEM = "Darwin" -o $SYSTEM = "FreeBSD"; then
   MAN_DIR=$INSTALL_DIR/share/man
 else
   MAN_DIR=$INSTALL_DIR/man