Skip to content

Mistakes in autotools code (configure.ac) #5067

Description

@fullincome

operating system

CentOS 6 with gcc 4.9.2.

curl/libcurl version

upstream (commit 94ced8e)

I did this

  1. Add this line between 64-65 and 275-276 in configure.ac:
    echo "Compiler info: $compiler_id, $compiler_num\n"

  2. ./buildconf && ./configure --enable-werror

I expected the following

Some compiler id and version number (492) in output

I got

Empty $compiler_id, $compiler_num at first echo
And wierd $compiler_num (= 409) at second

Problems and possible solutions:

  1. Condition in configure.ac:68:
    if test "$compiler_num" -ge "500"; then
    is always false, because compiler_num and compiler_id will defined only after CURL_CHECK_COMPILER macro.

As solution: put code about CURL_CFLAG_EXTRAS after CURL_CHECK_COMPILER.

  1. Code in m4/curl-compilers.m4:165-167 determine gcc version wierd. In my view it must be like:
diff --git a/m4/curl-compilers.m4 b/m4/curl-compilers.m4
index c64db4bc6..9eb68f698 100644
--- a/m4/curl-compilers.m4
+++ b/m4/curl-compilers.m4
@@ -164,8 +164,9 @@ AC_DEFUN([CURL_CHECK_COMPILER_GNU_C], [
     compiler_id="GNU_C"
     gccver=`$CC -dumpversion`
     gccvhi=`echo $gccver | cut -d . -f1`
-    gccvlo=`echo $gccver | cut -d . -f2`
-    compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
+    gccvme=`echo $gccver | cut -d . -f2`
+    gccvlo=`echo $gccver | cut -d . -f3`
+    compiler_num=`(expr $gccvhi "*" 100 + $gccvme "*" 10 + $gccvlo) 2>/dev/null`
     flags_dbg_all="-g -g0 -g1 -g2 -g3"
     flags_dbg_all="$flags_dbg_all -ggdb"
     flags_dbg_all="$flags_dbg_all -gstabs"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions