2014-12-21 14 views
-2

배포하려는 코드의 이식성 문제가 발생했습니다. 그렇지 않습니다. 필자가 보낸 Makefile은 사용자가 자신의 시스템 용 코드를 컴파일하고 최적화하기 전에 많은 수정 작업을 요구합니다. 이는 분명히 피하고 싶습니다. 나는 automake와 autoconf를 최근에 들여다 보았고 나의 시스템을위한 Makefile을 생성하기위한 configure 스크립트를 성공적으로 생성 할 수 있었다. 문제는 autoconf 나 automake가 설치되지 않은 머신이나 다른 버전의 머신에서는 작동하지 않을 수 있다는 것입니다. 그래서 모두 여기에 넣어 필요가 없습니다, 나는 간단한에 "Hello World"프로그램휴대용 코드 용 독립 실행 형 최소 구성 스크립트

에서는 hello.c

#include <iostream> 
using namespace std; 
int main(){ 
    cout << "Hello World" << endl; 
    return 0; 
} 

Makefile.am

bin_PROGRAMS=hello 
hello_SOURCES=hello.c 
이러한 결과를 복제 할 수있었습니다

그런 다음 autoscan을 실행합니다. 여기서 버전을 특별히 신경 쓰지 않아 configure.scanconfigure.ac으로 옮깁니다. 그럼 나는 automake를 실행한다. 그냥 완전성을 위해, 나는 이러한 오류를 얻을 :

touch NEWS README AUTHORS ChangeLog 
automake --add-missing 
add `AM_INIT_AUTOMAKE(hello, 1.0)` to configure.ac 
aclocal 
autoheader 
automake 

그리고 내가 할 수있는 유일한 오류가 automake는이 수를 좋아하지 않는다는 사실은 다음과 같습니다

configure.ac: error: no proper invocation of AM_INIT_AUTOMAKE was found. 
configure.ac: You should verify that configure.ac invokes AM_INIT_AUTOMAKE, 
configure.ac: that aclocal.m4 is present in the top-level directory, 
configure.ac: and that aclocal.m4 was recently regenerated (using aclocal) 
Makefile.am: error: required file './INSTALL' not found 
Makefile.am: 'automake --add-missing' can install 'INSTALL' 
Makefile.am: error: required file './NEWS' not found 
Makefile.am: error: required file './README' not found 
Makefile.am: error: required file './AUTHORS' not found 
Makefile.am: error: required file './ChangeLog' not found 
Makefile.am: error: required file './COPYING' not found 
Makefile.am: 'automake --add-missing' can install 'COPYING' 
configure.ac:7: error: required file 'config.h.in' not found 
Makefile.am: error: required file './depcomp' not found 
Makefile.am: 'automake --add-missing' can install 'depcomp' 
/usr/share/automake-1.13/am/depend2.am: error: am__fastdepCC does not appear in AM_CONDITIONAL 
/usr/share/automake-1.13/am/depend2.am: The usual way to define 'am__fastdepCC' is to add 'AC_PROG_CC' 
/usr/share/automake-1.13/am/depend2.am: to 'configure.ac' and run 'aclocal' and 'autoconf' again 
/usr/share/automake-1.13/am/depend2.am: error: AMDEP does not appear in AM_CONDITIONAL 
/usr/share/automake-1.13/am/depend2.am: The usual way to define 'AMDEP' is to add one of the compiler tests 
/usr/share/automake-1.13/am/depend2.am:  AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC, AC_PROG_OBJCXX, 
/usr/share/automake-1.13/am/depend2.am:  AM_PROG_AS, AM_PROG_GCJ, AM_PROG_UPC 
/usr/share/automake-1.13/am/depend2.am: to 'configure.ac' and run 'aclocal' and 'autoconf' again 

그래서 내가 오류를 수정 나는 AM_INIT_AUTOMAKE에 합격하는 논쟁 중 하나이다. 그런 다음 autoconfconfigure을 실행합니다. configure 스크립트는 그 일을하고 사용 가능한 makefile을 생성합니다. 이제 문제는 다른 시스템으로 이동하려고 할 때입니다.

나는 실행하는 구성 스크립트를 얻을 수 있습니다,하지만 내가 make

cd . && /bin/sh /home/dbwy/autohell/missing automake-1.13 --gnu 
/home/dbwy/autohell/missing: line 81: automake-1.13: command not found 
WARNING: 'automake-1.13' is missing on your system. 
     You should only need it if you modified 'Makefile.am' or 
     'configure.ac' or m4 files included by 'configure.ac'. 
     The 'automake' program is part of the GNU Automake package: 
     <http://www.gnu.org/software/automake> 
     It also requires GNU Autoconf, GNU m4 and Perl in order to run: 
     <http://www.gnu.org/software/autoconf> 
     <http://www.gnu.org/software/m4/> 
     <http://www.perl.org/> 
make: *** [Makefile.in] Error 1 

하려고 할 때 나는 다음과 같은 오류가 발생합니다 그래서 내 문제가 사실 인 것처럼 보인다 의해 생성 얻을 메이크 configure은 암시 적으로 automake에 종속됩니다. 과거에 필자가 필자가 필자는 필자가이 프로젝트를 생성하기 위해 autotools를 설치했기 때문에 항상 필요하지는 않다는 사실을 알고 있었기 때문에 어떻게 할 수 있을지 궁금합니다. 나는. 어떤 유닉스 계열 머신에 줄 수있는 configure 파일을 어떻게 만들 수 있고 automake 나 autoconf (필자는 Mac에서 autoconf로 문제가 생김) 없이도 설치할 수있다. 내 최종 목표는 누군가에게 소스 트리를 제공하고 스크립트를 구성하여 그들이 사용하는 컴파일러를 사용자 정의 할 수있게하는 것입니다.

+1

아마도겠습니까 자신에 선 AM_MAINTATINER_MODE([enable])을 추가하여 기본적으로 활성화 할 수 있습니다 autoconf와 automake를 사용하여 해결하고자하는 문제점을 설명하는 것이 더 좋을 것입니다. 아마도 우리는 더 나은 해결책을 제시 할 수 있을까요? –

+0

충분히 정교합니다. –

답변

0

이 문제는 관리자 모드가 활성화되었을 때 발생합니다. autotools는 기본적으로이 모드를 자동으로 활성화하므로 configure.acAM_MAINTAINER_MODE을 추가해야합니다. 자동 모드를 비활성화하고 옵션 구성에 따라 다시 켜 할 수 있습니다 AM_MAINTAINER_MODE 호출 :

./configure --enable-maintainer-mode

하나 또한이 configure.ac