Skip to content
Snippets Groups Projects
Commit a4aaf812 authored by Claus-Justus Heine's avatar Claus-Justus Heine
Browse files

Make the header file an option.

parent 0cd229e7
No related branches found
No related tags found
No related merge requests found
......@@ -28,9 +28,25 @@ AC_HELP_STRING([--without-$1], [disable use of package $1
esac],
[m4_bpatsubst([$1],-,_)_DISABLE=no])
])
AC_DEFUN([ALBERT_CHECK_PKG_HDR_OPT],
[AC_ARG_WITH($1-headers,
AC_HELP_STRING([--with-$1-headers=DIR],
[use $1 include files below directory DIR (default: $2)]),
[case "$withval" in
yes) AC_MSG_ERROR("option \"--with-$1-headers\" requires an argument")
;;
no) AC_MSG_ERROR("option \"--with-$1-headers\" requires an argument")
;;
*) m4_bpatsubst([$1],-,_)_INCLUDE_PATH=$withval
;;
esac],
[m4_bpatsubst([$1],-,_)_INCLUDE_PATH=$DEFAULT_INCDIR])
])
AC_DEFUN(ALBERT_CHECK_PACKAGE,
[AC_REQUIRE([AC_SET_PREFIX])
dnl
#
# foobar
#
m4_if($7, optional,[ALBERT_CHECK_PKG_OPT([$1])])
dnl if test "$7" = "optional"; then
dnl ALBERT_CHECK_PKG_OPT([$1])
......@@ -65,23 +81,10 @@ if test -z "$6"; then
else
DEFAULT_INCDIR=$6
fi
AC_ARG_WITH($1-headers,
AC_HELP_STRING([--with-$1-headers=DIR],
[use $1 include files below directory DIR (default: $6)]),
[case "$withval" in
yes) AC_MSG_ERROR("option \"--with-$1-headers\" requires an argument")
;;
no) AC_MSG_ERROR("option \"--with-$1-headers\" requires an argument")
;;
*) m4_bpatsubst([$1],-,_)_INCLUDE_PATH=$withval
;;
esac],
m4_bpatsubst([$1],-,_)_INCLUDE_PATH=$DEFAULT_INCDIR)
m4_if($5,[],[],[ALBERT_CHECK_PKG_HDR_OPT([$1], [$6])])
dnl
dnl now check if the library and header files exist
dnl
[ac_]m4_bpatsubst([$1],-,_)_save_LDFLAGS="$LDFLAGS"
LDFLAGS="-L${m4_bpatsubst([$1],-,_)_LIB_PATH} ${LDFLAGS}"
if test "$7" = "optional" ; then
AC_CHECK_LIB($2, main,
[m4_bpatsubst([$1],-,_)_LIB="-L${m4_bpatsubst([$1],-,_)_LIB_PATH} -l$2"],
......@@ -95,23 +98,24 @@ else
[AC_MSG_ERROR([Library "lib$2" was not found])],
-L$m4_bpatsubst([$1],-,_)_LIB_PATH $4)
fi
LDFLAGS="${[ac_]m4_bpatsubst([$1],-,_)_save_LDFLAGS}"
if test "x${m4_bpatsubst([$1],-,_)_LIB}" = "x" ; then
:
else
dnl
dnl check for the header file
dnl
[ac_]m4_bpatsubst([$1],-,_)_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-I${m4_bpatsubst([$1],-,_)_INCLUDE_PATH} $CPPFLAGS"
if test "$7" = "optional" ; then
AC_CHECK_HEADERS($5,, [m4_bpatsubst([$1],-,_)_LIB=""
m4_bpatsubst([$1],-,_)_LIB_PATH=""
m4_bpatsubst([$1],-,_)_INCLUDE_PATH=""])
else
AC_CHECK_HEADERS($5,, AC_MSG_ERROR([Header file "$5" was not found]))
if test -n "$5"; then
dnl
dnl check for the header file
dnl
[ac_]m4_bpatsubst([$1],-,_)_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-I${m4_bpatsubst([$1],-,_)_INCLUDE_PATH} $CPPFLAGS"
if test "$7" = "optional" ; then
AC_CHECK_HEADERS($5,, [m4_bpatsubst([$1],-,_)_LIB=""
m4_bpatsubst([$1],-,_)_LIB_PATH=""
m4_bpatsubst([$1],-,_)_INCLUDE_PATH=""])
else
AC_CHECK_HEADERS($5,, AC_MSG_ERROR([Header file "$5" was not found]))
fi
CPPCLAGS="${[ac_]m4_bpatsubst([$1],-,_)_save_CPPFLAGS}"
fi
CPPFLAGS="${[ac_]m4_bpatsubst([$1],-,_)_save_CPPFLAGS}"
dnl
dnl define makefile substitutions and config.h macros
dnl
......@@ -125,7 +129,6 @@ fi
fi dnl disable fi
AM_CONDITIONAL(m4_bpatsubst([$1],-,_), test -n "${m4_bpatsubst([$1],-,_)_LIB}")
AC_SUBST(m4_bpatsubst([$1],-,_)_INCLUDE_PATH)
AC_SUBST(m4_bpatsubst([$1],-,_)_LIB_PATH)
AC_SUBST(m4_bpatsubst([$1],-,_)_LIB)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment