## @id $Id: ax_init_standard_project.m4 31 2015-05-05 15:06:08Z marc $ ## 1 2 3 4 5 6 7 8 ## 45678901234567890123456789012345678901234567890123456789012345678901234567890 # define least version number from subversion's revision number: # it is taken modulo 256 due to a bug on Apple's MacOSX m4_define(x_version, m4_esyscmd_s( SVN_REVISION="ERROR-UNDEFINED-REVISION-to-be-built-in-subdirectory-of-svn-checkout" for path in . .. ../..; do if svn info $path 2>&1 > /dev/null; then SVN_REVISION=$(LANG= svn info $path | sed -n 's/Last Changed Rev: //p') (cd $path && svn2cl) break; fi done # Mac does not support LEAST > 255 echo $ECHO_N x_major.$((x_minor+$SVN_REVISION/256)).$(($SVN_REVISION%256)) )) ## bugreport mail address is taken from in first line of AUTHORS m4_define(x_bugreport, m4_esyscmd_s( head -1 AUTHORS | \ sed -n 's,.*<\([-_.a-z0-9A-Z]*@[-_.a-z0-9A-Z]*\)>.*,\1,gp' )) m4_include(ax_check_qt.m4) AC_ALIAS([AC_DEFINE_DIR], [AX_DEFINE_DIR]) AC_DEFUN([AX_DEFINE_DIR], [ prefix_NONE= exec_prefix_NONE= test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn dnl refers to ${prefix}. Thus we have to use `eval' twice. eval ax_define_dir="\"[$]$2\"" eval ax_define_dir="\"$ax_define_dir\"" AC_SUBST($1, "$ax_define_dir") AC_DEFINE_UNQUOTED($1, "$ax_define_dir", [$3]) test "$prefix_NONE" && prefix=NONE test "$exec_prefix_NONE" && exec_prefix=NONE ]) # add target dependencies to an existing makefile.in # - parameters: # $1 = existing target # $2 = new dependency for that target # $3 = filename of makefile.in AC_DEFUN([AX_ADD_MAKEFILE_TARGET_DEP], [ sh_add_makefile_target_dep() { sed -i ':a;/^'${1}':.*\\$/{N;s/\\\n//;ta};s/^'${1}':.*$/& '${2}'/' "${srcdir}/${3}" if ! egrep -q "${1}:.* ${2}" "${srcdir}/${3}"; then echo "${1}: ${2}" >> "${srcdir}/${3}" fi } sh_add_makefile_target_dep "$1" "$2" "$3" if test "$1" != ".PHONY"; then sh_add_makefile_target_dep ".PHONY" "$2" "$3" fi ]) # Same as AC_SUBST, but adds -Dname="value" option to CPPFLAGS # - parameters: # $1 = variable name AC_DEFUN([AX_SUBST], [ AC_SUBST([$1]) tmp_var=$(echo "${$1}" | awk 1 ORS='\\n') tmp_var=${tmp_var//\"/\\\"} tmp_var=${tmp_var//\'/\'\"\'\"\'} tmp_var=${tmp_var//#/\\#} AM_CPPFLAGS+=" '-D$1=\"${tmp_var}\"'" AC_SUBST(AM_CPPFLAGS) ]) # must be called on the right position in configure.ac # # configure.ac must start with: # # m4_define(x_package_name, YOUR_PACKAGE_NAME) # project's name # m4_define(x_major, MAJOR_NUMBER) # project's major version # m4_define(x_minor, MINOR_NUMBER) # project's minor version # m4_include(ax_init_standard_project.m4) # AC_INIT(x_package_name, x_major.x_minor.x_least, x_bugreport, x_package_name) # AM_INIT_AUTOMAKE([1.9 tar-pax]) # AX_INIT_STANDARD_PROJECT # # you change nothing but: YOUR_PACKAGE_NAME, MAJOR_NUMBER, MINOR_NUMBER # # configures the basic environment AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ AM_CPPFLAGS+=" '-DMAKE_STRING(X)=\#X' '-DNAMESPACE=${PACKAGE_NAME}'" AX_SUBST(NUMBERS) AX_SUBST(HOME) README=$(tail -n +3 README) AX_SUBST(README) _AM_SUBST_NOTMAKE([README]) DESCRIPTION=$(head -1 README) AX_SUBST(DESCRIPTION) _AM_SUBST_NOTMAKE([DESCRIPTION]) AUTHOR=$(head -1 AUTHORS) AX_SUBST(AUTHOR) _AM_SUBST_NOTMAKE([AUTHOR]) DISTRO=$(lsb_release -sc) AX_SUBST(DISTRO) BUILD_NUMBER=${BUILD_NUMBER:-1} AX_SUBST(BUILD_NUMBER) BUILD_DATE=$(date +"%Y-%m-%d %H:%M %Z") AX_SUBST(BUILD_DATE) if test -f "${PROJECT_NAME}-logo.png"; then PROJECT_LOGO="${PROJECT_NAME}-logo.png" fi AX_SUBST(PROJECT_LOGO) if test -f "${PROJECT_NAME}-icon.png"; then PROJECT_ICON="${PROJECT_NAME}-icon.png" fi AX_SUBST(PROJECT_ICON) AC_CONFIG_FILES([makefile]) AX_ADD_MAKEFILE_TARGET_DEP([clean-am], [clean-standard-project-targets], [makefile.in]) AX_ADD_MAKEFILE_TARGET_DEP([distclean-am], [distclean-standard-project-targets], [makefile.in]) AX_ADD_MAKEFILE_TARGET_DEP([maintainer-clean-am], [maintainer-clean-standard-project-targets], [makefile.in]) test -f makefile.in && cat >> makefile.in <> src/makefile.in <> test/makefile.in <> examples/makefile.in <> src/makefile.in <> makefile.in <> makefile.in <> doc/makefile.in <