I have an extension that I'm trying to get the config.m4 to read from a file
and use AC_DEFINE* to define some macros in the main/php_config.h for use
with my extension.
My question is, how can I get AC_DEFINE() to expand shell variable passes as
arguments? Here is my config.m4:
(Note: I've tried many different combo's with AC_DEFINE and
AC_DEFINE_UNQUOTED with different expanion styles but just can't get it to
evaluate as it does when run seperately)
dnl $Id$
dnl config.m4 for extension directoryservices
PHP_ARG_WITH(directoryservices, for directoryservices support,
[ --with-directoryservices Include directoryservices support])
if test "$PHP_DIRECTORYSERVICES" != "no"; then
PHP_NEW_EXTENSION(directoryservices, directoryservices.c,
$ext_shared)
AC_DEFINE(HAVE_DIRECTORYSERVICES, 1, [ ])
AC_CHECK_HEADERS([DirectoryService/DirServices.h
DirectoryService/DirServicesUtils.h DirectoryService/DirServicesConst.h])
ds_path="/System/Library/Frameworks/DirectoryService.framework/Versions/Curr
ent/Resources"
ds_plist=( $(cat $ds_path/version.plist |
sed
-e '/-$/N
{
s/<key>(.)</key>/ \1 /
}'
-e '/-$/N
{
s/<string>(.)</string>/ \1 /
}'
-e '/-$/N
{
s/<(.*)>/ /
}')
);
for (( i = 0; i < ${#ds_plist[@]}; i+=2 )); do
case $ds_plist[$i] in
CFBundleVersion)
AC_DEFINE_UNQUOTED(DS_CFBUNDLEVERSION,
"$ds_plist[$((i+1))]", [DS version.plist value CFBundleVersion]);;
ReleaseStatus)
AC_DEFINE_UNQUOTED(DS_RELEASESTATUS,
"$ds_plist[$((i+1))]", [DS version.plist value ReleaseStatus]);;
SourceVersion)
AC_DEFINE_UNQUOTED(DS_SOURCEVERSION,
"$ds_plist[$((i+1))]", [DS version.plist value SourceVersion]);;
BuildVersion)
AC_DEFINE_UNQUOTED(DS_BUILDVERSION,
"$ds_plist[$((i+1))]", [DS version.plist value BuildVersion]);;
esac
done
PHP_ADD_FRAMEWORK(DirectoryService)
fi
--
Justin Hannus
Lead Programmer/Web Development
jhannus@visualconceptsinc.com
www.visualconceptsinc.com
[860] 242.1150 ext.125
[860] 242.1446 fax
Maybe this was the wrong list to post to......
but for those of you who come across the same problem, I fixed it by
removing the array subscripts and using scalar values instead. AC_DEFINE*
and probably all the m4 macros strip all ['s and ]'s from your config.m4
file.
-JH
"Justin Hannus" jhannus@visualconceptsinc.com wrote in message
news:20031103202553.62539.qmail@pb1.pair.com...
I have an extension that I'm trying to get the config.m4 to read from a
file
and use AC_DEFINE* to define some macros in the main/php_config.h for use
with my extension.My question is, how can I get AC_DEFINE() to expand shell variable passes
as
arguments? Here is my config.m4:
(Note: I've tried many different combo's with AC_DEFINE and
AC_DEFINE_UNQUOTED with different expanion styles but just can't get it to
evaluate as it does when run seperately)dnl $Id$
dnl config.m4 for extension directoryservicesPHP_ARG_WITH(directoryservices, for directoryservices support,
[ --with-directoryservices Include directoryservices
support])if test "$PHP_DIRECTORYSERVICES" != "no"; then
PHP_NEW_EXTENSION(directoryservices, directoryservices.c,
$ext_shared)
AC_DEFINE(HAVE_DIRECTORYSERVICES, 1, [ ])
AC_CHECK_HEADERS([DirectoryService/DirServices.h
DirectoryService/DirServicesUtils.h DirectoryService/DirServicesConst.h])
ds_path="/System/Library/Frameworks/DirectoryService.framework/Versions/Curr
ent/Resources"
ds_plist=( $(cat $ds_path/version.plist |
sed
-e '/-$/N
{
s/<key>(.)</key>/ \1 /
}'
-e '/-$/N
{
s/<string>(.)</string>/ \1 /
}'
-e '/-$/N
{
s/<(.*)>/ /
}')
);
for (( i = 0; i < ${#ds_plist[@]}; i+=2 )); do
case $ds_plist[$i] in
CFBundleVersion)
AC_DEFINE_UNQUOTED(DS_CFBUNDLEVERSION,
"$ds_plist[$((i+1))]", [DS version.plist value CFBundleVersion]);;
ReleaseStatus)
AC_DEFINE_UNQUOTED(DS_RELEASESTATUS,
"$ds_plist[$((i+1))]", [DS version.plist value ReleaseStatus]);;
SourceVersion)
AC_DEFINE_UNQUOTED(DS_SOURCEVERSION,
"$ds_plist[$((i+1))]", [DS version.plist value SourceVersion]);;
BuildVersion)
AC_DEFINE_UNQUOTED(DS_BUILDVERSION,
"$ds_plist[$((i+1))]", [DS version.plist value BuildVersion]);;
esac
donePHP_ADD_FRAMEWORK(DirectoryService)fi
--
Justin Hannus
Lead Programmer/Web Development
jhannus@visualconceptsinc.com
www.visualconceptsinc.com
[860] 242.1150 ext.125
[860] 242.1446 fax