Autoconf check for program and fail if not found

后端 未结 6 1888
小鲜肉
小鲜肉 2021-02-19 03:52

I\'m creating a project and using GNU Autoconf tools to do the configuring and making. I\'ve set up all my library checking and header file checking but can\'t seem to figure ou

6条回答
  •  佛祖请我去吃肉
    2021-02-19 04:23

    When using AC_CHECK_PROG, this is the most concise version that I've run across is:

    AC_CHECK_PROG(BOGUS,[bogus],[bogus],[no])
    test "$BOGUS" == "no" && AC_MSG_ERROR([Required program 'bogus' not found.])
    

    When the program is missing, this output will be generated:

    ./configure
    ...cut...
    checking for bogus... no
    configure: error: Required program 'bogus' not found.
    

    Or when coupled with the built-in autoconf program checks, use this instead:

    AC_PROG_YACC
    AC_PROG_LEX
    
    test "$YACC" == ":" && AC_MSG_ERROR([Required program 'bison' not found.])
    test "$LEX" == ":" && AC_MSG_ERROR([Required program 'flex' not found.])
    

提交回复
热议问题