Newbie: how to handle different prototypes?

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

 



I have a basic question that I couldn't find in the info docs or the goat book.  What's the right way to deal with a prototype for a system library function that differs between platforms?  I know how to check for headers and libraries, but don't know what the autotools way is to get around different prototypes.

For example, on linux the scandir prototype is:

       int scandir(const char *dir, struct dirent ***namelist,
              int(*select)(const struct dirent *),
              int(*compar)(const struct dirent **, const struct dirent **));

and on darwin it's:

     int
     scandir(const char *dirname, struct dirent ***namelist,
         int (*select)(struct dirent *),
         int (*compar)(const void *, const void *));

I.e. the const is missing from darwin's 3rd parameter.  Not knowing which systems implement which headers seems problematic.  In any case, do I redefine scandir and know that the linker will still find it or add a const to my own select() prototype depending on the system?  Or is there a standard macro for this that I couldn't find?

Thanks in advance.

-d



_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux