automake使用实例

本文介绍了automake的使用,包括如何配置.so库的安装路径,解决非/usr/lib目录安装问题,以及添加缺失的libtoolize配置。内容涵盖configure.ac和Makefile.am文件的编辑,涉及API接口的automake配置。
摘要由CSDN通过智能技术生成

.so

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])
AC_CONFIG_SRCDIR([sm2.h])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE(libalgor1.so,1.0)
# Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB
# Checks for libraries.

# Checks for header files.
AC_CHECK_HEADERS([memory.h stdlib.h string.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
AC_PROG_LIBTOOL

# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([memset])

AC_OUTPUT(Makefile)

Makefile.am

AUTOMAKE_OPTIONS=foreign
lib_LTLIBRARIES=libalgor1.la
libalgor1_la_SOURCES=\
    algapi.c    \
    hash.c      \
    hmac.c      \
    sm2.c       \
    sm3.c       \
    alg1_mix.c \
LDFLAGS= -fPIC -shared -L/iwncomm/ac/target/lib -ldl -lpthread
INCLUDES=-I/iwncomm/ac/src/include  -I/iwncomm/ac/src/include/openssl -I/iwncomm/ac/src/openssl/include
#moduledir=/iwncomm/ac/target/lib

其它

1.如果需要安装到非/usr/lib目录,需要在configure时设置
–pre-fix=/libdir
2.执行automake –add-missing时

configure.in:18: required file `build/ltmain.sh' not found

解决方案(libtoolize配置即可):

$libtoolize --version
-libtoolize (GNU libtool) 1.4.2
.....
$libtoolize --automake --copy --debug --force

.lib

configure.ac

#                                               -*- 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([logApi.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE(liblogApi.a,1.0)
# Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB
# Checks for libraries.

# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h syslog.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_CHECK_FUNCS([memset select socket strerror])
AC_OUTPUT(Makefile)

Makefile.am

AUTOMAKE_OPTIONS=foreign
lib_LIBRARIES= liblogApi.a
liblogApi_a_SOURCES=logApi.c
INCLUDES=-I/iwncomm/ac/src/include/
CFLAGS=-Wall -Wconversion
libdir=/iwncomm/ac/target/lib

api

configure.ac

#                                               -*- 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([iwn_db_wtpImageTable.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE(db,1.0)
# Checks for programs.
AC_PROG_CC

# Checks for libraries.
# FIXME: Replace `main' with a function in `-loamsIf':
AC_CHECK_LIB([oamsIf], [main])
# FIXME: Replace `main' with a function in `-lodbc':
AC_CHECK_LIB([odbc], [main])
# FIXME: Replace `main' with a function in `-lpthread':
AC_CHECK_LIB([pthread], [main])

# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([memset strstr])

AC_OUTPUT(Makefile)

Makefile.am

# Makefile.in generated by automake 1.11.3 from Makefile.am.
# Makefile.  Generated from Makefile.in by configure.

# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.





pkgdatadir = $(datadir)/db
pkgincludedir = $(includedir)/db
pkglibdir = $(libdir)/db
pkglibexecdir = $(libexecdir)/db
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
bin_PROGRAMS = iwndb$(EXEEXT)
subdir = .
DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
	$(top_srcdir)/configure COPYING INSTALL depcomp install-sh \
	missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
	$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
 configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(1datadir)" \
	"$(DESTDIR)$(2datadir)" "$(DESTDIR)$(3datadir)" \
	"$(DESTDIR)$(4datadir)"
PROGRAMS = $(bin_PROGRAMS)
am_iwndb_OBJECTS = iwn_oams_main.$(OBJEXT) \
	iwn_db_interfaceManagerTable.$(OBJEXT) \
	iwn_db_dnsCfgTable.$(OBJEXT) iwn_db_asCfgTable.$(OBJEXT) \
	iwn_db_userBlackListTable.$(OBJEXT) iwn_db_main.$(OBJEXT) \
	iwn_db_securitySceneTable.$(OBJEXT) \
	iwn_db_usermanager.$(OBJEXT) iwn_db_common.$(OBJEXT) \
	iwn_db_msgSendTable.$(OBJEXT) iwn_db_ssidTable.$(OBJEXT) \
	iwn_db_wtpGroupTable.$(OBJEXT) iwn_db_dhcpPoolTable.$(OBJEXT) \
	iwn_db_radioConfigTable.$(OBJEXT) iwn_db_syslogtable.$(OBJEXT) \
	iwn_db_wtpImageTable.$(OBJEXT) \
	iwn_db_dhcpSrvFlagTable.$(OBJEXT) \
	iwn_db_rekeyCfgTable.$(OBJEXT) iwn_db_syslogCfgTable.$(OBJEXT) \
	iwn_db_wtpListTable.$(OBJEXT) iwn_db_ipRouteTable.$(OBJEXT) \
	iwn_db_rightManage.$(OBJEXT) iwn_db_wtpWlanTable.$(OBJEXT) \
	iwn_db_onlineUsrListTable.$(OBJEXT) \
	iwn_db_onlineWtpListTable.$(OBJEXT) \
	iwn_db_vendorTable.$(OBJEXT) iwn_db_dhcpLeaseTable.$(OBJEXT) \
	iwn_db_wtpOperateActionTable.$(OBJEXT) \
	iwn_db_wtpOperateResultTable.$(OBJEXT) \
	iwn_db_wtpStaticAddressTable.$(OBJEXT)
iwndb_OBJECTS = $(am_iwndb_OBJECTS)
iwndb_DEPENDENCIES =
DEFAULT_INCLUDES = -I.
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(iwndb_SOURCES)
DIST_SOURCES = $(iwndb_SOURCES)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
    *) f=$$p;; \
  esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
  for p in $$list; do echo "$$p $$p"; done | \
  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值