- 编辑hello.c
#include <stdio.h>
void colorprint(char* str, char* color)
{
printf("\033[%sm",color);
printf("%s\n",str);
printf("\033[0m");
}
void debug(char* str)
{
colorprint(str, "34");
}
void warning(char* str)
{
colorprint(str, "33");
}
void info(char* str)
{
colorprint(str, "32");
}
void error(char* str)
{
colorprint(str, "31");
}
int main()
{
char* str = "hello world";
char* color = "0";
colorprint(str,color);
debug(str);
info(str);
warning(str);
error(str);
return 0;
}
- autoscan
- aclocal确定缺少的文件,将configure.scan重命名
- vim configure.ac
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AM_INIT_AUTOMAKE(hello,1.0)
AC_CONFIG_SRCDIR([hello.c])
AC_CONFIG_HEADERS([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_FUNC_ERROR_AT_LINE
AC_OUTPUT(Makefile)
- autoheader
- autoconf
- vim Makefile.am 文件内容如下
bin_PROGRAMS=hello
hello_SOURCES=hello.c
-
touch NEWS README AUTHORS ChangeLog
-
automake --add-missing
-
./configure
-
make
-
./hello