📄 configure.ac
字号:
############################################### ## Nast - Network Analyzer Sniffer Tool ## ## configure.ac - written by embyte@madlab.it # # ###############################################AC_INIT(nast, 0.1.7e, embyte@madlab.it)AC_CONFIG_SRCDIR(main.c)AC_CONFIG_HEADER(config.h)# Print a bannerecho "Please wait, I'm going to configure Nast"########## Subst ##########AC_SUBST(NCURSES)AC_SUBST(GETOPT)AC_SUBST(LIBNET_CONFIG_DEFINES)################## Checks for OS ##################AC_CANONICAL_TARGETcase "$target" in*linux*) AC_MSG_NOTICE([Found Linux, happy day!]) LIBNET_CONFIG_DEFINES="-D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD" ;; *freebsd*) AC_MSG_NOTICE([Found FreeBSD, are you a nerd?]) LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP -DHAVE_SOCKADDR_SA_LEN" ;;*openbsd*) LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS" AC_MSG_WARN([ OpenBSD port: we are working on... Nast could not run correctly ]) ;;*netbsd*) LIBNET_CONFIG_DEFINES="-DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP" AC_MSG_WARN([ NetBSD port: we are working on... Nast could not run correctly ]) ;;*) AC_MSG_WARN([ Your OS seems to be officially unsupported yet, please send an email authors ]) ;;esac################# Setup prefix #################AC_PREFIX_DEFAULT(/usr/local)if test "$prefix" = "NONE"; then prefix="/usr/local" fi ######################## Checks for compiler ########################AC_PROG_CC########################## Checks for libraries. ############################ -- libnet --#filechk="yes"AC_CHECK_FILE(/usr/lib/libnet.a,, filechk="no")if test "$filechk" = "no"; then AC_CHECK_FILE(/usr/local/lib/libnet.a, filechk="yes" ; LDFLAGS="-L/usr/local/lib"; CPPFLAGS="-I/usr/local/include")fiif test "$filechk" = "no"; then AC_MSG_ERROR([Libnet archive file (libnet.a) not found in /usr or /usr/local!Libnet-1.1.x Packet Shaping Library is required.You can download it from official web site: http://www.packetfactory.net/libnet])fiAC_CHECK_LIB(net, libnet_name2addr4,, AC_MSG_ERROR([Libnet-1.1.x Packet Shaping Library not found! It's required.You can download it from official web site: http://www.packetfactory.net/libnet]))## -- libpcap --#filechk="yes"AC_CHECK_FILE(/usr/lib/libpcap.a,, filechk="no")if test "$filechk" = "no"; then AC_CHECK_FILE(/usr/local/lib/libpcap.a, filechk="yes" ; LDFLAGS="-L/usr/local/lib"; CPPFLAGS="-I/usr/local/include")fiif test "$filechk" = "no"; then AC_MSG_ERROR([Libpcap archive file (libpcap.a) not found in /usr or /usr/local!Libpcap-0.7.1 Packet Capture Library is required. You can download it from official web site: http://www.tcpdump.org/#current])fiAC_CHECK_LIB(pcap, pcap_dispatch,, AC_MSG_ERROR([Libpcap-0.7.1 Packet Capture Library not found! It's required. You can download it from official web site: http://www.tcpdump.org/#current]))## -- libncurses support --#filechk="yes"AC_CHECK_FILE(/usr/lib/libncurses.a,, filechk="no")if test "$filechk" = "no"; then AC_CHECK_FILE(/usr/local/lib/libncurses.a, filechk="yes" ; LDFLAGS="-L/usr/local/lib"; CPPFLAGS="-I/usr/local/include")fiif test "$filechk" = "no"; then AC_MSG_ERROR([Libncurses archive file (libncurses.a) not found in /usr or /usr/local!Ncurses library (*) not found in your system.You can download it from official web site: http://www.gnu.org/software/ncurses/ncurses.html(*): CRT screen handling and optimization packageBuilding without ncurses menu support (-G flag will doesn't work)])fiENABLE_NCRS="no"AC_CHECK_LIB(ncurses, initscr, ENABLE_NCRS="yes"; NCURSES=graph.o; LIBS="-lncurses $LIBS"; AC_DEFINE(HAVE_LIBNCURSES), AC_MSG_RESULT([Ncurses library (*) not found in your system.You can download it from official web site: http://www.gnu.org/software/ncurses/ncurses.html(*): CRT screen handling and optimization packageBuilding without ncurses menu support (-G flag will doesn't work)]))############################# Checks for linux pthread #############################case "$target" in*linux*) AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR([ Linux threads library not found in your linux-box! Strange.. ])) CFLAGS="-Wall -O2" ;;*bsd*) CFLAGS="-Wall -O2 -pthread" ;;esac ############################################### Checks for headers and common libs/headers ###############################################AC_HEADER_STDCAC_CHECK_HEADERS(errno.h sys/utsname.h,, AC_MSG_WARN(This headers are required!)) AH_TEMPLATE(HAVE_GETOPT, define if the getopt.h header is present, OpenBSD for ex. doesn't have one)AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPT), GETOPT="getopt.o getopt1.o")#AC_CHECK_HEADER(getopt.h, AC_DEFINE(HAVE_GETOPT), GETOPT="getopt.o getopt1.o")# Checks for typedefs, structures, and compiler characteristics.AC_C_CONSTAC_HEADER_TIMEAC_STRUCT_TM# Checks for library functions.AC_FUNC_MALLOCAC_TYPE_SIGNALAC_FUNC_VPRINTF################### Write Makefile ###################AC_OUTPUT(Makefile)################## Print results ##################echo "Ok. I have done with all. Results are:PLATFORM ...... : `uname -mp`O.S. .......... : `uname -rs` (`uname -n`)COMPILER ...... : ${CC}CFLAGS ........ : ${CFLAGS}DEFINES ....... : ${LIBNET_CONFIG_DEFINES} CPPFLAGS ...... : ${CPPFLAGS}LDFLAGS ....... : ${LDFLAGS}LIBS .......... : ${LIBS}PREFIX ........ : ${prefix}NCURSES SUPPORT : ${ENABLE_NCRS}Type 'make' to compile."# ok we have done
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -