一步步实现windows版ijkplayer系列文章之一——Windows10平台编译ffmpeg 4.0.2,生成ffplay

一步步实现windows版ijkplayer系列文章之二——Ijkplayer播放器源码分析之音视频输出——视频篇

一步步实现windows版ijkplayer系列文章之三——Ijkplayer播放器源码分析之音视频输出——音频篇

一步步实现windows版ijkplayer系列文章之四——windows下编译ijkplyer版ffmpeg

一步步实现windows版ijkplayer系列文章之五——使用automake一步步生成makefile

一步步实现windows版ijkplayer系列文章之六——SDL2源码分析之OpenGL ES在windows上的渲染过程

一步步实现windows版ijkplayer系列文章之七——终结篇(附源码)

一步步实现windows版ijkplayer系列文章之五——使用automake一步步生成makefile

上一篇文章我们把ffmpeg库成功在windows平台下编译成dll了,ffmpeg的编译方案是跨平台的,直接使用它的现成的configure文件用于生成makefile,但是ijkplayer的另外两个库ijkplayer和ijksdl只支持android和IOS平台,因此在windows平台的编译需要自己实现,我们打算使用automake,先熟悉一下,从网络搜罗了两个例子,在自己的环境里面一步步成功生成了makefile,其中有些坑,现在将这些步骤记录下来。

准备环境

平台 windows mingw

autoconf 版本:2.68

automake版本:1.11.1

一个简单例子

创建文件夹hello,进入文件夹后编辑一个简单的hello.c文件

#include <stdio.h>
int main(int argc, char** argv)
{
printf("Hello, automake!\n");
return 0;
}

手动创建Makefile.am,內容如下:

AUTOMAKE_OPTIONS= foreign
bin_PROGRAMS= hello hello_SOURCES= hello.c

执行autoscan,目录变化如下:

$ ls -l
total 2
drwxr-xr-x 2 zexu Administrators 0 Oct 20 12:14 autom4te.cache
-rw-r--r-- 1 zexu Administrators 0 Oct 20 12:14 autoscan-2.68.log
-rw-r--r-- 1 zexu Administrators 495 Oct 20 12:14 configure.scan
-rw-r--r-- 1 zexu Administrators 100 Oct 18 07:46 hello.c

看一下configure.scan的内容:

#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script. AC_PREREQ([2.68])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
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_CONFIG_FILES([Makefile])
AC_OUTPUT

将此文件重命名为configure.in,执行autolocal,autoconf,生成configure:

$ ls -lh
total 111K
drwxr-xr-x 2 zexu Administrators 0 Oct 20 12:29 autom4te.cache
-rw-r--r-- 1 zexu Administrators 0 Oct 20 12:14 autoscan-2.68.log
-rwxr-xr-x 1 zexu Administrators 109K Oct 20 12:29 configure
-rw-r--r-- 1 zexu Administrators 495 Oct 20 12:14 configure.in
-rw-r--r-- 1 zexu Administrators 100 Oct 18 07:46 hello.c

执行如下automake命令:

$ automake --add-missing
configure.in: no proper invocation of AM_INIT_AUTOMAKE was found.
configure.in: You should verify that configure.in invokes AM_INIT_AUTOMAKE,
configure.in: that aclocal.m4 is present in the top-level directory,
configure.in: and that aclocal.m4 was recently regenerated (using aclocal).
configure.in:7: required file `config.h.in' not found
Makefile.am: installing `./depcomp'
/mingw/share/automake-1.11/am/depend2.am: am__fastdepCC does not appear in AM_CONDITIONAL
/mingw/share/automake-1.11/am/depend2.am: The usual way to define `am__fastdepCC' is to add `AC_PROG_CC'
/mingw/share/automake-1.11/am/depend2.am: to `configure.in' and run `aclocal' and `autoconf' again.
/mingw/share/automake-1.11/am/depend2.am: AMDEP does not appear in AM_CONDITIONAL
/mingw/share/automake-1.11/am/depend2.am: The usual way to define `AMDEP' is to add one of the compiler tests
/mingw/share/automake-1.11/am/depend2.am: AC_PROG_CC, AC_PROG_CXX, AC_PROG_CXX, AC_PROG_OBJC,
/mingw/share/automake-1.11/am/depend2.am: AM_PROG_AS, AM_PROG_GCJ, AM_PROG_UPC
/mingw/share/automake-1.11/am/depend2.am: to `configure.in' and run `aclocal' and `autoconf' again.

看到出错了,在configure.in中添加如下信息:

AM_INIT_AUTOMAKE([-Wall -Werror foreign])

再次执行aclocal,autoconf和automake

zexu@DESKTOP-R4T030U ~/devel/hello
$ aclocal zexu@DESKTOP-R4T030U ~/devel/hello
$ autoconf $ automake --add-missing
configure.in:9: installing `./install-sh'
configure.in:9: installing `./missing'
configure.in:7: required file `config.h.in' not found

