From 0969045b6eda298c083ab8ee69c5d0dc5af203da Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 21 Dec 2012 17:26:19 +0100 Subject: [PATCH] configure: add internal sanity check (warn only) on vars for makefiles --- configure.ac | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/configure.ac b/configure.ac index 0848481..ff48c5b 100644 --- a/configure.ac +++ b/configure.ac @@ -3614,6 +3614,101 @@ squeeze CURL_NETWORK_AND_TIME_LIBS squeeze SUPPORT_FEATURES squeeze SUPPORT_PROTOCOLS +dnl +dnl Some sanity checks for LIBS, LDFLAGS, CPPFLAGS and CFLAGS values that +dnl configure is going to feed into makefiles generated by automake. Due +dnl to automake placement and usage of these variables we have to follow +dnl its rules or we may get funny results later on at make-time. +dnl + +dnl +dnl LIBS should only specify libraries +dnl +AC_MSG_NOTICE([using LIBS: $LIBS]) +tst_bad_spec="no" +for word1 in $LIBS; do + case "$word1" in + -l* | --library=*) + : + ;; + *) + tst_bad_spec="yes" + ;; + esac +done +if test "$tst_bad_spec" = "yes"; then + AC_MSG_WARN([oops, LIBS should only specify libraries.]) +fi + +dnl +dnl LDFLAGS should only specify linker flags +dnl +AC_MSG_NOTICE([using LDFLAGS: $LDFLAGS]) +tst_bad_msg="oops, LDFLAGS should only specify linker flags, not" +for word1 in $LDFLAGS; do + case "$word1" in + -D*) + AC_MSG_WARN([$tst_bad_msg macro definitions. Use CPPFLAGS for: $word1]) + ;; + -U*) + AC_MSG_WARN([$tst_bad_msg macro suppressions. Use CPPFLAGS for: $word1]) + ;; + -I*) + AC_MSG_WARN([$tst_bad_msg include directories. Use CPPFLAGS for: $word1]) + ;; + -l* | --library=*) + AC_MSG_WARN([$tst_bad_msg libraries. Use LIBS for: $word1]) + ;; + esac +done + +dnl +dnl CPPFLAGS should only specify C preprocessor flags +dnl +AC_MSG_NOTICE([using CPPFLAGS: $CPPFLAGS]) +tst_bad_msg="oops, CPPFLAGS should only specify C preprocessor flags, not" +for word1 in $CPPFLAGS; do + case "$word1" in + -rpath*) + AC_MSG_WARN([$tst_bad_msg library runtime directories. Use LDFLAGS for: $word1]) + ;; + -L* | --library-path=*) + AC_MSG_WARN([$tst_bad_msg library directories. Use LDFLAGS for: $word1]) + ;; + -l* | --library=*) + AC_MSG_WARN([$tst_bad_msg libraries. Use LIBS for: $word1]) + ;; + esac +done + +dnl +dnl CFLAGS should only specify C compiler flags +dnl +AC_MSG_NOTICE([using CFLAGS: $CFLAGS]) +tst_bad_msg="oops, CFLAGS should only specify C compiler flags, not" +for word1 in $CFLAGS; do + case "$word1" in + -D*) + AC_MSG_WARN([$tst_bad_msg macro definitions. Use CPPFLAGS for: $word1]) + ;; + -U*) + AC_MSG_WARN([$tst_bad_msg macro suppressions. Use CPPFLAGS for: $word1]) + ;; + -I*) + AC_MSG_WARN([$tst_bad_msg include directories. Use CPPFLAGS for: $word1]) + ;; + -rpath*) + AC_MSG_WARN([$tst_bad_msg library runtime directories. Use LDFLAGS for: $word1]) + ;; + -L* | --library-path=*) + AC_MSG_WARN([$tst_bad_msg library directories. Use LDFLAGS for: $word1]) + ;; + -l* | --library=*) + AC_MSG_WARN([$tst_bad_msg libraries. Use LIBS for: $word1]) + ;; + esac +done + if test "x$want_curldebug_assumed" = "xyes" && test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then ac_configure_args="$ac_configure_args --enable-curldebug" -- 2.7.4