Next: , Previous: Writing Test Programs, Up: Writing Tests   [Contents][Index]


6.3 ¥×¥ê¥×¥í¥»¥Ã¥µ¤Î¼Â¹Ô

¤¤¤¯¤Ä¤«¤Î¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤Ç¥×¥ê¥×¥í¥»¥Ã¥µ¤ò¼Â¹Ô¤¹¤ëɬÍפ¬¤¢¤ë¤È¤­¤â¤¢¤ê¤Þ ¤¹¡¥Ä̾ï¤Ï¥×¥í¥¸¥§¥¯¥È¤ò¥³¥ó¥Ñ¥¤¥ë¤¹¤ëɬÍפ¬¤¢¤ê¡¤¥×¥ê¥×¥í¥»¥Ã¥µ ¤ò¼Â¹Ô¤¹¤ëɬÍפ¬¤¢¤ë¤³¤È¤ÏÌÇ¿¤Ë̵¤¤¤Î¤Ç¡¤¤½¤¦¤¹¤ë¤³¤È¤Ï¡¤ÉáÄ̤ϰ­ ¤¤¹Í¤¨¤Ç¤¹¡¥¤½¤Î¤¿¤á¡¤¤­¤Ã¤È¥×¥ê¥×¥í¥»¥Ã¥µ¤Ç¤Ï¤Ê¤¯¥³¥ó¥Ñ¥¤¥é¤ò¼Â¹Ô¤·¤¿ ¤¤¤È»×¤¦¤Ç¤·¤ç¤¦¡¥°Â°×¤ÊÆ»¤ò¤¿¤É¤ëͶÏǤ˵դé¤Ã¤Æ¤¯¤À¤µ¤¤¡¥

¤½¤ì¤Ë¤â¤«¤«¤ï¤é¤º¡¤¥×¥ê¥×¥í¥»¥Ã¥µ¤ò¼Â¹Ô¤¹¤ëɬÍפ¬¤¢¤ë¾ì¹ç¡¤ AC_PREPROC_IFELSE¤ò»ÈÍѤ·¤Æ¤¯¤À¤µ¤¤¡¥

Macro: AC_PREPROC_IFELSE (input, [action-if-true], [action-if-false])

input¤Ç¸½ºß¤Î¸À¸ì(see Language Choice)¤Î¥×¥ê¥×¥í¥»¥Ã¥µ¤ò¼Â¹Ô¤·¡¤ À®¸ù¤·¤¿¤é¥·¥§¥ë¥³¥Þ¥ó¥Éaction-if-true¤ò¼Â¹Ô¤·¡¤¤½¤¦¤Ç¤Ê¤±¤ì¤Ð action-if-false¤ò¼Â¹Ô¤·¤Þ¤¹¡¥input¤ÏAC_LANG_PROGRAM¤È ¤½¤ÎÃç´Ö¤ÇºîÀ®¤¹¤ë¤³¤È¤¬²Äǽ¤Ç¤¹¡¥

¤³¤Î¥Þ¥¯¥í¤ÏCPPFLAGS¤ò»ÈÍѤ·¤Þ¤¹¤¬¡¤-g¡¤-O¤Ê¤É ¤Ï¿¤¯¤ÎC¥×¥ê¥×¥í¥»¥Ã¥µ¤ÇÍ­¸ú¤Ê¥ª¥×¥·¥ç¥ó¤Ç¤Ï¤Ê¤¤¤Î¤Ç¡¤CFLAGS ¤Ï »ÈÍѤ·¤Þ¤»¤ó¡¥

ͽ´ü¤»¤Ì°Û¾ï½ªÎ»¤Ï¡¤Ä̾ïAC_MSG_FAILURE¤ÇÊó¹ð¤·¤Þ¤¹¡¥

Î㤨¤Ð°Ê²¼¤Î¤è¤¦¤Ë¤·¤Þ¤¹¡¥

