From: Vincent Bernat Date: Sun, 16 Aug 2015 09:49:07 +0000 (+0200) Subject: build: replace AC_CONFIG_SUBDIRS with custom version X-Git-Tag: 0.7.17~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3940008c5fcea428d4f9dd4627e967529532913e;p=thirdparty%2Flldpd.git build: replace AC_CONFIG_SUBDIRS with custom version Modifying `$ac_configure_args` breaks maintainer mode. Moreover, ./configure is run even when not needed. We use a custom version allowing to pass custom parameters and not delaying ./configure invocation. --- diff --git a/m4/config_subdirs.m4 b/m4/config_subdirs.m4 new file mode 100644 index 00000000..e71762b2 --- /dev/null +++ b/m4/config_subdirs.m4 @@ -0,0 +1,89 @@ +# +# lldp_CONFIG_SUBDIRS +# +# This is almost like AC_CONFIG_SUBDIRS but it will take additional +# arguments for ./configure. Also, ./configure is not delayed. Be sure +# to call that late enough. + +AC_DEFUN([lldp_CONFIG_SUBDIRS], [ + ac_sub_configure_args= + ac_prev= + eval "set x $ac_configure_args" + shift + for ac_arg + do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case $ac_arg in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ + | --c=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + ;; + --disable-option-checking) + ;; + *) + case $ac_arg in + *\'*) ac_arg=`AS_ECHO(["$ac_arg"]) | sed "s/'/'\\\\\\\\''/g"` ;; + esac + AS_VAR_APPEND([ac_sub_configure_args], [" '$ac_arg'"]) ;; + esac + done + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + ac_arg="--prefix=$prefix" + case $ac_arg in + *\'*) ac_arg=`AS_ECHO(["$ac_arg"]) | sed "s/'/'\\\\\\\\''/g"` ;; + esac + ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" + + # Always prepend --disable-option-checking to silence warnings, since + # different subdirs can have different --enable and --with options. + ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" + + # Add additional options + ac_sub_configure_args="$ac_sub_configure_args $2" + + ac_popdir=`pwd` + ac_dir="m4_normalize([$1])" + + ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" + _AS_ECHO_LOG([$ac_msg]) + _AS_ECHO([$ac_msg]) + AS_MKDIR_P(["$ac_dir"]) + _AC_SRCDIRS(["$ac_dir"]) + + cd "$ac_dir" + + ac_sub_configure=$ac_srcdir/configure + + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative name. + ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; + esac + + AC_MSG_NOTICE([running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir]) + # The eval makes quoting arguments work. + eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ + --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || + AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir]) + + cd "$ac_popdir" +]) diff --git a/m4/libevent.m4 b/m4/libevent.m4 index 899b6d38..8d28955f 100644 --- a/m4/libevent.m4 +++ b/m4/libevent.m4 @@ -43,13 +43,12 @@ AC_DEFUN([lldp_CHECK_LIBEVENT], [ unset LIBEVENT_LIBS LIBEVENT_CFLAGS="-I\$(top_srcdir)/libevent/include -I\$(top_builddir)/libevent/include" LIBEVENT_LDFLAGS="\$(top_builddir)/libevent/libevent.la" + + # Call ./configure in libevent + lldp_CONFIG_SUBDIRS([libevent], + [--disable-libevent-regress --disable-thread-support --disable-openssl --disable-malloc-replacement --disable-debug-mode --enable-function-sections --disable-shared --with-pic --enable-static --enable-silent-rules]) fi - # Override configure arguments - ac_configure_args="$ac_configure_args --disable-libevent-regress --disable-thread-support --disable-openssl" - ac_configure_args="$ac_configure_args --disable-malloc-replacement --disable-debug-mode --enable-function-sections" - ac_configure_args="$ac_configure_args --disable-shared --with-pic --enable-static --enable-silent-rules" - AC_CONFIG_SUBDIRS([libevent]) AM_CONDITIONAL([LIBEVENT_EMBEDDED], [test x"$LIBEVENT_EMBEDDED" != x]) AC_SUBST([LIBEVENT_LIBS]) AC_SUBST([LIBEVENT_CFLAGS])