6 # Please view me with 4 column tabs!
9 # Before making any changes to this file, contact portmgr to arrange
10 # for an experimental ports run.
11 # Untested commits will almost certainly break the tree, incur the
12 # wrath of countless folks, and be unceremoniously backed out by
13 # the maintainer and/or portmgr.
15 Autotools_Include_MAINTAINER= autotools@FreeBSD.org
17 #---------------------------------------------------------------------------
18 # USE_AUTOTOOLS= tool[:env] ...
20 # 'tool' can currently be one of the following:
21 # autoconf, autoheader
22 # autoconf213, autoheader213 (legacy version)
24 # automake14, aclocal14 (legacy version)
25 # libtool, libtoolize, libltdl
27 # ':env' is used to specify that the environmental variables are needed
28 # but the relevant tool should NOT be run as part of the
29 # 'run-autotools' target
31 # In addition, these variables can be set in the port Makefile to be
32 # passed to the relevant tools:
35 # - Extra arguments passed to automake during configure step
38 # - Arguments passed to aclocal during configure step
41 # - Extra arguments passed to autoconf during configure step
44 # - Extra arguments passed to autoheader during configure step
47 # - Extra arguments passed to libtoolize during configure step
49 # LIBTOOLFLAGS=<value>
50 # - Arguments passed to libtool during configure step
52 # LIBTOOLFILES=<list-of-files>
53 # - A list of files to patch during libtool pre-configuration
55 # AUTOTOOLSFILES=<list-of-files>
56 # - A list of files to further patch with derived information
57 # post-patching to reduce churn during component updates
59 #---------------------------------------------------------------------------
61 #---------------------------------------------------------------------------
62 # NO USER-SERVICABLE PARTS BEYOND THIS POINT. REALLY. WE MEAN IT.
63 #---------------------------------------------------------------------------
65 # Known autotools components
66 _AUTOTOOLS_ALL= autoconf autoheader autoconf213 autoheader213 \
67 automake aclocal automake14 aclocal14 \
68 libtool libtoolize libltdl
70 # Incompatible autotools mixing
71 _AUTOTOOLS_IGN_autoconf= autoconf213 autoheader213
72 _AUTOTOOLS_IGN_autoheader= autoconf213 autoheader213
73 _AUTOTOOLS_IGN_autoconf213= autoconf autoheader
74 _AUTOTOOLS_IGN_autoheader213= autoconf autoheader
75 _AUTOTOOLS_IGN_automake= automake14 aclocal14
76 _AUTOTOOLS_IGN_aclocal= automake14 aclocal14
77 _AUTOTOOLS_IGN_automake14= automake aclocal
78 _AUTOTOOLS_IGN_aclocal14= automake aclocal
80 #---------------------------------------------------------------------------
81 # Primary magic to break out the USE_AUTOTOOLS stanza into something
82 # more useful, along with substantial error checking to prevent
84 #---------------------------------------------------------------------------
86 # Break out the stanza
89 .for stanza in ${USE_AUTOTOOLS}
90 _AUTOTOOLS_IMPL+= ${stanza:C/^([^:]+).*/\1/}
91 _AUTOTOOL_${stanza:C/^([^:]+).*/\1/}= ${stanza:C/^[^:]+:([^:]+)/\1/}
94 # Verify each component, normalize
97 .for component in ${_AUTOTOOLS_IMPL}
98 . if ${_AUTOTOOLS_ALL:M${component}}==""
99 _AUTOTOOLS_NOCOMP+= ${component}
101 . if ${_AUTOTOOL_${component}}==${component}
102 _AUTOTOOL_${component}= yes
103 . elsif ${_AUTOTOOL_${component}}!="env" && ${_AUTOTOOL_${component}}!="yes"
104 _AUTOTOOLS_BADCOMP+= ${component}:${_AUTOTOOL_${component}}
107 .if !empty(_AUTOTOOLS_NOCOMP)
108 IGNORE+= Unknown autotool: ${_AUTOTOOLS_NOCOMP:O:u}
111 # Check for anything other than 'yes' or 'env'
114 .for component in ${_AUTOTOOLS_IMPL}
115 . if ${_AUTOTOOL_${component}}!="env" && ${_AUTOTOOL_${component}}!="yes"
116 _AUTOTOOLS_BADCOMP+= ${component}:${_AUTOTOOL_${component}}
119 .if !empty(_AUTOTOOLS_BADCOMP)
120 IGNORE+= Bad autotool stanza: ${_AUTOTOOLS_BADCOMP:O:u}
123 # Check for incompatible mixes of components
126 .for component in ${_AUTOTOOLS_IMPL}
127 . for ignore in ${_AUTOTOOLS_IGN_${component}}
128 . if defined(_AUTOTOOL_${ignore})
129 _AUTOTOOLS_IGN+= ${component}
133 .if !empty(_AUTOTOOLS_IGN)
134 IGNORE+= Incompatible autotools: ${_AUTOTOOLS_IGN:O:u}
137 #---------------------------------------------------------------------------
138 # automake and aclocal
139 #---------------------------------------------------------------------------
141 .if defined(_AUTOTOOL_aclocal) && ${_AUTOTOOL_aclocal} == "yes"
142 _AUTOTOOL_automake?= env
143 _AUTOTOOL_rule_aclocal= yes
147 .if defined(_AUTOTOOL_automake)
148 AUTOMAKE_VERSION= 1.14
149 AUTOMAKE_APIVER= 1.14
150 AUTOMAKE_PORT= devel/automake
152 . if ${_AUTOTOOL_automake} == "yes"
153 _AUTOTOOL_rule_automake= yes
158 .if defined(_AUTOTOOL_aclocal14) && ${_AUTOTOOL_aclocal14} == "yes"
159 _AUTOTOOL_automake14?= env
160 _AUTOTOOL_rule_aclocal14= yes
164 .if defined(_AUTOTOOL_automake14)
165 AUTOMAKE_VERSION= 1.4
166 AUTOMAKE_APIVER= 1.4.6
167 AUTOMAKE_PORT= devel/automake14
168 AUTOMAKE_ARGS+= -i # backwards compatibility shim
170 . if ${_AUTOTOOL_automake14} == "yes"
171 _AUTOTOOL_rule_automake= yes
176 .if defined(AUTOMAKE_VERSION)
177 AUTOMAKE= ${LOCALBASE}/bin/automake-${AUTOMAKE_VERSION}
178 AUTOMAKE_DIR= ${LOCALBASE}/share/automake-${AUTOMAKE_VERSION}
179 ACLOCAL= ${LOCALBASE}/bin/aclocal-${AUTOMAKE_VERSION}
180 ACLOCAL_DIR= ${LOCALBASE}/share/aclocal-${AUTOMAKE_VERSION}
182 . if defined(_AUTOTOOL_aclocal)
183 ACLOCAL_ARGS?= --automake-acdir=${ACLOCAL_DIR}
185 . if defined(_AUTOTOOL_aclocal14)
186 ACLOCAL_ARGS?= --acdir=${ACLOCAL_DIR}
189 AUTOMAKE_VARS= AUTOMAKE=${AUTOMAKE} \
190 AUTOMAKE_DIR=${AUTOMAKE_DIR} \
191 AUTOMAKE_VERSION=${AUTOMAKE_VERSION} \
192 AUTOMAKE_APIVER=${AUTOMAKE_APIVER} \
194 ACLOCAL_DIR=${ACLOCAL_DIR}
196 AUTOMAKE_DEPENDS= ${AUTOMAKE}:${PORTSDIR}/${AUTOMAKE_PORT}
197 BUILD_DEPENDS+= ${AUTOMAKE_DEPENDS}
200 #---------------------------------------------------------------------------
201 # autoconf and autoheader
202 #---------------------------------------------------------------------------
204 .if defined(_AUTOTOOL_autoheader) && ${_AUTOTOOL_autoheader} == "yes"
205 _AUTOTOOL_autoconf= yes
206 _AUTOTOOL_rule_autoheader= yes
210 .if defined(_AUTOTOOL_autoconf)
211 AUTOCONF_VERSION= 2.69
212 AUTOCONF_PORT= devel/autoconf
214 . if ${_AUTOTOOL_autoconf} == "yes"
215 _AUTOTOOL_rule_autoconf= yes
220 .if defined(_AUTOTOOL_autoheader213) && ${_AUTOTOOL_autoheader213} == "yes"
221 _AUTOTOOL_autoconf213= yes
222 _AUTOTOOL_rule_autoheader= yes
226 .if defined(_AUTOTOOL_autoconf213)
227 AUTOCONF_VERSION= 2.13
228 AUTOCONF_PORT= devel/autoconf213
229 AUTOM4TE= ${FALSE} # doesn't exist here
231 . if ${_AUTOTOOL_autoconf213} == "yes"
232 _AUTOTOOL_rule_autoconf= yes
237 .if defined(AUTOCONF_VERSION)
238 AUTOCONF= ${LOCALBASE}/bin/autoconf-${AUTOCONF_VERSION}
239 AUTOCONF_DIR= ${LOCALBASE}/share/autoconf-${AUTOCONF_VERSION}
240 AUTOHEADER= ${LOCALBASE}/bin/autoheader-${AUTOCONF_VERSION}
241 AUTOIFNAMES= ${LOCALBASE}/bin/ifnames-${AUTOCONF_VERSION}
242 AUTOM4TE?= ${LOCALBASE}/bin/autom4te-${AUTOCONF_VERSION}
243 AUTORECONF= ${LOCALBASE}/bin/autoreconf-${AUTOCONF_VERSION}
244 AUTOSCAN= ${LOCALBASE}/bin/autoscan-${AUTOCONF_VERSION}
245 AUTOUPDATE= ${LOCALBASE}/bin/autoupdate-${AUTOCONF_VERSION}
247 AUTOCONF_VARS= AUTOCONF=${AUTOCONF} \
248 AUTOCONF_DIR=${AUTOCONF_DIR} \
249 AUTOHEADER=${AUTOHEADER} \
250 AUTOIFNAMES=${AUTOIFNAMES} \
251 AUTOM4TE=${AUTOM4TE} \
252 AUTORECONF=${AUTORECONF} \
253 AUTOSCAN=${AUTOSCAN} \
254 AUTOUPDATE=${AUTOUPDATE} \
255 AUTOCONF_VERSION=${AUTOCONF_VERSION}
257 AUTOCONF_DEPENDS= ${AUTOCONF}:${PORTSDIR}/${AUTOCONF_PORT}
258 BUILD_DEPENDS+= ${AUTOCONF_DEPENDS}
261 #---------------------------------------------------------------------------
263 #---------------------------------------------------------------------------
265 .if defined(_AUTOTOOL_libltdl)
266 LIB_DEPENDS+= libltdl.so:${PORTSDIR}/devel/libltdl
269 #---------------------------------------------------------------------------
271 #---------------------------------------------------------------------------
273 .if defined(_AUTOTOOL_libtool) || defined(_AUTOTOOL_libtoolize)
275 LIBTOOL_PORT= devel/libtool
277 . if defined(_AUTOTOOL_libtool) && ${_AUTOTOOL_libtool} == "yes"
278 _AUTOTOOL_rule_libtool= yes
281 . if defined(_AUTOTOOL_libtoolize) && ${_AUTOTOOL_libtoolize} == "yes"
282 _AUTOTOOL_rule_libtoolize= yes
288 .if defined(LIBTOOL_VERSION)
289 LIBTOOL= ${LOCALBASE}/bin/libtool
290 LIBTOOLIZE= ${LOCALBASE}/bin/libtoolize
291 LIBTOOL_LIBEXECDIR= ${LOCALBASE}/libexec/libtool
292 LIBTOOL_SHAREDIR= ${LOCALBASE}/share/libtool
293 LIBTOOL_M4= ${LOCALBASE}/share/aclocal/libtool.m4
294 LTMAIN= ${LOCALBASE}/share/libtool/config/ltmain.sh
296 LIBTOOL_VARS= LIBTOOL=${LIBTOOL} \
297 LIBTOOLIZE=${LIBTOOLIZE} \
298 LIBTOOL_LIBEXECDIR=${LIBTOOL_LIBEXECDIR} \
299 LIBTOOL_SHAREDIR=${LIBTOOL_SHAREDIR} \
300 LIBTOOL_M4=${LIBTOOL_M4} \
303 LIBTOOLFLAGS?= # default to empty
305 . if defined(_AUTOTOOL_rule_autoconf) || defined(_AUTOTOOL_rule_autoconf213)
306 LIBTOOLFILES?= aclocal.m4
307 . elif defined(_AUTOTOOL_rule_libtool)
308 LIBTOOLFILES?= ${CONFIGURE_SCRIPT}
311 LIBTOOL_DEPENDS= libtool>=2.4:${PORTSDIR}/${LIBTOOL_PORT}
312 BUILD_DEPENDS+= ${LIBTOOL_DEPENDS}
315 #---------------------------------------------------------------------------
316 # Add to the environment
317 #---------------------------------------------------------------------------
319 AUTOTOOLS_VARS= ${AUTOMAKE_VARS} ${AUTOCONF_VARS} ${LIBTOOL_VARS}
321 .if defined(AUTOTOOLS_VARS) && !empty(AUTOTOOLS_VARS)
322 . for var in AUTOTOOLS CONFIGURE MAKE SCRIPTS
323 ${var:tu}_ENV+= ${AUTOTOOLS_VARS}
327 #---------------------------------------------------------------------------
329 #---------------------------------------------------------------------------
331 .if !target(run-autotools)
332 .ORDER: run-autotools run-autotools-aclocal \
333 patch-autotools-libtool run-autotools-autoheader \
334 run-autotools-libtoolize run-autotools-autoconf \
335 run-autotools-automake
337 run-autotools:: run-autotools-aclocal \
338 patch-autotools-libtool run-autotools-autoheader \
339 run-autotools-libtoolize run-autotools-autoconf \
340 run-autotools-automake
343 .if !target(run-autotools-aclocal)
344 run-autotools-aclocal:
345 . if defined(_AUTOTOOL_rule_aclocal)
346 @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${ACLOCAL} \
353 .if !target(run-autotools-automake)
354 run-autotools-automake:
355 . if defined(_AUTOTOOL_rule_automake)
356 @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOMAKE} \
363 .if !target(run-autotools-autoconf)
364 run-autotools-autoconf:
365 . if defined(_AUTOTOOL_rule_autoconf)
366 @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOCONF} \
373 .if !target(run-autotools-autoheader)
374 run-autotools-autoheader:
375 . if defined(_AUTOTOOL_rule_autoheader)
376 @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOHEADER} \
383 .if !target(run-autotools-libtoolize)
384 run-autotools-libtoolize:
385 . if defined(_AUTOTOOL_rule_libtoolize)
386 @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${LIBTOOLIZE} \
393 .if !target(patch-autotools-libtool)
394 patch-autotools-libtool::
395 . if defined(_AUTOTOOL_rule_libtool)
396 @for file in ${LIBTOOLFILES}; do \
397 ${REINPLACE_CMD} -e \
398 "/^ltmain=/!s|\$$ac_aux_dir/ltmain.sh|${LIBTOOLFLAGS} ${LTMAIN}|g; \
399 /^LIBTOOL=/s|\$$(top_builddir)/libtool|${LIBTOOL}|g" \
400 ${PATCH_WRKSRC}/$$file; \
407 #---------------------------------------------------------------------------
408 # Reduce patch churn by auto-substituting data from AUTOTOOLS_VARS
409 # into the correct places. Code shamelessly stolen from PLIST_SUB.
411 AUTOTOOLSFILES?= # default to empty
412 AUTOTOOLS_VARS?= # empty if not already set
414 .if !target(configure-autotools)
415 configure-autotools::
416 . if ${AUTOTOOLS_VARS}!="" && ${AUTOTOOLSFILES} != ""
417 @for file in ${AUTOTOOLSFILES}; do \
418 ${REINPLACE_CMD} ${AUTOTOOLS_VARS:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
419 ${WRKSRC}/$${file} ; \