Hi Matt.
On Sun, Nov 19, 2000 at 02:54:54PM -0500, Matthew R. MacIntyre wrote:
> In a package I'm contributing to, we're looking for a way to include GNU
> getopt in the sources if the build system does not have it installed.
> I looked around for a way to do this, and the only thing semi-useful I
> found was the AC_REPLACE_GNU_GETOPT macro.
>
> Does this actually work? Whenever I use it in the configure.in I get a
>
> ./configure: AC_REPLACE_GNU_GETOPT: command not found
>
> I figure I must either be missing something, or this is broken?
You also need the AC_REPLACE_GNU_GETOPT macro definition... but I
don't know where you might find that -- at the autoconf macro
repository perhaps?
> If this macro does work, how are the sources setup in the Makefile.am.
> Currently, here's what I have, which I'm pretty sure is wrong:
>
> EXTRA_DIST = getopt.c getopt.h getopt1.c
>
> getopt.o: getopt.c
> $(CC) $(CFLAGS) -c getopt.c
>
> getopt1.o: getopt1.c
> $(CC) $(CFLAGS) -c getopt1.c
>
>
> Any suggestions would be very greatly appreciated. This one has been
> frustrating me for some time now.
>From the rather excellent ``GNU Autoconf, Automake and Libtool'' =)O|
$ ls replace/
...
getopt.c
getopt1.c
gnu-getopt.h
configure.in:
AC_CHECK_FUNCS(getopt_long, [],
[LIBOBJS="$LIBOBJS getopt.$ac_objext getopt1.$objext"
rm -f replace/getopt.h
$LN_S ./gnu-getopt.h replace/getopt.h])
...
Xsed="sed -e s/^X//"
LTLIBOBJS=`echo "$LIBOBJS | \
[$Xsed -e "s,\.[^.]* ,.lo ,g;s,\.[^.]*$,.lo,"]
AC_SUBST(LTLIBOBJS)
replace/Makefile.am:
noinst_HEADERS = gnu-getopt.h
noinst_LTLIBRARIES = libreplace.la
libreplace_la_SOURCES =
libreplace_la_LIBADD = @LTLIBOBJS@
But if you want to understand all the hoops this code jumps through,
you will need to reads the book =)O|
Cheers,
Gary.
--
___ _ ___ __ _ mailto: [EMAIL PROTECTED]
/ __|__ _ _ ___ _| | / / | / /_ _ _ _ __ _| |_ __ _ ___ [EMAIL PROTECTED]
| (_ / _` | '_|// / |/ /| |/ / _` | || / _` | ' \/ _` | _ \
\___\__,_|_|\_, /|___(_)___/\__,_|\_,_\__, |_||_\__,_|//_/
home page: /___/ /___/ gpg public key:
http://www.oranda.demon.co.uk http://www.oranda.demon.co.uk/key.asc