AC_INIT(Autoconf Documentation, 2.59, bug-autoconf@gnu.org)
AC_DEFINE([HELLO_WORLD], ["Hello, World\n"])
AC_PREPROC_IFELSE(
   [AC_LANG_PROGRAM([[const char hw[] = "Hello, World\n";]],
                    [[fputs (hw, stdout);]])],
   [AC_MSG_RESULT([OK])],
   [AC_MSG_FAILURE([unexpected preprocessor failure])])

·ë²Ì¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡¥

checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
OK

¥Þ¥¯¥íAC_TRY_CPP(see Obsolete Macros)¤Ï¡¤ AC_PREPROC_IFELSE¤ÎÌòÌܤò²Ì¤¿¤¹¤¿¤á¤Ë»ÈÍѤµ¤ì¤Æ¤¤¤Þ¤·¤¿¤¬¡¤¤½¤Î°ú ¿ô¤òÆó½Å¤Î°úÍÑÉä¤Ç°Ï¤ó¤Ç¤¤¤ë¤Î¤Ç¡¤Àº¹ª¤Ê¥½¡¼¥¹¤Ç»ÈÍѤ¹¤ë¤³¤È¤¬ÉÔ²Äǽ¤Ç¤· ¤¿¡¥¥Þ¥¯¥íAC_TRY_CPP¤ÎAC_PREPROC_IFELSE¤ò¤è¤¦¤Ê¸Å¤¤»È¤¤Êý ¤ò¼è¤ê½ü¤¯¤³¤È¤â¿ä¾©¤·¤Þ¤¹¤¬¡¤ºÇ½é¤Ë¥³¥ó¥Ñ¥¤¥é¤Ç¤Ï¤Ê¤¯¥×¥ê¥×¥í¥»¥Ã ¥µ¤ò¼Â¹Ô¤¹¤ëɬÍפ¬¤¢¤ë¤Î¤«¤ò³Î¤«¤á¤ë¤³¤È¤ò¿ä¾©¤·¤Þ¤¹¡¥

Macro: AC_EGREP_HEADER (pattern, header-file, action-if-found, [action-if-not-found])

¥·¥¹¥Æ¥à¥Ø¥Ã¥À¥Õ¥¡¥¤¥ëheader-file¤Ç¤Î¥×¥ê¥×¥í¥»¥Ã¥µ¤Î¼Â¹Ô¤Ç¤Î½ÐÎÏ ¤¬³ÈÄ¥Àµµ¬É½¸½¤Îpattern¤Ë¥Þ¥Ã¥Á¤¹¤ë¾ì¹ç¡¤¥·¥§¥ë¥³¥Þ¥ó¥É action-if-found¤ò¼Â¹Ô¤·¡¤¤½¤ì°Ê³°¤Ç¤Ïaction-if-not-found¤ò¼Â ¹Ô¤·¤Þ¤¹¡¥

Macro: AC_EGREP_CPP (pattern, program, [action-if-found], [action-if-not-found])

program¤¬C¤äC++¥×¥í¥°¥é¥à¤Î¥Æ¥­¥¹¥È¤Ç¡¤¤½¤Î¤Ê¤«¤Ç¤Ï¥·¥§¥ëÊÑ¿ô¡¤¥Ð¥Ã ¥¯¥¯¥ª¡¼¥È¡¤¤½¤·¤Æ¥Ð¥Ã¥¯¥¹¥é¥Ã¥·¥å¤ÎÂåÆþ¤¬¼Â¹Ô¤µ¤ì¤¿¤â¤Î¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡¥ program¤Ç¤Î¥×¥ê¥×¥í¥»¥Ã¥µ¤Î¼Â¹Ô¤Ç¤Î½ÐÎϤ¬³ÈÄ¥Àµµ¬É½¸½¤Î pattern¤Ë¥Þ¥Ã¥Á¤¹¤ë¾ì¹ç¡¤¥·¥§¥ë¥³¥Þ¥ó¥Éaction-if-found¤ò¼Â¹Ô ¤·¡¤¤½¤ì°Ê³°¤Ç¤Ïaction-if-not-found¤ò¼Â¹Ô¤·¤Þ¤¹¡¥