Skip to content

Commit

Permalink
Force C99 while compiling statically. (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic authored May 15, 2020
1 parent f235893 commit 5ce5eac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import shutil
import subprocess


OPTIONS = [
('dynamic-linking', None, 'link dynamically against libyara'),
('enable-cuckoo', None, 'enable "cuckoo" module'),
Expand Down Expand Up @@ -182,7 +181,9 @@ def run(self):
building_for_openbsd = 'openbsd' in self.plat_name # need testing

if building_for_linux:
module.define_macros.append(('_GNU_SOURCE', '1'))
module.define_macros.append(('USE_LINUX_PROC', '1'))
module.extra_compile_args.append('-std=c99')
elif building_for_windows:
module.define_macros.append(('USE_WINDOWS_PROC', '1'))
module.define_macros.append(('_CRT_SECURE_NO_WARNINGS', '1'))
Expand All @@ -192,26 +193,33 @@ def run(self):
module.libraries.append('crypt32')
module.libraries.append('ws2_32')
elif building_for_osx:
module.define_macros.append(('_GNU_SOURCE', '1'))
module.define_macros.append(('USE_MACH_PROC', '1'))
module.extra_compile_args.append('-std=c99')
module.include_dirs.append('/usr/local/opt/openssl/include')
module.include_dirs.append('/opt/local/include')
module.library_dirs.append('/opt/local/lib')
module.include_dirs.append('/usr/local/include')
module.library_dirs.append('/usr/local/lib')
elif building_for_freebsd:
module.define_macros.append(('_GNU_SOURCE', '1'))
module.define_macros.append(('USE_FREEBSD_PROC', '1'))
module.include_dirs.append('/opt/local/include')
module.library_dirs.append('/opt/local/lib')
module.include_dirs.append('/usr/local/include')
module.library_dirs.append('/usr/local/lib')
elif building_for_openbsd:
module.define_macros.append(('_GNU_SOURCE', '1'))
module.define_macros.append(('USE_OPENBSD_PROC', '1'))
module.extra_compile_args.append('-std=c99')
module.include_dirs.append('/opt/local/include')
module.library_dirs.append('/opt/local/lib')
module.include_dirs.append('/usr/local/include')
module.library_dirs.append('/usr/local/lib')
else:
module.define_macros.append(('_GNU_SOURCE', '1'))
module.define_macros.append(('USE_NO_PROC', '1'))
module.extra_compile_args.append('-std=c99')

if has_function('memmem'):
module.define_macros.append(('HAVE_MEMMEM', '1'))
Expand Down

0 comments on commit 5ce5eac

Please sign in to comment.