Redhat下使用automake自动配置wxWidgets的makefile

前提:假设这个程序叫做vso

路径为:

\vso

\vso\src

\vso\test

下面的步骤只包含的源代码目录,如果创建test的makefile,类似。

1. cd \vso


   autoscan

2. mv configure.scan configure.in

3. vim configure.in

as:

---------------------------------


AC_PREREQ(2.59)

AC_INIT(vso, 0.0.1, sun.noon@gmail.com)

AC_CONFIG_SRCDIR([src/PlotWindow.cpp])

AC_CONFIG_HEADER([config.h])

AM_INIT_AUTOMAKE(vso,0.0.1)


# Checks for programs.

AC_PROG_CXX

AC_PROG_CC


# Checks for libraries.

AM_OPTIONS_WXCONFIG

reqwx=2.8.10

AM_PATH_WXCONFIG($reqwx, wxWin=1)


if test "$wxWin" != 1; then

AC_MSG_ERROR([

wxWidgets must be installed on your system.


Please check that wx-config is in path, the directory

where wxWidgets libraries are installed (returned by

'wx-config --libs' or 'wx-config --static --libs' command)

is in LD_LIBRARY_PATH or equivalent variable and

wxWidgets version is $reqwx or above.

])

fi


CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"

CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"

CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"

LIBS="$LIBS $WX_LIBS"


# Checks for header files.

AC_HEADER_STDC

AC_CHECK_HEADERS([limits.h stdlib.h string.h])


# Checks for typedefs, structures, and compiler characteristics.

AC_HEADER_STDBOOL

AC_C_CONST

AC_TYPE_SIZE_T


# Checks for library functions.

AC_FUNC_CLOSEDIR_VOID

AC_CHECK_FUNCS([sqrt])

AC_CONFIG_FILES([Makefile

src/Makefile])

AC_OUTPUT


----------------------------------

4. touch NEWS README ChangeLog AUTHORS

5. cd src

vim Makefile.am

as:

--------------

bin_PROGRAMS=vso

vso_SOURCES=a.h a.cpp b.h b.cpp c.h c.cpp

vso_LDADD = @LIBS@

vso_CXXFLAGS = @CXXFLAGS@

--------------

6. cd ..

vim Makefile.am

as:

--------------

AUTOMAKE_OPTIONS=foreign

SUBDIRS=src

--------------

7.

aclocal

autoheader

autoconf

automake --add-missing

8. Finished!!

usage:

./configure

make

enjoy it!

linux

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/23842.html