File: agi_find_libheader.m4

package info (click to toggle)
aegisub 3.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 18,924 kB
  • ctags: 15,499
  • sloc: cpp: 55,752; ansic: 15,376; sh: 3,671; makefile: 656; xml: 425; cs: 175; python: 84
file content (58 lines) | stat: -rw-r--r-- 1,187 bytes parent folder | download | duplicates (6)
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
58
AC_DEFUN([AGI_FIND_HEADER],[
  file=`echo $2 | $as_tr_sh`

  aegisub_save_CPPFLAGS="$CPPFLAGS"

  for dir in $3; do
    vdir=`echo $dir | $as_tr_sh`
    CPPFLAGS="-I$dir"
    AC_CACHE_CHECK(
      [for $2 in $dir],
      [agi_cv_header_${vdir}_${file}],
      [AC_COMPILE_IFELSE(
        [AC_LANG_PROGRAM([#include <$2>])],
        [eval agi_cv_header_${vdir}_${file}="yes"; found="${dir}"],
        [eval agi_cv_header_${vdir}_${file}="no"; found=""])
    ])

    if test -n "$found"; then
      break;
    fi
  done

  if test -n "$found"; then
    $1_CFLAGS="-I$found"
  fi
  CPPFLAGS="$aegisub_save_CPPFLAGS"
])


AC_DEFUN([AGI_FIND_LIB],[
  aegisub_save_LIBS="$LIBS"

  if test -n "$3"; then
    LDDIR="-L$3"
  fi

  for lib in $2; do
    vlib=`echo $lib | $as_tr_sh`
    LIBS="$LDDIR -l$lib"
    AC_CACHE_CHECK(
      [for -l${lib}],
      [agi_cv_lib_${vlib}],
      [AC_LINK_IFELSE(
        [AC_LANG_PROGRAM()],
        [eval agi_cv_lib_${vlib}="yes"; found="${lib}"],
        [eval agi_cv_lib_${vlib}="no"; found=""])
    ])

    if test -n "$found"; then
      break;
    fi
  done

  if test -n "$found"; then
    $1_LIBS="$LDDIR -l$found"
  fi
  LIBS="$aegisub_save_LIBS"
])