[i=s] ±¾Ìû×îºóÓÉ yehg01 ÓÚ 2011-5-2 15:42 ±à¼ [/i]
ϵͳ£ºubuntu 10.04 ¹òÇë¸ßÊÖ½â»ó£¡
1¡¢Ä¿±ê£ºÊ¹ÓÃautoconfºÍautomake±àÒëhello.c
#include stdio.h
int main(int argc,char** argv)
{
printf("Hello,GNU!");
return 0;
}
2¡¢´íÎóÃèÊö£ºautomakeÍê³ÉºóÔËÐÐ./configureʱ·¢Éú´íÎó£º
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
./configure: line 4425: Makefile: command not found
3¡¢ÃüÁî¹ý³Ì£ºautoscan¡úconfigure.in
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.67])
AC_INIT(hello.c)
AC_CONFIG_SRCDIR([hello.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE(hello,1.0)
# Checks for programs.
AC_PROG_CC
# Checks for library functions.
AC_OUTPUT (Makefile)
AC_CONFIG_FILES([Makefile])
¡úaclocal¡úautoconf¡úautoheader¡úMakefile.am
AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS=hello
hello_SOURCES=hello.c
¡úautomake --add-missing¡úls
aclocal.m4 config.h config.status depcomp Makefile.am stamp-h1
autom4te.cache config.h.in configure hello.c Makefile.in
autoscan.log config.log configure.in install-sh missing
¡ú./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
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 gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
./configure: line 4425: Makefile: command not found
***** configureµÚ4425ÐдúÂ룺
4421****if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
4422**** { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
4423****$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
4424****fi
4425****(Makefile)
4426****ac_config_files="$ac_config_files Makefile"


yehg01 ÓÚ 2011-05-02 15:41:30·¢±í:
[i=s] ±¾Ìû×îºóÓÉ yehg01 ÓÚ 2011-5-2 15:44 ±à¼ [/i]
¾¹ýÁ˰ëÌìµÄ²âÊÔºÍÅŲ飬ÖÕÓÚÍê³ÉÄ¿±êÁË£¬Ë³±ã°Ñ±Ê¼ÇÌù³öÀ´É¹É¹£º:0wszxc
ÀÛËÀÁË£¡£¡£¡
²ËÄñдµÄautoconfºÍautomakeʹÓÃÈëÃűʼÇ
²âÊÔϵͳ£ºFreeBSD m-net.arbornet.org 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #1
$ ssh m-net.arbornet.net
###***Èç¹ûÄãÔÚm-net.arbornet.netûÓÐLinuxÕË»§£¬¿ÉÒÔÊäÈënewuser½¨Á¢Ò»¸ö
Ò»¡¢±àдһ¸öhello.cµÄÔ´´úÂëÎĵµ£º
$ mkdir ~/abc
$ cd ~/abc
$ touch hello.c
$ vi hello.c
# include "stdio.h"
int main(int argc, char** argv)
{
printf("Hello, GNU! ");
return 0;
}
¶þ¡¢ Éú³Éconfigure.scan²¢±à¼Îªconfigure.in£º
$ autoscan ¡ú cp configure.scan configure.in¡úvi configure.in ¡ú
###***ÔʼµÄconfigure.inÎĵµ£º
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61) ¡û
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS) ¡û
AC_CONFIG_SRCDIR([hello.c])
AC_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_OUTPUT ¡û
----------------------------------------------------------------------------------------------------------------------
###***Ð޸ĺóµÄconfigure.inÎĵµ£º
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#AC_PREREQ(2.61) ¡ú
###***ʹÓÃaclocal19ÃüÁî»á±¨´í£º
###***configure.in:4: error: Autoconf version 2.61 or higher is required
###***configure.in:4: the top level
###***autom4te259: /usr/local/bin/gm4 failed with exit status: 63
###***aclocal19: autom4te259 failed with exit status: 63
###***½«ÉÏÃæµÄ´úÂë×¢Ê͵ô¼´¿ÉÅųý´íÎó
AC_INIT(hello.c)
AC_CONFIG_SRCDIR([hello.c])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_FILES([Makefile])
AM_INIT_AUTOMAKE(hello, 1.0)
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_OUTPUT £¨Makefile£©
Èý¡¢ ʹÓÃaclocalºÍautoconfÉú³Éaclocal.m4ºÍconfigureÎļþ£º
$ aclocal119 ¡ú autoconf ¡útouch Makefile.am ¡ú
# -*- Makefile.am -*-
AUTOMAKE_OPTIONS= foreign
bin_PROGRAMS= hello
hello_SOURCES= hello.c
ËÄ¡¢ ʹÓÃautoheader
$ autoheader ¡ú
Îå¡¢ ʹÓÃautomakeÉú³ÉMakefile.inÎļþ£º
$ automake19 --add-missing
Áù¡¢ ʹÓÃconfigureÉú³É×îÖÕMakefile£º
$ ./configure --prefix=/home/XXX/hello ¡ú
checking for gcc... gcc
checking for C compiler default output file name... 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 ISO C89... none needed
configure: creating ./config.status
config.status: creating config.h
./configure: line 3448: Makefile: command not found
###***configure³öÏÖ´íÎ󣬰´ÌáʾÐÞ¸ÄconfigureÎļþ£º
$ vi ./configure ¡ú
###*** ÔʼµÄconfigureÎĵµÄÚÈÝ£º
###*** 3444
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
###*** 3445
# would make configure fail if this is the last instruction.
###*** 3446
$ac_cs_success || { (exit 1); exit 1; }
###*** 3447
fi
###*** 3448
(Makefile) ¡û
--------------------------------------------------------------------------------------------------------------------------
###***Ð޸ĺóµÄconfigureÎĵµÄÚÈÝ£º
###*** 3448
# £¨Makefile£©
###*** ½«3448ÐеĴúÂë×¢Ê͵ô¼´¿É¡£
Æß¡¢ ×îÖÕmakeǰÓÃls¼ì²éÎļþ£º
$ ls ¡ú
Makefile config.h configure.scan
Makefile.am config.h.in depcomp
Makefile.in config.log hello.c
aclocal.m4 config.status install-sh
autom4te.cache configure missing
autoscan-2.61.log configure.in stamp-h1
°Ë¡¢ ¿ªÊ¼±àÒë²¢ÔËÐвâÊÔ£º
$ Make
$ Make install
$ ~/hello/bin/hello
Hello, GNU! [XXXX@m-net ~/abc]$
¾Å¡¢ ²Î¿¼ÎÄÏ×¼°±¸×¢ÊÂÏ
1¡¢¡¶gcc¡· £¬freeMiÔÚhttp://blog.csdn.netµÄ²©¿Í£¬·¢²¼ÓÚ2005Äê12ÔÂ04ÈÕ£»
2¡¢¡¶Àý½â autoconf ºÍ automake Éú³É Makefile Îļþ¡·£¬http://www.ibm.com£¬·¢²¼ÓÚ2006 Äê 9 Ô 21 ÈÕ£»
3¡¢¡¶Autoconf/Automake¹¤¾ß×é¼ò½é¡·£¬ÈýÌßÂøÍ·ÔÚhttp://blog.163.comµÄ²©¿Í£¬·¢²¼ÓÚ2009Äê11ÔÂ9ÈÕ¡£
***¹ØÓÚÊÖ¹¤ÐÞ¸Äconfigure.inÎļþ£¬×¢Ê͵ô´úÂëAC_PREREQ(2.61)ºÍconfigureÎļþÖУ¬×¢Ê͵ôµÚ3448ÐÐÄÚÈݵÄ×ö·¨£¬
±¾ÈË»³ÒÉ¿ÉÄÜÓÐÈ¡Çɳɹ¦µÄ³É·Ö£¬Òò´ËÈç¹ûÓиßÊÖÖªµÀÓиüÕý¹æ¸ü¿ÆÑ§µÄ½â¾ö°ì·¨£¬»¹ÇëÁô¸ö»Ø¸´ËµÃ÷һϣ¬²»Ê¤¸Ðл£¡