autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: autoconfiscating getopt_long()...


From: Matthew Whitworth
Subject: Re: autoconfiscating getopt_long()...
Date: Tue, 5 Dec 2000 15:22:03 -0800

What I have done so far (and it seems to work), is to copy getopt.c and
getopt.h to getopt_long.c and getopt_long.h, and then to use the following
snippets:

configure.in:
AC_REPLACE_FUNCS(getopt_long)

Makefile.am:
useless_SOURCES=useless.c getopt_long.h tailor.h
dnl This condionally links getopt_long.o
address@hidden@

useless.c:
#ifndef HAVE_GETOPT_LONG
#  include "getopt_long.h"
#else
#  include <getopt.h>
#endif

I have no idea what tailor.h does yet, but getopt.h #includes it.  And I
didn't do anything with getopt1.c 'cause I didn't know what the hell it
was.  I'll be looking at those two later.

I'm happy with this solution so far (I've only used it for 45 minutes!).  I
was really just wondering why no one else seemed to do it.  I'm still
paranoid that I'm missing something.

Thanks!

Matthew


On 2000.12.05 15:05:37 -0800 Paul Eggert wrote:
> > From: Matthew Whitworth <address@hidden>
> > Date: Tue, 5 Dec 2000 14:45:19 -0800 (PST)
> 
> > I have examined several packages that use getopt_long(), including
> > several GNU packages, and none of them autoconfiscate this function
> > the same way.  Actually, few of them even autoconfiscate it at all
> > -- most simply compile and link it unconditionally
> 
> I suspect that's just tradition dating back to when getopt_long was
> invariably absent from the C library.
> 
> > Does anyone have a tried-and-true autoconf/getopt_long() technique? 
> I'm
> > currently playing around with AC_REPLACE_FUNCS(), but I don't seem to
> have
> > the source code just right yet.
> 
> If you figure it out, please send it in so that the autoconf folks can
> use it.  It'd be nice to have it done right.
> 

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
matthew whitworth
address@hidden

Between here and there is better than either here or there!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]