CONFIGURE.ACR(5)

NAME
configure.acr - configuration script for ACR

DESCRIPTION
configure.acr is the target file to be parsed by ACR to generate the final "configure" script for end-users.

Inside this file you must set some directives to indicate ACR what kind of languages are planning to be used in the package, libraries to be checked, variables to be exported, name for the package, version, vendor information, and other stuff.

The recommended order of checks and commands is:
•   check operating system
•   check paths
•   check required languages
•   libraries/includes/modules checks, dies
•   pkg-config checks: version/assignations
•   final conditionals and dies
•   generation of .acr files with SUBDIRS and SUBST_FILES

SYNTAX
The configure.acr file is a word-based configuration file for ACR.

This means that each word must be separated with space, tab or new-lines. The ';' separator to terminate strings must be also a separated word.

Each word is called "keyword", there are these types:

Miscelaneous-Keys:
    { } ;

Command:
    ( Any active keyword )

Conditionals
    [ IF IFEQ IFEQVAL IFAND IFOR ] [IFNOT-[EQ|EQVAL|AND|OR]

Argument:
    ( keywords after commands or conditionals )

Comment:
    Block comments: /* */ Line commentsr: // Note that one-word comments has been deprecated. But you can use line comments //

Definitions:
    ( Global or local variable assignations. '=' '+=' '?=' ) From the version 0.4, acr supports the normal variable assignation syntax format. Now you can use things like that: VAR = VALUE ;
    •   "=" resets the value of the target variable.
    •   "+=" appends the value to the target variable.
    •   "?=" checks if the target variable is yet defined, and does not overwrites its content.
    •   "<-" the target value gets the content of the variable defined in the text content.

Substitutions:
    You can use SUBDIRS to define a list of directories to find Makefile.acr files to generate Makefile peers. You can also use this for files instead of directories by giving a name, it'll parse the 'filename.acr' to generate the 'filename' file.

    You can use ##MARK## to define a range of code to show or hide depending on the value of the MARK variable (0 or 1). (This is available from acr 0.5)

Comments:

    You can add comments to your configure.acr files by using:

    // comment \\ or ## comment ##

Note that you can create multi-line comments using these tags, because everything in this file is word-based.

You are allowed to use one-word-comments, it's simple. Just prefix the desired word with a hash '#' sign. for example: #FOO PKGNAME FOO

Some keyword commands can be suffixed by '!'. This tells ACR to stop execution of the configure script when the condition fails, instead of adding one DIE for each check at the end of script.

For more information read acr(1) about the use of the '-d' flag.

PACKAGE INFORMATION

PKGNAME <pkgname>
    Sets the target package name to be used.

VERSION <version>
    Sets the version number for the target package.

CONTACT <name> ; <email>
    Sets the name of the developer and the contact mail to be used. This will export CONTANT_NAME and CONTACT_MAIL variables.

DESCRIPTION <text> ;
    Give a description for the package, this text is shown with `./configure -r` and it's also used for the pkgconfig files

ACR DIRECTIVES
This directives are used internally by ACR to work in a different way.

USE_BACKUP
    This command has been deprecated for design purposes (good programmers doesn't need to use this command) in acr 0.5, and will no longer exist in 0.6.

    The backup command allows you to ensure that no files will be lost by calling the ./configure script or make clean. This option interacts with SUBST_FILES and Makefile generation with -m. Read doc/backup for more info.

EXPORT_DEFINED|ED
    Tells ACR to only export defined variables. This causes OUTPUT_H to export only the variables with value != "" and != "0". And OUTPUT_SH to export the != "" variables.

INCLUDE <module-name>
    Includes an external acr file from ${datadir}/acr/modules/ or in the current directory. called 'module-name.acr'. No nested includes allowed.

NOP No Operation Keyword. This keyword is only for debugging purposes and it's used internally by ACR. This command does nothing.

LANGUAGES
All language keywords exports a HAVE_LANG_xxx variable with value 0 or 1. You can append '!' to the language keyword to specify that the target language is required, and script must die when the desired language is not supported on the target machine.

LANG_C[!]
    ACR will look for a C compiler and sets CC, depends for implicit LANG_CPP.

LANG_V[!]
    ACR will look for the V compiler and sets V and VFLAGS.

LANG_CC[!] LANG_CXX[!]
    Adds C++ support and sets CXX environ.

LANG_BASH[!]
    Tell acr to look for a bash on the target system.

LANG_TCL[!]
    Looks for tcl version and libraries. Exports TCL_VERSION, TCL_CFLAGS and TCL_LDFLAGS to the environment. This will also adds the --with-tcl-basedir to allow end-user to set the basedir for the TCL installation.

LANG_PERL[!]
    Looks for perl installed on current system

LANG_JAVA[!]
    Looks for javac in the current system. Exports JAVAC environ and adds --with-jikes and --with-kjc flags.

LANG_VALA[!]
    Looks for valac in PATH. Exports VALAC environ and adds --with-valac

LANG_PYTHON[!]
    Finds a python executable on the current system. Exports PYTHON and HAVE_LANG_PYTHON.

LANG_RUBY[!]
    Finds a ruby executable on the current system. Exports RUBY, HAVE_LANG_RUBY and RUBY_VERSION.

EXTERNAL SOFTWARE

USE_DL
    Sets LIBS_DL to -ldl or "" depending on the target system.

USE_LIBTOOL
    Checks for the libtool command and exports LIBTOOL_CC, LIBTOOL_CXX and some useful commands for your makefiles: LIBTOOL_SHARED, LIBTOOL_STATIC and LIBTOOL_INSTALL.

USE_PKGCONFIG | USE_PKGCONFIG!
    Check for pkg-config or pkgconf program in PATH. Required for the PKGCFG directive

USE_ICONV
    Sets LIBS_ICONV to -liconv or "" depending if iconv functions are implemented into the LibC or not.

USE_PTHREAD
    Checks for pthread on the current system and sets PTHREAD_LIBS to the proper value.

USE_PERL_THREADS
    Checks if the target system have perl build with threads support.

USE_X11
    Adds --with-x11base and --without-x flags and sets X11BASE to the proper value.

USE_TK
    Add --with-tk-libdir flag and sets TK_CFLAGS, TK_VERSION

USE_GMAKE
    Looks for a GNU make tool installed on the target system and sets MAKE properly.

USE_JNI
    Uses JAVA_HOME to check and define the JCFLAGS for building java native interface programs.

CHECKS

REQUIRE_ACR_VERSION version
    Checks if acr version is greater or equal than the given version.

CHECK varname <<EOF <..src..> <<EOF
    Executes the <..code..> delimited by the <eof> keyword and marks varname as the target variable to be defined by the script. (see examples/check.acr fmi)

CHKEXE,CHECK_EXEC[!] varname program ;
    Execute program and set varname = !!!$?

CHKPRG, CHECK_PROGRAM[!] varname program
    Finds the program in ${PATH} and sets variable environment to the properly path. Since 0.5 CHKPRG exports HAVE_varname variable and checks first if VARNAME is a valid executable file.

CHKINC, CHECK_INCLUDE[!] include.h[+include2.h[+include3.h]]
    Checks if 'include.h' is found in the current system. Requires LANG_C and sets HAVE_include_H environment to 0 or 1 (for example: HAVE_STDIO_H)

CHKFLG, CHECK_CFLAGS[!] varname cflags ;
    Checks if the selected C compiler supports the given CFLAGS (Useful for -std=c99 and such)

CHKFNC, CHECK_FUNCTION[!] libname function
    Checks if the desired function exists in libname and sets HAVE_FUNCTION to 0 or 1 (for example: HAVE_PRINTF)

CHKSYM, CHECK_SYMBOL[!] libname symbol
    Checks if the given symbol exists in libname and sets HAVE_SYMBOL to 0 or 1 (for example: HAVE_ENVIRON)

CHKDECL, CHECK_DECLARATION[!] include constant
    Checks if the given constant is defined in the specified include file

CHKLIB, CHECK_LIBRARY[!] libname
    Checks if the desired library exists on the system and sets HAVE_LIB_libname to 0 or 1 (for example: HAVE_LIB_SDL)

ENDIAN|CHECK_ENDIAN
    Checks for the host endianness to be big or little. It'll export BYTEORDER=1234 on little endian hosts or 4321 for big endian ones. Also exports LIL_ENDIAN and BIG_ENDIAN with 0 xor 1 values.

SIZEOF var ;
    Checks for the size of the desired variable and saves it into the variable SIZEOF_VARNAME. Requires LANG_C.

CHECK_PERL_MODULE[!],CHK_PM[!] perl_module
    Checks if the target system have installed the selected perl module. and sets HAVE_PM_xxx to 0 or 1 (for example: HAVE_PM_NETDNS)

CHECK_PYTHON_MODULE[!],CHK_PY[!] python_module
    Checks if the system have installed the desired python module and sets HAVE_PY_xxx to 0 or 1.

CHECK_RUBY_EXTENSION[!],CHK_RU[] ruby_extension
    Checks if the system have installed the desired ruby extension and sets HAVE_RU_xxx to 0 or 1.

CHECK_CLASSPATH[!],CHK_CP[!] java_package_name
    Checks if CLASSPATH contains the desired package (for example org.gnu.gtk). Exports the HAVE_CLASSPATH_(java-pkg-name) to 0 or 1.

CHKUSR[!] username

CHKGRP[!] group
    Checks the existence of the target user or group on the system.

DEFINITIONS
Sets are processed at the beginning of the configure script.

= varname value ;
    Sets the value of varname to value.

+= varname value ;
    Appends the content of varname with value.

?= varname value ;
    If the content of varname is empty then assign the value to it.

EXEC[!] variable command to execute ;
    Sets variable to the output (stdout) of the desired command to be executed.

CHECK_VERSION,CHKVER[!] pkgname version
    Checks if pkgname (software package registered into pkg-config database) is <= version. And crashes execution if it fails. It exports the HAVE_(pkgname)_VERSION_(version) variable to 0 or 1.

PKGCFG,PKGCONFIG[+] cflags_var ldflags_var pkg-config-name
    Use pkg-config to get the CFLAGS and LDFLAGS. If the '+' character is at the end of the command then ACR will concatenate the value of cflags_var and ldflags_var instead of overwrite the old value. This keyword exports also a variable called HAVE_PKGFG_{pkg-config-name|filtered} with 0 or 1 values.

PKGCFG_DO pcfile libname requires ;
    Generate a pkg-config file for the given library name and make it depend on the word separated list of pkg-config requires. Optional overrides can be exported with PKGCFG_LIBS_DEFAULT, PKGCFG_LIBS_PRIVATE_DEFAULT, PKGCFG_CFLAGS_DEFAULT or the per-library PKGCFG_<LIBNAME>_{LIBS,LIBS_PRIVATE,CFLAGS} variables, where <LIBNAME> is the filtered upper-case form of libname.

VALAPKG[!] pkgname
    Checks if a Vala package is available for VALAC

CONDITIONALS
All conditionals require an 'op'(operation) argument that defines how to set the setvarname. Valid operations are: '=' '+=' '?='.

You can also nest conditionals inside other conditionals using the '{' '}' keywords. That allows you to concatenate a group of conditionals and definitions inside it. The nested conditionals support is available from acr 0.4.

IF|IFNOT varname { ..code.. }
    If the value of varname is equal to '1'(IF) or '0'(IFNOT) then ACR will set the 'setvarname' to the 'value'.

IFNULL|IFNOTNULL varname { ..code.. }
    If the value of varname is equal to null (IFNULL) or not (IFNOTNULL)' then ACR will set the 'setvarname' to the 'value'.

IFEQ|IFNOTEQ varname value; { ..code.. }
    If the content of varname is equal(IFEQ) or different(IFNOTEQ) to value then setvarname to the value setvalue.

IFEQVAL|IFNOTEQVAL varname varname2 { ..code.. }
    DEPRECATED: This keyword has been deprecated in 0.5 and will disappear in 0.6. Use IFEQ FOO $FOO ; instead. If the content of varname is equal(IFEQ) or different(IFNOTEQ) to the content of varname2 and finally sets setvarname to the value setvalue.

IFAND|IFNOTAND var1 var2 { ..code.. }
    If var1 and var2 are equal to 1(IFAND) or 0(IFNOTAND) then setvar to setvalue.

IFAND|IFNOTAND var1 var2 { ..code.. }
    If var1 and var2 are equal to 1(IFAND) or 0(IFNOTAND) then setvar to setvalue.

IFOR|IFNOTOR var1 var2 { ..code.. }
    If var1 and var2 are equal to 1(IFAND) or 0(IFNOTAND) then setvar to setvalue.

ECHO string ;
    Prints a string to stderr.

DIEIF|DIE variable die_message ;

DIEIFNOT|DIENOT variable die_message ;

DIENOW die_message ;
    If the value of variable is equal to 1(DIE) or 0(DIENOT) then stop processing the ./configure script and shows the die message. Short keyword names (DIE, DIENOT) are going to be deprecated.

FLAGS

ARG_IGNORE flagname
    Ignore specific configure arg (do nothing)

ARG_[WITH|WITHOUT|ENABLE|DISABLE] varname[=value] flagname description ;
    Adds a with/without/enable/disable flag to the final configure script. For example:

    ARG_WITH MPLAYER=/usr/bin/mplayer mplayer Sets path for the mplayer ;

    If no =value given, ARG_* will act as a boolean variable (0 for WITH and ENABLE, and 1 for WITHOUT and DISABLE). If the =value is given ACR will allow the user to construct flags like --with-foo=bar.

    The 'value' argument must be:
    •   "" (empty) : if you want to create a true/false flag (ex: --without-x, --enable-ssl)
    •   "=" : if you want that the user adds his own value. (ex: --with-x11base=/usr/pkg/XFree86/ )
    •   "something" : if you want to set the value to "something" when the flag is passed. (ex: --with-kjc -> sets JAVAC to kjc)

OUTPUT GENERATION

OUTPUT_H file1 file2 ;
    Generates the file1 file2 with C-like syntax defining all exported variables with #defines.

OUTPUT_SH file1 file2 ;
    Generates the selected files like OUTPUT_H does but using a shellscript syntax.

SUBST|SUBST_FILES file1 file2 ;
    Replaces all @ENVWORDS@ with the exported variable proper value. Before doing the changes ACR copies the original file to file.orig. Remember to mv file.orig file on make clean target. This option is not recommended to use, because the problem you may experience by using acr+vcs systems. I recommend you to use SUBDIRS instead. (acr>=0.4)

SUBDIRS dir1 dir2 file1 file2 ;
    Finds Makefile.acr files in requested directories to generate the proper Makefile. acr>=0.4 allows to use SUBDIRS against files or directories, without difference. It's backward compatible. If the target name is a directory then acr will look for 'Makefile.acr', if not, it will get the filename.acr and will generate a new file keeping the name, but chopping the end '.acr'. You can also use the '%' keyword to match all Makefile.acr files under the current directory. This could be useful in case of changes on the directory structure of your project.

SUBCONF dir1 dir2 ;
    Calls recursively other ./configure scripts found in dir1, dir2 passing the root ./configure flag arguments.

REPORT var1 var2 ;
    Shows the varname and varvalue of the desired variables at the end of the final ./configure script. (useful for debugging)

EXAMPLES

Simple example:

        PKGNAME helloworld
        CONTACT my real name ; my@email.com
        VERSION 1.0
        LANG_C!
        SUBDIRS . src ;

Some more checks

        PKGNAME gtkapp
        VERSION 1.0
        LANG_C!
        PKGCFG+ CFLAGS LDFLAGS gtk+-2.0
        SUBDIRS . src ;
        REPORT HAVE_PKGCFG_GTK_2_0 CFLAGS LDFLAGS ;

SEE ALSO
acr(1) amr(1) acr-cat(1) configure.amr(5)

AUTHOR
pancake <pancake@nopcode.org>

http://nopcode.org/wk.php/Acr