#! /bin/sh
###############################################################################
#
# File:         ncftp-2.0.3.after.configure.sh
# RCS:          $Header: $
# Description:  compile ncftp with readline and ncurses
# Author:       Christian Limpach <chris@nice.ch>
# Created:      Mon Apr  3 20:47:24 1995
# Modified:     Tue Apr  4 02:32:15 1995 (Christian Limpach) chris@nice.ch
# Language:     Shell-script
# Package:      N/A
# Status:       Experimental (Do Not Distribute)
#
# (C) Copyright 1995, Christian Limpach, all rights reserved.
# This is free software, and you are welcome to redistribute it
# under certain conditions; see ftp://nice.ethz.ch/users/chris/TERMS
# for details. This software comes with ABSOLUTELY NO WARRANTY.
#
###############################################################################

# fix configurations:
# no -lposix, add -ltermcap
# -Wl,-m to make linke happy with multiple definitions of symbols
# add HAVE_LIBNCURSES and remove other (mostly posix) defines
# if you don't have ncurses, then remove -lncurses and the 3rd s/// line
perl -ni.orig \
  -e 's/-lposix ([^%]*) %/\1 -ltermcap -lncurses %/;' \
  -e 's/(LDFLAGS@%)/\1 -Wl,-m/;' \
  -e 's/HAVE_UTIME_H/HAVE_LIBNCURSES/g;' \
  -e '/(HAVE_UTIME_H|HAVE_LIBPOSIX|HAVE_GETCWD|HAVE_TCGETPGRP|HAVE_TERMIOS_H)/ || print;' config.status

# remove _POSIX_SOURCE definition
perl -ni.orig -e '/^#[\t ]*define _POSIX_SOURCE 1$/ || print' Xfer.c

./config.status
