eellak / build-recorder

GNU Lesser General Public License v2.1
23 stars 8 forks source link

Invalid use of `AC_CHECK_PROGS` #199

Closed fvalasiad closed 1 year ago

fvalasiad commented 1 year ago

The template for AC_CHECK_PROGS is:

AC_CHECK_PROGS (variable, progs-to-check-for, [value-if-not-found], [path = ‘$PATH’])

probably confused with:

AC_CHECK_PROG (variable, prog-to-check-for, value-if-found, [value-if-not-found], [path = ‘$PATH’], [reject])

which takes value-if-found as its third parameter.

AC_CHECK_PROGS instead sets the variable directly to the program we are looking for, in which case curl(1).

zvr commented 1 year ago

There is no difference in the invocation. The only difference is that AC_CHECK_PROG checks a single program and AC_CHECK_PROGS checks for more.

Why do you think it's invalid ?

fvalasiad commented 1 year ago

@zvr Trying to run the benchmark would result to errors, so I looked around and came upon the GNU doc for autoconf: https://www.gnu.org/software/autoconf/manual/autoconf-2.68/html_node/Generic-Programs.html

which states:

— Macro: AC_CHECK_PROG (variable, prog-to-check-for, value-if-found, [value-if-not-found], [path = ‘$PATH’], [reject])

Check whether program prog-to-check-for exists in path. If it is found, set variable to value-if-found, otherwise to value-if-not-found, if given. Always pass over reject (an absolute file name) even if it is the first found in the search path; in that case, set variable using the absolute file name of the prog-to-check-for found that is not reject. If variable was already set, do nothing. Calls AC_SUBST for variable. The result of this test can be overridden by setting the variable variable or the cache variable ac_cv_prog_variable.

— Macro: AC_CHECK_PROGS (variable, progs-to-check-for, [value-if-not-found], [path = ‘$PATH’])

Check for each program in the blank-separated list progs-to-check-for existing in the path. If one is found, set variable to the name of that program. Otherwise, continue checking the next program in the list. If none of the programs in the list are found, set variable to value-if-not-found; if value-if-not-found is not specified, the value of variable is not changed. Calls AC_SUBST for variable. The result of this test can be overridden by setting the variable variable or the cache variable ac_cv_prog_variable.

Which validates my point above. And also explains my error, which was:

curl https://ftp.gnu.org/gnu/hello/hello-2.12.1.tar.gz Warning: Binary output can mess up your terminal. Use "--output -" to tell Warning: curl to output it to your terminal anyway, or consider "--output Warning: " to save to a file. make: *** [Makefile:413: hello-2.12.1.tar.gz] Error 23

Showing that curl was used for DOWNLOAD Instead of curl -O.

fvalasiad commented 1 year ago

The difference in our context is that essentially AC_CHECK_PROG let's you choose what the variable(in our case DOWNLOAD) will be substituted with unlike AC_CHECK_PROGS which substitutes it with the executable found automatically.

zvr commented 1 year ago

Ah, right, it's a typo.