Soren A wrote:
> Hello,
> 
> This message is along similar lines to others i read on this list in the
> last couple of days. 
> 
> It occurs to me to ask, before i consider submitting this to an Autoconf
> macro collection, for tips on the approach taken. Feedback from the List
> is requested. 
> 
> The problem to be solved is that a program that wants to #include
> <utime.h> came my way recently and i realized that my platform doesn't
> have <utime.h>, it has <sys/utime.h> however. This bit of Autoconf code
> was what I put into my 'configure.ac' to accomplish porting of the
> build. 
> 
> --------------------------------8<---------------------------------
> where_toGet_utime_h=''
>    AC_CHECK_HEADER(utime.h,
>      [AC_DEFINE(HAVE_UTIME_H,1, ["utime.h" is present instead of 
> "sys/utime.h"])]
>                                 where_toGet_utime_h='utime.h',
>      [AC_CHECK_HEADER(sys/utime.h,
>          [AC_DEFINE(HAVE_SYS_UTIME_H,1, ["sys/utime.h" is present instead 
> of "utime.h"])]
>                                         where_toGet_utime_h='sys/utime.h',
>         [AC_MSG_WARN(Could find neither "utime.h" nor "sys/utime.h")]
>                     )]
> )
> --------------------------------8<---------------------------------
> 
> Now to make this re-usable i need to turn it into a stand-alone Autoconf 
> macro (AC_DEFUN() it).
> 

yes, AC_DEFUN([AX_HAVE_UTIME_H],[...text...]), add yourself a description
text as dnl-lines before, and make it re-usable via an ac-archive. Oh, btw,
it might be better to not check for utime.h itself but for the functionality
that you want to get from it - some platforms have weird locations for
something a unixish system has a "standard" place for. And your macro would
remind you of that... so, personally, I add an AC_MSG_ *before* making the
three ac-checks telling what the next section is about to do, and a more
importantly an extra result AC_MSG_ telling of the success if any, so it
would be "AC_MSG_RESULT([...done - found utime in sys/utime.h])"

As for extra macros to be usable for you, there is an "acinclude" tool
that I am using to manage the public extra macros from the ac-archive
and those of my personal likings, it will do something similar to aclocal
but create that acinclude.m4 instead. It allows me to pack an ac-archive
and carry it from system to system with all my personal macros attached.
Just a hint tho...

-- cheers, guido                                 http://ac-archive.sf.net



Reply via email to