From 3d76189c2873d1c35324a8a5ef684025b05dd1cf Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Fri, 30 Dec 2011 23:00:58 +0000 Subject: [PATCH] Use AS_IF [[Imported from SVN: r5140]] --- m4/ipopt.m4 | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/m4/ipopt.m4 b/m4/ipopt.m4 index a01f5377..8f8bb976 100644 --- a/m4/ipopt.m4 +++ b/m4/ipopt.m4 @@ -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) -- GitLab