========================================= Makefile.in

CC=@CC@
CFLAGS=-Wall @CFLAGS@ @DEFS@
LDFLAGS=@LDFLAGS@ @LIBS@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
mandir=@mandir@
INSTALL=@INSTALL@
VERSION=$(shell grep ^Version: whois.spec | cut -f2 -d' ')
RELEASE=$(shell grep ^Release: whois.spec | cut -f2 -d' ')
CVSTAG=$(shell echo whois-$(VERSION)-$(RELEASE) | sed 's^\.^-^g')

whois: whois.c
	$(CC) -o $@ $(CFLAGS) $< $(LDFLAGS)

clean:
	$(RM) whois

distclean: clean
	$(RM) Makefile config.cache config.log config.status

install:
	$(INSTALL) -m 755 whois $(DESTDIR)$(bindir)
	$(INSTALL) -m 644 fwhois.1 whois.1 $(DESTDIR)$(mandir)/man1
	ln -sf whois $(DESTDIR)$(bindir)/fwhois

dist: archive

archive:
	@cvs tag -cF $(CVSTAG)
	@rm -rf /tmp/whois-$(VERSION) /tmp/whois
	@cd /tmp; cvs export -r$(CVSTAG) whois; mv whois whois-$(VERSION)
	@cd /tmp/whois-$(VERSION); autoheader; autoconf
	@cd /tmp; tar czSpf whois-$(VERSION).tar.gz whois-$(VERSION)
	@rm -rf /tmp/whois-$(VERSION)
	@cp /tmp/whois-$(VERSION).tar.gz .
	@rm -f /tmp/whois-$(VERSION).tar.gz
	@echo " "
	@echo "The final archive is ./whois-$(VERSION).tar.gz."
========================================= autogen.sh

autoheader && autoconf && ./configure --prefix=/usr
========================================= config.h.in

/* config.h.in.  Generated automatically from configure.in by autoheader.  */

/* Define if you have the <arpa/nameser.h> header file.  */
#undef HAVE_ARPA_NAMESER_H

/* Define if you have the <ctype.h> header file.  */
#undef HAVE_CTYPE_H

/* Define if you have the <errno.h> header file.  */
#undef HAVE_ERRNO_H

/* Define if you have the <limits.h> header file.  */
#undef HAVE_LIMITS_H

/* Define if you have the <netdb.h> header file.  */
#undef HAVE_NETDB_H

/* Define if you have the <netinet/in.h> header file.  */
#undef HAVE_NETINET_IN_H

/* Define if you have the <stdio.h> header file.  */
#undef HAVE_STDIO_H

/* Define if you have the <stdlib.h> header file.  */
#undef HAVE_STDLIB_H

/* Define if you have the <string.h> header file.  */
#undef HAVE_STRING_H

/* Define if you have the <sys/socket.h> header file.  */
#undef HAVE_SYS_SOCKET_H

/* Define if you have the <sys/types.h> header file.  */
#undef HAVE_SYS_TYPES_H

/* Define if you have the <unistd.h> header file.  */
#undef HAVE_UNISTD_H

/* Define if you have the resolv library (-lresolv).  */
#undef HAVE_LIBRESOLV

/* Define if you have the socket library (-lsocket).  */
#undef HAVE_LIBSOCKET
========================================= configure.in

AC_INIT(Makefile.in)
AC_CONFIG_HEADER(config.h)
AC_PREFIX_DEFAULT(/usr)
AC_PROG_CC()
AC_PROG_INSTALL()
AC_CHECK_HEADERS(stdio.h string.h ctype.h limits.h sys/types.h sys/socket.h \
		 stdlib.h unistd.h netinet/in.h arpa/nameser.h netdb.h errno.h)
AC_CHECK_LIB(socket,socket)
AC_CHECK_LIB(resolv,res_mkquery)
AC_OUTPUT(Makefile)