执行autoheader,生成头文件后再次automake,最后成功,可见没有任何无误提示。

zexu@DESKTOP-R4T030U ~/devel/hello
$ automake --add-missing

最后执行configure,生成Makefile文件:

zexu@DESKTOP-R4T030U ~/devel/hello
$ ./configure

执行make,生成hello.exe:

zexu@DESKTOP-R4T030U ~/devel/hello
$ make
make all-am
make[1]: Entering directory `/home/zexu/devel/hello'
gcc -DHAVE_CONFIG_H -I. -g -O2 -MT hello.o -MD -MP -MF .deps/hello.Tpo -c -o hello.o hello.c
mv -f .deps/hello.Tpo .deps/hello.Po
gcc -g -O2 -o hello.exe hello.o
make[1]: Leaving directory `/home/zexu/devel/hello' zexu@DESKTOP-R4T030U ~/devel/hello
$ ls
Makefile aclocal.m4 config.h config.status depcomp hello.o stamp-h1
Makefile.am autom4te.cache config.h.in configure hello.c install-sh
Makefile.in autoscan-2.68.log config.log configure.in hello.exe missing

一个复杂一些的例子

这个例子使用了libtool,我把代码提交到了github,先把其clone下来:

git clone https://github.com/harlanc/automake_examples.git

进入example_2,先看一下目录结构:

$ ls -R
.:
Makefile.am configure.in error.c error.h lib main.c replace ./lib:
Makefile.am source.c source.h ./replace:
Makefile.am basename.c dummy.c

执行下面的命令:

zexu@DESKTOP-R4T030U ~/automake_examples/example_2
$ aclocal zexu@DESKTOP-R4T030U ~/automake_examples/example_2
$ autoheader zexu@DESKTOP-R4T030U ~/automake_examples/example_2
$ automake --add-missing --copy
configure.in:11: installing `./config.guess'
configure.in:11: installing `./config.sub'
configure.in:8: installing `./install-sh'
configure.in:11: required file `./ltmain.sh' not found
configure.in:8: installing `./missing'
lib/Makefile.am: installing `./depcomp'

看到有一个错误,执行下面的语句:

$libtoolize --automake --copy --debug --force

在此执行automake:

$ automake --add-missing --copy

最后成功,执行autoconf和configure:

zexu@DESKTOP-R4T030U ~/automake_examples/example_2
$ autoconf zexu@DESKTOP-R4T030U ~/automake_examples/example_2
$ ./configure

最后生成Makefile文件,执行make,生成可执行文件:

$ make

最后成功。

参考

Convenience-Libraries

轻轻松松生成makefile

