File: cpp_check_class.m4

package info (click to toggle)
ocaml-shine 0.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 300 kB
  • sloc: ansic: 138; ml: 135; makefile: 89; sh: 12
file content (24 lines) | stat: -rw-r--r-- 615 bytes parent folder | download | duplicates (76)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
dnl $1: linker lib name
dnl $2: included file
dnl $3: tested class
dnl $4: emitted variable
AC_DEFUN([AC_CPP_CHECK_CLASS],
[AC_LANG_PUSH([C++])
 SAVED_LDFLAGS=$LDFLAGS
 LDFLAGS="$LDFLAGS -l$1"
 AC_MSG_CHECKING([for class $3 in $1 library])
 AC_LINK_IFELSE(
   [AC_LANG_PROGRAM([#include <$2>],
     [$3 *x = NULL])],
   [TEST_LIBS="$TEST_LIBS -l$1"] [RESULT=1],
   [RESULT=])
 if test -z $RESULT; then
   AC_MSG_RESULT([not found])
 else
   AC_DEFINE([$4], [1], [Defined if class $3 has been found in $1 library])
   AC_MSG_RESULT([ok])
 fi
 $4=$RESULT
 AC_SUBST([$4])
 LDFLAGS=$SAVED_LDFLAGS
 AC_LANG_POP([C++])])