3 ms·
Since some here are suggesting to just use `uname -s` as an autoconf replacement. I thought I'd provide some data for that. The Git project is a very good showc
by avar 16y ago
Since some here are suggesting to just use `uname -s` as an autoconf
replacement. I thought I'd provide some data for that. The Git project
is a very good showcase, because it can do both.
Git can optionally use autoconf. To do this you can run make configure
&& ./configure which'll use this configure.ac file to generate the
configure script: http://github.com/git/git/blob/pu/configure.ac#L1 http://github.com/git/git/blob/pu/configure.ac#L1
Autoconf will then write out a config.mak file, which is generated
from this template: http://github.com/git/git/blob/pu/config.mak.in#L1 http://github.com/git/git/blob/pu/config.mak.in#L1
That's where autoconf's involvement ends. All it's doing is turning
simple macros like this:
# Define NO_GETTEXT if you don't have libintl.h
AC_CHECK_HEADER([libintl.h],
[NO_GETTEXT=],
[NO_GETTEXT=YesPlease])
AC_SUBST(NO_GETTEXT)
Into this:
NO_GETTEXT=
Or, if libintl.h doesn't exist:
NO_GETTEXT=YesPlease
Which you would otherwise need to specify manually as arguments to the
Makefile when building the program:
http://github.com/git/git/blob/pu/Makefile#L37 http://github.com/git/git/blob/pu/Makefile#L37, after checking if you
have libintl.h on your system or not.
Autoconf can certainly get hairy, but in most cases using it is a lot
easier than not doing it. Consider this definition:
AC_CHECK_LIB([curl], [curl_global_init],
[NO_CURL=],
[NO_CURL=YesPlease])
That's doing a lot of work checking if there's a libcurl on your
system, and making sure it has a curl_global_init function.
Also note that the autotools are more than just autoconf. You can
stop here, but you can also generate your makefiles with automake, and
create your libraries with libtool.
- maw 16y agoAll but certainly unrelated, but using constructs like NO_FOO=YesPlease is a wretched idea. On the bright side, there aren't no triple negatives neither.