Skip to content
Snippets Groups Projects
Commit 3d76189c authored by Elias Pipping's avatar Elias Pipping Committed by pipping
Browse files

Use AS_IF

[[Imported from SVN: r5140]]
parent c2e8216a
No related branches found
No related tags found
No related merge requests found
......@@ -12,20 +12,20 @@ ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_LIBS="$LIBS"
## do nothing if --without-amiramesh is used
if test x$with_ipopt != xno ; then
AS_IF([test x$with_ipopt != xno], [
# is --with-ipopt=bla used?
if test "x$with_ipopt" != x ; then
if ! test -d $with_ipopt; then
AS_IF([test "x$with_ipopt" != x], [
AS_IF([! test -d $with_ipopt], [
AC_MSG_WARN([IPOpt directory $with_ipopt does not exist])
else
], [
# expand tilde / other stuff
IPOPTROOT=`cd $with_ipopt && pwd`
fi
fi
if test "x$IPOPTROOT" = x; then
])
])
AS_IF([test "x$IPOPTROOT" = x], [
# use some default value...
IPOPTROOT="/usr/local/ipopt"
fi
])
IPOPT_LIB_PATH="$IPOPTROOT/lib"
IPOPT_INCLUDE_PATH="$IPOPTROOT/include"
......@@ -34,20 +34,19 @@ if test x$with_ipopt != xno ; then
CPPFLAGS="$CPPFLAGS -I$IPOPT_INCLUDE_PATH"
# Check whether ipopt is installed at all
if PKG_CONFIG_PATH=$IPOPT_LIB_PATH/pkgconfig $PKG_CONFIG --exists ipopt; then
AS_IF([PKG_CONFIG_PATH=$IPOPT_LIB_PATH/pkgconfig $PKG_CONFIG --exists ipopt], [
IPOPT_CPPFLAGS="-I$IPOPT_INCLUDE_PATH"
HAVE_IPOPT="1"
else
], [
AC_MSG_WARN([IPOpt not found in $IPOPT_ROOT])
fi
])
AC_LANG_PUSH([C++])
CPPFLAGS="$IPOPT_CPPFLAGS"
# if header is found...
if test x$HAVE_IPOPT = x1 ; then
AS_IF([test x$HAVE_IPOPT = x1], [
LIBS="$LIBS `PKG_CONFIG_PATH=$IPOPT_LIB_PATH/pkgconfig $PKG_CONFIG --libs ipopt`"
AC_LINK_IFELSE(AC_LANG_PROGRAM(
......@@ -57,14 +56,14 @@ if test x$with_ipopt != xno ; then
IPOPT_LDFLAGS="`PKG_CONFIG_PATH=$IPOPT_LIB_PATH/pkgconfig $PKG_CONFIG --libs-only-L ipopt`"],
[HAVE_IPOPT="0"
AC_MSG_WARN(IPOpt not found!)])
fi
])
AC_LANG_POP([C++])
fi
])
with_ipopt="no"
# survived all tests?
if test x$HAVE_IPOPT = x1 ; then
AS_IF([test x$HAVE_IPOPT = x1], [
AC_SUBST(IPOPT_LIBS, $IPOPT_LIBS)
AC_SUBST(IPOPT_LDFLAGS, $IPOPT_LDFLAGS)
AC_SUBST(IPOPT_CPPFLAGS, $IPOPT_CPPFLAGS)
......@@ -77,11 +76,11 @@ if test x$HAVE_IPOPT = x1 ; then
# set variable for summary
with_ipopt="yes"
else
], [
AC_SUBST(IPOPT_LIBS, "")
AC_SUBST(IPOPT_LDFLAGS, "")
AC_SUBST(IPOPT_CPPFLAGS, "")
fi
])
# also tell automake
AM_CONDITIONAL(IPOPT, test x$HAVE_IPOPT = x1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment