Changeset 82149f4 for lib


Ignore:
Timestamp:
2023-03-04T19:59:09Z (21 months ago)
Author:
GitHub <noreply@…>
Branches:
master
Children:
50d0a72
Parents:
709f41f
git-author:
Petr Vaněk <arkamar@…> (04-03-23 19:59:09)
git-committer:
GitHub <noreply@…> (04-03-23 19:59:09)
Message:

Fixes related to external-json-parser (#165)

  • configure: append conditionally json-parser to pc file

json-parser needs to be appended to Requires section of pkg-config file
when bitlbee is configured to use external-json-parser. This change is
needed for external plugins like bitlbee-steam.

  • Makefile: do not install json.h when system json-parser is used

install-dev target should not install bundled json.h when bitlbee is
configured to use external-json-parser.

  • Use correct json.h header file with respect to external_json_parser value

The preprocessor must include correct json.h header file with respect to
external_json_parser value, otherwise function prototypes and other
definitions do not need to correspond with object used for linking.

The state before this commit is that local version lib/json.h is used
always for compilation and external_json_parser variable controls if
local lib/json.o or global libjsonparser.so will be linked.

In order to fix this problem, #include directives in lib/json_util.h and
lib/oauth2.c were changed from "json.h" to <json.h> and preprocessor -I
flags were moved after conditional json-parser flags, which is enough
for solving the issue. Additionally, USE_EXTERNAL_JSON_PARSER macro is
exported when external-json-parser is used and it is used in lib/json.h
to trigger an error message, which should prevent similar mistakes in
future.

Location:
lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lib/json.h

    r709f41f r82149f4  
    2929 */
    3030
     31#ifdef USE_EXTERNAL_JSON_PARSER
     32#error Bitlbee was configured to use system json-parser, this header file should not be used.
     33#endif
     34
    3135#ifndef _JSON_H
    3236#define _JSON_H
  • lib/json_util.h

    r709f41f r82149f4  
    2222****************************************************************************/
    2323
    24 #include "json.h"
     24#include <json.h>
    2525
    2626#define JSON_O_FOREACH(o, k, v) \
  • lib/oauth2.c

    r709f41f r82149f4  
    4242#include "oauth2.h"
    4343#include "oauth.h"
    44 #include "json.h"
     44#include <json.h>
    4545#include "json_util.h"
    4646#include "url.h"
Note: See TracChangeset for help on using the changeset viewer.