first i write the a program like
#include <stdio.h>
#include <stdlib.h>
typedef struct a{
int a;
int b[];
}type_a;
// first i disagree the code will running ok , but it turn out i wrong
int main(void){
type_a * p = (type_a *) malloc(sizeof(type_a) + 100 * sizoef(int));
free(p);
return 0;
}
like first :
i run the autoscan to make the configure.scan
then cp configure.scan to configure.in
then,change the configure.in
like that:
AC_PREREQ([2.68]) AC_INIT([hello], [1.0], [zengfanbo2009@gmail.com]) AC_CONFIG_MACRO_DIR([m4]) AC_CANONICAL_SYSTEM AM_CONFIG_HEADER(config.h) AC_CONFIG_SRCDIR([hello.c]) #AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([1.9]) #turn on the libtoolize , to make the program easy , person view AM_PROG_LIBTOOL # Checks for programs. AC_PROG_CC AC_HEADER_STDC AC_C_BIGENDIAN # Checks for libraries. # Checks for header files. AC_CHECK_HEADERS([stdlib.h,stdio.h]) # Checks for typedefs, structures, and compiler characteristics. # Checks for library functions. AC_FUNC_MALLOC AC_OUTPUT(Makefile) AC_MSG_RESULT([====================================================]) AC_MSG_RESULT([]) AC_MSG_RESULT([]) AC_MSG_RESULT([====================================================])
so , run the aclocal ,haha , it turn out run ok
so, let run the autoconf then ,ok
run autoheader then , check if output config.in.h
then , we use the libtoolize , we will find kindness tip
add ACLOCAL_AMFLAGS = -I m4
we should write the makefile.am
ACLOCAL_AMFLAGS = -I m4 bin_PROGRAMS=hello hello_SOURCES=hello.c
write all of them, then save
using command automake --add-missing , you will find miss some file like AUTHORS NEWS README ChangeLog
haha , we run the command automake --add-missing , the Makefile.in is outputing.
#notice , I am fooled. run the automake several time , but no add the missing file.
so, let run ./configure , then we will find the makefile is in the fold.
so , they work properly
浙公网安备 33010602011771号