## C: Compiling with libsecret

Like other GNOME libraries, libsecret uses pkg-config to provide compiler options. The package name is "`libsecret-1`". So in your `configure.ac` script,you might specify something like:

    1
    2
    3

    PKG_CHECK_MODULES(LIBSECRET, [libsecret-1 >= 1.0])
    AC_SUBST(LIBSECRET_CFLAGS)
    AC_SUBST(LIBSECRET_LIBS)

Code using libsecret should include the header like this:

    1

    #include <libsecret/secret.h>

Including individual headers besides the main header files is not permitted and will cause an error.

Some parts of the libsecret API are not yet stable. To use them you need use the `libsecret-unstable` package. The API contained in this package will change from time to time. Here's how you would do it:

    1
    2
    3

    PKG_CHECK_MODULES(LIBSECRET, [libsecret-unstable >= 1.0])
    AC_SUBST(LIBSECRET_CFLAGS)
    AC_SUBST(LIBSECRET_LIBS)