Tag Archives: autoconf

Genuine fragment from RHEL spec file

# Unfuck gettextize.
grep -v '/dev/tty' < /usr/bin/gettextize > gettextize
chmod +x gettextize

# Patches affect Makefile.am and configure.ac, so rerun autotools.
./gettextize -f
autoreconf
autoconf

Personally I’ve never known a single pair of packages that cause more trouble than GNU gettext and autoconf. Probably together they have wasted thousands of years of human effort. Configure scripts probably cause extra power stations to be built.

17 Comments

Filed under Uncategorized

Why is gettext not an ordinary library?

Not being a regular library causes no end of constant build problems.

Like this crap because we did “gettextize” without doing “autoconf” (or vice versa):

make[2]: Entering directory `/builddir/build/BUILD/libguestfs-1.14.7/po'
*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version 0.17 but the autoconf macros are from gettext version 0.18

I just don’t get why gettext can’t be a regular, ordinary, plain library so we don’t have to constantly suffer from this sort of thing. There is surely no other library that needs to rewrite your entire build system.

8 Comments

Filed under Uncategorized

OCaml autoconf macros 1.1

_Zack did all the work for the new release of the autoconf macros to support OCaml projects.

There’s a build for Fedora already and you can read the manual page here.

Does anyone know a good way to format man pages to HTML, but without making them all sucky and proportional with randomly sized headers? I’d like them to look like they do when you type less foo.1, all in the same fixed-width font, with just bold and underline, and 72 columns wide naturally.

4 Comments

Filed under Uncategorized

Using autoconf for OCaml projects

Today Zack and I released the first version of ocaml-autoconf, which is a collection of OCaml-related autoconf macros. That package won’t tell you how to use autoconf though, and that is something that people wrongly regard as being incomprehensible or too hard to learn. In this tutorial you’ll see that you only need to create two files to start even a complex autoconf / OCaml project.

The download which goes along with this tutorial is: ocaml-autoconf-example-1.0.tar.gz

configure.ac

The first file controls autoconf. It is called configure.ac and looks like this. Notice the use of the OCaml autoconf macros which are documented in the ocaml.m4 manual page.

AC_INIT(ocaml-autoconf-example,1.0)
AM_INIT_AUTOMAKE

AC_PROG_CC

AC_PROG_OCAML
if test "$OCAMLC" = "no"; then
  AC_MSG_ERROR([You must install the OCaml compiler])
fi

AC_PROG_FINDLIB
if test "$OCAMLFIND" = "no"; then
  AC_MSG_ERROR([You must install OCaml findlib (the ocamlfind command)])
fi

AC_CHECK_OCAML_PKG([lablgtk2])
if test "$OCAML_PKG_lablgtk2" = "no"; then
  AC_MSG_ERROR([Please install OCaml findlib module 'lablgtk2'.])
fi

AC_CONFIG_FILES([Makefile])
AC_OUTPUT

Makefile.am

The second file controls automake. In fact we’re not really using automake’s capabilities, so our Makefile.am looks almost like an ordinary Makefile:

bin_SCRIPTS = gtk_test$(EXEEXT)

PACKAGES = -package lablgtk2
LIBS     = gtkInit.cmo -linkpkg

gtk_test$(EXEEXT): gtk_test.cmo
	$(OCAMLFIND) ocamlc $(PACKAGES) $(LIBS) $^ -o $@

.ml.cmo:
	ocamlfind ocamlc $(PACKAGES) -c $< -o $@

EXTRA_DIST = gtk_test.ml

CLEANFILES = *.cmi *.cmo $(bin_SCRIPTS) *~

m4/ocaml.m4

Those are the only two files you have to write, but you will also need to copy the OCaml autoconf macros (ocaml.m4) into an m4/ subdirectory:

mkdir m4
cp /usr/share/aclocal/ocaml.m4 m4/

autoreconf

Finally run autoreconf to run autoconf and automake and generate the ./configure script. Because automake defaults to assuming your project conforms to all the GNU coding standards, you probably want to add the automake --foreign flag, so:

AUTOMAKE='automake --foreign' autoreconf -i

Finished

Now you’re done. You can copy the gtk_test.ml program into this directory, and try:

./configure
make
make dist
make install

etc.

Download: ocaml-autoconf-example-1.0.tar.gz

Update #1: Zack’s blog posting about ocaml-autoconf

Update #2: See comments.

9 Comments

Filed under Uncategorized