Hash :
b6d6da4c
        
        Author :
  
        
        Date :
2024-02-20T04:40:32
        
      
build: Refactor function checks into a new libbsd-funcs.m4 file These are complex enough to clutter the main configure.ac. Move them into their own file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
# Copyright © 2011-2024 Guillem Jover <guillem@hadrons.org>
# LIBBSD_CHECK_PROGNAME
# ---------------------
AC_DEFUN([LIBBSD_CHECK_PROGNAME], [
  AC_MSG_CHECKING([for program_invocation_short_name])
  AC_LINK_IFELSE([
    AC_LANG_PROGRAM([[
#include <errno.h>
    ]], [[
const char *p = program_invocation_short_name;
    ]])
  ], [
    AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
      [Define to 1 if you have program_invocation_short_name])
    AC_MSG_RESULT([yes])
  ], [
    AC_MSG_RESULT([no])
  ])
  AC_MSG_CHECKING([for __progname])
  AC_LINK_IFELSE([
    AC_LANG_PROGRAM([[
#include <stdio.h>
extern char *__progname;
    ]], [[
printf("%s", __progname);
    ]])
  ], [
    AC_DEFINE([HAVE___PROGNAME], [1], [Define to 1 if you have __progname])
    AC_MSG_RESULT([yes])
  ], [
    AC_MSG_RESULT([no])
  ])
])
# LIBBSD_CHECK_REGISTER_ATFORK
# ----------------------------
AC_DEFUN([LIBBSD_CHECK_REGISTER_ATFORK], [
  AC_MSG_CHECKING([for __register_atfork])
  AC_LINK_IFELSE([
    AC_LANG_PROGRAM([[
#include <stddef.h>
extern void *__dso_handle;
extern int __register_atfork(void (*)(void), void(*)(void), void (*)(void), void *);
    ]], [[
__register_atfork(NULL, NULL, NULL, __dso_handle);
    ]])
  ], [
    AC_DEFINE([HAVE___REGISTER_ATFORK], [1],
      [Define to 1 if you have __register_atfork])
    AC_MSG_RESULT([yes])
  ], [
    LIBBSD_LIBS="$LIBBSD_LIBS -pthread"
    AC_MSG_RESULT([no])
  ])
])