diff --git a/m4/check-package.m4 b/m4/check-package.m4 index 174e6a8f1e2a413490eb2c67f0cc2fb5d5619945..3330f3d1b0a43772c4826db10d0b6a35bcbae172 100644 --- a/m4/check-package.m4 +++ b/m4/check-package.m4 @@ -9,12 +9,19 @@ dnl $2: library name (base name, lib$2[.so|.a] dnl $3: library path (-L$3) dnl $4: additional libraries needed (e.g. -lm -lGL) dnl $5: header name -dnl $6: include path (-I$6 +dnl $6: include path (-I$6) dnl $7 \in \{optional, required\}, bail out if required, warning otherwise dnl AC_DEFUN(ALBERT_CHECK_PKG, -[AC_ARG_WITH($1-lib, -[ --with-$1-lib=DIR use $1 library below directory DIR (default: $3)], +[AC_REQUIRE([AC_SET_PREFIX]) +if test -z "$3"; then + DEFAULT_LIBDIR=${libdir} +else + DEFAULT_LIBDIR=$3 +fi +AC_ARG_WITH($1-lib, +[ --with-$1-lib=DIR use $1 library below directory DIR + (default: $DEFAULT_LIBDIR)], [case "$withval" in yes) AC_MSG_ERROR("option \"--with-$1-lib\" requires an argument") ;; @@ -23,10 +30,18 @@ AC_DEFUN(ALBERT_CHECK_PKG, *) $1_DIR=$withval ;; esac], -$1_DIR=$3) +$1_DIR=$DEFAULT_LIBDIR) +dnl +dnl now for the header file +dnl +if test -z "$6"; then + DEFAULT_INCDIR=${libdir} +else + DEFAULT_INCDIR=$6 +fi AC_ARG_WITH($1-headers, [ --with-$1-headers=DIR use $1 include files below directory DIR - (default: $6)], + (default: $DEFAULT_INCDIR)], [case "$withval" in yes) AC_MSG_ERROR("option \"--with-$1-headers\" requires an argument") ;; @@ -35,7 +50,7 @@ AC_ARG_WITH($1-headers, *) $1_INCS=$withval ;; esac], -$1_INCLUDES=$6) +$1_INCLUDES=$DEFAULT_INCDIR) dnl dnl now check if the library and header files exist dnl