当 AC_CONFIG_MACRO_DIR 包含在 configure.ac

问题描述

我的项目有一个 configure.ac 文件

#AC_CONfig_MACRO_DIR([m4])
AC_INIT(Makefile.am)

AM_CONfig_HEADER(config.h)

AM_INIT_AUTomake(myproject,11.3.8)

AC_CHECK_LIB(pthread,pthread_create,AC_MSG_ERROR(pthread_create not functioning))
AC_CHECK_LIB(nsl,main)
AC_CHECK_LIB(rt,main)
AC_CHECK_LIB(socket,socket)
AC_CHECK_LIB(m,matherr)

AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_RANLIB
AM_PROG_LIBTOOL

#AX_BOOST_BASE([1.48],[have_boost=yes],)
#AX_BOOST_UNIT_TEST_FRAMEWORK
AM_CONDITIONAL([HAVE_BOOST],test "$have_boost" = yes)

PKG_CHECK_MODULES(LIBCCEXT2,libccext2 >= 1.7.3)
PKG_CHECK_MODULES(LIBCCGNU2,libccgnu2 >= 1.7.3)

dnl AC_OUTPUT(Makefile src/Makefile,echo timestamp > stamp-h)

dnl Use -Wall if we have gcc.
changequote(,)dnl
if test "x$GCC" = "xyes"; then
  case " $CFLAGS " in
  *[\ \ ]-Wall[\ \  ]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac
fi
changequote([,])dnl

AC_CONfig_FILES([ myproject.pc ])

AC_OUTPUT([
Makefile 
include/Makefile
someapp2/Makefile
someapp8/Makefile
log/Makefile
someapp6/Makefile
someapp5/Makefile
extra/Makefile
app/Makefile
someapp4/Makefile
someapp7/Makefile
lib/Makefile
someapp1/Makefile
someapp9/Makefile
someapp3/Makefile
test/Makefile
])

当我运行 aclocal; autoheader; libtoolize -f -c; automake -a -c; automake; autoconf; ./configure --enable-somefeature --enable-myproject; make -j4 时,我得到以下输出

acinclude.m4:10: warning: underquoted deFinition of AM_PATH_MysqLCLIENT
acinclude.m4:10:   run info Automake 'Extending aclocal'
acinclude.m4:10:   or see someapp4://www.gnu.org/software/automake/manual/automake.html#Extending-aclocal
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: Consider adding `AC_CONfig_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize,to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
libtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT'
configure.ac:6: warning: AM_INIT_AUTomake: two- and three-arguments forms are deprecated.  For more info,see:
configure.ac:6: someapp4://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTomake-invocation
app/Makefile.am:13: warning: compiling 'smsio.c' with per-target flags requires 'AM_PROG_CC_C_O' in 'configure.ac'
configure.ac:6: warning: AM_INIT_AUTomake: two- and three-arguments forms are deprecated.  For more info,see:
configure.ac:6: someapp4://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTomake-invocation
app/Makefile.am:13: warning: compiling 'smsio.c' with per-target flags requires 'AM_PROG_CC_C_O' in 'configure.ac'
configure: WARNING: unrecognized options: --enable-somefeature,--enable-myprojecttest
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for pthread_create in -lpthread... yes
checking for main in -lnsl... yes
checking for main in -lrt... yes
checking for socket in -lsocket... no
checking for matherr in -lm... yes
checking for gcc... (someapp9d) gcc
checking whether we are using the GNU C compiler... (someapp9d) yes
checking whether gcc accepts -g... (someapp9d) yes
checking for gcc option to accept ISO C89... (someapp9d) none needed
checking dependency style of gcc... (someapp9d) gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
...
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (someapp9d) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (someapp9d) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (someapp9d) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for LIBCCEXT2... yes
checking for LIBCCGNU2... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating myproject.pc
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating someapp2/Makefile
config.status: creating someapp8/Makefile
config.status: creating log/Makefile
config.status: creating someapp6/Makefile
config.status: creating someapp5/Makefile
config.status: creating extra/Makefile
config.status: creating app/Makefile
config.status: creating someapp4/Makefile
config.status: creating someapp7/Makefile
config.status: creating lib/Makefile
config.status: creating someapp1/Makefile
config.status: creating someapp9/Makefile
config.status: creating someapp3/Makefile
config.status: creating test/Makefile
config.status: creating config.h
config.status: executing depfiles someapp8ands
config.status: executing libtool someapp8ands
configure: WARNING: unrecognized options: --enable-somefeature,--enable-myprojecttest
make  all-recursive
make[1]: Entering directory `/home/someengineer/github/myproject'
...
make[2]: Leaving directory `/home/someengineer/github/myproject/test'
make[2]: Entering directory `/home/someengineer/github/myproject'
make[2]: Leaving directory `/home/someengineer/github/myproject'
make[1]: Leaving directory `/home/someengineer/github/myproject'

