Subject: pkg/25437: Proposed improvements to configure scripts for pkgsrc tools
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <dhgutteridge@sympatico.ca>
List: pkgsrc-bugs
Date: 05/02/2004 18:27:29
>Number:         25437
>Category:       pkg
>Synopsis:       Proposed improvements to configure scripts for pkgsrc tools
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 02 18:28:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     David Gutteridge
>Release:        N/A
>Organization:
>Environment:
N/A
>Description:
Hello,

I submitted this under pkg/24045, but that PR was already closed, so I thought I'd resubmit this as a new PR.  To summarize pkg/24045, I experienced problems bootstrapping the pkgsrc tools on a machine that didn't have any shared library installed with termcap/ncurses functions available.  The configure scripts for tnftp and pkg_install didn't have any error handling for this possibility (instead the compilation would fail when there were no libraries found to link against).

I've modified the autoconf input files for both of them and have attached my suggested revisions below.  (I guess this check could be  done once in the bootstrap script, but that wouldn't help if these packages were ever installed separately.)  These are of course merely a non-NetBSD developer's suggestions.

A few points I should note:

 - I'm not sure why the pertinent tnftp configure.in file used AC_CHECK_LIB recursively when the pkg_install configure.ac file used AC_SEARCH_LIBS.  Under the assumption the latter is the simpler choice, I used it for both files.

 - tnftp and pkg_install are looking for the same function, but each had one unique library name they queried against in addition to those they shared.  I added to both so they now check against five different library names.  (Those names being: termcap, curses, ncurses, tinfo, and termlib.)

 - I noticed there were other linking tests that had no action specified on failure (util for tnftp and db1 for pkg_install).  I added warning code for those as well, but I didn't add an exit on error, but that is a simple matter to add.

 - In the bootstrap script, there's a Debian specific item added by Mr. Schaumann (in response to my original query).  I don't think this is actually necessary, since if ncurses is installed on a Debian machine it will be picked up and added as -lncurses anyway.
>How-To-Repeat:
(Try bootstrapping pkgsrc on a machine without termcap or ncurses installed.)
>Fix:
Here are the diffs:
 
configure.in for tnftp:

--- configure.in.orig	Mon Apr 12 18:10:26 2004
+++ configure.in	Mon Apr 12 18:27:32 2004
@@ -37,12 +37,12 @@


dnl Checks for libraries.
dnl
-AC_CHECK_LIB(util, fparseln)
+AC_CHECK_LIB(util, fparseln, ,[echo "No util library is available to " \
+	"link against."])
if test $opt_editcomplete = yes; then
-	AC_CHECK_LIB(tinfo, tgetent, ,
-	    AC_CHECK_LIB(termcap, tgetent, ,
-	    AC_CHECK_LIB(curses, tgetent, ,
-	    AC_CHECK_LIB(ncurses, tgetent))))
+	AC_SEARCH_LIBS(tgetent, [termcap termlib curses ncurses tinfo], ,[\
+		echo "No curses library is available to link against.  "\
+		"Please install termcap or ncurses or similar library."; exit])
 	AC_SEARCH_LIBS(el_init, edit, have_libedit=yes, have_libedit=no)
fi
AC_LIBRARY_NET


configure.ac for pkg_install:
 
--- configure.ac.orig	Mon Apr 12 18:12:32 2004
+++ configure.ac	Mon Apr 12 18:23:54 2004
@@ -68,8 +68,11 @@
AC_SUBST(mtree)


dnl Checks for libraries.
-AC_CHECK_LIB(db1, dbopen)
-AC_SEARCH_LIBS(tgetent, [termcap termlib curses ncurses])
+AC_CHECK_LIB(db1, dbopen, ,[echo "No db1 library is available to link " \
+	"against."])
+AC_SEARCH_LIBS(tgetent, [termcap termlib curses ncurses tinfo], ,[\
+	echo "No curses library is available to link against.  "\
+	"Please install termcap or ncurses or similar library."; exit])


dnl Checks for header files.

>Release-Note:
>Audit-Trail:
>Unformatted: