On IRIX, getopt.h is expected to provide extern declarations of optind
et al. (Not unistd.h) Do it here since we shadow the system header.
Part of PR pkg/38054
- pull sources directly into pkgsrc
- do not depend on namespace.h, <sys/cdefs.h> (de-__P()ify), or <err.h>
- use libtool for better portability in shlib creation
The resultant library is still ABI compatible with prior versions and
should have the same shlib major version number.
Thanks to Roland Illig <roland.illig@gmx.de> for help in getting this
working properly on Solaris.