diff options
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 242 |
1 files changed, 44 insertions, 198 deletions
diff --git a/meson.build b/meson.build index 64f4c990c..e0ed7543f 100644 --- a/meson.build +++ b/meson.build | |||
@@ -412,206 +412,52 @@ endif | |||
412 | if cc.has_function('getloadavg') == false | 412 | if cc.has_function('getloadavg') == false |
413 | error('getloadadv missing') | 413 | error('getloadadv missing') |
414 | endif | 414 | endif |
415 | if cc.has_function('memset_s') | ||
416 | cdata.set('HAVE_MEMSET_S', 1) | ||
417 | endif | ||
418 | if cc.has_function('explicit_bzero') | ||
419 | cdata.set('HAVE_EXPLICIT_BZERO', 1) | ||
420 | endif | ||
421 | if cc.has_function('atoll') | ||
422 | cdata.set('HAVE_ATOLL', 1) | ||
423 | endif | ||
424 | if cc.has_function('stat64') | ||
425 | cdata.set('HAVE_STAT64', 1) | ||
426 | endif | ||
427 | if cc.has_function('strnlen', prefix : '#include <string.h>') | ||
428 | cdata.set('HAVE_STRNLEN', 1) | ||
429 | endif | ||
430 | if cc.has_function('mremap') | ||
431 | cdata.set('HAVE_MREMAP', 1) | ||
432 | endif | ||
433 | if cc.has_function('getrlimit') | ||
434 | cdata.set('HAVE_GETRLIMIT', 1) | ||
435 | endif | ||
436 | if cc.has_function('setrlimit') | ||
437 | cdata.set('HAVE_SETRLIMIT', 1) | ||
438 | endif | ||
439 | if cc.has_function('strndup', prefix : '#include <string.h>') | ||
440 | cdata.set('HAVE_STRNDUP', 1) | ||
441 | endif | ||
442 | if cc.has_function('gethostbyname2') | ||
443 | cdata.set('HAVE_GETHOSTBYNAME2', 1) | ||
444 | endif | ||
445 | if cc.has_function('getpeerucred') | ||
446 | cdata.set('HAVE_GETPEERUCRED', 1) | ||
447 | endif | ||
448 | if cc.has_function('getpeereid') | ||
449 | cdata.set('HAVE_GETPEEREID', 1) | ||
450 | endif | ||
451 | if cc.has_function('setresuid') | ||
452 | cdata.set('HAVE_SETRESUID', 1) | ||
453 | endif | ||
454 | if cc.has_function('getifaddrs') | ||
455 | cdata.set('HAVE_GETIFADDRS', 1) | ||
456 | endif | ||
457 | if cc.has_function('freeifaddrs') | ||
458 | cdata.set('HAVE_FREEIFADDRS', 1) | ||
459 | endif | ||
460 | if cc.has_function('getresgid') | ||
461 | cdata.set('HAVE_RESGID', 1) | ||
462 | endif | ||
463 | if cc.has_function('mallinfo2') | ||
464 | cdata.set('HAVE_MALLINFO2', 1) | ||
465 | endif | ||
466 | if cc.has_function('malloc_size') | ||
467 | cdata.set('HAVE_MALLOC_SIZE', 1) | ||
468 | endif | ||
469 | if cc.has_function('malloc_usable_size') | ||
470 | cdata.set('HAVE_MALLOC_USABLE_SIZE', 1) | ||
471 | endif | ||
472 | if cc.has_function('getrusage') | ||
473 | cdata.set('HAVE_GETRUSAGE', 1) | ||
474 | endif | ||
475 | if cc.has_function('random') | ||
476 | cdata.set('HAVE_RANDOM', 1) | ||
477 | endif | ||
478 | if cc.has_function('srandom') | ||
479 | cdata.set('HAVE_SRANDOM', 1) | ||
480 | endif | ||
481 | if cc.has_function('stat') | ||
482 | cdata.set('HAVE_STAT', 1) | ||
483 | endif | ||
484 | if cc.has_function('statfs') | ||
485 | cdata.set('HAVE_STATFS', 1) | ||
486 | endif | ||
487 | if cc.has_function('statvfs') | ||
488 | cdata.set('HAVE_STATVFS', 1) | ||
489 | endif | ||
490 | if cc.has_function('wait4') | ||
491 | cdata.set('HAVE_WAIT4', 1) | ||
492 | endif | ||
493 | if cc.has_function('timegm') | ||
494 | cdata.set('HAVE_TIMEGM', 1) | ||
495 | endif | ||
496 | if cc.has_function('getaddrinfo') | ||
497 | cdata.set('HAVE_GETADDRINFO', 1) | ||
498 | endif | ||
499 | if cc.has_function('initgroups') | ||
500 | cdata.set('HAVE_INITGROUPS', 1) | ||
501 | endif | ||
502 | if cc.has_function('gethostbyname') | ||
503 | cdata.set('HAVE_GETHOSTBYNAME', 1) | ||
504 | endif | ||
505 | |||
506 | if cc.check_header('stdatomic.h') | ||
507 | add_project_arguments('-DHAVE_STDATOMIC_H', language : 'c') | ||
508 | endif | ||
509 | if cc.check_header('malloc.h') | ||
510 | add_project_arguments('-DHAVE_MALLOC_H', language : 'c') | ||
511 | endif | ||
512 | if cc.check_header('malloc/malloc.h') | ||
513 | add_project_arguments('-DHAVE_MALLOC_MALLOC_H', language : 'c') | ||
514 | endif | ||
515 | if cc.check_header('malloc/malloc_np.h') | ||
516 | add_project_arguments('-DHAVE_MALLOC_MALLOC_NP_H', language : 'c') | ||
517 | endif | ||
518 | if cc.check_header('langinfo.h') | ||
519 | add_project_arguments('-DHAVE_LANGINFO_H', language : 'c') | ||
520 | endif | ||
521 | if cc.check_header('sys/param.h') | ||
522 | add_project_arguments('-DHAVE_SYS_PARAM_H', language : 'c') | ||
523 | endif | ||
524 | if cc.check_header('sys/mount.h') | ||
525 | add_project_arguments('-DHAVE_SYS_MOUNT_H', language : 'c') | ||
526 | endif | ||
527 | if cc.check_header('sys/statvfs.h') | ||
528 | add_project_arguments('-DHAVE_SYS_STATVFS_H', language : 'c') | ||
529 | endif | ||
530 | if cc.check_header('sys/select.h') | ||
531 | add_project_arguments('-DHAVE_SYS_SELECT_H', language : 'c') | ||
532 | endif | ||
533 | if cc.check_header('sockLib.h') | ||
534 | add_project_arguments('-DHAVE_SOCKLIB_H', language : 'c') | ||
535 | endif | ||
536 | if cc.check_header('sys/mman.h') | ||
537 | add_project_arguments('-DHAVE_SYS_MMAN_H', language : 'c') | ||
538 | endif | ||
539 | if cc.check_header('sys/msg.h') | ||
540 | add_project_arguments('-DHAVE_SYS_MSG_H', language : 'c') | ||
541 | endif | ||
542 | if cc.check_header('sys/vfs.h') | ||
543 | add_project_arguments('-DHAVE_SYS_VFS_H', language : 'c') | ||
544 | endif | ||
545 | if cc.check_header('arpa/inet.h') | ||
546 | add_project_arguments('-DHAVE_ARPA_INET_H', language : 'c') | ||
547 | endif | ||
548 | if cc.check_header('libintl.h') | ||
549 | add_project_arguments('-DHAVE_LIBINTL_H', language : 'c') | ||
550 | endif | ||
551 | if cc.check_header('netdb.h') | ||
552 | add_project_arguments('-DHAVE_NETDB_H', language : 'c') | ||
553 | endif | ||
554 | if cc.check_header('netinet/in.h') | ||
555 | add_project_arguments('-DHAVE_NETINET_IN_H', language : 'c') | ||
556 | endif | ||
557 | if cc.check_header('sys/ioctl.h') | ||
558 | add_project_arguments('-DHAVE_SYS_IOCTL_H', language : 'c') | ||
559 | endif | ||
560 | if cc.check_header('sys/socket.h') | ||
561 | add_project_arguments('-DHAVE_SYS_SOCKET_H', language : 'c') | ||
562 | endif | ||
563 | if cc.check_header('sys/time.h') | ||
564 | add_project_arguments('-DHAVE_SYS_TIME_H', language : 'c') | ||
565 | endif | ||
566 | if cc.check_header('sys/sysinfo.h') | ||
567 | add_project_arguments('-DHAVE_SYS_SYSINFO_H', language : 'c') | ||
568 | endif | ||
569 | if cc.check_header('sys/file.h') | ||
570 | add_project_arguments('-DHAVE_SYS_FILE_H', language : 'c') | ||
571 | endif | ||
572 | if cc.check_header('sys/resource.h') | ||
573 | add_project_arguments('-DHAVE_SYS_RESOURCE_H', language : 'c') | ||
574 | endif | ||
575 | if cc.check_header('ifaddrs.h') | ||
576 | add_project_arguments('-DHAVE_IFADDRS_H', language : 'c') | ||
577 | endif | ||
578 | if cc.check_header('mach/mach.h') | ||
579 | add_project_arguments('-DHAVE_MACH_MACH_H', language : 'c') | ||
580 | endif | ||
581 | if cc.check_header('sys/timeb.h') | ||
582 | add_project_arguments('-DHAVE_SYS_TIMEB_H', language : 'c') | ||
583 | endif | ||
584 | if cc.check_header('argz.h') | ||
585 | add_project_arguments('-DHAVE_ARGZ_H', language : 'c') | ||
586 | endif | ||
587 | if cc.check_header('ucred.h') | ||
588 | add_project_arguments('-DHAVE_UCRED_H', language : 'c') | ||
589 | endif | ||
590 | if cc.check_header('sys/ucred.h') | ||
591 | add_project_arguments('-DHAVE_SYS_UCRED_H', language : 'c') | ||
592 | endif | ||
593 | if cc.check_header('endian.h') | ||
594 | add_project_arguments('-DHAVE_ENDIAN_H', language : 'c') | ||
595 | endif | ||
596 | if cc.check_header('sys/endian.h') | ||
597 | add_project_arguments('-DHAVE_SYS_ENDIAN_H', language : 'c') | ||
598 | endif | ||
599 | if cc.check_header('execinfo.h') | ||
600 | add_project_arguments('-DHAVE_EXECINFO_H', language : 'c') | ||
601 | endif | ||
602 | if cc.check_header('byteswap.h') | ||
603 | add_project_arguments('-DHAVE_BYTESWAP_H', language : 'c') | ||
604 | endif | ||
605 | |||
606 | |||
607 | |||
608 | |||
609 | |||
610 | |||
611 | |||
612 | |||
613 | 415 | ||
416 | syscalls = [ | ||
417 | 'memset_s', 'explicit_bzero', 'atoll', 'stat64', | ||
418 | 'mremap', 'getrlimit', 'setrlimit', 'gethostbyname2', | ||
419 | 'getpeerucred', 'getpeereid', 'setresuid', 'getifaddrs', 'freeifaddrs', | ||
420 | 'getresgid', 'mallinfo2', 'malloc_size', 'malloc_usable_size', 'getrusage', | ||
421 | 'random', 'srandom', 'stat', 'statfs', 'statvfs', 'wait4', 'timegm', | ||
422 | 'getaddrinfo', 'initgroups', 'gethostbyname' | ||
423 | ] | ||
424 | |||
425 | str_syscalls = [ | ||
426 | 'strnlen', 'strndup', | ||
427 | ] | ||
428 | |||
429 | foreach f : syscalls | ||
430 | if cc.has_function(f) | ||
431 | define = 'HAVE_' + f.underscorify().to_upper() | ||
432 | cdata.set(define, 1) | ||
433 | endif | ||
434 | endforeach | ||
614 | 435 | ||
436 | foreach f : str_syscalls | ||
437 | if cc.has_function(f, prefix : '#include <string.h>') | ||
438 | define = 'HAVE_' + f.underscorify().to_upper() | ||
439 | cdata.set(define, 1) | ||
440 | endif | ||
441 | endforeach | ||
442 | |||
443 | |||
444 | headers = [ | ||
445 | 'stdatomic.h', 'malloc.h', 'malloc/malloc.h', 'malloc/malloc_np.h', | ||
446 | 'langinfo.h', 'sys/param.h', 'sys/mount.h', 'sys/statvfs.h', | ||
447 | 'sys/select.h', 'sockLib.h', 'sys/mman.h', 'sys/msg.h', 'sys/vfs.h', | ||
448 | 'arpa/inet.h', 'libintl.h', 'netdb.h', 'netinet/in.h', 'sys/ioctl.h', | ||
449 | 'sys/socket.h', 'sys/time.h', 'sys/sysinfo.h', 'sys/file.h', 'sys/resource.h', | ||
450 | 'ifaddrs.h', 'mach/mach.h', 'sys/timeb.h', 'argz.h', 'ucred.h', 'sys/ucred.h', | ||
451 | 'endian.h', 'sys/endian.h', 'execinfo.h', 'byteswap.h', 'sys/types.h' | ||
452 | ] | ||
453 | |||
454 | foreach h : headers | ||
455 | if cc.check_header(h) | ||
456 | define = '-DHAVE_' + h.underscorify().to_upper() | ||
457 | message(define) | ||
458 | add_project_arguments(define, language : 'c') | ||
459 | endif | ||
460 | endforeach | ||
615 | 461 | ||
616 | configure_file(#input: 'gnunet_private_config.h.in', | 462 | configure_file(#input: 'gnunet_private_config.h.in', |
617 | output : 'gnunet_private_config.h', | 463 | output : 'gnunet_private_config.h', |