On Tue, 2 Oct 2012, Tothwolf wrote:
if the
autoconf scripts are well written...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is the key, right here. Most software developers who are really good at
C do not have enough experience with autotools.
There are a number things I learned while working with autotools that are key
to making this stuff work /right/.
1. Everything will be processed through M4, so make sure you quote and escape
stuff properly. If you don't know M4 you probably shouldn't be writing
autoconf tests. Go write sendmail configuration files for awhile.
2. Never ever assume /bin/sh is GNU Bash. Unless you are using Linux based
system, it probably isn't, and even then /bin/sh might actually be some form
of Ash.
3. Many /bin/sh Bourne shells are broken, especially with quoting, use
explicit means for testing for such things as empty strings. Use 'if test
"x$foo" != x', NOT 'if test "$foo" != ""'. The
same goes for comparing
variable that might be empty, 'if test "x$foo" == "x$bar"',
NOT 'if test
"$foo" == "$bar"'. ...also use 'test', not [].
So, a programmer has gotten good enough at C to want to make their code
portable. This was a lot of work. Now let's say they know how to write
portable sh scripts. That's even harder (more arcane) than learning how to
program C well, but let's argue that it has applications outside autotools
and let's assume that they put in this huge effort as well. Now you say
they need to learn M4, which is even more arcane than sh scripting, and is
not widely used anywhere but autotools and sendmail, where (sendmail) it
is the #1 thing driving people to adopt other MTAs with other
configuration systems (ones not relying on M4)? No. No no no. M4 in this
context is not a solution, it is a problem. It is the cure that is worse
than the disease.
You got good at autotools? Good for you. I think it's unreasonable to
require a majority of C programmers to do so. All we need is some header
files that tell us what libraries / features are on the target system, and
some make macros that tell us what tools are on the host system. There is
absolutely no reason that that should require learning 2 other programming
languages.
Alexey