Merge commit '62d5b5a9d3b0181335072d6fa792f2d805bc27b6'
authorJames Almer <jamrial@gmail.com>
Sat, 11 Nov 2017 19:45:00 +0000 (16:45 -0300)
committerJames Almer <jamrial@gmail.com>
Sat, 11 Nov 2017 19:48:49 +0000 (16:48 -0300)
* commit '62d5b5a9d3b0181335072d6fa792f2d805bc27b6':
  configure: Extend check_header() to allow checking for multiple headers

Merged-by: James Almer <jamrial@gmail.com>
1  2 
configure

diff --cc configure
+++ b/configure
@@@ -1107,37 -929,17 +1107,39 @@@ check_stripflags()
  
  check_header(){
      log check_header "$@"
-     header=$1
+     headers=$1
      shift
-     disable_sanitized $header
-     check_cpp "$@" <<EOF && enable_sanitized $header
- #include <$header>
- int x;
- EOF
+     disable_sanitized $headers
+     {
+         for hdr in $headers; do
+             print_include $hdr
+         done
+         echo "int x;"
+     } | check_cpp "$@" && enable_sanitized $headers
  }
  
 +check_header_objcc(){
 +    log check_header_objcc "$@"
 +    rm -f -- "$TMPO"
 +    header=$1
 +    shift
 +    disable_sanitized $header
 +    {
 +       echo "#include <$header>"
 +       echo "int main(void) { return 0; }"
 +    } | check_objcc && check_stat "$TMPO" && enable_sanitized $header
 +}
 +
 +check_apple_framework(){
 +    log check_apple_framework "$@"
 +    framework="$1"
 +    name="$(tolower $framework)"
 +    header="${framework}/${framework}.h"
 +    disable $name
 +    check_header_objcc $header &&
 +        enable $name && eval ${name}_extralibs='"-framework $framework"'
 +}
 +
  check_func(){
      log check_func "$@"
      func=$1
@@@ -1379,19 -1128,11 +1381,19 @@@ require()
      check_lib $name "$headers" $func "$@" || die "ERROR: $name_version not found"
  }
  
 +require_cpp(){
 +    name="$1"
 +    headers="$2"
 +    classes="$3"
 +    shift 3
 +    check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
 +}
 +
  require_header(){
      log require "$@"
-     header="$1"
+     headers="$1"
      shift
-     check_header "$header" "$@" || die "ERROR: $header header not found"
+     check_header "$headers" "$@" || die "ERROR: $headers not found"
  }
  
  require_cpp_condition(){
@@@ -6145,27 -4781,15 +6147,24 @@@ check_lib vfw32 "windows.h vfw.h" capCr
  # w32api 3.12 had it defined wrong
  check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
  
 +check_type "dshow.h" IBaseFilter
 +
  # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
- { check_header dev/bktr/ioctl_meteor.h &&
-   check_header dev/bktr/ioctl_bt848.h; } ||
- { check_header machine/ioctl_meteor.h &&
-   check_header machine/ioctl_bt848.h; } ||
- { check_header dev/video/meteor/ioctl_meteor.h &&
-   check_header dev/video/bktr/ioctl_bt848.h; } ||
- check_header dev/ic/bt8xx.h
+ check_header "dev/bktr/ioctl_meteor.h dev/bktr/ioctl_bt848.h"                   ||
+     check_header "machine/ioctl_meteor.h machine/ioctl_bt848.h"                 ||
+     check_header "dev/video/meteor/ioctl_meteor.h dev/video/bktr/ioctl_bt848.h" ||
+     check_header "dev/ic/bt8xx.h"
  
 -check_header sys/soundcard.h
 +if check_struct sys/soundcard.h audio_buf_info bytes; then
 +    enable_sanitized sys/soundcard.h
 +else
 +    check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_sanitized sys/soundcard.h
 +    #include <sys/soundcard.h>
 +    audio_buf_info abc;
 +EOF
 +fi
  
 -enabled_any alsa_indev alsa_outdev &&
 +enabled alsa && check_pkg_config alsa alsa "alsa/asoundlib.h" snd_pcm_htimestamp ||
      check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound
  
  enabled libjack &&