13 [ -z "$CC" ] && CC
=gcc
16 CC
="$(eval echo ${CROSS_COMPILE}${CC})"
19 if [ "${SYSROOT}xx" != "xx" ]; then
20 CFLAGS
="$(eval echo --sysroot=${SYSROOT} )"
23 echo "/* This file is auto-generated by configure.sh */" > config.h
29 echo -n "[*] Checking header $1 ... "
31 rm -f "$TMP" ||
exit 1
32 echo "#include <$1>" >"$TMP.c"
34 ${CC} ${CFLAGS} "$TMP.c" -E &>"$TMP.log"
36 echo $GREEN "[YES]" $COL_RESET
37 echo "#define $2 1" >> config.h
39 echo $RED "[NO]" $COL_RESET
44 #############################################################################################
46 echo -n "#define " >> config.h
47 grep VERSION
= Makefile |
sed 's/=/ /' >> config.h
49 #############################################################################################
51 echo "[*] Checking system headers."
53 #############################################################################################
54 # is /usr/include/linux/if_pppox.h new enough to feature pppol2tpin6/pppol2tpv3in6
56 echo -n "[*] Checking if pppox can use pppol2tpin6.. "
57 rm -f "$TMP" ||
exit 1
61 #include <netinet/in.h>
63 #include <linux/if_pppox.h>
67 struct sockaddr_pppol2tpin6 *pppox;
68 printf("%d\n", pppox->sa_family);
72 ${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log"
73 if [ ! -x "$TMP" ]; then
74 echo $RED "[NO]" $COL_RESET
77 echo $GREEN "[YES]" $COL_RESET
78 echo "#define USE_PPPOL2TPIN6 1" >> config.h
81 #############################################################################################
82 # is /usr/include/linux/if_pppox.h new enough to feature pppol2tpv3
84 echo -n "[*] Checking if pppox can use pppol2tv3.. "
85 rm -f "$TMP" ||
exit 1
89 #include <netinet/in.h>
91 #include <linux/if_pppox.h>
95 struct sockaddr_pppol2tpv3 *pppox;
96 printf("%d\n", pppox->sa_family);
100 ${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log"
101 if [ ! -x "$TMP" ]; then
102 echo $RED "[NO]" $COL_RESET
105 echo $GREEN "[YES]" $COL_RESET
106 echo "#define USE_PPPOL2TPV3 1" >> config.h
109 #############################################################################################
110 # is /usr/include/linux/if_pppox.h new enough to feature pptp
112 echo -n "[*] Checking if pppox can use pptp.. "
113 rm -f "$TMP" ||
exit 1
117 #include <netinet/in.h>
118 #include <linux/if.h>
119 #include <linux/if_pppox.h>
123 struct sockaddr_pppox *pppox;
124 printf("%d\n", pppox->sa_addr.pptp.call_id);
128 ${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log"
129 if [ ! -x "$TMP" ]; then
130 echo $RED "[NO]" $COL_RESET
133 echo $GREEN "[YES]" $COL_RESET
134 echo "#define USE_PPPOX_PPTP 1" >> config.h
137 #############################################################################################
138 # is /usr/include/linux/llc.h new enough to feature LLC_OPT_PKTINFO
140 echo -n "[*] Checking if llc can use LLC_OPT_PKTINFO.. "
141 rm -f "$TMP" ||
exit 1
146 #include <linux/llc.h>
150 printf("%d\n", LLC_OPT_PKTINFO);
154 ${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log"
155 if [ ! -x "$TMP" ]; then
156 echo $RED "[NO]" $COL_RESET
159 echo $GREEN "[YES]" $COL_RESET
160 echo "#define USE_LLC_OPT_PKTINFO 1" >> config.h
163 #############################################################################################
164 # Do glibc headers provides struct termios2
166 echo -n "[*] Checking if glibc headers provide termios2.. "
167 rm -f "$TMP" ||
exit 1
170 #include <sys/ioctl.h>
176 struct termios2 test;
180 ${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log"
181 if [ ! -x "$TMP" ]; then
182 echo $RED "[NO]" $COL_RESET
185 echo $GREEN "[YES]" $COL_RESET
186 echo "#define HAVE_TERMIOS2 1" >> config.h
189 #############################################################################################
191 check_header linux
/caif
/caif_socket.h USE_CAIF
192 check_header linux
/if_alg.h USE_IF_ALG
193 check_header linux
/rds.h USE_RDS
194 check_header linux
/vfio.h USE_VFIO
195 check_header linux
/btrfs.h USE_BTRFS
196 check_header drm
/drm.h USE_DRM
197 check_header drm
/exynos_drm.h USE_DRM_EXYNOS
198 check_header sound
/compress_offload.h USE_SNDDRV_COMPRESS_OFFLOAD
199 check_header linux
/kvm.h USE_KVM
200 check_header linux
/seccomp.h USE_SECCOMP
201 check_header linux
/vhost.h USE_VHOST
203 rm -f "$TMP" "$TMP.log" "$TMP.c"
205 #############################################################################################
206 if [ "$DEVEL" == "1" ]; then
207 VER
=$
(git describe
--always)
208 echo "#define GITVERSION \""$VER\" >> config.h
211 #############################################################################################
213 if [ "$MISSING_DEFS" == "1" ]; then
214 echo "[-] Some header definitions were missing. This is not fatal."
215 echo " It usually means you're building on an older distribution which doesn't"
216 echo " have header files describing newer kernel features."
217 echo " Trinity will still compile and run, it just won't use those new features."
218 echo " Go ahead, and run 'make'"