1 /* check-version.h --- Check version string compatibility.
2 Copyright (C) 1998-2006, 2008-2017 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Simon Josefsson. This interface is influenced by
18 gcry_check_version from Werner Koch's Libgcrypt. Paul Eggert
19 suggested the use of strverscmp to simplify implementation. */
26 /* Get specification. */
27 #include "check-version.h"
29 /* Check that the version of the library (i.e., the CPP symbol VERSION)
30 * is at minimum the requested one in REQ_VERSION (typically found in
31 * a header file) and return the version string. Return NULL if the
32 * condition is not satisfied. If a NULL is passed to this function,
33 * no check is done, but the version string is simply returned.
36 check_version (const char *req_version
)
38 if (!req_version
|| strverscmp (req_version
, VERSION
) <= 0)