この記事ではOpenBSDでlibconfigというCライブラリをビルドするときに必要になったAutotoolsの使い方について紹介します。
対象のバージョンは次の通り:
uname -a
# OpenBSD obsd.local 7.9 GENERIC.MP#449 amd64
手順
libconfig自体のビルドは次のようにできました。要点はAutoconfとAutomakeのバージョンを指定することです。
doas pkg_add autoconf-2.72p0 automake-1.18.1 libtool
AUTOCONF_VERSION=2.72 AUTOMAKE_VERSION=1.18 autoreconf -if
./configure
make clean
make
より詳しく
autoreconfツールはAutoconfのパッケージに含まれています。そのためこのパッケージのインストールが必要です。
doas pkg_add autoconf
# quirks-7.194 signed on 2026-07-04T22:17:51Z
# Ambiguous: choose package for autoconf
# a 0: <None>
# 1: autoconf-2.13p4
# [...]
# 18: autoconf-2.72p0
# Your choice: 18
# autoconf-2.72p0:metaauto-1.0p4: ok
# autoconf-2.72p0: ok
この状態でautoreconfを呼び出すと、AUTOCONF_VERSION環境変数が必要と言われます。
autoreconf -if
# Provide an AUTOCONF_VERSION environment variable, please
これにしたがい設定して実行すると次のエラーになります。追加でAutomakeのバージョンの指定も必要とわかります。またaclocalはAutomakeのパッケージに含まれるため、インストールが必要です。
AUTOCONF_VERSION=2.72 autoreconf -if
# Provide an AUTOMAKE_VERSION environment variable, please
# autoreconf-2.72: error: aclocal failed with exit status: 127
Automakeをインストールします。
doas pkg_add automake
# quirks-7.194 signed on 2026-07-04T22:17:51Z
# Ambiguous: choose package for automake
# a 0: <None>
# 1: automake-1.4.6p5
# [...]
# 12: automake-1.18.1
# Your choice: 12
# automake-1.18.1: ok
Automakeのバージョン設定を追記して再実行すると、以下のエラーになります。ビルドでlibtoolizeを要求しており、これはlibtoolパッケージに含まれます。
AUTOCONF_VERSION=2.72 AUTOMAKE_VERSION=1.18 autoreconf -if
# Can't exec "libtoolize": No such file or directory at /usr/local/share/autoconf-2.72/Autom4te/FileUtils.pm line 318.
# autoreconf-2.72: error: libtoolize failed with exit status: 2
libtoolをインストールします。
doas pkg_add libtool
# quirks-7.194 signed on 2026-07-04T22:17:51Z
# libtool-2.4.2p3: ok
これで構成が通るようになりました!
AUTOCONF_VERSION=2.72 AUTOMAKE_VERSION=1.18 autoreconf -if
# libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `aux-build'.
# libtoolize: copying file `aux-build/ltmain.sh'
# libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
# libtoolize: copying file `m4/libtool.m4'
# libtoolize: copying file `m4/ltoptions.m4'
# libtoolize: copying file `m4/ltsugar.m4'
# libtoolize: copying file `m4/ltversion.m4'
# libtoolize: copying file `m4/lt~obsolete.m4'
./configure
# [...]
使用許諾
Copyright (C) 2026 gemmaro
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without any warranty.