Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F8308564
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
13 KB
Subscribers
None
View Options
Index: trunk/pub/autotools/cedar-pkgchecks.m4
===================================================================
--- trunk/pub/autotools/cedar-pkgchecks.m4 (revision 852)
+++ trunk/pub/autotools/cedar-pkgchecks.m4 (revision 853)
@@ -1,308 +1,308 @@
# Declares an external package to be used. This macro will declare appropriate
# command line switches for ./configure and corresponding environment variables
# to define the package's prefix path, library path and include path. The
# configure command line option switches override the corresponding environment
# variables. Various permutations of capitalisation, version number appendage
# and include/lib path will be attempted. Omit the version number if it isn't
# relevant. The third and fourth options will be executed respectively if the
# package is or isn't found: this is an ideal place to place ERROR/WARNING
# messages as appropriate for mandatory/optional packages and to run tests of
# the library if it appears to be there.
#
#AC_CEDAR_LIBRARYANDHEADERS(PrettyName, ReleaseNumber, action-if-true, action-if-false)
#----------------------------------------
AC_DEFUN([AC_CEDAR_LIBRARYANDHEADERS], [
## Define a bunch of case permutations
m4_define([cedar_PkgName], [$1])dnl
m4_define([cedar_PKGNAME], [translit([translit([$1], [a-z], [A-Z])], [.])])dnl
m4_define([cedar_pkgname], [translit([translit([$1], [A-Z], [a-z])], [.])])dnl
m4_define([cedar_SAFEPKGNAME], [translit(cedar_PKGNAME, [-], [_])])dnl
m4_define([cedar_safepkgname], [translit(cedar_pkgname, [-], [_])])dnl
m4_define([cedar_pkgversion], [$2])dnl
pkgpath=""
pkglib=no; pkginc=no; pkggood=no
## Don't know why this isn't working by default:
test x${prefix} == xNONE && prefix=${ac_default_prefix}
## Environment variables for specifying paths
AC_ARG_VAR(@&t@cedar_SAFEPKGNAME@&t@PATH,
path to cedar_PkgName @<:@$prefix and various standard locations@:>@)
pkgpath=${cedar_SAFEPKGNAME@&t@PATH}
## "configure" option switches for specifying paths
AC_ARG_WITH([cedar_safepkgname],
[AC_HELP_STRING(--with-@&t@cedar_safepkgname,
path to cedar_PkgName @<:@$prefix and various standard locations@:>@)],
[pkgpath=$with_@&t@cedar_safepkgname], [])
dnl echo "DEBUG: withval=$withval, with_@&t@cedar_safepkgname=$with_@&t@cedar_safepkgname -> pkgpath=$pkgpath"
if test "$pkgpath"; then cedar_SAFEPKGNAME@&t@PATH="$pkgpath"; fi
## Has this lib been disabled?
#echo "DEBUG: pkgpath = $pkgpath"
if test x$pkgpath == xno; then
AC_MSG_NOTICE(Not building against cedar_PkgName)
AM_CONDITIONAL(WITH_@&t@cedar_SAFEPKGNAME@&t@INC, false)
AM_CONDITIONAL(WITH_@&t@cedar_SAFEPKGNAME@&t@LIB, false)
$4
else
## Check library and header
AC_CEDAR_LIBRARY(cedar_PkgName, cedar_pkgversion, , pkglib=no)
AC_CEDAR_HEADERS(cedar_PkgName, cedar_pkgversion, , pkginc=no)
## Execute pass/fail shell code
if test "x$pkglib" == "xyes" && test "x$pkginc" == "xyes"; then
#AC_MSG_NOTICE([cedar_PkgName paths verified])
pkggood="yes"
$3
else
pkggood="no"
$4
fi
fi
## Export variables to automake
AM_CONDITIONAL(WITH_@&t@cedar_SAFEPKGNAME, [test x$pkggood != xno])
])
#AC_CEDAR_HEADERS(PrettyName, ReleaseNumber, action-if-true, action-if-false)
AC_DEFUN([AC_CEDAR_HEADERS], [
## Define a bunch of case permutations
m4_define([cedar_PkgName], [$1])dnl
m4_define([cedar_PKGNAME], [translit([translit([$1], [a-z], [A-Z])], [.])])dnl
m4_define([cedar_pkgname], [translit([translit([$1], [A-Z], [a-z])], [.])])dnl
m4_define([cedar_SAFEPKGNAME], [translit(cedar_PKGNAME, [-], [_])])dnl
m4_define([cedar_safepkgname], [translit(cedar_pkgname, [-], [_])])dnl
m4_define([cedar_IncName], [cedar_PkgName])dnl
m4_define([cedar_INCNAME], [cedar_PKGNAME])dnl
m4_define([cedar_incname], [cedar_pkgname])dnl
m4_define([cedar_IncName1], [translit(cedar_PkgName, [-], [_])])dnl
m4_define([cedar_INCNAME1], [translit(cedar_PKGNAME, [-], [_])])dnl
m4_define([cedar_incname1], [translit(cedar_pkgname, [-], [_])])dnl
m4_define([cedar_IncName2], [translit(cedar_PkgName, [-], [])])dnl
m4_define([cedar_INCNAME2], [translit(cedar_PKGNAME, [-], [])])dnl
m4_define([cedar_incname2], [translit(cedar_pkgname, [-], [])])dnl
m4_define([cedar_pkgversion], [$2])dnl
## We have a set of user-set variables:
pkgpath=""; pkgincpath=""
## Also need some status variables:
pkginc=no
## Don't know why this isn't working by default:
test x${prefix} == xNONE && prefix=${ac_default_prefix}
## Environment variables for specifying paths
AC_ARG_VAR(@&t@cedar_SAFEPKGNAME@&t@PATH,
path to cedar_PkgName @<:@$prefix and various standard locations@:>@)
AC_ARG_VAR(@&t@cedar_SAFEPKGNAME@&t@INCPATH,
path to the directory containing the cedar_PkgName header files @<:@cedar_SAFEPKGNAME@&t@PATH/include/cedar_PkgName@:>@)
pkgpath=${cedar_SAFEPKGNAME@&t@PATH}
pkgincpath=${cedar_SAFEPKGNAME@&t@INCPATH}
## "configure" option switches for specifying paths
dnl AC_ARG_WITH([cedar_safepkgname],
dnl AC_HELP_STRING(--with-@&t@cedar_safepkgname,
dnl path to cedar_PkgName @<:@$prefix and various standard locations@:>@),
dnl [pkgpath=$with_@&t@cedar_safepkgname], [])
AC_ARG_WITH(cedar_safepkgname@&t@-incpath,
AC_HELP_STRING(--with-@&t@cedar_safepkgname@&t@-incpath,
path to directory containing cedar_PkgName headers @<:@cedar_SAFEPKGNAME@&t@PATH/include/cedar_PkgName@:>@),
[pkgincpath=$with_@&t@cedar_safepkgname@&t@_incpath], [])
if test "$pkgpath"; then cedar_SAFEPKGNAME@&t@PATH="$pkgpath"; fi
## Has this header been disabled?
if test x$pkgpath == xno; then
AC_MSG_NOTICE(Not building against cedar_PkgName)
$4
else
## Base paths
- pkgbases="$prefix $ac_default_prefix /usr / ."
+ pkgbases="$prefix $ac_default_prefix /usr /"
if test "$pkgpath"; then pkgbases="$pkgpath"; fi
## Look for include files: first build the search list...
incpaths=""
if test "$pkgincpath"; then
incpaths="$pkgincpath"
else
for base in $pkgbases; do
for i in cedar_IncName cedar_INCNAME cedar_incname; do incpaths="$incpaths $base/include/$i"; done
if test "cedar_IncName" != "cedar_IncName1"; then
for i in cedar_IncName1 cedar_INCNAME1 cedar_incname1; do incpaths="$incpaths $base/include/$i"; done
fi
if test "cedar_IncName" != "cedar_IncName2"; then
for i in cedar_IncName2 cedar_INCNAME2 cedar_incname2; do incpaths="$incpaths $base/include/$i"; done
fi
done
fi
## .. and then do the search:
for incpath in $incpaths; do
incpath=`echo $incpath | sed -e s:'//*':'/':g -e s:'/$':'':`
if test -d $incpath; then
pkginc=yes; break; else pkginc=no;
fi
if test x$pkginc != xno; then break; fi
done
if test x$pkginc != xno; then
cedar_SAFEPKGNAME@&t@INCPATH=`dirname $incpath | sed -e s:'/$':'':`
cedar_SAFEPKGNAME@&t@INCNAME=`basename $incpath`
#echo cedar_SAFEPKGNAME@&t@INCPATH : $cedar_SAFEPKGNAME@&t@INCPATH
AC_MSG_NOTICE([Found cedar_PkgName header directory at $incpath])
else
AC_MSG_WARN(cedar_PkgName header directory was not found)
fi
## Execute pass/fail shell code
if test "x$pkginc" == "xyes"; then
true
$3
else
true
$4
fi
fi
## Export variables to automake
AC_SUBST(cedar_SAFEPKGNAME@&t@INCPATH)
AC_SUBST(cedar_SAFEPKGNAME@&t@INCNAME)
AM_CONDITIONAL(WITH_@&t@cedar_SAFEPKGNAME@&t@INC, [test x$pkgginc != xno])
])
#AC_CEDAR_LIBRARY(PrettyName, ReleaseNumber, action-if-true, action-if-false)
AC_DEFUN([AC_CEDAR_LIBRARY], [
## Define a bunch of case permutations
m4_define([cedar_PkgName], [$1])dnl
m4_define([cedar_PKGNAME], [translit([translit([$1], [a-z], [A-Z])], [.])])dnl
m4_define([cedar_pkgname], [translit([translit([$1], [A-Z], [a-z])], [.])])dnl
m4_define([cedar_SAFEPKGNAME], [translit(cedar_PKGNAME, [-], [_])])dnl
m4_define([cedar_safepkgname], [translit(cedar_pkgname, [-], [_])])dnl
m4_define([cedar_LibName], [cedar_PkgName])dnl
m4_define([cedar_LIBNAME], [cedar_PKGNAME])dnl
m4_define([cedar_libname], [cedar_pkgname])dnl
m4_define([cedar_LibName1], [translit(cedar_PkgName, [-], [_])])dnl
m4_define([cedar_LIBNAME1], [translit(cedar_PKGNAME, [-], [_])])dnl
m4_define([cedar_libname1], [translit(cedar_pkgname, [-], [_])])dnl
m4_define([cedar_LibName2], [translit(cedar_PkgName, [-], [])])dnl
m4_define([cedar_LIBNAME2], [translit(cedar_PKGNAME, [-], [])])dnl
m4_define([cedar_libname2], [translit(cedar_pkgname, [-], [])])dnl
m4_define([cedar_libversion], [$2])dnl
## We have a set of user-set variables:
pkgpath=""; pkglibpath=""; pkglibname=""
## Also need some status variables:
pkglib=no
## Don't know why this isn't working by default:
test x${prefix} == xNONE && prefix=${ac_default_prefix}
## Environment variables for specifying paths
AC_ARG_VAR(@&t@cedar_SAFEPKGNAME@&t@PATH,
path to cedar_PkgName @<:@$prefix and various standard locations@:>@)
AC_ARG_VAR(@&t@cedar_SAFEPKGNAME@&t@LIBPATH,
path to the directory containing the cedar_PkgName library @<:@cedar_SAFEPKGNAME@&t@PATH/lib or cedar_SAFEPKGNAME@&t@PATH/lib/cedar_PkgName@:>@)
AC_ARG_VAR(@&t@cedar_SAFEPKGNAME@&t@LIBNAME,
name to be used when linking the cedar_PkgName library @<:@cedar_PkgName@:>@)
pkgpath=${cedar_SAFEPKGNAME@&t@PATH}
pkglibpath=${cedar_SAFEPKGNAME@&t@LIBPATH}
pkglibname=${cedar_SAFEPKGNAME@&t@LIBFLAG}
## "configure" option switches for specifying paths
dnl AC_ARG_WITH([cedar_safepkgname],
dnl AC_HELP_STRING(--with-@&t@cedar_safepkgname,
dnl path to cedar_PkgName @<:@$prefix and various standard locations@:>@),
dnl [pkgpath=$with_@&t@cedar_safepkgname], [])
AC_ARG_WITH(cedar_safepkgname@&t@-ldpath,
AC_HELP_STRING(--with-@&t@cedar_safepkgname@&t@-libpath,
path to directory containing cedar_PkgName library @<:@cedar_SAFEPKGNAME@&t@PATH/lib or cedar_SAFEPKGNAME@&t@PATH/lib/cedar_PkgName@:>@),
[pkglibpath=$with_@&t@cedar_safepkgname@&t@_libpath], [])
AC_ARG_WITH(cedar_safepkgname@&t@-libname,
AC_HELP_STRING(--with-@&t@cedar_safepkgname@&t@-libname,
name to be used when linking the cedar_PkgName library @<:@cedar_PkgName@:>@),
[pkglibname=$with_@&t@cedar_safepkgname@&t@_libname], [])
if test "$pkgpath"; then cedar_SAFEPKGNAME@&t@PATH="$pkgpath"; fi
## Has this lib been disabled?
if test x$pkgpath == xno; then
AC_MSG_NOTICE(Not building against cedar_PkgName)
$4
else
## Base paths
- pkgbases="$prefix $ac_default_prefix /usr / ."
+ pkgbases="$prefix $ac_default_prefix /usr /"
if test "$pkgpath"; then pkgbases="$pkgpath"; fi
## Build a list of library search locations, unless specified
libpaths=""
if test "$pkglibpath"; then
libpaths="$pkglibpath"
else
for base in $pkgbases; do
libpaths="$libpaths $base/lib"
for i in cedar_LibName cedar_LIBNAME cedar_libname; do libpaths="$libpaths $base/lib/$i"; done
if test "cedar_LibName" != "cedar_LibName1"; then
for i in cedar_LibName1 cedar_LIBNAME1 cedar_libname1; do libpaths="$libpaths $base/lib/$i"; done
fi
if test "cedar_LibName" != "cedar_LibName2"; then
for i in cedar_LibName2 cedar_LIBNAME2 cedar_libname2; do libpaths="$libpaths $base/lib/$i"; done
fi
done
libpaths="$libpaths ./src"
fi
## Look for library with various name permutations
for libpath in $libpaths; do
libpath=`echo $libpath | sed -e s:'//*':'/':g -e s:'/$':'':`
libnames="cedar_LibName cedar_libname cedar_LIBNAME"
if test "$pkglibname"; then libnames=$pkglibname; fi
libversions="-cedar_libversion cedar_libversion"
for libversion in $libversions ""; do
for libname in $libnames; do
for libextn in so la dylib a; do
#echo "DEBUG: Testing ${libpath}/lib${libname}${libversion}.${libextn}"
if test -e ${libpath}/lib${libname}${libversion}.${libextn}; then
pkglib=yes; break; else pkglib=no;
fi
done
if test x$pkglib != xno; then break; fi
done
if test x$pkglib != xno; then break; fi
done
if test x$pkglib != xno; then break; fi
done
## Announce success/failure and set variables
if test x$pkglib != xno; then
libfullpath=`echo ${libpath}/lib${libname}${libversion}.${libextn}`
cedar_SAFEPKGNAME@&t@LIBPATH=`dirname $libfullpath`
#`echo $libpath | sed -e s:'//*':'/':g -e s:'/$':'':`
cedar_SAFEPKGNAME@&t@LIBNAME=`basename $libfullpath | sed -e s/'^lib'// -e s/'\.@<:@a-zA-Z@:>@*$'//`
#echo :$cedar_SAFEPKGNAME@&t@LIBNAME:
AC_MSG_NOTICE([Found cedar_PkgName library at ${libfullpath}])
else
AC_MSG_WARN(cedar_PkgName library was not found)
fi
## Execute pass/fail shell code
if test "x$pkglib" == "xyes"; then
true
$3
else
true
$4
fi
fi
## Export variables to automake
AC_SUBST(cedar_SAFEPKGNAME@&t@LIBPATH)
AC_SUBST(cedar_SAFEPKGNAME@&t@LIBNAME)
AM_CONDITIONAL(WITH_@&t@cedar_SAFEPKGNAME@&t@LIB, [test x$pkglib != xno])
])
# Create a variable called EMPTY with appropriate content
#AC_EMPTY_SUBST
AC_DEFUN([AC_EMPTY_SUBST],
[EMPTY=""
AC_SUBST(EMPTY)
])
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Dec 21, 12:26 PM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4022766
Default Alt Text
(13 KB)
Attached To
rCEDARSVN cedarsvn
Event Timeline
Log In to Comment