多言語からCのライブラリのラッパーを実装するときに、構造体の大きさを知りたいということは、ちょくちょくあるとおもう。

configure.ac

AC_PREREQ(2.59)
AC_INIT([oreore], [0.1], [info@example.com])
AC_CONFIG_HEADERS([config.h])
AC_CHECK_SIZEOF([pthread_mutex_t], [], [#include <pthread.h>])
AC_SUBST([HOGE], [$ac_cv_sizeof_pthread_mutex_t])
AC_CONFIG_FILES([boke.txt])
AC_OUTPUT

config.h.in

#undef SIZEOF_PTHREAD_MUTEX_T

boke.txt.in

sizeof pthread_mutex_t is @HOGE@.

実行例

% autoconf
% ./configure
checking for gcc... no
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking size of pthread_mutex_t... 8
configure: creating ./config.status
config.status: creating boke.txt
config.status: creating config.h
% cat config.h
/* config.h.  Generated from config.h.in by configure.  */
#define SIZEOF_PTHREAD_MUTEX_T 8
% cat boke.txt
sizeof pthread_mutex_t is 8.
%

koie