| 1 | dnl gput.m4 -- Find the compiler and linker flags for GPUT. |
|---|
| 2 | dnl |
|---|
| 3 | dnl Provides the macro RRA_LIB_GPUT, which finds the compiler and linker flags |
|---|
| 4 | dnl for linking with GPUT libraries (an authorization system developed at |
|---|
| 5 | dnl Carnegie Mellon University) and sets the substitution variables |
|---|
| 6 | dnl GPUT_CPPFLAGS, GPUT_LDFLAGS, and GPUT_LIBS. Provides the --with-gput, |
|---|
| 7 | dnl --with-gput-lib, and --with-gput-include configure options and defines |
|---|
| 8 | dnl HAVE_GPUT if the library is available. |
|---|
| 9 | dnl |
|---|
| 10 | dnl Depends on RRA_SET_LDFLAGS. |
|---|
| 11 | dnl |
|---|
| 12 | dnl Written by Russ Allbery <rra@stanford.edu> |
|---|
| 13 | dnl Copyright 2008 Board of Trustees, Leland Stanford Jr. University |
|---|
| 14 | dnl |
|---|
| 15 | dnl See LICENSE for licensing terms. |
|---|
| 16 | |
|---|
| 17 | AC_DEFUN([RRA_LIB_GPUT], |
|---|
| 18 | [GPUT_CPPFLAGS= |
|---|
| 19 | GPUT_LDFLAGS= |
|---|
| 20 | GPUT_LIBS= |
|---|
| 21 | AC_SUBST([GPUT_CPPFLAGS]) |
|---|
| 22 | AC_SUBST([GPUT_LDFLAGS]) |
|---|
| 23 | AC_SUBST([GPUT_LIBS]) |
|---|
| 24 | rra_with_gput= |
|---|
| 25 | |
|---|
| 26 | AC_ARG_WITH([gput], |
|---|
| 27 | [AC_HELP_STRING([--with-gput=DIR], |
|---|
| 28 | [Location of CMU GPUT headers and libraries])], |
|---|
| 29 | [rra_with_gput=yes |
|---|
| 30 | AS_IF([test x"$withval" = xno], |
|---|
| 31 | [rra_with_gput=no], |
|---|
| 32 | [AS_IF([test x"$withval" != xyes], |
|---|
| 33 | [GPUT_CPPFLAGS="-I$withval/include" |
|---|
| 34 | RRA_SET_LDFLAGS([GPUT_LDFLAGS], [$withval])])])]) |
|---|
| 35 | AC_ARG_WITH([gput-include], |
|---|
| 36 | [AC_HELP_STRING([--with-gput-include=DIR], |
|---|
| 37 | [Location of CMU GPUT headers])], |
|---|
| 38 | [AS_IF([test x"$withval" = xyes || test x"$withval" = xno], |
|---|
| 39 | [AC_MSG_ERROR([no argument given for --with-gput-include])]) |
|---|
| 40 | rra_with_gput=yes |
|---|
| 41 | GPUT_CPPFLAGS="-I$withval"]) |
|---|
| 42 | AC_ARG_WITH([gput-lib], |
|---|
| 43 | [AC_HELP_STRING([--with-gput-lib=DIR], [Location of CMU GPUT libraries])], |
|---|
| 44 | [AS_IF([test x"$withval" = xyes || test x"$withval" = xno], |
|---|
| 45 | [AC_MSG_ERROR([no argument given for --with-gput-lib])]) |
|---|
| 46 | rra_with_gput=yes |
|---|
| 47 | GPUT_LDFLAGS="-L$withval"]) |
|---|
| 48 | |
|---|
| 49 | rra_save_CPPFLAGS="$CPPFLAGS" |
|---|
| 50 | rra_save_LDFLAGS="$LDFLAGS" |
|---|
| 51 | CPPFLAGS="$GPUT_CPPFLAGS $CPPFLAGS" |
|---|
| 52 | LDFLAGS="$GPUT_LDFLAGS $LDFLAGS" |
|---|
| 53 | AS_IF([test x"$rra_with_gput" != xno], |
|---|
| 54 | [AC_CHECK_HEADER([gput.h], |
|---|
| 55 | [AC_CHECK_LIB([gput], [gput_open], |
|---|
| 56 | [AC_DEFINE([HAVE_GPUT], 1, |
|---|
| 57 | [Define to 1 if the CMU GPUT library is present]) |
|---|
| 58 | GPUT_LIBS=-lgput], |
|---|
| 59 | [AS_IF([test x"$rra_with_gput" = xyes], |
|---|
| 60 | [AC_MSG_ERROR([GPUT library not found])])])], |
|---|
| 61 | [AS_IF([test x"$rra_with_gput" = xyes], |
|---|
| 62 | [AC_MSG_ERROR([GPUT header gput.h not found])])])])]) |
|---|