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

On Darwin, check whether -framework works if -l fails.

parent 31a39d91
No related branches found
No related tags found
No related merge requests found
......@@ -122,11 +122,9 @@ if test "${UPNAME[_DISABLE]}" = yes; then
:
else
if test -z "$3"; then
DEFAULT_LIBDIR=`eval eval echo ${libdir}`
else
DEFAULT_LIBDIR=$3
fi
m4_if($3,[],[DEFAULT_LIBDIR=`eval eval echo ${libdir}`],
[DEFAULT_LIBDIR=$3])
dnl
dnl Optionally use an alternate name (e.g. MesaGL instead of GL etc.)
dnl
......@@ -166,17 +164,15 @@ test -z "${UPNAME[_LIB_PATH]}" && UPNAME[_LIB_PATH]=$DEFAULT_LIBDIR)
dnl
dnl now for the header file
dnl
if test -z "$6"; then
DEFAULT_INCDIR=`eval eval echo ${includedir}`
else
DEFAULT_INCDIR=$6
fi
m4_if($5,[],[],[ALBERTA_CHECK_PKG_HDR_OPT([$1], [PREFIX/include/])])
m4_if($5,[],[],
[m4_if($6,[],[DEFAULT_INCDIR=`eval eval echo ${includedir}`],
[DEFAULT_INCDIR=$6])
ALBERTA_CHECK_PKG_HDR_OPT([$1], [PREFIX/include/])])
dnl
dnl now check if the library and header files exist
dnl
if test "$8" = "optional" ; then
AC_CHECK_LIB(${UPNAME[_NAME]}, main,
m4_if($8,[optional],
[AC_CHECK_LIB(${UPNAME[_NAME]}, main,
[UPNAME[_LIB]="-L${UPNAME[_LIB_PATH]} -l${UPNAME[_NAME]}"
UPNAME[_ALL_LIB]="-L${UPNAME[_LIB_PATH]} -l${UPNAME[_NAME]} $4"],
[UPNAME[_LIB]=""
......@@ -184,32 +180,59 @@ if test "$8" = "optional" ; then
UPNAME[_LIB_PATH]=""
UPNAME[_INCLUDE]=""
UPNAME[_INCLUDE_PATH]=""],
-L${UPNAME[_LIB_PATH]} $4)
else
AC_CHECK_LIB(${UPNAME[_NAME]}, main,
[UPNAME[_LIB]="-L${UPNAME[_LIB_PATH]} -l${UPNAME[_NAME]}"
UPNAME[_ALL_LIB]="-L${UPNAME[_LIB_PATH]} -l${UPNAME[_NAME]} $4"],
[AC_MSG_ERROR([Library "lib${UPNAME[_NAME]}" was not found])],
-L$UPNAME[_LIB_PATH] $4)
-L${UPNAME[_LIB_PATH]} $4)],
[AC_CHECK_LIB(${UPNAME[_NAME]}, main,
[UPNAME[_LIB]="-L${UPNAME[_LIB_PATH]} -l${UPNAME[_NAME]}"
UPNAME[_ALL_LIB]="-L${UPNAME[_LIB_PATH]} -l${UPNAME[_NAME]} $4"],
[AC_MSG_ERROR([Library "lib${UPNAME[_NAME]}" was not found])],
-L$UPNAME[_LIB_PATH] $4)])
dnl
dnl On MacOS X we have that funky -framework switch ...
dnl So just run the test again with the framework switch in case the
dnl package was not found.
dnl
if test "x${UPNAME[_LIB]}" = "x" ; then
case "$host" in
*darwin*)
AC_MSG_RESULT([Running the test for "$1" again with -framework switch])
eval "unset ac_cv_lib_${UPNAME[_NAME]}___main"
m4_if($8,[optional],
[AC_CHECK_FRAMEWORK(${UPNAME[_NAME]}, main,
[UPNAME[_LIB]="-F${UPNAME[_LIB_PATH]} -framework ${UPNAME[_NAME]}"
UPNAME[_ALL_LIB]="-F${UPNAME[_LIB_PATH]} -framework ${UPNAME[_NAME]} $4"],
[UPNAME[_LIB]=""
UPNAME[_ALL_LIB]=""
UPNAME[_LIB_PATH]=""
UPNAME[_INCLUDE]=""
UPNAME[_INCLUDE_PATH]=""],
-F${UPNAME[_LIB_PATH]} $4)],
[AC_CHECK_FRAMEWORK(${UPNAME[_NAME]}, main,
[UPNAME[_LIB]="-F${UPNAME[_LIB_PATH]} -framework ${UPNAME[_NAME]}"
UPNAME[_ALL_LIB]="-F${UPNAME[_LIB_PATH]} -framework ${UPNAME[_NAME]} $4"],
[AC_MSG_ERROR([Framework "${UPNAME[_NAME]}" was not found])],
-F$UPNAME[_LIB_PATH] $4)])
;;
esac
fi
if test "x${UPNAME[_LIB]}" = "x" ; then
:
else
if test -n "$5"; then
m4_if($5,[],,[
dnl
dnl check for the header file
dnl
[ac_]UPNAME[_save_CPPFLAGS]="$CPPFLAGS"
CPPFLAGS="-I${UPNAME[_INCLUDE_PATH]} $CPPFLAGS"
if test "$8" = "optional" ; then
AC_CHECK_HEADERS($5,, [UPNAME[_LIB]=""
m4_if($8,[optional],
[AC_CHECK_HEADERS($5,, [UPNAME[_LIB]=""
UPNAME[_ALL_LIB]=""
UPNAME[_INCLUDE]=""
UPNAME[_LIB_PATH]=""
UPNAME[_INCLUDE_PATH]=""])
else
AC_CHECK_HEADERS($5,, AC_MSG_ERROR([Header file "$5" was not found]))
fi
UPNAME[_INCLUDE_PATH]=""])],
[AC_CHECK_HEADERS($5,, AC_MSG_ERROR([Header file "$5" was not found]))])
dnl
dnl no need to use -I... if header is located in standard include path
dnl
......@@ -217,7 +240,7 @@ dnl
UPNAME[_INCLUDE]=""
fi
CPPCLAGS="${[ac_]UPNAME[_save_CPPFLAGS]}"
fi
])
dnl
dnl define makefile substitutions and config.h macros
dnl
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment