diff options
author | Yang Tse <yangsita@gmail.com> | 2012-12-21 17:26:19 +0100 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2012-12-21 17:29:31 +0100 |
commit | 0969045b6eda298c083ab8ee69c5d0dc5af203da (patch) | |
tree | 9a06bf7555811abf2622dd30ad96641e3cf03522 | |
parent | c30c557e4d2089953339fc669474091bdd505651 (diff) |
configure: add internal sanity check (warn only) on vars for makefiles
-rw-r--r-- | configure.ac | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 0848481f5..ff48c5bc4 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" |