Changeset 1392


Ignore:
Timestamp:
Aug 1, 2009 11:53:36 AM (10 years ago)
Author:
stefan
Message:

change last weeks commit again: give project directory and name as separate arguments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stable/BSPsplit/coin.m4

    r1380 r1392  
    1414
    1515###########################################################################
    16 #                           COIN_MAIN_SUBDIRS                             #
    17 ###########################################################################
    18 
    19 # This is the macro for AC_COIN_MAIN_SUBDIRS taking care of ONE (or two) argument(s)
    20 # It calles AC_COIN_HAS_PROJECT for the project given in $1 and adds $1 to the CONFIG_SUBDIRS, if
    21 # either argument $2 is given and the file $1/$2 is available in $srcdir,
    22 # or $2 is not given and the file $1/configure is available in $srcdir
     16#                           COIN_MAIN_SUBDIR                              #
     17###########################################################################
     18
     19# This is the macro for AC_COIN_MAIN_SUBDIRS taking care of ONE (or two or three) argument(s)
     20# It calles AC_COIN_HAS_PROJECT with the given argument(s) and adds $1 to the CONFIG_SUBDIRS, if
     21# either argument $3 is given and the file $2/$1/$3 is available in $srcdir,
     22# or $3 is not given and the file $2/$1/configure is available in $srcdir,
     23# where $2 = . if not given
    2324AC_DEFUN([AC_COIN_MAIN_SUBDIR],
    2425[AC_ARG_VAR([COIN_SKIP_PROJECTS],[Set to the subdirectories of projects that should be skipped in the configuration])
    2526
    2627#replace backslashes by underscore
    27 m4_define([escape], m4_bpatsubsts([$1],[/],[_]))
     28#m4_define([escape], m4_bpatsubsts([$1],[/],[_]))
    2829
    2930# AC_COIN_HAS_PROJECT also checks whether $2 is available in $1, if not it sets coin_has... to notGiven
    30 AC_COIN_HAS_PROJECT($1,$2)
    31 AC_MSG_CHECKING(whether directory $1 should be recursed into)
    32 if test "$m4_tolower(coin_has_[]escape($1))" != skipping &&
    33    test "$m4_tolower(coin_has_[]escape($1))" != notGiven &&
    34    test "$m4_tolower(coin_has_[]escape($1))" != installed; then
    35 
    36   if test -r $srcdir/$1/configure; then
    37     coin_subdirs="$coin_subdirs $1"
     31AC_COIN_HAS_PROJECT($1,$2,$3)
     32m4_ifvaln([$2], [projfulldir=$2/$1], [projfulldir=$1])
     33AC_MSG_CHECKING(whether directory $projfulldir should be recursed into)
     34if test "$m4_tolower(coin_has_$1)" != skipping &&
     35   test "$m4_tolower(coin_has_$1)" != notGiven &&
     36   test "$m4_tolower(coin_has_$))" != installed; then
     37
     38  if test -r $srcdir/$projfulldir/configure; then
     39    coin_subdirs="$coin_subdirs $projfulldir"
    3840    AC_MSG_RESULT(yes)
    39     AC_CONFIG_SUBDIRS($1)
     41    m4_ifvaln([$2], [AC_CONFIG_SUBDIRS($2/$1)], [AC_CONFIG_SUBDIRS($1)])
    4042  else
    4143    AC_MSG_RESULT(no)
     
    4547fi
    4648])
     49
     50###########################################################################
     51#                           COIN_MAIN_SUBDIRS                             #
     52###########################################################################
    4753
    4854# This macro sets up the recursion into configure scripts into
     
    23562362
    23572363AC_DEFUN([AC_COIN_HAS_PROJECT],
    2358 [AC_MSG_CHECKING([for COIN project $1])
     2364[AC_MSG_CHECKING([for COIN project $1 in $2])
    23592365# First check, if the sub-project is actually available (ToDo: allow
    23602366# other locations)
    23612367
    23622368#replace backslashes by underscore
    2363 m4_define([escape], m4_bpatsubsts([$1],[/],[_]))
    2364 
    2365 m4_tolower(coin_has_[]escape($1))=notGiven
     2369#m4_define([escape], m4_bpatsubsts([$1],[/],[_]))
     2370
     2371m4_tolower(coin_has_$1)=notGiven
    23662372if test x"$COIN_SKIP_PROJECTS" != x; then
    23672373  for dir in $COIN_SKIP_PROJECTS; do
    23682374    if test $dir = $1; then
    2369       m4_tolower(coin_has_[]escape($1))=skipping
     2375      m4_tolower(coin_has_$1)=skipping
    23702376    fi
    23712377  done
    23722378fi
    23732379
    2374 AC_SUBST(m4_toupper(escape($1)SRCDIR))
    2375 AC_SUBST(m4_toupper(escape($1)OBJDIR))
    2376 AC_SUBST(m4_toupper(escape($1)DOCDIR))
    2377 AC_SUBST(m4_toupper(escape($1)DATADIR))
    2378 AC_SUBST(m4_toupper(escape($1)INSTDIR))
    2379 m4_toupper(escape($1)SRCDIR)=This_Variable_Is_Not_Set
    2380 m4_toupper(escape($1)OBJDIR)=This_Variable_Is_Not_Set
    2381 m4_toupper(escape($1)DOCDIR)=This_Variable_Is_Not_Set
    2382 m4_toupper(escape($1)DATADIR)=This_Variable_Is_Not_Set
    2383 m4_toupper(escape($1)INSTDIR)=This_Variable_Is_Not_Set
    2384 
    2385 if test $m4_tolower(coin_has_[]escape($1)) != skipping; then
    2386   if test $PACKAGE_TARNAME = m4_tolower(escape($1)); then
    2387     m4_tolower(coin_has_[]escape($1))=.
     2380AC_SUBST(m4_toupper($1SRCDIR))
     2381AC_SUBST(m4_toupper($1OBJDIR))
     2382AC_SUBST(m4_toupper($1DOCDIR))
     2383AC_SUBST(m4_toupper($1DATADIR))
     2384AC_SUBST(m4_toupper($1INSTDIR))
     2385m4_toupper($1SRCDIR)=This_Variable_Is_Not_Set
     2386m4_toupper($1OBJDIR)=This_Variable_Is_Not_Set
     2387m4_toupper($1DOCDIR)=This_Variable_Is_Not_Set
     2388m4_toupper($1DATADIR)=This_Variable_Is_Not_Set
     2389m4_toupper($1INSTDIR)=This_Variable_Is_Not_Set
     2390
     2391if test $m4_tolower(coin_has_$1) != skipping; then
     2392  if test $PACKAGE_TARNAME = m4_tolower($1); then
     2393    m4_tolower(coin_has_$1)=.
    23882394  else
    2389     AC_ARG_WITH([m4_tolower(escape($1))-instdir],
    2390                 AC_HELP_STRING([--with-m4_tolower(escape($1))-instdir],
     2395    AC_ARG_WITH([m4_tolower($1)-instdir],
     2396                AC_HELP_STRING([--with-m4_tolower($1)-instdir],
    23912397                               [prefix of installation directory for precompiled $1 package]),
    2392                 [m4_tolower(coin_has_[]escape($1))=installed
     2398                [m4_tolower(coin_has_$1)=installed
    23932399                 if test -d "$withval"; then : ; else
    2394                    AC_MSG_ERROR([argument for --with-m4_tolower(escape($1))-instdir not a directory])
     2400                   AC_MSG_ERROR([argument for --with-m4_tolower($1)-instdir not a directory])
    23952401                 fi
    2396                  m4_toupper(escape($1)INSTDIR)=`cd $withval; pwd`], [])
    2397 
    2398     AC_ARG_WITH([m4_tolower(escape($1))-srcdir],
    2399                 AC_HELP_STRING([--with-m4_tolower(escape($1))-srcdir],
     2402                 m4_toupper($1INSTDIR)=`cd $withval; pwd`], [])
     2403
     2404    AC_ARG_WITH([m4_tolower($1)-srcdir],
     2405                AC_HELP_STRING([--with-m4_tolower($1)-srcdir],
    24002406                               [source directory for $1 package]),
    2401                 [if test "$m4_tolower(coin_has_[]escape($1))" = installed; then
    2402                    AC_MSG_ERROR([--with-$m4_tolower(escape($1))-srcdir cannot be given together with --with-m4_tolower(escape($1))-instdir])
     2407                [if test "$m4_tolower(coin_has_$1)" = installed; then
     2408                   AC_MSG_ERROR([--with-$m4_tolower($1)-srcdir cannot be given together with --with-m4_tolower($1)-instdir])
    24032409                 fi
    24042410                 if test -d "$withval"; then : ; else
    2405                    AC_MSG_ERROR([argument for --with-m4_tolower(escape($1))-srcdir not a directory])
     2411                   AC_MSG_ERROR([argument for --with-m4_tolower($1)-srcdir not a directory])
    24062412                 fi
    2407                  m4_tolower(coin_has_[]escape($1))=$withval
    2408                  m4_toupper(escape($1)SRCDIR)=`cd $withval; pwd`], [])
    2409 
    2410     AC_ARG_WITH([m4_tolower(escape($1))-objdir],
    2411                 AC_HELP_STRING([--with-m4_tolower(escape($1))-objdir],
     2413                 m4_tolower(coin_has_$1)=$withval
     2414                 m4_toupper($1SRCDIR)=`cd $withval; pwd`], [])
     2415
     2416    AC_ARG_WITH([m4_tolower($1)-objdir],
     2417                AC_HELP_STRING([--with-m4_tolower($1)-objdir],
    24122418                               [object directory for $1 package (if different from source directory in VPATH compilation)]),
    2413                 [if test "$m4_tolower(coin_has_[]escape($1))" = installed; then
    2414                    AC_MSG_ERROR([--with-m4_tolower(escape($1))-objdir cannot be given together with --with-m4_tolower(escape($1))-instdir])
     2419                [if test "$m4_tolower(coin_has_$1)" = installed; then
     2420                   AC_MSG_ERROR([--with-m4_tolower($1)-objdir cannot be given together with --with-m4_tolower($1)-instdir])
    24152421                 fi
    2416                  if test "$m4_tolower(coin_has_[]escape($1))" = notGiven; then
    2417                    AC_MSG_ERROR([--with-m4_tolower(escape($1))-objdir must be accompanied by --with-m4_tolower(escape($1))-srcdir])
     2422                 if test "$m4_tolower(coin_has_$1)" = notGiven; then
     2423                   AC_MSG_ERROR([--with-m4_tolower($1)-objdir must be accompanied by --with-m4_tolower($1)-srcdir])
    24182424                 fi
    24192425                 if test -d "$withval"; then : ; else
    2420                    AC_MSG_ERROR([argument for --with-m4_tolower(escape($1))-objdir not a directory])
     2426                   AC_MSG_ERROR([argument for --with-m4_tolower($1)-objdir not a directory])
    24212427                 fi
    2422                  m4_toupper(escape($1)OBJDIR)=`cd $withval; pwd`], [m4_toupper(escape($1)OBJDIR)="$m4_toupper(escape($1)SRCDIR)"])
     2428                 m4_toupper($1OBJDIR)=`cd $withval; pwd`], [m4_toupper($1OBJDIR)="$m4_toupper($1SRCDIR)"])
    24232429
    24242430    # if we still don't have a location, check for generic flag
    2425     if test "$m4_tolower(coin_has_[]escape($1))" = notGiven; then
     2431    if test "$m4_tolower(coin_has_$1)" = notGiven; then
    24262432      AC_ARG_WITH([coin-instdir],
    24272433                  AC_HELP_STRING([--with-coin-instdir],
     
    24312437                   fi
    24322438                   if test -r $withval/share/doc/coin/$1/README; then
    2433                      m4_tolower(coin_has_[]escape($1))=installed
    2434                      m4_toupper(escape($1)INSTDIR)=`cd $withval; pwd`
     2439                     m4_tolower(coin_has_$1)=installed
     2440                     m4_toupper($1INSTDIR)=`cd $withval; pwd`
    24352441                   fi],
    24362442                   [])
    24372443    fi
    24382444
    2439     if test "$m4_tolower(coin_has_[]escape($1))" = notGiven; then
    2440       if test -d $srcdir/../$1; then
    2441         m4_ifvaln([$2],
    2442           [if test -r $srcdir/$1/$2; then
    2443             m4_tolower(coin_has_[]escape($1))=../$1
     2445    # check if project can be found in $2/$1
     2446    m4_ifvaln([$2], [fulldir=$2/$1], [fulldir=$1])
     2447    if test "$m4_tolower(coin_has_$1)" = notGiven; then
     2448      if test -d $srcdir/$fulldir; then
     2449        m4_ifvaln([$3],
     2450          [if test -r $srcdir/$fulldir/$3; then
     2451            m4_tolower(coin_has_$1)=$fulldir
    24442452          fi],
    2445           [ m4_tolower(coin_has_[]escape($1))=../$1 ]
     2453          [ m4_tolower(coin_has_$1)=$fulldir ]
    24462454        )
    24472455      fi
     
    24502458fi
    24512459
    2452 if test $m4_tolower(coin_has_[]escape($1)) != notGiven &&
    2453    test $m4_tolower(coin_has_[]escape($1)) != skipping; then
     2460if test $m4_tolower(coin_has_$1) != notGiven &&
     2461   test $m4_tolower(coin_has_$1) != skipping; then
    24542462  # Set the #define if the component is available
    2455   AC_DEFINE(m4_toupper(COIN_HAS_[]escape($1)),[1],[Define to 1 if the $1 package is used])
    2456 
    2457   if test $m4_tolower(coin_has_[]escape($1)) = installed; then
    2458     m4_toupper(escape($1)DOCDIR)=$m4_toupper(escape($1)INSTDIR)/share/doc/coin/$1
    2459     m4_toupper(escape($1)DATADIR)=$m4_toupper(escape($1)INSTDIR)/share/coin/$1
     2463  AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is used])
     2464
     2465  if test $m4_tolower(coin_has_$1) = installed; then
     2466    m4_toupper($1DOCDIR)=$m4_toupper($1INSTDIR)/share/doc/coin/$1
     2467    m4_toupper($1DATADIR)=$m4_toupper($1INSTDIR)/share/coin/$1
    24602468  else
    2461     if test "$m4_toupper(escape($1)OBJDIR)" = This_Variable_Is_Not_Set; then
     2469    if test "$m4_toupper($1OBJDIR)" = This_Variable_Is_Not_Set; then
    24622470      # Set the variables for source and object code location
    2463       m4_toupper(escape($1)SRCDIR)=`cd $srcdir/$m4_tolower(coin_has_[]escape($1)); pwd`
    2464       m4_toupper(escape($1)OBJDIR)=`pwd`/$m4_tolower(coin_has_[]escape($1))
    2465       m4_toupper(escape($1)DOCDIR)=$abs_lib_dir/../share/doc/coin/$1
    2466       m4_toupper(escape($1)DATADIR)=$m4_toupper(escape($1)OBJDIR)
     2471      m4_toupper($1SRCDIR)=`cd $srcdir/$m4_tolower(coin_has_$1); pwd`
     2472      m4_toupper($1OBJDIR)=`pwd`/$m4_tolower(coin_has_$1)
     2473      m4_toupper($1DOCDIR)=$abs_lib_dir/../share/doc/coin/$1
     2474      m4_toupper($1DATADIR)=$m4_toupper($1OBJDIR)
    24672475    else
    24682476      # This is just a guess:
    2469       m4_toupper(escape($1)DOCDIR)=$m4_toupper(escape($1)OBJDIR)/../share/doc/coin/$1
    2470       m4_toupper(escape($1)DATADIR)=$m4_toupper(escape($1)OBJDIR)/../share/coin/$1
    2471     fi
    2472   fi
    2473 fi
    2474 
    2475   # Define the Makefile conditional
    2476 AM_CONDITIONAL(m4_toupper(COIN_HAS_[]escape($1)),
    2477                [test $m4_tolower(coin_has_[]escape($1)) != notGiven &&
    2478                 test $m4_tolower(coin_has_[]escape($1)) != skipping])
    2479 AM_CONDITIONAL(m4_toupper(COIN_HAS_[]escape($1)_PREINSTALLED),
    2480                [test $m4_tolower(coin_has_[]escape($1)) = installed])
    2481 
    2482 if test $m4_tolower(coin_has_[]escape($1)) = installed; then
    2483   AC_MSG_RESULT([installed in $m4_toupper(escape($1)INSTDIR)])
    2484   AC_COIN_CHECK_FILE([$m4_toupper(escape($1)INSTDIR)/share/doc/coin/$1/README],
    2485                      [],[AC_MSG_ERROR([$m4_toupper(escape($1)INSTDIR)/share/doc/coin/$1/README should be available if $1 is installed])])
     2477      m4_toupper($1DOCDIR)=$m4_toupper($1OBJDIR)/../share/doc/coin/$1
     2478      m4_toupper($1DATADIR)=$m4_toupper($1OBJDIR)/../share/coin/$1
     2479    fi
     2480  fi
     2481fi
     2482
     2483# Define the Makefile conditional
     2484AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
     2485               [test $m4_tolower(coin_has_$1) != notGiven &&
     2486                test $m4_tolower(coin_has_$1) != skipping])
     2487AM_CONDITIONAL(m4_toupper(COIN_HAS_$1_PREINSTALLED),
     2488               [test $m4_tolower(coin_has_$1) = installed])
     2489
     2490if test $m4_tolower(coin_has_$1) = installed; then
     2491  AC_MSG_RESULT([installed in $m4_toupper($1INSTDIR)])
     2492  AC_COIN_CHECK_FILE([$m4_toupper($1INSTDIR)/share/doc/coin/$1/README],
     2493                     [],[AC_MSG_ERROR([$m4_toupper($1INSTDIR)/share/doc/coin/$1/README should be available if $1 is installed])])
    24862494else
    2487   AC_MSG_RESULT([$m4_tolower(coin_has_[]escape($1))])
    2488   if test $m4_tolower(coin_has_[]escape($1)) != notGiven &&
    2489      test $m4_tolower(coin_has_[]escape($1)) != skipping; then
     2495  AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
     2496  if test $m4_tolower(coin_has_$1) != notGiven &&
     2497     test $m4_tolower(coin_has_$1) != skipping; then
    24902498    AC_MSG_CHECKING([for source code location of $1])
    2491     AC_MSG_RESULT([$m4_toupper(escape($1)SRCDIR)])
     2499    AC_MSG_RESULT([$m4_toupper($1SRCDIR)])
    24922500    AC_MSG_CHECKING([for object code location of $1])
    2493     AC_MSG_RESULT([$m4_toupper(escape($1)OBJDIR)])
     2501    AC_MSG_RESULT([$m4_toupper($1OBJDIR)])
    24942502  fi
    24952503fi
Note: See TracChangeset for help on using the changeset viewer.