Changeset 3241


Ignore:
Timestamp:
Jun 29, 2014 1:18:42 PM (7 years ago)
Author:
stefan
Message:

put back logic to figure out cflags/libs/datadir from dependencies; put back logic to skip certain projects

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/coin.m4

    r3192 r3241  
    427427  :
    428428fi
    429  
     429
    430430AC_OUTPUT
    431431
     
    551551m4_tolower(coin_has_$1)=notGiven
    552552
     553# check if user wants to skip package in any case
     554if test x"$COIN_SKIP_PROJECTS" != x; then
     555  for dir in $COIN_SKIP_PROJECTS; do
     556    if test $dir = "$1"; then
     557      m4_tolower(coin_has_$1)=skipping
     558    fi
     559  done
     560fi
     561
     562if test "$m4_tolower(coin_has_$1)" != skipping; then
     563  AC_ARG_WITH([m4_tolower($1)],,
     564    [if test "$withval" = no ; then
     565       m4_tolower(coin_has_$1)=skipping
     566     fi
     567    ])
     568fi
     569
     570m4_toupper($1_LIBS)=
     571m4_toupper($1_CFLAGS)=
     572m4_toupper($1_DATA)=
     573m4_toupper($1_DEPENDENCIES)=
     574m4_toupper($1_PCREQUIRES)=
     575AC_SUBST(m4_toupper($1_LIBS))
     576AC_SUBST(m4_toupper($1_CFLAGS))
     577AC_SUBST(m4_toupper($1_DATA))
     578AC_SUBST(m4_toupper($1_DEPENDENCIES))
     579m4_foreach_w([myvar], [$3], [
     580  AC_SUBST(m4_toupper(myvar)_CFLAGS)
     581  AC_SUBST(m4_toupper(myvar)_LIBS)
     582  AC_SUBST(m4_toupper(myvar)_PCREQUIRES)
     583  AC_SUBST(m4_toupper(myvar)_DEPENDENCIES)
     584])
     585
     586#check if user provided LIBS for package or disables use of package
     587if test $m4_tolower(coin_has_$1) != skipping; then
     588  AC_ARG_WITH([m4_tolower($1)-lib],
     589    AC_HELP_STRING([--with-m4_tolower($1)-lib],
     590                   [linker flags for using package $1]),
     591    [if test "$withval" = no ; then
     592       m4_tolower(coin_has_$1)=skipping
     593     else
     594       m4_tolower(coin_has_$1)=yes
     595       m4_toupper($1_LIBS)="$withval"
     596       m4_foreach_w([myvar], [$3], [
     597         m4_toupper(myvar)_LIBS="$withval $m4_toupper(myvar)_LIBS"
     598       ])
     599     fi
     600    ],
     601    [])
     602fi
     603
     604#check if user provided INCDIR for package or disables use of package
     605if test $m4_tolower(coin_has_$1) != skipping; then
     606  AC_ARG_WITH([m4_tolower($1)-incdir],
     607    AC_HELP_STRING([--with-m4_tolower($1)-incdir],
     608                   [directory with header files for using package $1]),
     609    [if test "$withval" = no ; then
     610       m4_tolower(coin_has_$1)=skipping
     611     else
     612       m4_tolower(coin_has_$1)=yes
     613       m4_toupper($1_CFLAGS)="-I$withval"
     614       m4_foreach_w([myvar], [$3], [m4_toupper(myvar)_CFLAGS="-I$withval $m4_toupper(myvar)_CFLAGS"])
     615     fi
     616    ],
     617    [])
     618fi
     619
     620#check if user provided DATADIR for package or disables use of package
     621if test $m4_tolower(coin_has_$1) != skipping; then
     622  AC_ARG_WITH([m4_tolower($1)-datadir],
     623    AC_HELP_STRING([--with-m4_tolower($1)-datadir],
     624                   [directory with data files for using package $1]),
     625    [if test "$withval" = no ; then
     626       m4_tolower(coin_has_$1)=skipping
     627     else
     628       m4_tolower(coin_has_$1)=yes
     629       m4_toupper($1_DATA)="$withval"
     630     fi
     631    ],
     632    [])
     633fi
     634
     635# now use pkg-config, if nothing of the above applied
    553636if test $m4_tolower(coin_has_$1) = notGiven; then
    554637  if test -n "$PKG_CONFIG" ; then
     
    563646      [ m4_tolower(coin_has_$1)=yes
    564647        AC_MSG_RESULT([yes: $m4_toupper($1)_VERSIONS])
     648
     649        m4_toupper($1_DATA)=`$PKG_CONFIG --variable=datadir --define-variable prefix=${COIN_DESTDIR}${prefix} $2 2>/dev/null`
     650       
     651        m4_toupper($1_PCREQUIRES)="$2"
     652        # augment X_PCREQUIRES for each build target X in $3
     653        m4_foreach_w([myvar], [$3], [
     654          m4_toupper(myvar)_PCREQUIRES="$2 $m4_toupper(myvar)_PCREQUIRES"
     655        ])
    565656      ],
    566657      [ m4_tolower(coin_has_$1)=notGiven
     
    572663    export PKG_CONFIG_PATH
    573664
     665    m4_foreach_w([myvar], [$3], [
     666      m4_toupper(myvar)_PCREQUIRES="$2 $m4_toupper(myvar)_PCREQUIRES"
     667    ])
     668
    574669  else
    575670    AC_MSG_ERROR([skipped check via pkg-config, redirect to fallback... -- oops, not there yet])
     
    585680   test $m4_tolower(coin_has_$1) != notGiven ; then
    586681  AC_DEFINE(m4_toupper(COIN_HAS_$1),[1],[Define to 1 if the $1 package is available])
     682 
     683  if test 1 = 0 ; then  #change this test to enable a bit of debugging output
     684    if test -n "$m4_toupper($1)_DATA" ; then
     685      AC_MSG_NOTICE([$1 DATA   is  $m4_toupper($1)_DATA])
     686    fi
     687    if test -n "$m4_toupper($1)_PCREQUIRES" ; then
     688      AC_MSG_NOTICE([$1 PCREQUIRES are $m4_toupper($1)_PCREQUIRES])
     689    fi
     690  fi
     691 
    587692fi
    588693
     
    591696               [test $m4_tolower(coin_has_$1) != notGiven &&
    592697                test $m4_tolower(coin_has_$1) != skipping])
     698])
     699
     700###########################################################################
     701#                           COIN_FINALIZE_FLAGS                           #
     702###########################################################################
     703
     704# TODO this could be moved into COIN_FINALIZE, if we were able to remember
     705#   for which variables we need to run pkg-config
     706AC_DEFUN([AC_COIN_FINALIZE_FLAGS],[
     707
     708# do pkg-config calls to complete LIBS and CFLAGS
     709coin_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
     710PKG_CONFIG_PATH="$COIN_PKG_CONFIG_PATH:$COIN_PKG_CONFIG_PATH_UNINSTALLED"
     711export PKG_CONFIG_PATH
     712
     713m4_foreach_w([myvar],[$1],[
     714  if test -n "${m4_toupper(myvar)_PCREQUIRES}" ; then
     715    m4_toupper(myvar)_CFLAGS=`$PKG_CONFIG --cflags --define-variable prefix=${COIN_DESTDIR}${prefix} ${m4_toupper(myvar)_PCREQUIRES} ` ${m4_toupper(myvar)_CFLAGS}
     716    m4_toupper(myvar)_LIBS=`$PKG_CONFIG --libs --define-variable prefix=${COIN_DESTDIR}${prefix} ${m4_toupper(myvar)_PCREQUIRES} ` ${m4_toupper(myvar)_LIBS}
     717    #TODO setup _DEPENDENCIES from _LIBS
     718  fi
     719   
     720  if test 1 = 0 ; then  #change this test to enable a bit of debugging output
     721    if test -n "${m4_toupper(myvar)_CFLAGS}" ; then
     722      AC_MSG_NOTICE([myvar CFLAGS are ${m4_toupper(myvar)_CFLAGS}])
     723    fi
     724    if test -n "${m4_toupper(myvar)_LIBS}" ; then
     725      AC_MSG_NOTICE([myvar LIBS   are ${m4_toupper(myvar)_LIBS}])
     726    fi
     727  fi
     728])
     729
     730# reset PKG_CONFIG_PATH variable
     731PKG_CONFIG_PATH="$coin_save_PKG_CONFIG_PATH"
    593732
    594733])
     
    608747m4_tolower(coin_has_$1)=notGiven
    609748coin_reason=
     749
     750# check if user wants to skip project in any case
     751AC_ARG_VAR([COIN_SKIP_PROJECTS],[Set to the subdirectories of projects that should be skipped in the configuration])
     752if test x"$COIN_SKIP_PROJECTS" != x; then
     753  for dir in $COIN_SKIP_PROJECTS; do
     754    if test $dir = "$1"; then
     755      m4_tolower(coin_has_$1)="no"
     756      coin_reason="$1 has been specified in COIN_SKIP_PROJECTS"
     757    fi
     758    m4_ifval($2,[
     759    if test $dir = "$2/$1"; then
     760      m4_tolower(coin_has_$1)="no"
     761      coin_reason="$2/$1 has been specified in COIN_SKIP_PROJECTS"
     762    fi])
     763  done
     764fi
     765
     766if test "$m4_tolower(coin_has_$1)" != no; then
     767  AC_ARG_WITH([m4_tolower($1)],,
     768    [if test "$withval" = no ; then
     769       m4_tolower(coin_has_$1)="no"
     770       coin_reason="--without-m4_tolower($1) has been specified"
     771     fi
     772    ])
     773fi
     774
     775if test "$m4_tolower(coin_has_$1)" != no; then
     776  AC_ARG_WITH([m4_tolower($1)-lib],
     777    AC_HELP_STRING([--with-m4_tolower($1)-lib],
     778                   [linker flags for using project $1]),
     779    [if test "$withval" = no ; then
     780       m4_tolower(coin_has_$1)="no"
     781       coin_reason="--without-m4_tolower($1)-lib has been specified"
     782     else
     783       m4_tolower(coin_has_$1)="no"
     784       coin_reason="--with-m4_tolower($1)-lib has been specified"
     785     fi],
     786    [])
     787fi
     788
     789if test "$m4_tolower(coin_has_$1)" != no; then
     790  AC_ARG_WITH([m4_tolower($1)-incdir],
     791    AC_HELP_STRING([--with-m4_tolower($1)-incdir],
     792                   [directory with header files for using project $1]),
     793    [if test "$withval" = no ; then
     794       m4_tolower(coin_has_$1)="no"
     795       coin_reason="--without-m4_tolower($1)-incdir has been specified"
     796     else
     797       m4_tolower(coin_has_$1)="no"
     798       coin_reason="--with-m4_tolower($1)-incdir has been specified"
     799     fi],
     800    [])
     801fi
     802
     803if test "$m4_tolower(coin_has_$1)" != no; then
     804  AC_ARG_WITH([m4_tolower($1)-datadir],
     805    AC_HELP_STRING([--with-m4_tolower($1)-datadir],
     806                   [directory with data files for using project $1]),
     807    [if test "$withval" = no ; then
     808       m4_tolower(coin_has_$1)="no"
     809       coin_reason="--without-m4_tolower($1)-datadir has been specified"
     810     else
     811       m4_tolower(coin_has_$1)="no"
     812       coin_reason="--with-m4_tolower($1)-datadir has been specified"
     813     fi],
     814    [])
     815fi
     816
    610817
    611818# check if project is available in present directory
Note: See TracChangeset for help on using the changeset viewer.