Changeset 1455


Ignore:
Timestamp:
Nov 29, 2009 3:48:13 PM (11 years ago)
Author:
stefan
Message:

some cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • stable/BSPsplit/coin.m4

    r1452 r1455  
    33963396
    33973397###########################################################################
    3398 #                           COIN_PKG_CHECK_EXISTS (deprecated)            #
    3399 ###########################################################################
    3400 
    3401 # COIN_PKG_CHECK_EXISTS(MODULE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
    3402 #
    3403 # Check to see whether a particular module exists.  Similar
    3404 # to PKG_CHECK_MODULES(), but set only the variables $1_VERSION and $1_PKG_ERRORS variables
    3405 #
    3406 AC_DEFUN([AC_COIN_PKG_CHECK_EXISTS],
    3407 [AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
    3408 if test -n "$PKG_CONFIG" ; then
    3409   if $PKG_CONFIG --exists "m4_tolower($1)"; then
    3410     m4_toupper($1)[]_VERSION=`$PKG_CONFIG --modversion "m4_tolower($1)" 2>/dev/null`
    3411     m4_ifval([$2], [$2], [:])
    3412   else
    3413     m4_toupper($1)_PKG_ERRORS=`$PKG_CONFIG $pkg_short_errors --errors-to-stdout --print-errors "m4_tolower($1)"`
    3414     $3
    3415   fi
    3416 else
    3417   AC_MSG_ERROR("Cannot check for existance of module $1 without pkg-config")
    3418 fi
    3419 ])
    3420 
    3421 
    3422 ###########################################################################
    3423 #                           COIN_PKG_CHECK_MODULE   (deprecated)          #
    3424 ###########################################################################
    3425 
    3426 # COIN_PKG_CHECK_MODULE(MODULE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
    3427 #
    3428 # Checks whether a pkg-config file for a given module is available.
    3429 # If so, sets MODULE_CFLAGS, MODULE_LIBS, and MODULES_DATA and executes ACTION-IF-FOUND.
    3430 # If not, then ACTION-IF-NOT-FOUND is executed.
    3431 # A reason for not finding a package is stored in MODULE_PKG_ERRORS
    3432 #
    3433 # --------------------------------------------------------------
    3434 AC_DEFUN([AC_COIN_PKG_CHECK_MODULE],
    3435 [AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
    3436 
    3437 AC_COIN_PKG_CHECK_EXISTS([$1],
    3438   [ m4_toupper($1)[]_CFLAGS=`$PKG_CONFIG --cflags "m4_tolower($1)" 2>/dev/null`
    3439     m4_toupper($1)[]_LIBS=`$PKG_CONFIG --libs "m4_tolower($1)" 2>/dev/null`
    3440     m4_toupper($1)[]_DATA=`$PKG_CONFIG --variable=datadir "m4_tolower($1)" 2>/dev/null`
    3441     $2
    3442   ],
    3443   [ $3 ])
    3444 
    3445 ])# PKG_CHECK_MODULES
    3446 
    3447 ###########################################################################
    34483398#                           COIN_PKG_CHECK_PROJECT_EXISTS                 #
    34493399###########################################################################
     
    34973447###########################################################################
    34983448
    3499 # COIN_PKG_CHECK_MODULE(MODULE, PACKAGES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
     3449# COIN_PKG_HAS_MODULE(MODULE, PACKAGES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
    35003450#
    35013451# Checks whether pkg-config files for a given set of packages is available.
     
    35193469
    35203470###########################################################################
    3521 #                           COIN_MAIN_SUBDIR2 (deprecated)                #
    3522 ###########################################################################
    3523 
    3524 # This is the macro for AC_COIN_MAIN_SUBDIRS taking care of ONE (or two or three) argument(s)
    3525 # It calles AC_COIN_HAS_PROJECT with the given argument(s) and adds $1 to the CONFIG_SUBDIRS, if
    3526 # either argument $3 is given and the file $2/$1/$3 is available in $srcdir,
    3527 # or $3 is not given and the file $2/$1/configure is available in $srcdir,
    3528 # where $2 = . if not given
    3529 AC_DEFUN([AC_COIN_MAIN_SUBDIR2],
     3471#                           COIN_MAIN_PACKAGEDIR                          #
     3472###########################################################################
     3473
     3474# This macro substitutes COIN_MAIN_SUBDIR.
     3475# If $2/$1 or $1 is in COIN_SKIP_PROJECTS, do nothing.
     3476# If --with-$1-lib, --with-$1-incdir, or --with-$1-datadir is given, then assume that the package is installed.
     3477# Otherwise, if pkg-config is available, use it to check whether package is available.
     3478# Otherwise, if the directory subdir/package and the file subdir/package/file exist, check whether subdir/package/configure exists.
     3479#   If so, include this directory into the list of directories where configure and make recourse into.
     3480# tolower(coin_has_$1) is set to notGiven, skipping, installed, or the projects main directory (if uninstalled).
     3481
     3482AC_DEFUN([AC_COIN_MAIN_PACKAGEDIR],
    35303483[AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
     3484AC_MSG_CHECKING([whether project $1 is available])
     3485
     3486m4_tolower(coin_has_$1)=notGiven
     3487
     3488# check if user wants to skip project in any case
    35313489AC_ARG_VAR([COIN_SKIP_PROJECTS],[Set to the subdirectories of projects that should be skipped in the configuration])
    3532 
    3533 # First check, if the sub-project is actually available
    3534 
    3535 m4_tolower(coin_has_$1)=notGiven
    3536 
    3537 # check if user wants to skip project in any case
    35383490if test x"$COIN_SKIP_PROJECTS" != x; then
    35393491  for dir in $COIN_SKIP_PROJECTS; do
     
    35723524
    35733525if test $m4_tolower(coin_has_$1) = notGiven; then
     3526  #only if pkg-config is available:
    35743527  #see if user gives directory where project might be installed: assemble search path for pkg-config
    3575   coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
    3576   AC_ARG_WITH([coin-instdir],
    3577     AC_HELP_STRING([--with-coin-instdir],
    3578                    [prefix of installation directory for precompiled COIN packages]),
    3579     [if test -d "$withval"; then : ; else
    3580        AC_MSG_ERROR([argument for --with-coin-instdir not a directory])
    3581      fi
    3582      PKG_CONFIG_PATH="$withval/lib/$2/pkgconfig:$PKG_CONFIG_PATH"
    3583     ],[])
    3584 
    3585 #   AC_ARG_WITH([m4_tolower($1)],
    3586 #     AC_HELP_STRING([--with-m4_tolower($1)],
    3587 #                    [prefix of installation directory for precompiled $1 package]),
    3588 #     [if test -d "$withval"; then : ; else
    3589 #        AC_MSG_ERROR([argument for --with-m4_tolower($1) not a directory])
    3590 #      fi
    3591 #      # maybe the user points directly to the directory with the .pc file
    3592 #      PKG_CONFIG_PATH="$withval:$PKG_CONFIG_PATH"
    3593 #      # maybe the user points to a project main directory
    3594 #      if test -d "$withval/lib/$2/pkgconfig"; then
    3595 #        PKG_CONFIG_PATH="$withval/lib/$2/pkgconfig:$PKG_CONFIG_PATH"
    3596 #      fi
    3597 #     ],[])
    3598 
    3599   # let pkgconfig check if the project is already installed somewhere
    3600   # need to export variable to be sure that the following pkg-config call gets these values
    3601   export PKG_CONFIG_PATH
    3602   AC_COIN_PKG_CHECK_EXISTS([$1], [m4_tolower(coin_has_$1)="$m4_toupper($1)_VERSION"])
    3603 
    3604   PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH"
     3528  if test -n "$PKG_CONFIG" ; then
     3529    coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
     3530   
     3531    # let's assume that when installing into $prefix, then the user may have installed some other coin projects there before, so it's worth to have a look into there
     3532    if test -d "$prefix"; then
     3533      PKG_CONFIG_PATH="$prefix/lib/$2/pkgconfig:$PKG_CONFIG_PATH"
     3534    fi
     3535   
     3536    AC_ARG_WITH([coin-instdir],
     3537      AC_HELP_STRING([--with-coin-instdir],
     3538                     [prefix of installation directory for precompiled COIN packages]),
     3539      [if test -d "$withval"; then : ; else
     3540         AC_MSG_ERROR([argument for --with-coin-instdir not a directory])
     3541       fi
     3542       PKG_CONFIG_PATH="$withval/lib/$2/pkgconfig:$PKG_CONFIG_PATH"
     3543      ],[])
     3544
     3545    # let pkgconfig check if the project is already installed somewhere
     3546    # need to export variable to be sure that the following pkg-config call gets these values
     3547    export PKG_CONFIG_PATH
     3548    AC_COIN_PKG_CHECK_PROJECT_EXISTS([$1], [m4_tolower(coin_has_$1)="$m4_toupper($1)_VERSION"])
     3549
     3550    PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH"
     3551  fi
    36053552fi
    36063553
     
    36403587fi
    36413588])
    3642 
    3643 ###########################################################################
    3644 #                           COIN_MAIN_PACKAGEDIR                          #
    3645 ###########################################################################
    3646 
    3647 # This is the macro for AC_COIN_MAIN_SUBDIRS taking care of ONE (or two or three) argument(s)
    3648 # It calles AC_COIN_HAS_PROJECT with the given argument(s) and adds $1 to the CONFIG_SUBDIRS, if
    3649 # either argument $3 is given and the file $2/$1/$3 is available in $srcdir,
    3650 # or $3 is not given and the file $2/$1/configure is available in $srcdir,
    3651 # where $2 = . if not given
    3652 AC_DEFUN([AC_COIN_MAIN_PACKAGEDIR],
    3653 [AC_REQUIRE([AC_COIN_HAS_PKGCONFIG])
    3654 AC_MSG_CHECKING([whether project $1 is available])
    3655 
    3656 m4_tolower(coin_has_$1)=notGiven
    3657 
    3658 # check if user wants to skip project in any case
    3659 AC_ARG_VAR([COIN_SKIP_PROJECTS],[Set to the subdirectories of projects that should be skipped in the configuration])
    3660 if test x"$COIN_SKIP_PROJECTS" != x; then
    3661   for dir in $COIN_SKIP_PROJECTS; do
    3662     if test $dir = "$1"; then
    3663       m4_tolower(coin_has_$1)=skipping
    3664     fi
    3665     if test $dir = "$2/$1"; then
    3666       m4_tolower(coin_has_$1)=skipping
    3667     fi
    3668   done
    3669 fi
    3670 
    3671 if test $m4_tolower(coin_has_$1) != skipping; then
    3672   if test $PACKAGE_TARNAME = m4_tolower($1); then
    3673     m4_tolower(coin_has_$1)=.
    3674   fi
    3675 
    3676   AC_ARG_WITH([m4_tolower($1)-lib],
    3677     AC_HELP_STRING([--with-m4_tolower($1)-lib],
    3678                    [linker flags for using project $1]),
    3679       [m4_tolower(coin_has_$1)=installed],
    3680       [])
    3681 
    3682   AC_ARG_WITH([m4_tolower($1)-incdir],
    3683     AC_HELP_STRING([--with-m4_tolower($1)-incdir],
    3684                    [directory with header files for using project $1]),
    3685     [m4_tolower(coin_has_$1)=installed],
    3686     [])
    3687 
    3688   AC_ARG_WITH([m4_tolower($1)-datadir],
    3689     AC_HELP_STRING([--with-m4_tolower($1)-datadir],
    3690                    [directory with data files for using project $1]),
    3691     [m4_tolower(coin_has_$1)=installed],
    3692     [])
    3693 fi
    3694 
    3695 if test $m4_tolower(coin_has_$1) = notGiven; then
    3696   #only if pkg-config is available:
    3697   #see if user gives directory where project might be installed: assemble search path for pkg-config
    3698   if test -n "$PKG_CONFIG" ; then
    3699     coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
    3700     AC_ARG_WITH([coin-instdir],
    3701       AC_HELP_STRING([--with-coin-instdir],
    3702                      [prefix of installation directory for precompiled COIN packages]),
    3703       [if test -d "$withval"; then : ; else
    3704          AC_MSG_ERROR([argument for --with-coin-instdir not a directory])
    3705        fi
    3706        PKG_CONFIG_PATH="$withval/lib/$2/pkgconfig:$PKG_CONFIG_PATH"
    3707       ],[])
    3708 
    3709     # let pkgconfig check if the project is already installed somewhere
    3710     # need to export variable to be sure that the following pkg-config call gets these values
    3711     export PKG_CONFIG_PATH
    3712     AC_COIN_PKG_CHECK_PROJECT_EXISTS([$1], [m4_tolower(coin_has_$1)="$m4_toupper($1)_VERSION"])
    3713 
    3714     PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH"
    3715   fi
    3716 fi
    3717 
    3718 # if not found yet, check if project is available in present directory
    3719 if test "$m4_tolower(coin_has_$1)" = notGiven; then
    3720   if test -d $srcdir/$2/$1; then
    3721     coin_pkg_is_here=no
    3722     m4_ifvaln([$3],
    3723       [for i in $srcdir/$2/$1/$3; do
    3724          if test -r $i; then
    3725            coin_pkg_is_here=yes
    3726          fi
    3727        done],
    3728       [ coin_pkg_is_here=yes ])
    3729     if test $coin_pkg_is_here = yes; then
    3730       m4_tolower(coin_has_$1)=$2/$1
    3731     fi
    3732   fi
    3733 fi
    3734 
    3735 AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
    3736 
    3737 AC_MSG_CHECKING(whether project $1 need to be configured)
    3738 if test "$m4_tolower(coin_has_$1)" != skipping &&
    3739    test "$m4_tolower(coin_has_$1)" != notGiven &&
    3740    test "$m4_tolower(coin_has_$1)" != installed; then
    3741 
    3742   if test -r $srcdir/$2/$1/configure; then
    3743     coin_subdirs="$coin_subdirs m4_ifval($2,[$2/],)$1"
    3744     AC_MSG_RESULT(yes)
    3745     AC_CONFIG_SUBDIRS(m4_ifval($2,[$2/],)$1)
    3746   else
    3747     AC_MSG_RESULT(no)
    3748   fi
    3749 else
    3750   AC_MSG_RESULT(no)
    3751 fi
    3752 ])
    3753 
    3754 ###########################################################################
    3755 #                            COIN_HAS_PROJECT2 (deprecated)               #
    3756 ###########################################################################
    3757 
    3758 # This macro sets up usage of a Coin package.  It defines the
    3759 # PKG_CFLAGS and PKG_LIBS variables, refering to the compiler and linker
    3760 # flags to use when linking against this package.
    3761 # It also defines a COIN_HAS_PKG preprocessor macro and makefile conditional.
    3762 # The argument should be the name (Pkg) of the project (in correct lower
    3763 # and upper case), optionally a directory where to look at it, and
    3764 # optionally a file that need to be present in the package directory.
    3765 #
    3766 # It is also possible to specify a preinstalled version of this Coin
    3767 # package or to specify only the linker and compiler flags.
    3768 
    3769 AC_DEFUN([AC_COIN_HAS_PROJECT2],
    3770 [AC_MSG_CHECKING([for COIN project $1])
    3771 
    3772 m4_tolower(coin_has_$1)=notGiven
    3773 
    3774 # check if user wants to skip project in any case
    3775 if test x"$COIN_SKIP_PROJECTS" != x; then
    3776   for dir in $COIN_SKIP_PROJECTS; do
    3777     if test $dir = "$1"; then
    3778       m4_tolower(coin_has_$1)=skipping
    3779     fi
    3780     if test $dir = "$2/$1"; then
    3781       m4_tolower(coin_has_$1)=skipping
    3782     fi
    3783   done
    3784 fi
    3785 
    3786 m4_toupper($1_LIBS)=
    3787 m4_toupper($1_CFLAGS)=
    3788 m4_toupper($1_DATA)=
    3789 AC_SUBST(m4_toupper($1_LIBS))
    3790 AC_SUBST(m4_toupper($1_CFLAGS))
    3791 AC_SUBST(m4_toupper($1_DATA))
    3792 
    3793 if test $m4_tolower(coin_has_$1) != skipping; then
    3794   if test $PACKAGE_TARNAME = m4_tolower($1); then
    3795     m4_tolower(coin_has_$1)=.
    3796   fi
    3797 
    3798   AC_ARG_WITH([m4_tolower($1)-lib],
    3799     AC_HELP_STRING([--with-m4_tolower($1)-lib],
    3800                    [linker flags for using project $1]),
    3801       [m4_tolower(coin_has_$1)=yes
    3802        m4_toupper($1_LIBS)="$withval"],
    3803       [])
    3804 
    3805   AC_ARG_WITH([m4_tolower($1)-incdir],
    3806     AC_HELP_STRING([--with-m4_tolower($1)-incdir],
    3807                    [directory with header files for using project $1]),
    3808     [m4_tolower(coin_has_$1)=yes
    3809      m4_toupper($1_CFLAGS)="-I$withval"],
    3810     [])
    3811 
    3812   AC_ARG_WITH([m4_tolower($1)-datadir],
    3813     AC_HELP_STRING([--with-m4_tolower($1)-datadir],
    3814                    [directory with data files for using project $1]),
    3815     [m4_tolower(coin_has_$1)=yes
    3816      m4_toupper($1_DATA)="$withval"],
    3817     [])
    3818 fi
    3819 
    3820 if test $m4_tolower(coin_has_$1) = notGiven; then
    3821   #assemble search path for pkg-config
    3822   coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
    3823 
    3824   AC_ARG_WITH([coin-instdir],
    3825     AC_HELP_STRING([--with-coin-instdir],
    3826                    [prefix of installation directory for precompiled COIN packages]),
    3827     [if test -d "$withval"; then : ; else
    3828        AC_MSG_ERROR([argument for --with-coin-instdir not a directory])
    3829      fi
    3830      PKG_CONFIG_PATH="$withval/lib/$2/pkgconfig:$PKG_CONFIG_PATH",
    3831     ],[])
    3832 
    3833 #   AC_ARG_WITH([m4_tolower($1)],
    3834 #     AC_HELP_STRING([--with-m4_tolower($1)],
    3835 #                    [prefix of installation directory for precompiled $1 package]),
    3836 #     [if test -d "$withval"; then : ; else
    3837 #        AC_MSG_ERROR([argument for --with-m4_tolower($1) not a directory])
    3838 #      fi
    3839 #      #if the user points directly to the directory with the .pc file
    3840 #      PKG_CONFIG_PATH="$withval:$PKG_CONFIG_PATH"
    3841 #      #if the user points to a project main directory
    3842 #      if test -d "$withval/lib/$2/pkgconfig"; then
    3843 #        PKG_CONFIG_PATH="$withval/lib/$2/pkgconfig:$PKG_CONFIG_PATH"
    3844 #      fi
    3845 #     ],[])
    3846 
    3847   # check if uninstalled project can be found in ../$2/$1
    3848   # this is for the classic setup when this macro is called from the project main directory
    3849   if test -d $srcdir/../$2/$1; then
    3850     coin_pkg_is_here=no
    3851     m4_ifvaln([$3],
    3852       [for i in $srcdir/../$2/$1/$3; do
    3853          if test -r $i; then
    3854            coin_pkg_is_here=yes
    3855          fi
    3856        done],
    3857       [ coin_pkg_is_here=yes ])
    3858     if test $coin_pkg_is_here = yes; then
    3859       PKG_CONFIG_PATH="../$2/$1:$PKG_CONFIG_PATH"
    3860     fi
    3861   fi
    3862 
    3863   # let pkg-config do it's magic
    3864   # need to export variable to be sure that the following pkg-config gets these values
    3865   export PKG_CONFIG_PATH
    3866   AC_COIN_PKG_CHECK_MODULE([$1],
    3867     [ m4_tolower(coin_has_$1)=$m4_toupper($1)_VERSION
    3868       AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
    3869     ],
    3870     [ m4_tolower(coin_has_$1)=notGiven
    3871       AC_MSG_RESULT([not given: $m4_toupper($1)_PKG_ERRORS])
    3872     ])
    3873 
    3874   PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH"
    3875 
    3876 else
    3877   AC_MSG_RESULT([$m4_tolower(coin_has_$1)])
    3878 fi
    3879 
    3880 if test $m4_tolower(coin_has_$1) != skipping &&
    3881    test $m4_tolower(coin_has_$1) != notGiven ; then
    3882   if test "x$m4_toupper($1)_CFLAGS" != x ; then
    3883     AC_MSG_NOTICE([$1 CFLAGS are $m4_toupper($1)_CFLAGS])
    3884   fi
    3885   if test "x$m4_toupper($1)_LIBS" != x ; then
    3886     AC_MSG_NOTICE([$1 LIBS   are $m4_toupper($1)_LIBS])
    3887     ADDLIBS="$m4_toupper($1)_LIBS $ADDLIBS"
    3888   fi
    3889   if test "x$m4_toupper($1)_DATA" != x ; then
    3890     AC_MSG_NOTICE([$1 DATA   is  $m4_toupper($1)_DATA])
    3891   fi
    3892   AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is used])
    3893 fi
    3894 
    3895 # Define the Makefile conditional
    3896 AM_CONDITIONAL(m4_toupper(COIN_HAS_$1),
    3897                [test $m4_tolower(coin_has_$1) != notGiven &&
    3898                 test $m4_tolower(coin_has_$1) != skipping])
    3899 
    3900 ]) # AC_COIN_HAS_PROJECT2
    39013589
    39023590###########################################################################
Note: See TracChangeset for help on using the changeset viewer.