---
name: "configure.acr"
section: "5"
platform: "linux"
package: "acr"
version: "2.2.0-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/configure.acr"
---

# configure.acr(5)

configuration script for ACR

## 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)](/acr/1.md) 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

- 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 one 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)](/acr/1.md) [amr(1)](/amr/1.md) [acr-cat(1)](/acr-cat/1.md) [configure.amr(5)](/configure.amr/5.md)

## AUTHOR

pancake \<pancake@nopcode.org\>

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