1 /* check-version.h --- Check version string compatibility.
2 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free
3 Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 /* Written by Simon Josefsson. This interface is influenced by
20 gcry_check_version from Werner Koch's Libgcrypt. Paul Eggert
21 suggested the use of strverscmp to simplify implementation. */
28 #include <strverscmp.h>
30 /* Get specification. */
31 #include "check-version.h"
33 /* Check that the version of the library (i.e., the CPP symbol VERSION)
34 * is at minimum the requested one in REQ_VERSION (typically found in
35 * a header file) and return the version string. Return NULL if the
36 * condition is not satisfied. If a NULL is passed to this function,
37 * no check is done, but the version string is simply returned.
40 check_version (const char *req_version)
42 if (!req_version || strverscmp (req_version, VERSION) <= 0)