如果我取消对 configure.ac 文件中注释行的注释,并将我的 acinclude.m4 移动到名为 m4 的目录,输出将变成这样:

m4/acinclude.m4:10: warning: underquoted deFinition of AM_PATH_MysqLCLIENT
m4/acinclude.m4:10:   run info Automake 'Extending aclocal'
m4/acinclude.m4:10:   or see someapp4://www.gnu.org/software/automake/manual/automake.html#Extending-aclocal
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONfig_MACRO_DIR,`m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
libtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT'
configure.ac:6: warning: AM_INIT_AUTomake: two- and three-arguments forms are deprecated.  For more info,--enable-myprojecttest
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for pthread_create in -lpthread... yes
checking for main in -lnsl... yes
checking for main in -lrt... yes
checking for socket in -lsocket... no
checking for matherr in -lm... yes
checking for gcc... (someapp9d) gcc
checking whether we are using the GNU C compiler... (someapp9d) yes
checking whether gcc accepts -g... (someapp9d) yes
checking for gcc option to accept ISO C89... (someapp9d) none needed
checking dependency style of gcc... (someapp9d) gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
...
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (someapp9d) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (someapp9d) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (someapp9d) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for boostlib >= 1.48 (104800)... yes
checking whether the Boost::Unit_Test_Framework library is available... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for LIBCCEXT2... yes
checking for LIBCCGNU2... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating myproject.pc
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating someapp2/Makefile
config.status: creating someapp8/Makefile
config.status: creating log/Makefile
config.status: creating someapp6/Makefile
config.status: creating someapp5/Makefile
config.status: creating extra/Makefile
config.status: creating app/Makefile
config.status: creating someapp4/Makefile
config.status: creating someapp7/Makefile
config.status: creating lib/Makefile
config.status: creating someapp1/Makefile
config.status: creating someapp9/Makefile
config.status: creating someapp3/Makefile
config.status: creating test/Makefile
config.status: creating config.h
config.status: executing depfiles someapp8ands
config.status: executing libtool someapp8ands
configure: WARNING: unrecognized options: --enable-somefeature,--enable-myprojecttest
Cdpath="${ZSH_VERSION+.}:" && cd . && /bin/sh /home/someengineer/github/myproject/missing aclocal-1.13
m4/acinclude.m4:10: warning: underquoted deFinition of AM_PATH_MysqLCLIENT
m4/acinclude.m4:10:   run info Automake 'Extending aclocal'
m4/acinclude.m4:10:   or see someapp4://www.gnu.org/software/automake/manual/automake.html#Extending-aclocal
Cdpath="${ZSH_VERSION+.}:" && cd . && /bin/sh /home/someengineer/github/myproject/missing autoconf
 cd . && /bin/sh /home/someengineer/github/myproject/missing automake-1.13 --gnu
/bin/sh ./config.status --recheck
configure.ac:6: warning: AM_INIT_AUTomake: two- and three-arguments forms are deprecated.  For more info,see:
configure.ac:6: someapp4://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTomake-invocation
running CONfig_SHELL=/bin/sh /bin/sh ./configure --enable-somefeature --enable-myprojecttest PKG_CONfig_PATH=/usr/local/lib/pkgconfig --no-create --no-recursion
app/Makefile.am:13: warning: compiling 'smsio.c' with per-target flags requires 'AM_PROG_CC_C_O' in 'configure.ac'
configure: WARNING: unrecognized options: --enable-somefeature,--enable-myprojecttest
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for pthread_create in -lpthread... yes
checking for main in -lnsl... yes
checking for main in -lrt... yes
checking for socket in -lsocket... no
checking for matherr in -lm... yes
checking for gcc... (someapp9d) gcc
checking whether we are using the GNU C compiler... (someapp9d) yes
checking whether gcc accepts -g... (someapp9d) yes
checking for gcc option to accept ISO C89... (someapp9d) none needed
checking dependency style of gcc... (someapp9d) gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
...
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (someapp9d) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (someapp9d) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (someapp9d) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for boostlib >= 1.48 (104800)... yes
checking whether the Boost::Unit_Test_Framework library is available... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for LIBCCEXT2... yes
checking for LIBCCGNU2... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
configure: WARNING: unrecognized options: --enable-somefeature,--enable-myprojecttest
 /bin/sh ./config.status
config.status: creating myproject.pc
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating someapp2/Makefile
config.status: creating someapp8/Makefile
config.status: creating log/Makefile
config.status: creating someapp6/Makefile
config.status: creating someapp5/Makefile
config.status: creating extra/Makefile
config.status: creating app/Makefile
config.status: creating someapp4/Makefile
config.status: creating someapp7/Makefile
config.status: creating lib/Makefile
config.status: creating someapp1/Makefile
config.status: creating someapp9/Makefile
config.status: creating someapp3/Makefile
config.status: creating test/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles someapp8ands
config.status: executing libtool someapp8ands
(Cdpath="${ZSH_VERSION+.}:" && cd . && /bin/sh /home/someengineer/github/myproject/missing autoheader)
rm -f stamp-h1
touch config.h.in
cd . && /bin/sh ./config.status config.h
config.status: creating config.h
config.status: config.h is unchanged
make  all-recursive
make[1]: Entering directory `/home/someengineer/github/myproject'
...
make[2]: Leaving directory `/home/someengineer/github/myproject/test'
make[2]: Entering directory `/home/someengineer/github/myproject'
make[2]: Leaving directory `/home/someengineer/github/myproject'
make[1]: Leaving directory `/home/someengineer/github/myproject'

