CONFIGURE.ACR(5)
π configure.acr(5) π
File Formats Manual Β· section 5, bestie π
okay so this is the manual page for configure.acr(5) β the glow-up blueprint that ACR reads to spit out your final build script. it's giving main character energy for your whole build system. let's gooo β¨
πΈ NAME πΈ
configure.acr β configuration script for ACR
π DESCRIPTION π
configure.acr is the target file that ACR parses to generate the final configure script that your end-users actually run. no cap.
so inside this file you gotta set some directives to tell ACR what's up: which languages you're planning to use in the package, which libraries need checking, which variables get exported, the package name, the version, the vendor info, and all the other stuff. π
the recommended order of checks and commands is, and this is lowkey important:
- check operating system
- check paths
- check required languages
- libraries/includes/modules checks, dies
- pkg-config checks: version/assignations
- final conditionals and dies
- generation of
.acrfiles withSUBDIRSandSUBST_FILES
β¨ SYNTAX β¨
the configure.acr file is a word-based configuration file for ACR. periodt.
that means every word has to be separated by a space, a tab, or newlines. and listen β the ; separator used to terminate strings also has to be its own separated word. don't sneak it onto the end of a word, she will not read it. π«Ά
every one of these words is called a "keyword", and here are the 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 comments://. note that one-word comments have been deprecated, but you can still use line comments//Definitionsβ global or local variable assignations,=+=?=
π Definitions, in detail
from version 0.4, acr supports the normal variable assignation syntax format. now you can do stuff like:
VAR = VALUE ;
and the operators mean:
=β 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 overwrite 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 and generate Makefile peers. π―ββοΈ and you can use it for files instead of directories too β just give it a name and it'll parse the filename.acr to generate the filename file.
you can also use ##MARK## to define a range of code to show or hide depending on the value of the MARK variable (0 or 1). (this one is available from acr 0.5) π₯
π Comments
you can add comments to your configure.acr files by using:
// comment \\
or
## comment ##
and note that you can create multi-line comments using these tags, because everything in this file is word-based. iconic.
you're also allowed to use one-word-comments, it's simple. just prefix the desired word with a hash # sign. for example: #FOO PKGNAME FOO
β the ! thing
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 the script. dramatic, but effective π
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 theCONTANT_NAMEandCONTACT_MAILvariables.DESCRIPTION <text> ;β gives a description for the package. this text is shown with./configure -rand it's also used for the pkgconfig files.
π§ ACR DIRECTIVES π§
these directives are used internally by ACR to work in a different way. iykyk.
USE_BACKUPβ ok so this command has been deprecated for design purposes (good programmers doesn't need to use this command, their words not mine π) 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./configurescript ormake clean. this option interacts withSUBST_FILESandMakefilegeneration with-m. readdoc/backupfor more info.EXPORT_DEFINED|EDβ tells ACR to only export defined variables. this causesOUTPUT_Hto export only the variables with value!= ""and!= "0". andOUTPUT_SHto export the!= ""variables.INCLUDE <module-name>β includes an external acr file from${datadir}/acr/modules/or from the current directory, calledmodule-name.acr. no nested includes allowed, bestie, i don't make the rules. π«NOPβ No Operation Keyword. this keyword is only for debugging purposes and it's used internally by ACR. this command does nothing. literally nothing. slay, i guess π
π LANGUAGES π
all language keywords export a HAVE_LANG_xxx variable with value 0 or 1. and you can append ! to the language keyword to specify that the target language is required, meaning the script must die when the desired language isn't supported on the target machine. dramatic exit, we love to see it π
LANG_C[!]β ACR will look for a C compiler and setsCC, depends for implicitLANG_CPP.LANG_V[!]β ACR will look for the V compiler and setsVandVFLAGS.LANG_CC[!]LANG_CXX[!]β adds C++ support and setsCXXenviron.LANG_BASH[!]β tells acr to look for abashon the target system.LANG_TCL[!]β looks for tcl version and libraries. exportsTCL_VERSION,TCL_CFLAGSandTCL_LDFLAGSto the environment. this will also add the--with-tcl-basedirflag so the end-user can set the basedir for the TCL installation. πLANG_PERL[!]β looks for perl installed on the current system.LANG_JAVA[!]β looks forjavacon the current system. exportsJAVACenviron and adds--with-jikesand--with-kjcflags.LANG_VALA[!]β looks forvalacinPATH. exportsVALACenviron and adds--with-valac.LANG_PYTHON[!]β finds apythonexecutable on the current system. exportsPYTHONandHAVE_LANG_PYTHON.LANG_RUBY[!]β finds arubyexecutable on the current system. exportsRUBY,HAVE_LANG_RUBYandRUBY_VERSION.
π₯ EXTERNAL SOFTWARE π₯
USE_DLβ setsLIBS_DLto-ldlor""depending on the target system.USE_LIBTOOLβ checks for thelibtoolcommand and exportsLIBTOOL_CC,LIBTOOL_CXXand some useful commands for your makefiles:LIBTOOL_SHARED,LIBTOOL_STATICandLIBTOOL_INSTALL.USE_PKGCONFIG | USE_PKGCONFIG!β checks for thepkg-configorpkgconfprogram inPATH. required for thePKGCFGdirective.USE_ICONVβ setsLIBS_ICONVto-liconvor"", depending on whether iconv functions are implemented into the LibC or not.USE_PTHREADβ checks for pthread on the current system and setsPTHREAD_LIBSto the proper value.USE_PERL_THREADSβ checks if the target system has perl built with threads support.USE_X11β adds--with-x11baseand--without-xflags and setsX11BASEto the proper value.USE_TKβ adds the--with-tk-libdirflag and setsTK_CFLAGS,TK_VERSION.USE_GMAKEβ looks for a GNU make tool installed on the target system and setsMAKEproperly.USE_JNIβ usesJAVA_HOMEto check and define theJCFLAGSfor building java native interface programs.
π CHECKS π
REQUIRE_ACR_VERSION versionβ checks if the acr version is greater or equal than the given version.CHECK varname <<EOF <..src..> <<EOFβ executes the<..code..>delimited by the<eof>keyword and marksvarnameas the target variable to be defined by the script. (seeexamples/check.acrfmi)CHKEXE,CHECK_EXEC[!] varname program ;β executesprogramand setsvarname = !!!$?CHKPRG, CHECK_PROGRAM[!] varname programβ finds the program in${PATH}and sets the variable environment to the proper path. since 0.5CHKPRGexports aHAVE_varnamevariable and checks first ifVARNAMEis a valid executable file.CHKINC, CHECK_INCLUDE[!] include.h[+include2.h[+include3.h]]β checks ifinclude.his found in the current system. requiresLANG_Cand sets theHAVE_include_Henvironment to0or1(for example:HAVE_STDIO_H).CHKFLG, CHECK_CFLAGS[!] varname cflags ;β checks if the selected C compiler supports the given CFLAGS. (useful for-std=c99and such)CHKFNC, CHECK_FUNCTION[!] libname functionβ checks if the desired function exists inlibnameand setsHAVE_FUNCTIONto0or1(for example:HAVE_PRINTF).CHKSYM, CHECK_SYMBOL[!] libname symbolβ checks if the given symbol exists inlibnameand setsHAVE_SYMBOLto0or1(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 setsHAVE_LIB_libnameto0or1(for example:HAVE_LIB_SDL).ENDIAN|CHECK_ENDIANβ checks for the host endianness to be big or little. it'll exportBYTEORDER=1234on little endian hosts or4321for big endian ones. also exportsLIL_ENDIANandBIG_ENDIANwith0xor1values.SIZEOF var ;β checks for the size of the desired variable and saves it into the variableSIZEOF_VARNAME. requiresLANG_C.CHECK_PERL_MODULE[!],CHK_PM[!] perl_moduleβ checks if the target system has installed the selected perl module, and setsHAVE_PM_xxxto0or1(for example:HAVE_PM_NETDNS).CHECK_PYTHON_MODULE[!],CHK_PY[!] python_moduleβ checks if the system has installed the desired python module and setsHAVE_PY_xxxto0or1.CHECK_RUBY_EXTENSION[!],CHK_RU[] ruby_extensionβ checks if the system has installed the desired ruby extension and setsHAVE_RU_xxxto0or1.CHECK_CLASSPATH[!],CHK_CP[!] java_package_nameβ checks ifCLASSPATHcontains the desired package (for exampleorg.gnu.gtk). exports theHAVE_CLASSPATH_(java-pkg-name)to0or1.CHKUSR[!] usernameCHKGRP[!] groupβ checks the existence of the target user or group on the system. π«Ά
π§ DEFINITIONS π
okay so bestie, definitions get processed at the very beginning of the configure script β like, before anything else even wakes up. so these are your ground rules, set first, no takebacks. β¨
= varname value ;β sets the value ofvarnametovalue. just... assigns it. that's the whole vibe. π+= varname value ;β appendsvalueonto whatevervarnamealready has, no erasing, just adding on. π¦?= varname value ;β only ifvarnameis empty does it get assignedvalue. like, if it's already got something, back off. conditional queen behavior. πEXEC[!] variable command to execute ;β setsvariableto the output (stdout) of the command you want executed. πΈCHECK_VERSION,CHKVER[!] pkgname versionβ checks whetherpkgname(a software package registered in thepkg-configdatabase) is<= version. and if it's not? it crashes execution. dramatic, but okay. it exports theHAVE_(pkgname)_VERSION_(version)variable as0or1. βPKGCFG,PKGCONFIG[+] cflags_var ldflags_var pkg-config-nameβ usespkg-configto grab theCFLAGSandLDFLAGS. if there's a'+'at the end of the command then ACR concatenates the value ofcflags_varandldflags_varinstead of overwriting the old value. this keyword also exports a variable calledHAVE_PKGFG_{pkg-config-name|filtered}with0or1values. β¨PKGCFG_DO pcfile libname requires ;β generates apkg-configfile for the given library name and makes it depend on the word-separated list ofpkg-configrequires. optional overrides can be exported withPKGCFG_LIBS_DEFAULT,PKGCFG_LIBS_PRIVATE_DEFAULT,PKGCFG_CFLAGS_DEFAULTor the per-libraryPKGCFG_<LIBNAME>_{LIBS,LIBS_PRIVATE,CFLAGS}variables, where<LIBNAME>is the filtered upper-case form oflibname. πVALAPKG[!] pkgnameβ checks if a Vala package is available forVALAC. π§
π CONDITIONALS π
fr fr, all conditionals need an 'op' (operation) argument that tells ACR how to set the setvarname. the valid operations are:
'=''+=''?='
you can nest conditionals inside other conditionals using the '{' '}' keywords too! that lets you glue a whole group of conditionals and definitions together inside one block. nested conditionals have been a thing since acr 0.4. π
IF|IFNOT varname { ..code.. }β if the value ofvarnameis equal to'1'(IF) or'0'(IFNOT), then ACR sets the'setvarname'to the'value'. π«IFNULL|IFNOTNULL varname { ..code.. }β if the value ofvarnameis equal to null (IFNULL), or not (IFNOTNULL), then ACR sets the'setvarname'to the'value'. π«ΆIFEQ|IFNOTEQ varname value; { ..code.. }β if the content ofvarnameis equal (IFEQ) or different (IFNOTEQ) tovalue, then setsetvarnameto the valuesetvalue. πΈIFEQVAL|IFNOTEQVAL varname varname2 { ..code.. }β DEPRECATED: this keyword has been deprecated in 0.5 and will disappear in 0.6. useIFEQ FOO $FOO ;instead. if the content ofvarnameis equal (IFEQ) or different (IFNOTEQ) to the content ofvarname2, it finally setssetvarnameto the valuesetvalue. πIFAND|IFNOTAND var1 var2 { ..code.. }β ifvar1andvar2are equal to1(IFAND) or0(IFNOTAND), then setvartosetvalue. β¨IFAND|IFNOTAND var1 var2 { ..code.. }β ifvar1andvar2are equal to1(IFAND) or0(IFNOTAND), then setvartosetvalue. (yes bestie, it's listed twice. i don't make the rules, i just translate them. π)IFOR|IFNOTOR var1 var2 { ..code.. }β ifvar1andvar2are equal to1(IFAND) or0(IFNOTAND), then setvartosetvalue.ECHO string ;β prints a string tostderr. π’DIEIF|DIE variable die_message ;β πDIEIFNOT|DIENOT variable die_message ;β πDIENOW die_message ;β if the value ofvariableis equal to1(DIE) or0(DIENOT), then it stops processing the./configurescript and shows the die message. the short keyword names (DIE,DIENOT) are going to be deprecated. β οΈ
π© FLAGS π©
ARG_IGNORE flagnameβ ignores a specific configure arg. literally does nothing. it's giving "not my problem". πARG_[WITH|WITHOUT|ENABLE|DISABLE] varname[=value] flagname description ;β adds awith/without/enable/disableflag to the final configure script. for example:
ARG_WITH MPLAYER=/usr/bin/mplayer mplayer Sets path for the mplayer ;
if no =value is given, ARG_* acts as a boolean variable (0 for WITH and ENABLE, and 1 for WITHOUT and DISABLE). if the =value is given, ACR lets the user construct flags like --with-foo=bar. π₯
the 'value' argument must be one of these:
""(empty) β if you want a true/false flag (ex:--without-x,--enable-ssl) π"="β if you want the user to add their 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-> setsJAVACtokjc) β¨
π OUTPUT GENERATION π
OUTPUT_H file1 file2 ;β generatesfile1file2with C-like syntax,#define-ing all the exported variables. π§OUTPUT_SH file1 file2 ;β generates the selected files likeOUTPUT_Hdoes, but using a shellscript syntax instead. πΈSUBST|SUBST_FILES file1 file2 ;β replaces all@ENVWORDS@with the exported variable's proper value. before making any changes, ACR copies the original file tofile.orig. remember tomv file.orig fileon themake cleantarget! this option is not recommended to use, because of the problems you may run into with acr + vcs systems. i recommend you useSUBDIRSinstead. (acr>=0.4) πSUBDIRS dir1 dir2 file1 file2 ;β findsMakefile.acrfiles in the requested directories to generate the properMakefile. acr>=0.4 lets you useSUBDIRSagainst files or directories, with no difference β it's backward compatible. if the target name is a directory, then acr looks forMakefile.acr; if not, it grabsfilename.acrand generates a new file keeping the name, but chopping off the'.acr'at the end. you can also use the'%'keyword to match allMakefile.acrfiles under the current directory β super handy if your project's directory structure keeps changing. πSUBCONF dir1 dir2 ;β calls recursively other./configurescripts found indir1,dir2, passing along the root./configureflag arguments. πREPORT var1 var2 ;β shows thevarnameandvarvalueof the desired variables at the end of the final./configurescript. 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>
and that's the whole page, bestie!! π«Ά this one comes to you from Debian, dated Feb 25, 2022, and it's the CONFIGURE.ACR(5) manual page β so if you ever need the receipts, that's where they live. now go write a configure.acr that slays. periodt. π
β¨π
π¦ where this page comes from
- ubuntu stonking: acr 2.2.6-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms