autotools - how to make automake conditionally choose a src package? -
under project, have 3 source code packages, package1, package2, package3. 1 of them compiled according dependent software (e.g. softa) version.
if input './configure --softa-version=1.7.2', hope package3 choose.
in makefile.am, might like
if "softa_version" == "1.5.2"; subdirs = package1 else if "softa_version == "1.6.4"; subdirs = package2 else if "softa_version" == "1.7.2"; subdirs = package3 endif
how should define micros in configure.ac or *.m4 file?
you should @ ac_arg_with
macro, works describe:
ac_arg_with([softa-version], [as_help_string([--with-softa-version=version], [use softa version (default 1.7.2)])], [softa_version="$withval"], [softa_version="1.7.2"]) am_conditional([build_softa_1_5_2], [test "$softa_version" = "1.5.2"]) am_conditional([build_softa_1_6_4], [test "$softa_version" = "1.6.4"]) am_conditional([build_softa_1_7_2], [test "$softa_version" = "1.7.2"]) ...
and in makefile.am
:
if build_softa_1_5_2 subdirs = package1 endif if build_softa_1_6_4 subdirs = package2 endif if build_softa_1_7_2 subdirs = package3 endif
and invoked like:
configure --with-softa-version=1.5.2
you might able ac_subst
package name directly, instead of using am_conditional
work. have not tried though.
Comments
Post a Comment