一步步实现windows版ijkplayer系列文章之五——使用automake生成makefile的更多相关文章

  1. 一步步实现windows版ijkplayer系列文章之七——终结篇(附源码)

    一步步实现windows版ijkplayer系列文章之一--Windows10平台编译ffmpeg 4.0.2,生成ffplay 一步步实现windows版ijkplayer系列文章之二--Ijkpl ...

  2. 一步步实现windows版ijkplayer系列文章之六——SDL2源码分析之OpenGL ES在windows上的渲染过程

    一步步实现windows版ijkplayer系列文章之一--Windows10平台编译ffmpeg 4.0.2,生成ffplay 一步步实现windows版ijkplayer系列文章之二--Ijkpl ...

  3. 一步步实现windows版ijkplayer系列文章之四——windows下编译ijkplyer版ffmpeg

    一步步实现windows版ijkplayer系列文章之一--Windows10平台编译ffmpeg 4.0.2,生成ffplay 一步步实现windows版ijkplayer系列文章之二--Ijkpl ...

  4. 一步步实现windows版ijkplayer系列文章之三——Ijkplayer播放器源码分析之音视频输出——音频篇

    一步步实现windows版ijkplayer系列文章之一--Windows10平台编译ffmpeg 4.0.2,生成ffplay 一步步实现windows版ijkplayer系列文章之二--Ijkpl ...

  5. 一步步实现windows版ijkplayer系列文章之二——Ijkplayer播放器源码分析之音视频输出——视频篇

    一步步实现windows版ijkplayer系列文章之一--Windows10平台编译ffmpeg 4.0.2,生成ffplay 一步步实现windows版ijkplayer系列文章之二--Ijkpl ...

  6. 一步步实现windows版ijkplayer系列文章之一——Windows10平台编译ffmpeg 4.0.2,生成ffplay

    一步步实现windows版ijkplayer系列文章之一--Windows10平台编译ffmpeg 4.0.2,生成ffplay 一步步实现windows版ijkplayer系列文章之二--Ijkpl ...

  7. Windows Shell Extension 系列文章

    Windows Shell Extension 系列文章 http://www.codeproject.com/Articles/512956/NET-Shell-Extensions-Shell-C ...

  8. Windows Azure Platform 系列文章目录

    Windows Azure Platform (一) 云计算的出现 Windows Azure Platform (二) 云计算的分类和服务层次 Windows Azure Platform (三) ...

  9. .NET Core 微服务学习与实践系列文章目录索引(2019版)

    参考网址: https://archy.blog.csdn.net/article/details/103659692 2018年,我开始学习和实践.NET Core,并开始了微服务的学习,以及通过各 ...

随机推荐

  1. git 28原则

    一.流程 $ git init # 创建一个新的仓库 sublime 编写文本,不要使用win自带文本编辑器 $ git add file1 # 将文件添加到暂存区 $ git add file2 $ ...

  2. CF1114F Please, another Queries on Array?(线段树,数论,欧拉函数,状态压缩)

    这题我在考场上也是想出了正解的……但是没调出来. 题目链接:CF原网 题目大意:给一个长度为 $n$ 的序列 $a$,$q$ 个操作:区间乘 $x$,求区间乘积的欧拉函数模 $10^9+7$ 的值. ...

  3. A1096. Consecutive Factors

    Among all the factors of a positive integer N, there may exist several consecutive numbers. For exam ...

  4. [luogu1655][小朋友的球]

    luogu1665 思路 一道第二类斯特兰数的模板题.只不过需要写个高精. f[i][j]表示前i个球放到j个盒子里的方案数.第i个球可以单独一个盒子,所以f[i][j]+=f[i-1][j-1].还 ...

  5. [hihocoder1509][异或排序]

    hihocoder1509 思路 对于每两个数,从二进制的高位到低位考虑,发现,若前面一个的当前位是1,后面一个的当前位置是0,那么s的当前位置必须是1.反之,若前面是0,后面是1,那么s的当前位置必 ...

  6. java中的内存空间 堆和栈

        认识堆与栈 栈与堆都是Java用来在Ram中存放数据的地方.与C++不同,Java自动管理栈和堆,程序员不能直接地设置栈或堆.Java的堆是一个运行时数据区,类的对象从中分配空间.这些对象通过 ...

  7. 文件操作(十二)——open,read,close,write,seek,truncate

    open函数 #!/usr/bin/env python #-*- coding:utf8 -*- f = open('xxx','r',encoding='utf-8') data = f.read ...

  8. word公式的使用

    插入->公式->插入新公式 优点:可以表示一些特殊符号,而且word公式的字更好看. 方法: 1.Shift+Enter,公式转入下一行 2.选择内嵌或显示 3.选择性粘贴->粘贴成 ...

  9. 聊一聊docker存储驱动

    目录 镜像的分层特性 容器读写层的工作原理 写时复制 用时配置 Docker存储驱动 AUFS OverlayFS Devicemapper 常用存储驱动对比 AUFS VS OverlayFS Ov ...

  10. https和server-status配置案例

    https和server-status配置案例 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.https协议 我们知道http协议是明文的,所以,你的数据发送不管是请求报文(r ...