1 /* check-version.h --- Check version string compatibility.
2 Copyright (C) 1998-2006, 2008-2011 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, write to the Free Software Foundation,
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18 /* Written by Simon Josefsson. This interface is influenced by
19 gcry_check_version from Werner Koch's Libgcrypt. Paul Eggert
20 suggested the use of strverscmp to simplify implementation. */
27 /* Get specification. */
28 #include "check-version.h"
30 /* Check that the version of the library (i.e., the CPP symbol VERSION)
31 * is at minimum the requested one in REQ_VERSION (typically found in
32 * a header file) and return the version string. Return NULL if the
33 * condition is not satisfied. If a NULL is passed to this function,
34 * no check is done, but the version string is simply returned.
37 check_version (const char *req_version)
39 if (!req_version || strverscmp (req_version, VERSION) <= 0)