AC_CONfig_MACRO_DIR([m4]) 包含在 configure.ac 中时,依赖项的检查似乎进行了两次。我的 m4 目录还包含来自 autoconf archive 的 m4_ax_boost_base.m4 和 m4_ax_boost_unit_test_framework.m4。

我在m4目录下的acinclude.m4如下:

dnl Test for libMysqLclient and 
dnl define MysqLCLIENT_CFLAGS,MysqLCLIENT_LDFLAGS and MysqLCLIENT_LIBS
dnl usage:
dnl AM_PATH_MysqLCLIENT(
dnl     [MINIMUM-VERSION,dnl     [ACTION-IF-FOUND [,dnl     ACTION-IF-NOT-FOUND ]]])
dnl

AC_DEFUN(AM_PATH_MysqLCLIENT,[
AC_ARG_WITH(MysqLclient-prefix,[  --with-MysqLclient-prefix=PFX Prefix where MysqLclient is 
installed],MysqLclient_prefix="$withval",MysqLclient_prefix="")

AC_ARG_WITH(MysqLclient-include,[  --with-MysqLclient-include=DIR Directory pointing 
             to MysqLclient include files],MysqLclient_include="$withval",MysqLclient_include="")

AC_ARG_WITH(MysqLclient-lib,[  --with-MysqLclient-lib=LIB  Directory pointing to MysqLclient library
                          (Note: -include and -lib do override
                           paths found with -prefix)
],MysqLclient_lib="$withval",MysqLclient_lib="")

    AC_MSG_CHECKING([for MysqLclient ifelse([$1],[>= v$1])])
    MysqLCLIENT_LDFLAGS=""
    MysqLCLIENT_CFLAGS=""
    MysqLCLIENT_LIBS="-lMysqLclient"
    MysqLclient_fail=""

    dnl test --with-MysqLclient-prefix
        for tryprefix in /usr /usr/local /usr/MysqL /usr/local/MysqL /usr/pkg $msqlclient_prefix; do
                #testloop
                for hloc in lib/MysqL lib ; do
                        if test -f "$tryprefix/$hloc/libMysqLclient.so"; then
                        MysqLCLIENT_LDFLAGS="-L$tryprefix/$hloc"
                        fi
                done

                for iloc in include/MysqL include; do
                        if test -f "$tryprefix/$iloc/MysqL.h"; then
                        MysqLCLIENT_CFLAGS="-I$tryprefix/$iloc"
                    fi
            done
                # testloop
        done

    dnl test --with-MysqLclient-include
    if test "x$MysqLclient_include" != "x" ; then
                echo "checking for MysqL includes... "
        if test -d "$MysqLclient_include/MysqL" ; then
            MysqLCLIENT_CFLAGS="-I$MysqLclient_include"
                        echo " found $MysqLCLIENT_CFLAGS"
        elif test -d "$MysqLclient_include/include/MysqL" ; then
            MysqLCLIENT_CFLAGS="-I$MysqLclient_include/include"
                        echo " found $MysqLCLIENT_CFLAGS"
        elif test -d "$MysqLclient_include" ; then
            MysqLCLIENT_CFLAGS="-I$MysqLclient_include"
                        echo "found $MysqLCLIENT_CFLAGS"
                else
                        echo "not found!  no include dir found in $MysqLclient_include"
        fi
    fi

    dnl test --with-MysqLclient-lib
    if test "x$MysqLclient_lib" != "x" ; then
                echo "checking for MysqL libx... "
        if test -d "$MysqLclient_lib/lib/MysqL" ; then
            MysqLCLIENT_LDFLAGS="-L$MysqLclient_lib/lib/MysqL"
                        echo "found $MysqLCLIENT_LDFLAGS"
        elif test -d "$MysqLclient_lib/lin" ; then
            MysqLCLIENT_LDFLAGS="-L$MysqLclient_lib/lib"
                        echo "found $MysqLCLIENT_LDFLAGS"
        else
            MysqLCLIENT_LDFLAGS="-L$MysqLclient_lib"
                        echo "defaultd to $MysqLCLIENT_LDFLAGS"
        fi
    fi

    ac_save_CFLAGS="$CFLAGS"
    ac_save_LDFLAGS="$LDFLAGS"
    ac_save_LIBS="$LIBS"
    CFLAGS="-v $CFLAGS $MysqLCLIENT_CFLAGS"
    LDFLAGS="$LDFLAGS $MysqLCLIENT_LDFLAGS"
    LIBS="$LIBS $MysqLCLIENT_LIBS"
    dnl if no minimum version is given,just try to compile
    dnl else try to compile AND run
        AC_TRY_COMPILE([
            #include <MysqL.h>
            #include <MysqL_version.h>
        ],[
            MysqL_connect( 0,0);
        ],[AC_MSG_RESULT(yes $MysqLCLIENT_CFLAGS $MysqLCLIENT_LDFLAGS)
           CFLAGS="$ac_save_CFLAGS"
           LDFLAGS="$ac_save_LDFLAGS"
           LIBS="$ac_save_LIBS"
           ifelse([$2],:,[$2])
        ],[
                        echo "no"
                        echo "can't compile a simple app with MysqL_connnect in it. bad."
          MysqLclient_fail="yes"
        ])

    if test "x$MysqLclient_fail" != "x" ; then
            dnl AC_MSG_RESULT(no)
            echo
            echo "***"
            echo "*** MysqLclient test source had problems,check your config.log ."
            echo "*** Also try one of the following switches :"
            echo "***   --with-MysqLclient-prefix=PFX"
            echo "***   --with-MysqLclient-include=DIR"
            echo "***   --with-MysqLclient-lib=DIR"
            echo "***"
            CFLAGS="$ac_save_CFLAGS"
            LDFLAGS="$ac_save_LDFLAGS"
            LIBS="$ac_save_LIBS"
            ifelse([$3],[$3])
    fi

    CFLAGS="$ac_save_CFLAGS"
    LDFLAGS="$ac_save_LDFLAGS"
    LIBS="$ac_save_LIBS"
    AC_SUBST(MysqLCLIENT_LDFLAGS)
    AC_SUBST(MysqLCLIENT_CFLAGS)
    AC_SUBST(MysqLCLIENT_LIBS)
])

如何修复我的 configure.ac 以便只检查一次依赖项?

解决方法

通过以下规则在 configure 中执行 make -j4 时已对 Makefile 进行第二次调用

$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
    $(SHELL) ./config.status --recheck

可能是 configure 发生变化导致 make 触发器重新检查。您需要在发出 ./configure 命令之前/之后检查 configure 脚本的内容

另一方面,应该在 CONFIG_STATUS_DEPENDENCIES 中定义一些东西