Next: , Previous: Complete, Up: Examples   [Contents][Index]


3.2 ¸ÅŵŪ¤Ê¥×¥í¥°¥é¥à

GNU hello¤Ï¡¤¸Å ŵŪñ½ã¤µ¤ÈÍ»ÄÌÀ­¤Çͭ̾¤Ç¤¹¡¥¤³¤Î¥»¥¯¥·¥ç¥ó¤Ç¤Ï¡¤Automake¤òGNU Hello ¥Ñ¥Ã¥±¡¼¥¸¤Ë»ÈÍѤ¹¤ëÊýË¡¤ò¼¨¤·¤Þ¤¹¡¥°Ê²¼¤ÎÎã¤Ï¡¤GNU Hello¤ÎºÇ¶á¤Î¥Ù¡¼ ¥¿¥Ð¡¼¥¸¥ç¥ó¤«¤é¤Î¤â¤Î¤Ç¤¹¤¬¡¤Ãøºî¸¢¤Î¥³¥á¥ó¥ÈÁ´ÂÎ¤ÈÆ±Íͤˡ¤´ÉÍý¼ÔÀìÍÑ ¤Î¤¹¤Ù¤Æ¤Î¥³¡¼¥É¤¬¼è¤ê½ü¤«¤ì¤Æ¤¤¤Þ¤¹¡¥

¤â¤Á¤í¤ó¡¤GNU Hello¤ÏÅÁÅýŪ¤ÊÆó¹Ô¤è¤ê´öʬŤ¯¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥GNU Hello¤Ï ¹ñºÝ²½¤µ¤ì¤Æ¤¤¤Æ¡¤¥ª¥×¥·¥ç¥ó½èÍý¤ò¤·¤Æ¡¤¤½¤·¤Æ¥Þ¥Ë¥å¥¢¥ë¤È¥Æ¥¹¥È¥¹¥¤¡¼ ¥È¤â¤¢¤ê¤Þ¤¹¡¥

GNU Hello¤Îconfigure.ac¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥Ãí°Õ ¤·¤Æ²¼¤µ¤¤: Îã¤Ë¤¢¤ëAC_INIT¤ÈAM_INIT_AUTOMAKE¤Î¸Æ½Ð¤Ï¡¤ ¿ä¾©¤µ¤ì¤Ê¤¤¹½Ê¸¤Ç¤¹¡¥¸½ºß¤Î¼êË¡¤Ï¡¤Public macros¤Î AM_INIT_AUTOMAKE¤Îµ­½Ò¤ò»²¾È¤·¤Æ²¼¤µ¤¤¡¥

dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/hello.c)
AM_INIT_AUTOMAKE(hello, 1.3.11)
AM_CONFIG_HEADER(config.h)

dnl Set of available languages.
ALL_LINGUAS="de fr es ko nl no pl pt sl sv"

dnl Checks for programs.
AC_PROG_CC
AC_ISC_POSIX

dnl Checks for libraries.

dnl Checks for header files.
AC_STDC_HEADERS
AC_HAVE_HEADERS(string.h fcntl.h sys/file.h sys/param.h)

dnl Checks for library functions.
AC_FUNC_ALLOCA

dnl Check for st_blksize in struct stat
AC_ST_BLKSIZE

dnl internationalization macros
AM_GNU_GETTEXT
AC_OUTPUT([Makefile doc/Makefile intl/Makefile po/Makefile.in \
           src/Makefile tests/Makefile tests/hello],
   [chmod +x tests/hello])

AM_’¥Þ¥¯¥í¤Ï¡¤Automake(¤¢¤ë¤¤¤ÏGettext¥é¥¤¥Ö¥é¥ê)¤Ë¤è¤Ã¤ÆÄ󶡤µ ¤ì¤Æ¤¤¤Þ¤¹¡¥»Ä¤ê¤Ïɸ½àŪ¤ÊAutoconf¥Þ¥¯¥í¤Ç¤¹¡¥

ºÇ¾å°Ì¤ÎMakefile.am¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥

EXTRA_DIST = BUGS ChangeLog.O
SUBDIRS = doc intl po src tests

¸æÍ÷¤Î¤è¤¦¤Ë¡¤¤³¤³¤Ç¤Î»Å»ö¤Ï¤¹¤Ù¤Æ¥µ¥Ö¥Ç¥£¥ì¥¯¥È¥ê¤Ç¼ÂºÝ¤Ë¼Â¹Ô¤µ¤ì¤Þ¤¹¡¥

po¤Èintl¥Ç¥£¥ì¥¯¥È¥ê¤Ï¡¤gettextize¤ò»ÈÍѤ¹¤ë¤³¤È ¤Ç¼«Æ°Åª¤ËÀ¸À®¤µ¤ì¤Þ¤¹¡¥¤½¤ì¤é¤Ë¤Ä¤¤¤Æ¤Ï¤³¤³¤Ç½Ò¤Ù¤Þ¤»¤ó¡¥

doc/Makefile.am¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥

info_TEXINFOS = hello.texi
hello_TEXINFOS = gpl.texi

¤³¤ì¤Ç¡¤GNU Hello¥Þ¥Ë¥å¥¢¥ë¤ò¥Ó¥ë¥É¤·¤Æ¡¤¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¡¤¤½¤·¤ÆÇÛÉÛ ¤¹¤ë¤Ë¤Ï½½Ê¬¤Ç¤¹¡¥

tests/Makefile.am¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥

TESTS = hello
EXTRA_DIST = hello.in testdata

hello¥¹¥¯¥ê¥×¥È¤Ï¡¤configure¤Ë¤è¤êÀ¸À®¤µ¤ì¡¤¤½¤ì¤Ï¥Æ¥¹¥È ¥±¡¼¥¹¤Î¤ß¤ÇÀ¸À®¤µ¤ì¤Þ¤¹¡¥make check¤Ç¤³¤Î¥Æ¥¹¥È¤ò¼Â¹Ô¤·¤Þ¤¹¡¥

ºÇ¸å¤Ïsrc¡¿Makefile.am¤Ç¡¤¼ÂºÝ¤Ë¤¹¤Ù¤Æ¤Î»Å»ö¤¬¹Ô¤Ê¤ï¤ì¤ë¾ì½ê¤Ç ¤¹¡¥

bin_PROGRAMS = hello
hello_SOURCES = hello.c version.c getopt.c getopt1.c getopt.h system.h
hello_LDADD = $(INTLLIBS) $(ALLOCA)
localedir = $(datadir)/locale
INCLUDES = -I../intl -DLOCALEDIR=\"$(localedir)\"