Changeset 1438


Ignore:
Timestamp:
Nov 1, 2009 2:12:48 PM (11 years ago)
Author:
stefan
Message:

add AC_COIN_MAIN_PACKAGEDIR; fixes in COIN_HAS_MODULE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stable/BSPsplit/coin.m4

    r1433 r1438  
    34303430
    34313431###########################################################################
     3432#                           COIN_PKG_CHECK_PROJECT_EXISTS                 #
     3433###########################################################################
     3434
     3435# COIN_PKG_CHECK_PROJECT_EXISTS(PROJECT, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
     3436#
     3437# Check to see whether a particular project exists.  Similar
     3438# to PKG_CHECK_MODULES(), but set only the variables $1_VERSION and $1_PKG_ERRORS variables
     3439#
     3440AC_DEFUN([AC_COIN_PKG_CHECK_PROJECT_EXISTS],
     3441[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
     3442if test -n "$PKG_CONFIG" ; then
     3443  if $PKG_CONFIG --exists "m4_tolower($1)"; then
     3444    m4_toupper($1)[]_VERSION=`$PKG_CONFIG --modversion "m4_tolower($1)" 2>/dev/null`
     3445    m4_ifval([$2], [$2], [:])
     3446  else
     3447    m4_toupper($1)_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "m4_tolower($1)"`
     3448    $3
     3449  fi
     3450else
     3451  AC_MSG_ERROR("Cannot check for existance of module $1 without pkg-config")
     3452fi
     3453])
     3454
     3455###########################################################################
    34323456#                           COIN_PKG_CHECK_MODULE_EXISTS                  #
    34333457###########################################################################
     
    34693493
    34703494AC_COIN_PKG_CHECK_MODULE_EXISTS([$1],[$2],
    3471   [ m4_toupper($1)[]_CFLAGS=`$PKG_CONFIG --cflags "m4_tolower($1)" 2>/dev/null`
    3472     m4_toupper($1)[]_LIBS=`$PKG_CONFIG --libs "m4_tolower($1)" 2>/dev/null`
    3473     m4_toupper($1)[]_DATA=`$PKG_CONFIG --variable=datadir "m4_tolower($1)" 2>/dev/null`
     3495  [ m4_toupper($1)[]_CFLAGS=`$PKG_CONFIG --cflags "m4_tolower($2)" 2>/dev/null`
     3496    m4_toupper($1)[]_LIBS=`$PKG_CONFIG --libs "m4_tolower($2)" 2>/dev/null`
     3497    m4_toupper($1)[]_DATA=`$PKG_CONFIG --variable=datadir "m4_tolower($2)" 2>/dev/null`
    34743498    $3
    34753499  ],
     
    34793503
    34803504###########################################################################
    3481 #                           COIN_MAIN_SUBDIR2                             #
     3505#                           COIN_MAIN_SUBDIR2 (deprecated)                #
    34823506###########################################################################
    34833507
     
    34883512# where $2 = . if not given
    34893513AC_DEFUN([AC_COIN_MAIN_SUBDIR2],
    3490 [AC_ARG_VAR([COIN_SKIP_PROJECTS],[Set to the subdirectories of projects that should be skipped in the configuration])
    3491 
    3492 AC_MSG_CHECKING([for project $1])
     3514[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
     3515AC_ARG_VAR([COIN_SKIP_PROJECTS],[Set to the subdirectories of projects that should be skipped in the configuration])
     3516
    34933517# First check, if the sub-project is actually available
    34943518
     
    36023626
    36033627###########################################################################
     3628#                           COIN_MAIN_PACKAGEDIR                          #
     3629###########################################################################
     3630
     3631# This is the macro for AC_COIN_MAIN_SUBDIRS taking care of ONE (or two or three) argument(s)
     3632# It calles AC_COIN_HAS_PROJECT with the given argument(s) and adds $1 to the CONFIG_SUBDIRS, if
     3633# either argument $3 is given and the file $2/$1/$3 is available in $srcdir,
     3634# or $3 is not given and the file $2/$1/configure is available in $srcdir,
     3635# where $2 = . if not given
     3636AC_DEFUN([AC_COIN_MAIN_PACKAGEDIR],
     3637[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
     3638AC_MSG_CHECKING([whether project $1 is available])
     3639
     3640m4_tolower(coin_has_$1)=notGiven
     3641
     3642# check if user wants to skip project in any case
     3643AC_ARG_VAR([COIN_SKIP_PROJECTS],[Set to the subdirectories of projects that should be skipped in the configuration])
     3644if test x"$COIN_SKIP_PROJECTS" != x; then
     3645  for dir in $COIN_SKIP_PROJECTS; do
     3646    if test $dir = "$1"; then
     3647      m4_tolower(coin_has_$1)=skipping
     3648    fi
     3649    if test $dir = "$2/$1"; then
     3650      m4_tolower(coin_has_$1)=skipping
     3651    fi
     3652  done
     3653fi
     3654
     3655if test $m4_tolower(coin_has_$1) != skipping; then
     3656  if test $PACKAGE_TARNAME = m4_tolower($1); then
     3657    m4_tolower(coin_has_$1)=.
     3658  fi
     3659
     3660  AC_ARG_WITH([m4_tolower($1)-lib],
     3661    AC_HELP_STRING([--with-m4_tolower($1)-lib],
     3662                   [linker flags for using project $1]),
     3663      [m4_tolower(coin_has_$1)=installed],
     3664      [])
     3665
     3666  AC_ARG_WITH([m4_tolower($1)-incdir],
     3667    AC_HELP_STRING([--with-m4_tolower($1)-incdir],
     3668                   [directory with header files for using project $1]),
     3669    [m4_tolower(coin_has_$1)=installed],
     3670    [])
     3671
     3672  AC_ARG_WITH([m4_tolower($1)-datadir],
     3673    AC_HELP_STRING([--with-m4_tolower($1)-datadir],
     3674                   [directory with data files for using project $1]),
     3675    [m4_tolower(coin_has_$1)=installed],
     3676    [])
     3677fi
     3678
     3679if test $m4_tolower(coin_has_$1) = notGiven; then
     3680  #only if pkg-config is available:
     3681  #see if user gives directory where project might be installed: assemble search path for pkg-config
     3682  if test -n "$PKG_CONFIG" ; then
     3683    coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
     3684    AC_ARG_WITH([coin-instdir],
     3685      AC_HELP_STRING([--with-coin-instdir],
     3686                     [prefix of installation directory for precompiled COIN packages]),
     3687      [if test -d "$withval"; then : ; else
     3688         AC_MSG_ERROR([argument for --with-coin-instdir not a directory])
     3689       fi
     3690       PKG_CONFIG_PATH="$withval/lib/$2/pkgconfig:$PKG_CONFIG_PATH"
     3691      ],[])
     3692
     3693    # let pkgconfig check if the project is already installed somewhere
     3694    # need to export variable to be sure that the following pkg-config call gets these values
     3695    export PKG_CONFIG_PATH
     3696    AC_COIN_PKG_CHECK_PROJECT_EXISTS([$1], [m4_tolower(coin_has_$1)="$m4_toupper($1)_VERSION"])
     3697
     3698    PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH"
     3699  fi
     3700fi
     3701
     3702# if not found yet, check if project is available in present directory
     3703if test "$m4_tolower(coin_has_$1)" = notGiven; then
     3704  if test -d $srcdir/$2/$1; then
     3705    coin_pkg_is_here=no
     3706    m4_ifvaln([$3],
     3707      [for i in $srcdir/$2/$1/$3; do
     3708         if test -r $i; then
     3709           coin_pkg_is_here=yes
     3710         fi
     3711       done],
     3712      [ coin_pkg_is_here=yes ])
     3713    if test $coin_pkg_is_here = yes; then
     3714      m4_tolower(coin_has_$1)=$2/$1
     3715    fi
     3716  fi
     3717fi
     3718
     3719AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
     3720
     3721AC_MSG_CHECKING(whether project $1 need to be configured)
     3722if test "$m4_tolower(coin_has_$1)" != skipping &&
     3723   test "$m4_tolower(coin_has_$1)" != notGiven &&
     3724   test "$m4_tolower(coin_has_$1)" != installed; then
     3725
     3726  if test -r $srcdir/$2/$1/configure; then
     3727    coin_subdirs="$coin_subdirs m4_ifval($2,[$2/],)$1"
     3728    AC_MSG_RESULT(yes)
     3729    AC_CONFIG_SUBDIRS(m4_ifval($2,[$2/],)$1)
     3730  else
     3731    AC_MSG_RESULT(no)
     3732  fi
     3733else
     3734  AC_MSG_RESULT(no)
     3735fi
     3736])
     3737
     3738###########################################################################
    36043739#                            COIN_HAS_PROJECT2                            #
    36053740###########################################################################
     
    37583893# check if directory $srcdir/../$1 exists and add ../$1 to the PKG_CONFIG_PATH
    37593894# this is for the classic setup where an uninstalled project can be found in ../$1
     3895# we do the same for ThirdParty/$1 and Data/$1; it's not nice but the only way I see to easily get around these nonstandard locations
    37603896if test -d $srcdir/../$pkgname; then
    37613897  PKG_CONFIG_PATH="../$pkgname:$PKG_CONFIG_PATH"
    37623898fi
     3899if test -d $srcdir/../ThirdParty/$pkgname; then
     3900  PKG_CONFIG_PATH="../ThirdParty/$pkgname$PKG_CONFIG_PATH"
     3901fi
     3902if test -d $srcdir/../Data/$pkgname; then
     3903  PKG_CONFIG_PATH="../Data/$pkgname:$PKG_CONFIG_PATH"
     3904fi
     3905
    37633906]) # AC_COIN_HAS_MODULE_HELPER
    37643907
     
    38013944AC_SUBST(m4_toupper($1_CFLAGS))
    38023945AC_SUBST(m4_toupper($1_DATA))
     3946AC_SUBST(REQUIREDPACKAGES)
    38033947
    38043948#check if user provided LIBS, CFLAGS, and DATA for module
     
    38093953                   [linker flags for using module $1]),
    38103954      [m4_tolower(coin_has_$1)=yes
    3811        m4_toupper($1_LIBS)="$withval"],
     3955       m4_toupper($1_LIBS)="$withval"
     3956       ADDLIBS="$ADDLIBS $withval"
     3957      ],
    38123958      [])
    38133959
     
    38383984         AC_MSG_ERROR([argument for --with-coin-instdir not a directory])
    38393985       fi
    3840        PKG_CONFIG_PATH="$withval/lib/pkgconfig:$PKG_CONFIG_PATH",
     3986       PKG_CONFIG_PATH="$withval/lib/pkgconfig:$withval/lib/ThirdParty/pkgconfig:$withval/lib/Data/pkgconfig:$PKG_CONFIG_PATH",
    38413987      ],[])
    38423988
     
    38594005        AC_MSG_RESULT([yes: $m4_toupper($1)_VERSIONS])
    38604006        REQUIREDPACKAGES="$REQUIREDPACKAGES $module_content"
    3861         AC_SUBST(REQUIREDPACKAGES)
    38624007      ],
    38634008      [ m4_tolower(coin_has_$1)=notGiven
     
    38764021if test $m4_tolower(coin_has_$1) != skipping &&
    38774022   test $m4_tolower(coin_has_$1) != notGiven ; then
    3878   if test "x$m4_toupper($1)_CFLAGS" != x ; then
     4023  if test -n "$m4_toupper($1)_CFLAGS" ; then
    38794024    AC_MSG_NOTICE([$1 CFLAGS are $m4_toupper($1)_CFLAGS])
    38804025  fi
    3881   if test "x$m4_toupper($1)_LIBS" != x ; then
     4026  if test -n "$m4_toupper($1)_LIBS" ; then
    38824027    AC_MSG_NOTICE([$1 LIBS   are $m4_toupper($1)_LIBS])
    38834028  fi
    3884   if test "x$m4_toupper($1)_DATA" != x ; then
     4029  if test -n "$m4_toupper($1)_DATA" ; then
    38854030    AC_MSG_NOTICE([$1 DATA   is  $m4_toupper($1)_DATA])
    38864031  fi
Note: See TracChangeset for help on using the changeset viewer.