NetBSD-Users archive

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

Re: NetBSD macros



> There is not much else you can do apart from writing code like:
> 
> #if NetBSD && NetBSD_Version >= 5.0
>       use NetBSD atomic_ops
> #elif Solaris
>       use Solaris atomic_ops
> #elif Linux
>       use Linux atomic_ops
> #else
>       use pthread_mutex_lock
> #endif

How many kind of interfaces do you need?  If you're not going to write a
software which can run on top of either GNOME or KDE or whatever, you won't
need autoconf, but only a subset of it.  Go for writing your-own-configure
script.  The config.h would have only a few HAVE_XXX.

Code would look like:
        #include "portable_ops.h"
        PORTABLE_OPS_ATOMIC_ADD();
portable_ops.h:
        #include "config.h"
        #ifdef NETBSD
        #include "portable_ops_netbsd.h"
        #endif
portable_ops_netbsd.h:
        #define PORTABLE_OPS_ATOMIC_ADD_32      atomic_add32()

Masao

-- 
Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635


Home | Main Index | Thread Index | Old Index