0

under my project, I have 3 source code packages, say package1, package2, package3. one of them will be compiled according to a dependent software (e.g. softA) version.

if I input './configure --softA-version=1.7.2', I hope that package3 will be choose.

In the makefile.am, it might look like

if "softA_version" == "1.5.2"; then
    SUBDIRS = package1
else if "softA_version == "1.6.4"; then
    SUBDIRS = package2
else if "softA_version" == "1.7.2"; then
    SUBDIRS = package3
endif 

how should I define Micros in configure.ac or a *.m4 file?

jimmy.cao
  • 3
  • 1

1 Answers1

0

You should probably look at the AC_ARG_WITH macro, which works almost as you describe:

AC_ARG_WITH([softA-version], [AS_HELP_STRING([--with-softA-version=version],
[use the 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 be able to AC_SUBST the package name directly, instead of using AM_CONDITIONAL but this will probably work. I have not tried it though.

ldav1s
  • 15,885
  • 2
  • 53
  • 56