kpu / kenlm

KenLM: Faster and Smaller Language Model Queries
http://kheafield.com/code/kenlm/
Other
2.5k stars 513 forks source link

Guard against missing __GNUC_PREREQ #233

Closed futurulus closed 5 years ago

futurulus commented 5 years ago

The C header files for musl (used in e.g. Alpine Linux) define _GNU_SOURCE but not __GLIBC_PREREQ, making the line

#if __GLIBC_PREREQ(2,17)

a syntax error:

    util/file.cc:544:19: error: missing binary operator before token "("
     #if __GLIBC_PREREQ(2,17)
                       ^
    error: command 'gcc' failed with exit status 1

cf:

https://github.com/leo-yuriev/ReOpenLDAP/issues/123 http://www.openwall.com/lists/musl/2012/10/20/10

This wraps the use of __GLIBC_PREREQ in a defined() guard.