How to write multiple conditions in Makefile.am with “else if”

前端 未结 5 514
隐瞒了意图╮
隐瞒了意图╮ 2021-02-02 05:29

I want to compile my project with autoconf/automake. There are 2 conditions defined in my configure.ac

AM_CONDITIONAL(HAVE_CLIENT, test $enable-client -eq 1)
AM_         


        
5条回答
  •  礼貌的吻别
    2021-02-02 06:00

    I would accept ldav1s' answer if I were you, but I just want to point out that 'else if' can be written in terms of 'else's and 'if's in any language:

    if HAVE_CLIENT
      libtest_LIBS = $(top_builddir)/libclient.la
    else
      if HAVE_SERVER
        libtest_LIBS = $(top_builddir)/libserver.la
      else
        libtest_LIBS = 
      endif
    endif
    

    (The indentation is for clarity. Don't indent the lines, they won't work.)

提交回复
热议问题