1# 2# configure.ac 3# 4# Author: Giovanni Giacobbi <giovanni@giacobbi.net> 5# 6# Copyright (C) 2002 - 2004 Giovanni Giacobbi 7# 8# This program is free software; you can redistribute it and/or modify 9# it under the terms of the GNU General Public License as published by 10# the Free Software Foundation; either version 2 of the License, or 11# (at your option) any later version. 12# 13# This program is distributed in the hope that it will be useful, 14# but WITHOUT ANY WARRANTY; without even the implied warranty of 15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16# GNU General Public License for more details. 17# 18 19dnl initialize with some random file to ensure the source is here. 20AC_INIT(ChangeLog) 21 22dnl put any platform specific stuff here 23AC_CANONICAL_SYSTEM 24 25AM_INIT_AUTOMAKE(netcat, 0.7.1) 26AC_PREREQ(2.53) 27 28dnl without this order in this file, automake will be confused! 29AM_CONFIG_HEADER(config.h) 30 31dnl check for programs. first the c compiler. 32AC_PROG_CC 33AC_PROG_CPP 34AC_PROG_RANLIB 35 36dnl check for pod2man since we'll need it for building documentation 37dnl this is really needed only by packagers 38dnl AC_CHECK_PROG(netcat_pod2man, pod2man, yes, no) 39 40AC_PATH_PROGS(PERL, perl5 perl, no) 41AC_PATH_PROG(POD2MAN, pod2man, no) 42 43dnl add --with-extra-includes and --with-extra-libs switch to ./configure 44dnl 45all_libraries="$all_libraries $USER_LDFLAGS" 46all_includes="$all_includes $USER_INCLUDES" 47AC_SUBST(all_includes) 48AC_SUBST(all_libraries) 49 50dnl I18n support 51ALL_LINGUAS="it sk" 52AM_GNU_GETTEXT([external], need-ngettext) 53AM_INTL_SUBDIR 54 55dnl find resolver functions and the socket library on some broken OS 56AC_LBL_LIBRARY_NET 57 58dnl Fortunately we have Solaris... 59AC_CHECK_HEADERS(sys/sockio.h) 60 61AC_CHECK_FUNCS(srandom random) 62if test $ac_cv_func_srandom = no; then 63 # let's try with the older srand/rand functions 64 AC_CHECK_FUNCS(srand rand) 65fi 66 67dnl Advanced network address translating functions 68AC_CHECK_FUNCS(inet_pton inet_ntop) 69 70dnl Support BSD4.4 "sa_len" extension when calculating sockaddrs arrays 71AC_CHECK_MEMBERS(struct sockaddr.sa_len, , , [#include <sys/types.h> 72#include <sys/socket.h>]) 73 74dnl Check if it is available the RFC2292 IPv4 extension and in_port_t. 75AC_CHECK_TYPES([struct in_pktinfo, in_port_t], , , [#include <sys/types.h> 76#include <netinet/in.h>]) 77 78# check if this compiler supports the common parameter `-Wall' 79if test -n "$GCC"; then 80 CFLAGS="$CFLAGS -Wall" 81fi 82 83# check wether we shall use linux-style select(2) call 84case "$host" in 85 *-linux*) 86 AC_DEFINE(USE_LINUX_SELECT, , [use the linux-style select(2) call]) 87 ;; 88esac 89 90 91dnl ********************************************************************* 92dnl ** CONFIGURE SWITCHES *********************************************** 93dnl ********************************************************************* 94 95dnl the non-debug CFLAGS should include -DNDEBUG in a more stable context 96dnl in order to remove the assert() calls 97 98AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], 99 [enable debugging (requires GNU compiler, default: no)]), 100 [CFLAGS="$CFLAGS -O0 -g3 -ggdb3 -DDEBUG"]) 101 102AC_ARG_ENABLE(compat, AC_HELP_STRING([--enable-compat], 103 [enable all old compatibility switches (default: no)]), 104 nc_enab_compat=yes 105 nc_enab_oldhexdump=yes 106 nc_enab_oldtelnet=yes) 107 108AC_ARG_ENABLE(oldhexdump, AC_HELP_STRING([--enable-oldhexdump], 109 [use the old style hexdump format (default: no)]), 110 nc_enab_oldhexdump=yes) 111 112AC_ARG_ENABLE(oldtelnet, AC_HELP_STRING([--enable-oldtelnet], 113 [use old telnet codes parsing policy (default: no)]), 114 nc_enab_oldtelnet=yes) 115 116AC_ARG_WITH(included-getopt, AC_HELP_STRING([--with-included-getopt], 117 [use the internal getopt library (default: auto)]), 118 nc_need_getopt=yes) 119 120 121# apply the acquired enable options 122if test "x$nc_enab_compat" = "xyes"; then 123 AC_DEFINE(USE_OLD_COMPAT, , [misc old compat behaviours]) 124fi 125 126if test "x$nc_enab_oldhexdump" = "xyes"; then 127 AC_DEFINE(USE_OLD_HEXDUMP, , [use the old style hexdump format]) 128fi 129 130if test "x$nc_enab_oldtelnet" = "xyes"; then 131 AC_DEFINE(USE_OLD_TELNET, , [use the old telnet codes parsing policy]) 132fi 133 134 135dnl ********************************************************************* 136dnl ** SPECIAL FUNCTIONS VALIDITY CHECKING ****************************** 137dnl ********************************************************************* 138 139dnl Try to see if we need the included getopt 140dnl NOTE: with this configuration, it could happen on a really broken 141dnl system, that we have the header file but not the library 142dnl function, and I don't know what would happen. 143dnl AC_CHECK_HEADER(getopt.h) 144dnl AM_CONDITIONAL(NEED_GETOPT_H, test ac_cv_header_getopt_h = no) 145 146# don't run the check if --with-included-getopt was specified 147if test "x$nc_need_getopt" != "xyes"; then 148 AC_CHECK_FUNCS(getopt_long) 149 if test $ac_cv_func_getopt_long = no; then 150 # automatically use the internal getopt library 151 nc_need_getopt=yes 152 CONTRIBLIBS="../lib/contrib/libcontrib.a" 153 fi 154fi 155 156 157dnl ********************************************************************* 158dnl ** AUTOMAKE CONDITIONALS ******************************************** 159dnl ********************************************************************* 160 161AC_SUBST(CONTRIBLIBS) 162AM_CONDITIONAL(NEED_GETOPT, test "x$nc_need_getopt" = "xyes") 163 164 165dnl ********************************************************************* 166dnl ** OUTPUT SECTION *************************************************** 167dnl ********************************************************************* 168 169dnl add here all the Makefiles. These will be created by configure. 170dnl 171AC_CONFIG_FILES(Makefile m4/Makefile lib/Makefile lib/contrib/Makefile 172 src/Makefile doc/Makefile doc/drafts/Makefile po/Makefile.in) 173 174dnl this one is special, it needs the executable flag 175dnl 176AC_CONFIG_FILES(doc/texi2pod.pl, chmod +x doc/texi2pod.pl) 177AC_OUTPUT 178