Changeset 1375 for stable


Ignore:
Timestamp:
Jul 25, 2009 2:06:09 PM (11 years ago)
Author:
stefan
Message:

allow to call AC_COIN_HAS_PROJECT macro with arguments that have a / in the name; create additional variable DATADIR which points to share/coin/ (if project is installed)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stable/BSPsplit/coin.m4

    r1371 r1375  
    23742374# other locations)
    23752375
    2376 m4_tolower(coin_has_$1)=notGiven
     2376#replace backslashes by underscore
     2377m4_define([escape], m4_bpatsubsts([$1],[/],[_]))
     2378
     2379m4_tolower(coin_has_[]escape($1))=notGiven
    23772380if test x"$COIN_SKIP_PROJECTS" != x; then
    23782381  for dir in $COIN_SKIP_PROJECTS; do
    23792382    if test $dir = $1; then
    2380       m4_tolower(coin_has_$1)=skipping
     2383      m4_tolower(coin_has_[]escape($1))=skipping
    23812384    fi
    23822385  done
    23832386fi
    23842387
    2385 AC_SUBST(m4_toupper($1SRCDIR))
    2386 AC_SUBST(m4_toupper($1OBJDIR))
    2387 AC_SUBST(m4_toupper($1DOCDIR))
    2388 AC_SUBST(m4_toupper($1INSTDIR))
    2389 m4_toupper($1SRCDIR)=This_Variable_Is_Not_Set
    2390 m4_toupper($1OBJDIR)=This_Variable_Is_Not_Set
    2391 m4_toupper($1DOCDIR)=This_Variable_Is_Not_Set
    2392 m4_toupper($1INSTDIR)=This_Variable_Is_Not_Set
    2393 
    2394 if test $m4_tolower(coin_has_$1) != skipping; then
    2395   if test $PACKAGE_TARNAME = m4_tolower($1); then
    2396     m4_tolower(coin_has_$1)=.
     2388AC_SUBST(m4_toupper(escape($1)SRCDIR))
     2389AC_SUBST(m4_toupper(escape($1)OBJDIR))
     2390AC_SUBST(m4_toupper(escape($1)DOCDIR))
     2391AC_SUBST(m4_toupper(escape($1)DATADIR))
     2392AC_SUBST(m4_toupper(escape($1)INSTDIR))
     2393m4_toupper(escape($1)SRCDIR)=This_Variable_Is_Not_Set
     2394m4_toupper(escape($1)OBJDIR)=This_Variable_Is_Not_Set
     2395m4_toupper(escape($1)DOCDIR)=This_Variable_Is_Not_Set
     2396m4_toupper(escape($1)DATADIR)=This_Variable_Is_Not_Set
     2397m4_toupper(escape($1)INSTDIR)=This_Variable_Is_Not_Set
     2398
     2399if test $m4_tolower(coin_has_[]escape($1)) != skipping; then
     2400  if test $PACKAGE_TARNAME = m4_tolower(escape($1)); then
     2401    m4_tolower(coin_has_[]escape($1))=.
    23972402  else
    2398     AC_ARG_WITH([m4_tolower($1)-instdir],
    2399                 AC_HELP_STRING([--with-m4_tolower($1)-instdir],
     2403    AC_ARG_WITH([m4_tolower(escape($1))-instdir],
     2404                AC_HELP_STRING([--with-m4_tolower(escape($1))-instdir],
    24002405                               [prefix of installation directory for precompiled $1 package]),
    2401                 [m4_tolower(coin_has_$1)=installed
     2406                [m4_tolower(coin_has_[]escape($1))=installed
    24022407                 if test -d "$withval"; then : ; else
    2403                    AC_MSG_ERROR([argument for --with-m4_tolower($1)-instdir not a directory])
     2408                   AC_MSG_ERROR([argument for --with-m4_tolower(escape($1))-instdir not a directory])
    24042409                 fi
    2405                  m4_toupper($1INSTDIR)=`cd $withval; pwd`], [])
    2406 
    2407     AC_ARG_WITH([m4_tolower($1)-srcdir],
    2408                 AC_HELP_STRING([--with-m4_tolower($1)-srcdir],
     2410                 m4_toupper(escape($1)INSTDIR)=`cd $withval; pwd`], [])
     2411
     2412    AC_ARG_WITH([m4_tolower(escape($1))-srcdir],
     2413                AC_HELP_STRING([--with-m4_tolower(escape($1))-srcdir],
    24092414                               [source directory for $1 package]),
    2410                 [if test "$m4_tolower(coin_has_$1)" = installed; then
    2411                    AC_MSG_ERROR([--with-$m4_tolower($1)-srcdir cannot be given together with --with-m4_tolower($1)-instdir])
     2415                [if test "$m4_tolower(coin_has_[]escape($1))" = installed; then
     2416                   AC_MSG_ERROR([--with-$m4_tolower(escape($1))-srcdir cannot be given together with --with-m4_tolower(escape($1))-instdir])
    24122417                 fi
    24132418                 if test -d "$withval"; then : ; else
    2414                    AC_MSG_ERROR([argument for --with-m4_tolower($1)-srcdir not a directory])
     2419                   AC_MSG_ERROR([argument for --with-m4_tolower(escape($1))-srcdir not a directory])
    24152420                 fi
    2416                  m4_tolower(coin_has_$1)=$withval
    2417                  m4_toupper($1SRCDIR)=`cd $withval; pwd`], [])
    2418 
    2419     AC_ARG_WITH([m4_tolower($1)-objdir],
    2420                 AC_HELP_STRING([--with-m4_tolower($1)-objdir],
     2421                 m4_tolower(coin_has_[]escape($1))=$withval
     2422                 m4_toupper(escape($1)SRCDIR)=`cd $withval; pwd`], [])
     2423
     2424    AC_ARG_WITH([m4_tolower(escape($1))-objdir],
     2425                AC_HELP_STRING([--with-m4_tolower(escape($1))-objdir],
    24212426                               [object directory for $1 package (if different from source directory in VPATH compilation)]),
    2422                 [if test "$m4_tolower(coin_has_$1)" = installed; then
    2423                    AC_MSG_ERROR([--with-m4_tolower($1)-objdir cannot be given together with --with-m4_tolower($1)-instdir])
     2427                [if test "$m4_tolower(coin_has_[]escape($1))" = installed; then
     2428                   AC_MSG_ERROR([--with-m4_tolower(escape($1))-objdir cannot be given together with --with-m4_tolower(escape($1))-instdir])
    24242429                 fi
    2425                  if test "$m4_tolower(coin_has_$1)" = notGiven; then
    2426                    AC_MSG_ERROR([--with-m4_tolower($1)-objdir must be accompanied by --with-m4_tolower($1)-srcdir])
     2430                 if test "$m4_tolower(coin_has_[]escape($1))" = notGiven; then
     2431                   AC_MSG_ERROR([--with-m4_tolower(escape($1))-objdir must be accompanied by --with-m4_tolower(escape($1))-srcdir])
    24272432                 fi
    24282433                 if test -d "$withval"; then : ; else
    2429                    AC_MSG_ERROR([argument for --with-m4_tolower($1)-objdir not a directory])
     2434                   AC_MSG_ERROR([argument for --with-m4_tolower(escape($1))-objdir not a directory])
    24302435                 fi
    2431                  m4_toupper($1OBJDIR)=`cd $withval; pwd`], [m4_toupper($1OBJDIR)="$m4_toupper($1SRCDIR)"])
     2436                 m4_toupper(escape($1)OBJDIR)=`cd $withval; pwd`], [m4_toupper(escape($1)OBJDIR)="$m4_toupper(escape($1)SRCDIR)"])
    24322437
    24332438    # if we still don't have a location, check for generic flag
    2434     if test "$m4_tolower(coin_has_$1)" = notGiven; then
     2439    if test "$m4_tolower(coin_has_[]escape($1))" = notGiven; then
    24352440      AC_ARG_WITH([coin-instdir],
    24362441                  AC_HELP_STRING([--with-coin-instdir],
     
    24402445                   fi
    24412446                   if test -r $withval/share/doc/coin/$1/README; then
    2442                      m4_tolower(coin_has_$1)=installed
    2443                      m4_toupper($1INSTDIR)=`cd $withval; pwd`
     2447                     m4_tolower(coin_has_[]escape($1))=installed
     2448                     m4_toupper(escape($1)INSTDIR)=`cd $withval; pwd`
    24442449                   fi],
    24452450                   [])
    24462451    fi
    24472452
    2448     if test "$m4_tolower(coin_has_$1)" = notGiven; then
     2453    if test "$m4_tolower(coin_has_[]escape($1))" = notGiven; then
    24492454      if test -d $srcdir/../$1; then
    2450         m4_tolower(coin_has_$1)=../$1
     2455        m4_tolower(coin_has_[]escape($1))=../$1
    24512456      fi
    24522457    fi
     
    24542459fi
    24552460
    2456 if test $m4_tolower(coin_has_$1) != notGiven &&
    2457    test $m4_tolower(coin_has_$1) != skipping; then
     2461if test $m4_tolower(coin_has_[]escape($1)) != notGiven &&
     2462   test $m4_tolower(coin_has_[]escape($1)) != skipping; then
    24582463  # Set the #define if the component is available
    2459   AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is used])
    2460 
    2461   if test $m4_tolower(coin_has_$1) = installed; then
    2462     m4_toupper($1DOCDIR)=$m4_toupper($1INSTDIR)/share/doc/coin/$1
     2464  AC_DEFINE(m4_toupper(COIN_HAS_[]escape($1)),[1],[Define to 1 if the $1 package is used])
     2465
     2466  if test $m4_tolower(coin_has_[]escape($1)) = installed; then
     2467    m4_toupper(escape($1)DOCDIR)=$m4_toupper(escape($1)INSTDIR)/share/doc/coin/$1
     2468    m4_toupper(escape($1)DATADIR)=$m4_toupper(escape($1)INSTDIR)/share/coin/$1
    24632469  else
    2464     if test "$m4_toupper($1OBJDIR)" = This_Variable_Is_Not_Set; then
     2470    if test "$m4_toupper(escape($1)OBJDIR)" = This_Variable_Is_Not_Set; then
    24652471      # Set the variables for source and object code location
    2466       m4_toupper($1SRCDIR)=`cd $srcdir/$m4_tolower(coin_has_$1); pwd`
    2467       m4_toupper($1OBJDIR)=`pwd`/$m4_tolower(coin_has_$1)
    2468       m4_toupper($1DOCDIR)=$abs_lib_dir/../share/doc/coin/$1
     2472      m4_toupper(escape($1)SRCDIR)=`cd $srcdir/$m4_tolower(coin_has_[]escape($1)); pwd`
     2473      m4_toupper(escape($1)OBJDIR)=`pwd`/$m4_tolower(coin_has_[]escape($1))
     2474      m4_toupper(escape($1)DOCDIR)=$abs_lib_dir/../share/doc/coin/$1
     2475      m4_toupper(escape($1)DATADIR)=$m4_toupper(escape($1)OBJDIR)
    24692476    else
    24702477      # This is just a guess:
    2471       m4_toupper($1DOCDIR)=$m4_toupper($1OBJDIR)/../share/doc/coin/$1
     2478      m4_toupper(escape($1)DOCDIR)=$m4_toupper(escape($1)OBJDIR)/../share/doc/coin/$1
     2479      m4_toupper(escape($1)DATADIR)=$m4_toupper(escape($1)OBJDIR)/../share/coin/$1
    24722480    fi
    24732481  fi
     
    24752483
    24762484  # Define the Makefile conditional
    2477 AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
    2478                [test $m4_tolower(coin_has_$1) != notGiven &&
    2479                 test $m4_tolower(coin_has_$1) != skipping])
    2480 AM_CONDITIONAL(m4_toupper(COIN_HAS_$1_PREINSTALLED),
    2481                [test $m4_tolower(coin_has_$1) = installed])
    2482 
    2483 if test $m4_tolower(coin_has_$1) = installed; then
    2484   AC_MSG_RESULT([installed in $m4_toupper($1INSTDIR)])
    2485   AC_COIN_CHECK_FILE([$m4_toupper($1INSTDIR)/share/doc/coin/$1/README],
    2486                      [],[AC_MSG_ERROR([$m4_toupper($1INSTDIR)/share/doc/coin/$1/README should be available if $1 is installed])])
     2485AM_CONDITIONAL(m4_toupper(COIN_HAS_[]escape($1)),
     2486               [test $m4_tolower(coin_has_[]escape($1)) != notGiven &&
     2487                test $m4_tolower(coin_has_[]escape($1)) != skipping])
     2488AM_CONDITIONAL(m4_toupper(COIN_HAS_[]escape($1)_PREINSTALLED),
     2489               [test $m4_tolower(coin_has_[]escape($1)) = installed])
     2490
     2491if test $m4_tolower(coin_has_[]escape($1)) = installed; then
     2492  AC_MSG_RESULT([installed in $m4_toupper(escape($1)INSTDIR)])
     2493  AC_COIN_CHECK_FILE([$m4_toupper(escape($1)INSTDIR)/share/doc/coin/$1/README],
     2494                     [],[AC_MSG_ERROR([$m4_toupper(escape($1)INSTDIR)/share/doc/coin/$1/README should be available if $1 is installed])])
    24872495else
    2488   AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
    2489   if test $m4_tolower(coin_has_$1) != notGiven &&
    2490      test $m4_tolower(coin_has_$1) != skipping; then
     2496  AC_MSG_RESULT([$m4_tolower(coin_has_[]escape($1))])
     2497  if test $m4_tolower(coin_has_[]escape($1)) != notGiven &&
     2498     test $m4_tolower(coin_has_[]escape($1)) != skipping; then
    24912499    AC_MSG_CHECKING([for source code location of $1])
    2492     AC_MSG_RESULT([$m4_toupper($1SRCDIR)])
     2500    AC_MSG_RESULT([$m4_toupper(escape($1)SRCDIR)])
    24932501    AC_MSG_CHECKING([for object code location of $1])
    2494     AC_MSG_RESULT([$m4_toupper($1OBJDIR)])
     2502    AC_MSG_RESULT([$m4_toupper(escape($1)OBJDIR)])
    24952503  fi
    24962504fi
Note: See TracChangeset for help on using the changeset viewer.