configure.in
上传用户:nilegod
上传日期:2007-01-08
资源大小:220k
文件大小:10k
- dnl
- dnl ettercap -- configure script
- dnl
- dnl Copyright (C) 2001 ALoR <alor@users.sourceforge.net>, NaGA <crwm@freemail.it>
- dnl
- dnl This program is free software; you can redistribute it and/or modify
- dnl it under the terms of the GNU General Public License as published by
- dnl the Free Software Foundation; either version 2 of the License, or
- dnl (at your option) any later version.
- dnl
- dnl This program is distributed in the hope that it will be useful,
- dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
- dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- dnl GNU General Public License for more details.
- dnl
- dnl You should have received a copy of the GNU General Public License
- dnl along with this program; if not, write to the Free Software
- dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- dnl
- AC_INIT(src/ec_main.c)
- AC_CONFIG_HEADER(config.h)
- VERSION=`grep VERSION ./src/include/ec_main.h | cut -f2 -d"""`
- AC_SUBST(VERSION)
- PROG=`grep PROGRAM ./src/include/ec_main.h | cut -f2 -d"""`
- AC_SUBST(PROG)
- EC_MESSAGE(Configuring $PROG-$VERSION)
- SERIAL=`date +%Y%m%d`
- AC_SUBST(SERIAL)
- RELEASE=1
- AC_SUBST(RELEASE)
- SOURCES=`ls ./src/ec_*.c | awk ' { printf "%s ", $1 } '`
- AC_SUBST(SOURCES)
- MISSING=`ls ./src/missing/*.c | awk ' { printf "%s ", $1 } '`
- AC_SUBST(MISSING)
- dnl ================
- dnl Check the OS
- dnl ================
- AC_CANONICAL_SYSTEM
- case "$target_os" in
- linux*)
- EC_LINUX_KERNEL()
- OS=LINUX
- OS_OPT=
- ;;
- *freebsd*)
- EC_FREEBSD_VERSION()
- OS=FREEBSD
- OS_OPT=
- ;;
- *openbsd*)
- OS=OPENBSD
- OS_OPT=
- ;;
- *)
- echo
- echo "NOT A SUPPORTED SYSTEM / OR SYSTEM NOT RECOGNISED"
- echo
- cat PORTINGS
- echo
- exit
- ;;
- esac
- AC_SUBST(OS)
- AC_SUBST(OS_OPT)
- dnl ======================
- dnl Machine Endianness
- dnl ======================
- EC_ENDIAN_CHECK()
- dnl ======================
- dnl Initialize prefix.
- dnl ======================
- AC_PREFIX_DEFAULT(/usr/local)
- if test "$prefix" = "NONE"; then
- prefix="/usr/local"
- fi
- echo "char *path = "$prefix/share/ettercap/";" > ./src/include/ec_install_path.h
- dnl ========================
- dnl Check the C compiler
- dnl ========================
- AC_PROG_CC
- AC_PROG_INSTALL
- AC_PROG_MAKE_SET
- dnl =====================
- dnl Check for headers
- dnl =====================
- AC_HEADER_STDC
- AC_CHECK_HEADERS(getopt.h)
- AC_CHECK_HEADERS(fcntl.h termios.h ctype.h)
- AC_CHECK_HEADERS(sys/time.h sys/utsname.h)
- AC_CHECK_HEADERS(ifaddrs.h)
- dnl Theese are required !!
- AC_CHECK_HEADERS(unistd.h stdlib.h signal.h stdarg.h sys/ioctl.h,,
- AC_MSG_WARN(**************************************************);
- AC_MSG_WARN(* REQUIRED !! I cant believe U don't have this !!*);
- AC_MSG_WARN(**************************************************);
- exit)
- AC_CHECK_HEADERS(sys/ipc.h sys/shm.h dirent.h,,
- AC_MSG_WARN(***************);
- AC_MSG_WARN(* REQUIRED !! *);
- AC_MSG_WARN(***************);
- exit)
- AC_CHECK_HEADERS(net/ethernet.h net/if_arp.h net/if.h)
- AC_CHECK_HEADERS(netinet/ip.h netinet/ip_icmp.h netinet/tcp.h)
- AC_CHECK_HEADERS(sys/socket.h)
- dnl ===========================
- dnl Check for Socket Packet
- dnl ===========================
- AC_MSG_CHECKING(for correct UID)
- if test "$UID" -gt 0; then
- AC_MSG_RESULT($UID. not sufficient)
- AC_MSG_WARN(***********************************************);
- AC_MSG_WARN(* This configure must run with UID 0 (root)!! *);
- AC_MSG_WARN(***********************************************);
- rm *.cache *.log
- exit;
- else
- AC_MSG_RESULT($UID ok root let's go...)
- fi
- if test "$OS" = "LINUX"; then
- EC_PF_PACKET()
- EC_SOCK_PACKET()
- if test "$nopf" = 1 && test "$nosock" = 1; then
- AC_MSG_WARN(*************************************);
- AC_MSG_WARN(* You can't create Socket Packet !! *);
- AC_MSG_WARN(*************************************);
- exit;
- fi
- fi
- dnl ===========================================
- dnl Check for /proc/sys/net/ipv4/ip_forward
- dnl ===========================================
- if test "$OS" = "LINUX"; then
- AC_PATH_PROGS(IPFORWARD,ip_forward,no,/proc/sys/net/ipv4)
- if test "$IPFORWARD" = no; then
- AC_MSG_WARN(*****************************************************************)
- AC_MSG_WARN(* /proc/sys/net/ipv4/ip_forward not found !! *)
- AC_MSG_WARN(* please disable manually ip_forwarding before running ettercap *)
- AC_MSG_WARN(*****************************************************************)
- fi
- fi
- dnl ==================================================================
- dnl Checks for typedefs, structures, and compiler characteristics.
- dnl ==================================================================
- AC_DECL_SYS_SIGLIST
- AC_HEADER_TIME
- AC_STRUCT_TM
- dnl =====================
- dnl Check for libs
- dnl =====================
- AC_FUNC_MEMCMP
- AC_TYPE_SIGNAL
- AC_FUNC_VPRINTF
- AC_CHECK_FUNCS(gettimeofday)
- AC_CHECK_FUNCS(vsnprintf)
- AC_CHECK_FUNCS(select socket)
- AC_CHECK_FUNCS(atexit)
- AC_CHECK_FUNCS(getopt_long,,MISSLIBS="$MISSLIBS ./src/missing/getopt.o ./src/missing/getopt1.o")
- AC_CHECK_FUNCS(strlcat,,MISSLIBS="$MISSLIBS ./src/missing/strlcat.o")
- AC_SUBST(MISSLIBS)
- dnl =======================================
- dnl Check user defined --enable-FEATURE
- dnl =======================================
- EC_MESSAGE(Checking user defined options)
- dnl -----------------------
- dnl -- NCURSES INTERFACE --
- dnl -----------------------
- check_ncurses=0
- AC_MSG_CHECKING([if --enable-ncurses option is specified])
- AC_ARG_ENABLE(ncurses, [ --enable-ncurses enable the ncurses interface.],
- [ case "$enableval" in
- yes)
- AC_MSG_RESULT(yes.)
- check_ncurses=1
- ;;
- no) AC_MSG_RESULT(no.)
- ;;
- esac ],
- AC_MSG_RESULT(yes. enabled by default.)
- check_ncurses=1
- )
- if test $check_ncurses -ne 0; then
- ncurses_warn=0
- curses_warn=0
- AC_CHECK_HEADERS(ncurses.h,,ncurses_warn=1)
- AC_CHECK_LIB(ncurses,newwin,,ncurses_warn=1)
- if test $ncurses_warn -ne 1; then
- AC_DEFINE(HAVE_NCURSES,1)
- else
- AC_CHECK_HEADERS(curses.h,,curses_warn=1)
- AC_CHECK_LIB(curses,newwin,,curses_warn=1)
- if test $curses_warn -ne 1; then
- AC_DEFINE(HAVE_NCURSES,1)
- else
- AC_MSG_WARN(***********************************************)
- AC_MSG_WARN(* NCURSES are NOT available in your system !! *)
- AC_MSG_WARN(* Interactive mod will not be supported! *)
- AC_MSG_WARN(***********************************************)
- fi
- fi
- fi
- dnl -----------
- dnl -- DEBUG --
- dnl -----------
- AC_MSG_CHECKING([if --enable-debug option is specified])
- AC_ARG_ENABLE(debug, [ --enable-debug create a file for debugging messages.],
- [ case "$enableval" in
- yes)
- DEBUG="-DDEBUG"
- CFLAGS="-O2 -Wall"
- AC_MSG_RESULT(yes)
- ;;
- no) AC_MSG_RESULT(no.)
- ;;
- esac ],
- AC_MSG_RESULT(no. disabled by default.)
- )
- AC_SUBST(DEBUG)
- dnl ----------
- dnl -- SUID --
- dnl ----------
- AC_MSG_CHECKING([if --enable-suid option is specified])
- AC_ARG_ENABLE(suid, [ --enable-suid permit setuid on ettercap.],
- [ case "$enableval" in
- yes)
- AC_DEFINE(PERMIT_SUID,1)
- AC_MSG_RESULT(yes)
- ;;
- no) AC_MSG_RESULT(no)
- ;;
- esac ],
- AC_MSG_RESULT(no. disabled by default.)
- )
- dnl -------------
- dnl -- PLUGINS --
- dnl -------------
- check_plugins=0
- AC_MSG_CHECKING([if --enable-plugins option is specified])
- AC_ARG_ENABLE(plugins, [ --enable-plugins enable the use of plugins on ettercap.],
- [ case "$enableval" in
- yes)
- AC_MSG_RESULT(yes.)
- check_plugins=1
- ;;
- no) AC_MSG_RESULT(no.)
- ;;
- esac ],
- AC_MSG_RESULT(yes. enabled by default.)
- check_plugins=1
- )
- if test "$OS" = "OPENBSD"; then
- AC_MSG_WARN(****************************************************)
- AC_MSG_WARN(* Plugins were NOT yet ported to OpenBSD, sorry... *)
- AC_MSG_WARN(****************************************************)
- check_plugins=0
- fi
- if test $check_plugins -ne 0; then
- plugins_warn=0
- AC_CHECK_HEADERS(dlfcn.h,,plugins_warn=1)
- if test "$OS" = "LINUX"; then
- AC_CHECK_LIB(dl,dlopen,,plugins_warn=1)
- else
- AC_CHECK_LIB(c,dlopen,,plugins_warn=1)
- fi
- if test $plugins_warn -ne 1; then
- AC_DEFINE(PERMIT_PLUGINS,1)
- LIBS="$LIBS -rdynamic"
- else
- AC_MSG_WARN(***********************************************)
- AC_MSG_WARN(* Plugins are NOT supported by your system !! *)
- AC_MSG_WARN(***********************************************)
- fi
- fi
- dnl ---------
- dnl -- SSH --
- dnl ---------
- check_ssh=0
- AC_ARG_WITH(openssl, [ --with-openssl=DIR use OpenSSL in DIR],
- [ case "$withval" in
- yes|no)
- AC_MSG_CHECKING(for OpenSSL)
- AC_MSG_RESULT(no)
- ;;
- *)
- AC_MSG_CHECKING(for OpenSSL in $withval)
- check_ssh=1
- ssl_path=$withval
- ;;
- esac ],
- [ AC_MSG_CHECKING(for OpenSSL in ${prefix})
- check_ssh=1
- ssl_path=${prefix}
- ]
- )
- if test $check_ssh -ne 0; then
- if test -f $ssl_path/include/openssl/ssl.h; then
- CFLAGS="$CFLAGS -I$ssl_path/include"
- LIBS="$LIBS -L$ssl_path/lib -lssl -lcrypto"
- AC_DEFINE(HAVE_OPENSSL,1)
- AC_MSG_RESULT(yes)
- elif test -f $ssl_path/ssl/include/openssl/ssl.h; then
- CFLAGS="$CFLAGS -I$ssl_path/ssl/include"
- LIBS="$LIBS -L$ssl_path/ssl/lib -lssl -lcrypto"
- AC_DEFINE(HAVE_OPENSSL,1)
- AC_MSG_RESULT(yes)
- elif test -f /usr/include/openssl/ssl.h; then
- LIBS="$LIBS -lssl -lcrypto"
- AC_DEFINE(HAVE_OPENSSL,1)
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- AC_MSG_WARN(**********************************************)
- AC_MSG_WARN(* OpenSSL is NOT installed in your system !! *)
- AC_MSG_WARN(* SSH support will NOT be available... *)
- AC_MSG_WARN(**********************************************)
- fi
- fi
- dnl ===============
- dnl FINISHED !!
- dnl ===============
- EC_MESSAGE(Writing output files)
- makeplug=`ls ./plugins | grep -v Make | awk '{ printf("plugins/%s/Makefile ", $1) }'`
- AC_OUTPUT(ettercap.spec ettercap.8
- Makefile
- $makeplug
- plugins/Makefile)