/* SPDX-License-Identifier: GPL-2.0-only */

#include <ppm/ppm.h>

#include <sodium.h>

#ifndef PPM_VERSION
#  define PPM_VERSION "0.1.0"
#endif

const char *ppm_version_string(void) {
    return PPM_VERSION;
}

const char *ppm_build_string(void) {
    static char buf[160];
    static int  built = 0;
    if (!built) {
        snprintf(buf, sizeof(buf),
                 "ppm %s, libsodium %s, compiled %s with %s",
                 PPM_VERSION,
                 sodium_version_string(),
                 __DATE__,
#if defined(__clang__)
                 "clang " __clang_version__
#elif defined(__GNUC__)
                 "gcc " __VERSION__
#else
                 "unknown compiler"
#endif
                );
        built = 1;
    }
    return buf;
}
