1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349
|
.Dd Feb 25, 2022
.Dt CONFIGURE.ACR 5
.Os
.Sh NAME
.Nm configure.acr
.Nd configuration script for ACR
.Sh DESCRIPTION
configure.acr is the target file to be parsed by ACR to generate the final
"configure" script for end-users.
.Pp
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.
.Pp
The recommended order of checks and commands is:
.Bl -bullet -compact
.It
check operating system
.It
check paths
.It
check required languages
.It
libraries/includes/modules checks, dies
.It
pkg-config checks: version/assignations
.It
final conditionals and dies
.It
generation of .acr files with SUBDIRS and SUBST_FILES
.El
.\"
.Sh SYNTAX
The configure.acr file is a word-based configuration file for ACR.
.Pp
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.
.Pp
Each word is called "keyword", there are these types:
.Bl -tag -width indent
.It Miscelaneous-Keys:
{ } ;
.It Command:
( Any active keyword )
.It Conditionals
[ IF IFEQ IFEQVAL IFAND IFOR ] [IFNOT-[EQ|EQVAL|AND|OR]
.It Argument:
( keywords after commands or conditionals )
.It Comment:
Block comments: /* */
Line commentsr: //
Note that one-word comments has been deprecated. But you can use line comments //
.It 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 ;
.Bl -bullet -compact
.It
"=" resets the value of the target variable.
.It
"+=" appends the value to the target variable.
.It
"?=" checks if the target variable is yet defined, and does not overwrites its content.
.It
"<-" the target value gets the content of the variable defined in the text content.
.El
.It 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.
.Pp
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)
.It Comments:
.Pp
You can add comments to your configure.acr files by using:
.Pp
// comment \\\\ or ## comment ##
.El
.Pp
Note that you can create multi-line comments using these tags, because
everything in this file is word-based.
.Pp
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
.Pp
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.
.Pp
For more information read acr(1) about the use of the '\-d' flag.
.\"
.Sh PACKAGE INFORMATION
.Bl -tag -width indent
.It PKGNAME <pkgname>
Sets the target package name to be used.
.It VERSION <version>
Sets the version number for the target package.
.It 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.
.It DESCRIPTION <text>\ ;
Give a description for the package, this text is shown with `./configure -r` and it's also used for the pkgconfig files
.El
.\"
.Sh ACR DIRECTIVES
This directives are used internally by ACR to work in a different way.
.Bl -tag -width indent
.It 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.
.Pp
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.
.It 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.
.It 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.
.It NOP
No Operation Keyword. This keyword is only for debugging purposes and it's
used internally by ACR. This command does nothing.
.El
.\"
.Sh 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.
.Bl -tag -width indent
.It LANG_C[!]
ACR will look for a C compiler and sets CC, depends for implicit LANG_CPP.
.It LANG_V[!]
ACR will look for the V compiler and sets V and VFLAGS.
.It LANG_CC[!] LANG_CXX[!]
Adds C++ support and sets CXX environ.
.It LANG_BASH[!]
Tell acr to look for a bash on the target system.
.It 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.
.It LANG_PERL[!]
Looks for perl installed on current system
.It LANG_JAVA[!]
Looks for javac in the current system. Exports JAVAC environ and adds \-\-with-jikes and \-\-with-kjc flags.
.It LANG_VALA[!]
Looks for valac in PATH. Exports VALAC environ and adds \-\-with-valac
.It LANG_PYTHON[!]
Finds a python executable on the current system. Exports PYTHON and HAVE_LANG_PYTHON.
.It LANG_RUBY[!]
Finds a ruby executable on the current system. Exports RUBY, HAVE_LANG_RUBY and RUBY_VERSION.
.El
.\"
.Sh EXTERNAL SOFTWARE
.Bl -tag -width indent
.It USE_DL
Sets LIBS_DL to \-ldl or "" depending on the target system.
.It 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.
.It USE_PKGCONFIG | USE_PKGCONFIG!
Check for pkg-config or pkgconf program in PATH. Required for the PKGCFG directive
.It USE_ICONV
Sets LIBS_ICONV to \-liconv or "" depending if iconv functions are implemented
into the LibC or not.
.It USE_PTHREAD
Checks for pthread on the current system and sets PTHREAD_LIBS to the proper
value.
.It USE_PERL_THREADS
Checks if the target system have perl build with threads support.
.It USE_X11
Adds \-\-with-x11base and \-\-without-x flags and sets X11BASE to the proper value.
.It USE_TK
Add \-\-with-tk-libdir flag and sets TK_CFLAGS, TK_VERSION
.It USE_GMAKE
Looks for a GNU make tool installed on the target system and sets MAKE properly.
.It USE_JNI
Uses JAVA_HOME to check and define the JCFLAGS for building java native interface programs.
.El
.\"
.Sh CHECKS
.Bl -tag -width indent
.It REQUIRE_ACR_VERSION version
Checks if acr version is greater or equal than the given version.
.It 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)
.It CHKEXE,CHECK_EXEC[!] varname program\ ;
Execute program and set varname = !!!$?
.It 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.
.It 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)
.It CHKFLG, CHECK_CFLAGS[!] varname cflags\ ;
Checks if the selected C compiler supports the given CFLAGS (Useful for -std=c99 and such)
.It 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)
.It 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)
.It CHKDECL, CHECK_DECLARATION[!] include constant
Checks if the given constant is defined in the specified include file
.It 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)
.It 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.
.It SIZEOF var\ ;
Checks for the size of the desired variable and saves it into the variable SIZEOF_VARNAME. Requires LANG_C.
.It 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)
.It 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.
.It 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.
.It 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.
.It CHKUSR[!] username
.It CHKGRP[!] group
Checks the existence of the target user or group on the system.
.El
.\"
.Sh DEFINITIONS
Sets are processed at the beginning of the configure script.
.Bl -tag -width indent
.It = varname value\ ;
Sets the value of varname to value.
.It += varname value\ ;
Appends the content of varname with value.
.It ?= varname value\ ;
If the content of varname is empty then assign the value to it.
.It EXEC[!] variable command to execute\ ;
Sets variable to the output (stdout) of the desired command to be executed.
.It 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.
.It 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.
.It 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
.It VALAPKG[!] pkgname
Checks if a Vala package is available for VALAC
.El
.\"
.Sh CONDITIONALS
All conditionals require an 'op'(operation) argument that defines how to set
the setvarname. Valid operations are: '=' '+=' '?='.
.Pp
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.
.Bl -tag -width indent
.It 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'.
.It 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'.
.It IFEQ|IFNOTEQ varname value ; { ..code.. }
If the content of varname is equal(IFEQ) or different(IFNOTEQ) to value then setvarname to the value setvalue.
.It 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.
.It IFAND|IFNOTAND var1 var2 { ..code.. }
If var1 and var2 are equal to 1(IFAND) or 0(IFNOTAND) then setvar to setvalue.
.It IFAND|IFNOTAND var1 var2 { ..code.. }
If var1 and var2 are equal to 1(IFAND) or 0(IFNOTAND) then setvar to setvalue.
.It IFOR|IFNOTOR var1 var2 { ..code.. }
If var1 and var2 are equal to 1(IFAND) or 0(IFNOTAND) then setvar to setvalue.
.It ECHO string\ ;
Prints a string to stderr.
.It DIEIF|DIE variable die_message\ ;
.It DIEIFNOT|DIENOT variable die_message\ ;
.It 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.
.El
.\"
.Sh FLAGS
.Bl -tag -width indent
.It ARG_IGNORE flagname
Ignore specific configure arg (do nothing)
.It ARG_[WITH|WITHOUT|ENABLE|DISABLE] varname[=value] flagname description\ ;
Adds a with/without/enable/disable flag to the final configure script. For example:
.Pp
ARG_WITH MPLAYER=/usr/bin/mplayer mplayer Sets path for the mplayer\ ;
.Pp
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.
.Pp
The 'value' argument must be:
.Bl -bullet -compact
.It
"" (empty) : if you want to create a true/false flag (ex: \-\-without-x, \-\-enable-ssl)
.It
"=" : if you want that the user adds his own value. (ex: \-\-with-x11base=/usr/pkg/XFree86/ )
.It
"something" : if you want to set the value to "something" when the flag is passed. (ex: \-\-with-kjc \-> sets JAVAC to kjc)
.El
.El
.\"
.Sh OUTPUT GENERATION
.Bl -tag -width indent
.It OUTPUT_H file1 file2\ ;
Generates the file1 file2 with C-like syntax defining all exported variables with #defines.
.It OUTPUT_SH file1 file2\ ;
Generates the selected files like OUTPUT_H does but using a shellscript syntax.
.It 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)
.It 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.
.It SUBCONF dir1 dir2\ ;
Calls recursively other ./configure scripts found in dir1, dir2 passing the root ./configure flag arguments.
.It REPORT var1 var2\ ;
Shows the varname and varvalue of the desired variables at the end of the final ./configure script. (useful for debugging)
.El
.Sh EXAMPLES
.Bl -tag -width indent
.It Simple example:
.Bd -literal -offset indent
PKGNAME helloworld
CONTACT my real name ; my@email.com
VERSION 1.0
LANG_C!
SUBDIRS . src ;
.Ed
.It Some more checks
.Bd -literal -offset indent
PKGNAME gtkapp
VERSION 1.0
LANG_C!
PKGCFG+ CFLAGS LDFLAGS gtk+-2.0
SUBDIRS . src ;
REPORT HAVE_PKGCFG_GTK_2_0 CFLAGS LDFLAGS ;
.Ed
.El
.\"
.Sh SEE ALSO
.Xr acr 1
.Xr amr 1
.Xr acr-cat 1
.Xr configure.amr 5
.Sh AUTHOR
pancake <pancake@nopcode.org>
.Pp
http://nopcode.org/wk.php/Acr
|