6 | | #------------------------------------------------------------------------ |
7 | | # MP_CHECK_FRAMEWORK_COREFOUNDATION -- |
8 | | # |
9 | | # Check if CoreFoundation framework is available, define HAVE_FRAMEWORK_COREFOUNDATION if so. |
10 | | # |
11 | | # Arguments: |
12 | | # None. |
13 | | # |
14 | | # Requires: |
15 | | # None. |
16 | | # |
17 | | # Depends: |
18 | | # AC_LANG_PROGRAM |
19 | | # |
20 | | # Results: |
21 | | # Result is cached. |
22 | | # |
23 | | # If CoreFoundation framework is available, defines the following variables: |
24 | | # HAVE_FRAMEWORK_COREFOUNDATION |
25 | | # |
26 | | #------------------------------------------------------------------------ |
27 | | AC_DEFUN(MP_CHECK_FRAMEWORK_COREFOUNDATION, [ |
28 | | FRAMEWORK_LIBS="-framework CoreFoundation" |
29 | | |
30 | | AC_MSG_CHECKING([for CoreFoundation framework]) |
31 | | |
32 | | AC_CACHE_VAL(mp_cv_have_framework_corefoundation, [ |
33 | | ac_save_LIBS="$LIBS" |
34 | | LIBS="$FRAMEWORK_LIBS $LIBS" |
35 | | |
36 | | AC_LINK_IFELSE([ |
37 | | AC_LANG_PROGRAM([ |
38 | | #include <CoreFoundation/CoreFoundation.h> |
39 | | ], [ |
40 | | CFURLRef url = CFURLCreateWithFileSystemPath(NULL, CFSTR("/testing"), kCFURLPOSIXPathStyle, 1); |
41 | | CFArrayRef bundles = CFBundleCreateBundlesFromDirectory(NULL, url, CFSTR("pkg")); |
42 | | ]) |
43 | | ], [ |
44 | | mp_cv_have_framework_corefoundation="yes" |
45 | | ], [ |
46 | | mp_cv_have_framework_corefoundation="no" |
47 | | ] |
48 | | ) |
49 | | |
50 | | LIBS="$ac_save_LIBS" |
51 | | ]) |
52 | | |
53 | | AC_MSG_RESULT(${mp_cv_have_framework_corefoundation}) |
54 | | |
55 | | if test x"${mp_cv_have_framework_corefoundation}" = "xyes"; then |
56 | | AC_DEFINE([HAVE_FRAMEWORK_COREFOUNDATION], [], [Define if CoreFoundation framework is available]) |
57 | | fi |
58 | | |
59 | | AC_SUBST(HAVE_FRAMEWORK_COREFOUNDATION) |
60 | | ]) |
61 | | |
62 | | |
63 | | #------------------------------------------------------------------------ |
64 | | # MP_CHECK_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER -- |
65 | | # |
66 | | # Check if if the routine CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER |
67 | | # is available in CoreFoundation. |
68 | | # |
69 | | # Arguments: |
70 | | # None. |
71 | | # |
72 | | # Requires: |
73 | | # None. |
74 | | # |
75 | | # Depends: |
76 | | # AC_LANG_PROGRAM |
77 | | # |
78 | | # Results: |
79 | | # Result is cached. |
80 | | # |
81 | | # If function CFNotificationCenterGetDarwinNotifyCenter is in the CoreFoundation framework, defines the following variables: |
82 | | # HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER |
83 | | # |
84 | | #------------------------------------------------------------------------ |
85 | | AC_DEFUN(MP_CHECK_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER, [ |
86 | | FRAMEWORK_LIBS="-framework CoreFoundation" |
87 | | |
88 | | AC_MSG_CHECKING([for CFNotificationCenterGetDarwinNotifyCenter]) |
89 | | |
90 | | AC_CACHE_VAL(mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter, [ |
91 | | ac_save_LIBS="$LIBS" |
92 | | LIBS="$FRAMEWORK_LIBS $LIBS" |
93 | | |
94 | | AC_LINK_IFELSE([ |
95 | | AC_LANG_PROGRAM([ |
96 | | #include <CoreFoundation/CoreFoundation.h> |
97 | | ], [ |
98 | | CFNotificationCenterRef ref = CFNotificationCenterGetDarwinNotifyCenter(); |
99 | | ]) |
100 | | ], [ |
101 | | mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter="yes" |
102 | | ], [ |
103 | | mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter="no" |
104 | | ] |
105 | | ) |
106 | | |
107 | | LIBS="$ac_save_LIBS" |
108 | | ]) |
109 | | |
110 | | AC_MSG_RESULT(${mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter}) |
111 | | |
112 | | if test x"${mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter}" = "xyes"; then |
113 | | AC_DEFINE([HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER], [], [Define if function CFNotificationCenterGetDarwinNotifyCenter in CoreFoundation framework]) |
114 | | fi |
115 | | |
116 | | AC_SUBST(HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER) |
117 | | ]) |
118 | | |
119 | | |
120 | | #------------------------------------------------------------------------ |
121 | | # MP_CHECK_FRAMEWORK_SYSTEMCONFIGURATION -- |
122 | | # |
123 | | # Check if SystemConfiguration framework is available, define HAVE_FRAMEWORK_SYSTEMCONFIGURATION if so. |
124 | | # |
125 | | # Arguments: |
126 | | # None. |
127 | | # |
128 | | # Requires: |
129 | | # None. |
130 | | # |
131 | | # Depends: |
132 | | # AC_LANG_PROGRAM |
133 | | # |
134 | | # Results: |
135 | | # Result is cached. |
136 | | # |
137 | | # If SystemConfiguration framework is available, defines the following variables: |
138 | | # HAVE_FRAMEWORK_SYSTEMCONFIGURATION |
139 | | # |
140 | | #------------------------------------------------------------------------ |
141 | | AC_DEFUN(MP_CHECK_FRAMEWORK_SYSTEMCONFIGURATION, [ |
142 | | FRAMEWORK_LIBS="-framework SystemConfiguration" |
143 | | |
144 | | AC_MSG_CHECKING([for SystemConfiguration framework]) |
145 | | |
146 | | AC_CACHE_VAL(mp_cv_have_framework_systemconfiguration, [ |
147 | | ac_save_LIBS="$LIBS" |
148 | | LIBS="$FRAMEWORK_LIBS $LIBS" |
149 | | |
150 | | AC_LINK_IFELSE([ |
151 | | AC_LANG_PROGRAM([ |
152 | | #include <SystemConfiguration/SystemConfiguration.h> |
153 | | ], [ |
154 | | int err = SCError(); |
155 | | SCDynamicStoreRef dsRef = SCDynamicStoreCreate(NULL, NULL, NULL, NULL); |
156 | | ]) |
157 | | ], [ |
158 | | mp_cv_have_framework_systemconfiguration="yes" |
159 | | ], [ |
160 | | mp_cv_have_framework_systemconfiguration="no" |
161 | | ] |
162 | | ) |
163 | | |
164 | | LIBS="$ac_save_LIBS" |
165 | | ]) |
166 | | |
167 | | AC_MSG_RESULT(${mp_cv_have_framework_systemconfiguration}) |
168 | | |
169 | | if test x"${mp_cv_have_framework_systemconfiguration}" = "xyes"; then |
170 | | AC_DEFINE([HAVE_FRAMEWORK_SYSTEMCONFIGURATION], [], [Define if SystemConfiguration framework is available]) |
171 | | fi |
172 | | |
173 | | AC_SUBST(HAVE_FRAMEWORK_SYSTEMCONFIGURATION) |
174 | | ]) |
175 | | |
176 | | |
177 | | #------------------------------------------------------------------------ |
178 | | # MP_CHECK_FRAMEWORK_IOKIT -- |
179 | | # |
180 | | # Check if IOKit framework is available, define HAVE_FRAMEWORK_IOKIT if so. |
181 | | # |
182 | | # Arguments: |
183 | | # None. |
184 | | # |
185 | | # Requires: |
186 | | # None. |
187 | | # |
188 | | # Depends: |
189 | | # AC_LANG_PROGRAM |
190 | | # |
191 | | # Results: |
192 | | # Result is cached. |
193 | | # |
194 | | # If IOKit framework is available, defines the following variables: |
195 | | # HAVE_FRAMEWORK_IOKIT |
196 | | # |
197 | | #------------------------------------------------------------------------ |
198 | | AC_DEFUN(MP_CHECK_FRAMEWORK_IOKIT, [ |
199 | | FRAMEWORK_LIBS="-framework IOKit" |
200 | | |
201 | | AC_MSG_CHECKING([for IOKit framework]) |
202 | | |
203 | | AC_CACHE_VAL(mp_cv_have_framework_iokit, [ |
204 | | ac_save_LIBS="$LIBS" |
205 | | LIBS="$FRAMEWORK_LIBS $LIBS" |
206 | | |
207 | | AC_LINK_IFELSE([ |
208 | | AC_LANG_PROGRAM([ |
209 | | #include <IOKit/IOKitLib.h> |
210 | | ], [ |
211 | | IOCreateReceivePort(0, NULL); |
212 | | IORegisterForSystemPower(0, NULL, NULL, NULL); |
213 | | ]) |
214 | | ], [ |
215 | | mp_cv_have_framework_iokit="yes" |
216 | | ], [ |
217 | | mp_cv_have_framework_iokit="no" |
218 | | ] |
219 | | ) |
220 | | |
221 | | LIBS="$ac_save_LIBS" |
222 | | ]) |
223 | | |
224 | | AC_MSG_RESULT(${mp_cv_have_framework_iokit}) |
225 | | |
226 | | if test x"${mp_cv_have_framework_iokit}" = "xyes"; then |
227 | | AC_DEFINE([HAVE_FRAMEWORK_IOKIT], [], [Define if IOKit framework is available]) |
228 | | fi |
229 | | |
230 | | AC_SUBST(HAVE_FRAMEWORK_IOKIT) |
231 | | ]) |
232 | | |
233 | | |
234 | | dnl This macro checks if the user specified a ports tree |
235 | | dnl explicitly. If not, search for it |
236 | | |
237 | | # MP_PATH_PORTSDIR(DEFAULT_PORTSDIR) |
238 | | #--------------------------------------- |
239 | | AC_DEFUN([MP_PATH_PORTSDIR],[ |
240 | | dnl For ease of reading, run after gcc has been found/configured |
241 | | AC_REQUIRE([AC_PROG_CC]) |
242 | | |
243 | | AC_ARG_WITH(ports-dir, [AS_HELP_STRING([--with-ports-dir=DIR],[Specify alternate ports directory])], [ portsdir="$withval" ] ) |
244 | | |
245 | | |
246 | | AC_MSG_CHECKING([for ports tree]) |
247 | | if test "x$portsdir" != "x" ; then |
248 | | if test -d "$portsdir" -a -e "$portsdir/PortIndex" ; then |
249 | | : |
250 | | else |
251 | | AC_MSG_ERROR([$portsdir not a valid ports tree]) |
252 | | fi |
253 | | else |
254 | | dnl If the user didn't give a path, look for default |
255 | | if test "x$1" != "x" ; then |
256 | | if test -d "$1" -a -e "$1/PortIndex" ; then |
257 | | portsdir=$1 |
258 | | fi |
259 | | fi |
260 | | fi |
261 | | |
262 | | if test "x$portsdir" != "x" ; then |
263 | | AC_MSG_RESULT($portsdir) |
264 | | PORTSDIR="$portsdir" |
265 | | AC_SUBST(PORTSDIR) |
266 | | else |
267 | | AC_MSG_WARN([No ports tree found]) |
268 | | fi |
269 | | |
270 | | ]) |
271 | | |
272 | | |
273 | | # MP_PATH_MPCONFIGDIR |
274 | | #--------------------------------------- |
275 | | AC_DEFUN([MP_PATH_MPCONFIGDIR],[ |
276 | | dnl if the user actually specified --prefix, shift |
277 | | dnl mpconfigdir to $prefix/etc/macports |
278 | | dnl AC_REQUIRE([MP_PATH_PORTSDIR]) |
279 | | |
280 | | AC_MSG_CHECKING([for MacPorts config directory]) |
281 | | |
282 | | mpconfigdir='${sysconfdir}/macports' |
283 | | |
284 | | AC_MSG_RESULT([$mpconfigdir]) |
285 | | MPCONFIGDIR="$mpconfigdir" |
286 | | AC_SUBST(MPCONFIGDIR) |
287 | | |
288 | | ]) |
289 | | |
290 | | # MP_CHECK_OLDLAYOUT |
291 | | #--------------------------------------- |
292 | | AC_DEFUN([MP_CHECK_OLDLAYOUT],[ |
293 | | dnl Bail if there is an existing install of DP/MP older than 1.5 |
294 | | |
295 | | AC_MSG_CHECKING([that any existing MacPorts install can be upgraded]) |
296 | | |
297 | | eval dpversionfile="${sysconfdir}/ports/dp_version" |
298 | | if test -f $dpversionfile; then |
299 | | AC_MSG_ERROR([Existing MacPorts or DarwinPorts install is too old to be upgraded. Install MacPorts 1.7.1 first.]) |
300 | | else |
301 | | AC_MSG_RESULT([yes]) |
302 | | fi |
303 | | |
304 | | ]) |
305 | | |
306 | | # MP_CHECK_NOROOTPRIVILEGES |
307 | | #------------------------------------------------- |
308 | | AC_DEFUN([MP_CHECK_NOROOTPRIVILEGES],[ |
309 | | dnl if with user specifies --with-no-root-privileges, |
310 | | dnl use current user and group. |
311 | | dnl use ~/Library/Tcl as Tcl package directory |
312 | | AC_REQUIRE([MP_PATH_MPCONFIGDIR]) |
313 | | |
314 | | AC_ARG_WITH(no-root-privileges, [AS_HELP_STRING([--with-no-root-privileges],[Specify that MacPorts should be installed in your home directory])], [ROOTPRIVS=$withval] ) |
315 | | |
316 | | if test "${ROOTPRIVS+set}" = set; then |
317 | | |
318 | | # Set install-user to current user |
319 | | AC_MSG_CHECKING([for install user]) |
320 | | DSTUSR=`id -un` |
321 | | AC_MSG_RESULT([$DSTUSR]) |
322 | | AC_SUBST(DSTUSR) |
323 | | |
324 | | # Set install-group to current user |
325 | | AC_MSG_CHECKING([for install group]) |
326 | | DSTGRP=`id -gn` |
327 | | AC_MSG_RESULT([$DSTGRP]) |
328 | | AC_SUBST(DSTGRP) |
329 | | |
330 | | # Set run-user to current user |
331 | | AC_MSG_CHECKING([for macports user]) |
332 | | RUNUSR=`id -un` |
333 | | AC_MSG_RESULT([$RUNUSR]) |
334 | | AC_SUBST(RUNUSR) |
335 | | |
336 | | # Set Tcl package directory to ~/Library/Tcl |
337 | | AC_MSG_CHECKING(for Tcl package directory) |
338 | | ac_cv_c_tclpkgd=`eval echo ~$DSTUSR/Library/Tcl` |
339 | | # Convert to a native path and substitute into the output files. |
340 | | PACKAGE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclpkgd}` |
341 | | TCL_PACKAGE_DIR=${PACKAGE_DIR_NATIVE} |
342 | | AC_SUBST(TCL_PACKAGE_DIR) |
343 | | if test x"${ac_cv_c_tclpkgd}" = x ; then |
344 | | AC_MSG_ERROR(Tcl package directory not found. Please specify its location with --with-tclpackage) |
345 | | else |
346 | | AC_MSG_RESULT(${ac_cv_c_tclpkgd}) |
347 | | fi |
348 | | fi |
349 | | |
350 | | ]) |
351 | | |
352 | | # MP_CHECK_RUNUSER |
353 | | #------------------------------------------------- |
354 | | AC_DEFUN([MP_CHECK_RUNUSER],[ |
355 | | dnl if with user specifies --with-macports-user, |
356 | | dnl use it. otherwise default to platform defaults |
357 | | AC_REQUIRE([MP_PATH_MPCONFIGDIR]) |
358 | | |
359 | | AC_ARG_WITH(macports-user, [AS_HELP_STRING([--with-macports-user=USER],[Specify user to drop privileges to, if possible, during compiles etc.])], [ RUNUSR=$withval ] ) |
360 | | |
361 | | AC_MSG_CHECKING([for macports user]) |
362 | | if test "x$RUNUSR" = "x" ; then |
363 | | RUNUSR=macports |
364 | | fi |
365 | | |
366 | | AC_MSG_RESULT([$RUNUSR]) |
367 | | AC_SUBST(RUNUSR) |
368 | | ]) |
369 | | |
370 | | |
371 | | # MP_SHARED_DIRECTORY |
372 | | #------------------------------------------------- |
373 | | AC_DEFUN([MP_SHARED_DIRECTORY],[ |
374 | | dnl if with user specifies --with-shared-directory, |
375 | | dnl use 0775 permissions for ${prefix} directories |
376 | | AC_REQUIRE([MP_PATH_MPCONFIGDIR]) |
377 | | |
378 | | AC_ARG_WITH(shared-directory, [AS_HELP_STRING([--with-shared-directory],[Use 0775 permissions for installed directories])], [ SHAREDIR=$withval ] ) |
379 | | |
380 | | if test "${SHAREDIR+set}" = set; then |
381 | | AC_MSG_CHECKING([whether to share the install directory with all members of the install group]) |
382 | | DSTMODE=0775 |
383 | | |
384 | | AC_MSG_RESULT([$DSTMODE]) |
385 | | AC_SUBST(DSTMODE) |
386 | | fi |
387 | | ]) |
388 | | |
389 | | # MP_CHECK_INSTALLUSER |
390 | | #------------------------------------------------- |
391 | | AC_DEFUN([MP_CHECK_INSTALLUSER],[ |
392 | | dnl if with user specifies --with-install-user, |
393 | | dnl use it. otherwise default to platform defaults |
394 | | AC_REQUIRE([MP_PATH_MPCONFIGDIR]) |
395 | | |
396 | | AC_ARG_WITH(install-user, [AS_HELP_STRING([--with-install-user=USER],[Specify user ownership of installed files])], [ DSTUSR=$withval ] ) |
397 | | |
398 | | AC_MSG_CHECKING([for install user]) |
399 | | if test "x$DSTUSR" = "x" ; then |
400 | | DSTUSR=root |
401 | | fi |
402 | | |
403 | | AC_MSG_RESULT([$DSTUSR]) |
404 | | AC_SUBST(DSTUSR) |
405 | | ]) |
406 | | |
407 | | # MP_CHECK_INSTALLGROUP |
408 | | #------------------------------------------------- |
409 | | AC_DEFUN([MP_CHECK_INSTALLGROUP],[ |
410 | | dnl if with user specifies --with-install-group, |
411 | | dnl use it. otherwise default to platform defaults |
412 | | AC_REQUIRE([MP_CHECK_INSTALLUSER]) |
413 | | |
414 | | AC_ARG_WITH(install-group, [AS_HELP_STRING([--with-install-group=GROUP],[Specify group ownership of installed files])], [ DSTGRP=$withval ] ) |
415 | | |
416 | | AC_MSG_CHECKING([for install group]) |
417 | | if test "x$DSTGRP" = "x" ; then |
418 | | |
419 | | case $host_os in |
420 | | darwin*) |
421 | | DSTGRP="admin" |
422 | | ;; |
423 | | freebsd*) |
424 | | DSTGRP="wheel" |
425 | | ;; |
426 | | linux*) |
427 | | DSTGRP="root" |
428 | | ;; |
429 | | *) |
430 | | DSTGRP="wheel" |
431 | | ;; |
432 | | esac |
433 | | fi |
434 | | |
435 | | AC_MSG_RESULT([$DSTGRP]) |
436 | | AC_SUBST(DSTGRP) |
437 | | ]) |
438 | | |
439 | | # MP_DIRECTORY_MODE |
440 | | #------------------------------------------------- |
441 | | AC_DEFUN([MP_DIRECTORY_MODE],[ |
442 | | dnl if with user specifies --with-directory-mode, |
443 | | dnl use the specified permissions for ${prefix} directories |
444 | | dnl otherwise use 0755 |
445 | | AC_REQUIRE([MP_PATH_MPCONFIGDIR]) |
446 | | |
447 | | AC_ARG_WITH(directory-mode, [AS_HELP_STRING([--with-directory-mode=MODE],[Specify directory mode of installed directories])], [ DSTMODE=$withval ] ) |
448 | | |
449 | | AC_MSG_CHECKING([what permissions to use for installation directories]) |
450 | | if test "x$DSTMODE" = "x" ; then |
451 | | DSTMODE=0755 |
452 | | fi |
453 | | |
454 | | AC_MSG_RESULT([$DSTMODE]) |
455 | | AC_SUBST(DSTMODE) |
456 | | ]) |
457 | | |
458 | | # MP_PATH_APPLICATIONS |
459 | | #--------------------------------------- |
460 | | AC_DEFUN([MP_PATH_APPLICATIONS],[ |
461 | | AC_REQUIRE([MP_CHECK_INSTALLUSER]) |
462 | | |
463 | | AC_ARG_WITH(applications-dir,[AS_HELP_STRING([--with-applications-dir],[Applications installation directory.])], MPAPPLICATIONSDIR=${withval}) |
464 | | |
465 | | oldprefix=$prefix |
466 | | if test "x$prefix" = "xNONE" ; then |
467 | | prefix=$ac_default_prefix |
468 | | fi |
469 | | AC_MSG_CHECKING([for Applications installation directory]) |
470 | | |
471 | | if test "x$MPAPPLICATIONSDIR" = "x" ; then |
472 | | if test "$DSTUSR" = "root" ; then |
473 | | MPAPPLICATIONSDIR="/Applications/MacPorts" |
474 | | else |
475 | | MPAPPLICATIONSDIR="$(eval echo ~$DSTUSR)/Applications/MacPorts" |
476 | | fi |
477 | | fi |
478 | | |
479 | | AC_MSG_RESULT([$MPAPPLICATIONSDIR]) |
480 | | AC_SUBST(MPAPPLICATIONSDIR) |
481 | | prefix=$oldprefix |
482 | | ]) |
483 | | |
484 | | # MP_PATH_FRAMEWORKS |
485 | | #--------------------------------------- |
486 | | AC_DEFUN([MP_PATH_FRAMEWORKS],[ |
487 | | AC_REQUIRE([MP_CHECK_INSTALLUSER]) |
488 | | |
489 | | AC_ARG_WITH(frameworks-dir,[AS_HELP_STRING([--with-frameworks-dir],[Frameworks installation directory.])], MPFRAMEWORKSDIR=${withval}) |
490 | | |
491 | | oldprefix=$prefix |
492 | | if test "x$prefix" = "xNONE" ; then |
493 | | prefix=$ac_default_prefix |
494 | | fi |
495 | | AC_MSG_CHECKING([for Frameworks installation directory]) |
496 | | |
497 | | if test "x$MPFRAMEWORKSDIR" = "x" ; then |
498 | | MPFRAMEWORKSDIR="${prefix}/Library/Frameworks" |
499 | | fi |
500 | | |
501 | | AC_MSG_RESULT([$MPFRAMEWORKSDIR]) |
502 | | AC_SUBST(MPFRAMEWORKSDIR) |
503 | | prefix=$oldprefix |
504 | | ]) |
505 | | |
506 | | |
507 | | # MP_UNIVERSAL_OPTIONS |
508 | | #--------------------------------------- |
509 | | AC_DEFUN([MP_UNIVERSAL_OPTIONS],[ |
510 | | AC_ARG_WITH(universal-archs,[AS_HELP_STRING([--with-universal-archs="CPU"],[Universal CPU architectures (space separated)])], UNIVERSAL_ARCHS=${withval}) |
511 | | |
512 | | if test "x$UNIVERSAL_ARCHS" = "x"; then |
513 | | case "$MACOSX_VERSION" in |
514 | | 10.[[0-5]]*) |
515 | | UNIVERSAL_ARCHS="i386 ppc" |
516 | | ;; |
517 | | *) |
518 | | UNIVERSAL_ARCHS="x86_64 i386" |
519 | | ;; |
520 | | esac |
521 | | fi |
522 | | |
523 | | AC_MSG_CHECKING([for Universal CPU architectures]) |
524 | | AC_MSG_RESULT([$UNIVERSAL_ARCHS]) |
525 | | AC_SUBST(UNIVERSAL_ARCHS) |
526 | | ]) |
527 | | |
528 | | # MP_LIB_MD5 |
529 | | #--------------------------------------- |
530 | | # Check for an md5 implementation |
531 | | AC_DEFUN([MP_LIB_MD5],[ |
532 | | |
533 | | # Check for libmd from FreeBSD, which is preferred |
534 | | AC_CHECK_LIB([md], [MD5File],[ |
535 | | AC_CHECK_HEADERS([md5.h sha.h], ,[ |
536 | | AC_MSG_ERROR([libmd was found, but md5.h or sha.h is missing.]) |
537 | | ]) |
538 | | ac_save_LIBS="$LIBS" |
539 | | LIBS="-lmd $LIBS" |
540 | | AC_CHECK_FUNCS([SHA1_File]) |
541 | | LIBS="$ac_save_LIBS" |
542 | | AC_CHECK_HEADERS([ripemd.h sha256.h]) |
543 | | AC_DEFINE([HAVE_LIBMD], ,[Define if you have the `md' library (-lmd).]) |
544 | | MD5_LIBS="-lmd"] |
545 | | ) |
546 | | if test "x$MD5_LIBS" = "x"; then |
547 | | # If libmd is not found, check for libcrypto from OpenSSL |
548 | | AC_CHECK_LIB([crypto], [MD5_Update],[ |
549 | | AC_CHECK_HEADERS([openssl/md5.h openssl/sha.h], ,[ |
550 | | AC_MSG_ERROR([libcrypto was found, but openssl/md5.h or openssl/sha.h is missing.]) |
551 | | ]) |
552 | | AC_CHECK_HEADERS([openssl/ripemd.h]) |
553 | | ac_save_LIBS="$LIBS" |
554 | | LIBS="-lcrypto $LIBS" |
555 | | AC_CHECK_FUNCS([SHA256_Update]) |
556 | | LIBS="$ac_save_LIBS" |
557 | | AC_DEFINE([HAVE_LIBCRYPTO], ,[Define if you have the `crypto' library (-lcrypto).]) |
558 | | MD5_LIBS="-lcrypto"] |
559 | | ) |
560 | | fi |
561 | | if test "x$MD5_LIBS" = "x"; then |
562 | | AC_MSG_ERROR([Neither CommonCrypto, libmd nor libcrypto were found. A working md5 implementation is required.]) |
563 | | fi |
564 | | AC_SUBST([MD5_LIBS]) |
565 | | ]) |
566 | | |
567 | | # MP_PROG_DAEMONDO |
568 | | #--------------------------------------- |
569 | | AC_DEFUN([MP_PROG_DAEMONDO],[ |
570 | | AC_REQUIRE([MP_CHECK_FRAMEWORK_COREFOUNDATION]) |
571 | | AC_REQUIRE([MP_CHECK_FRAMEWORK_SYSTEMCONFIGURATION]) |
572 | | AC_REQUIRE([MP_CHECK_FRAMEWORK_IOKIT]) |
573 | | AC_REQUIRE([MP_CHECK_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER]) |
574 | | |
575 | | AC_MSG_CHECKING(for whether we will build daemondo) |
576 | | result=no |
577 | | case $host_os in |
578 | | darwin*) |
579 | | if test "x$mp_cv_have_framework_corefoundation" == "xyes" && |
580 | | test "x$mp_cv_have_framework_systemconfiguration" == "xyes" && |
581 | | test "x$mp_cv_have_framework_iokit" == "xyes" && |
582 | | test "x$mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter" == "xyes"; then |
583 | | result=yes |
584 | | EXTRA_PROGS="$EXTRA_PROGS daemondo" |
585 | | AC_CONFIG_FILES([src/programs/daemondo/Makefile]) |
586 | | fi |
587 | | ;; |
588 | | *) |
589 | | esac |
590 | | AC_MSG_RESULT(${result}) |
591 | | ]) |
592 | | |
593 | | #------------------------------------------------------------------------ |
594 | | # MP_TCL_PACKAGE_DIR -- |
595 | | # |
596 | | # Locate the correct directory for Tcl package installation |
597 | | # |
598 | | # Arguments: |
599 | | # None. |
600 | | # |
601 | | # Requires: |
602 | | # TCLVERSION must be set |
603 | | # CYGPATH must be set |
604 | | # TCLSH must be set |
605 | | # |
606 | | # Results: |
607 | | # |
608 | | # Adds a --with-tclpackage switch to configure. |
609 | | # Result is cached. |
610 | | # |
611 | | # Substs the following vars: |
612 | | # TCL_PACKAGE_DIR |
613 | | #------------------------------------------------------------------------ |
614 | | |
615 | | AC_DEFUN(MP_TCL_PACKAGE_DIR, [ |
616 | | AC_REQUIRE([MP_CHECK_INSTALLUSER]) |
617 | | |
618 | | AC_MSG_CHECKING(for Tcl package directory) |
619 | | |
620 | | AC_ARG_WITH(tclpackage, [ --with-tclpackage Tcl package installation directory.], with_tclpackagedir=${withval}) |
621 | | |
622 | | if test x"${with_tclpackagedir}" != x ; then |
623 | | ac_cv_c_tclpkgd=${with_tclpackagedir} |
624 | | else |
625 | | AC_CACHE_VAL(ac_cv_c_tclpkgd, [ |
626 | | # Use the value from --with-tclpackage, if it was given |
627 | | |
628 | | if test x"${with_tclpackagedir}" != x ; then |
629 | | echo "tclpackagedir" |
630 | | ac_cv_c_tclpkgd=${with_tclpackagedir} |
631 | | else |
632 | | # On darwin we can do some intelligent guessing |
633 | | case $host_os in |
634 | | darwin*) |
635 | | tcl_autopath=`echo 'puts -nonewline \$auto_path' | $TCLSH` |
636 | | for path in $tcl_autopath; do |
637 | | if test "$DSTUSR" = "root" ; then |
638 | | if test "$path" = "/Library/Tcl"; then |
639 | | ac_cv_c_tclpkgd="$path" |
640 | | break |
641 | | fi |
642 | | if test "$path" = "/System/Library/Tcl"; then |
643 | | if test -d "$path"; then |
644 | | ac_cv_c_tclpkgd="$path" |
645 | | break |
646 | | fi |
647 | | fi |
648 | | elif test "$path" = "~/Library/Tcl"; then |
649 | | ac_cv_c_tclpkgd=`eval echo ~$DSTUSR/Library/Tcl` |
650 | | break |
651 | | fi |
652 | | done |
653 | | ;; |
654 | | esac |
655 | | if test x"${ac_cv_c_tclpkgd}" = x ; then |
656 | | # Fudge a path from the first entry in the auto_path |
657 | | tcl_pkgpath=`echo 'puts -nonewline [[lindex \$auto_path 0]]' | $TCLSH` |
658 | | if test -d "$tcl_pkgpath"; then |
659 | | ac_cv_c_tclpkgd="$tcl_pkgpath" |
660 | | fi |
661 | | # If the first entry does not exist, do nothing |
662 | | fi |
663 | | fi |
664 | | ]) |
665 | | fi |
666 | | |
667 | | if test x"${ac_cv_c_tclpkgd}" = x ; then |
668 | | AC_MSG_ERROR(Tcl package directory not found. Please specify its location with --with-tclpackage) |
669 | | else |
670 | | AC_MSG_RESULT(${ac_cv_c_tclpkgd}) |
671 | | fi |
672 | | |
673 | | # Convert to a native path and substitute into the output files. |
674 | | |
675 | | PACKAGE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tclpkgd}` |
676 | | |
677 | | TCL_PACKAGE_DIR=${PACKAGE_DIR_NATIVE} |
678 | | |
679 | | AC_SUBST(TCL_PACKAGE_DIR) |
680 | | ]) |
681 | | |
682 | | # MP_PROG_TCLSH |
683 | | #--------------------------------------- |
684 | | AC_DEFUN([MP_PROG_TCLSH],[ |
685 | | |
686 | | |
687 | | case $host_os in |
688 | | freebsd*) |
689 | | # FreeBSD installs a dummy tclsh (annoying) |
690 | | # Look for a real versioned tclsh with threads first |
691 | | # Look for a real versioned tclsh without threads second |
692 | | AC_PATH_PROG([TCLSH], [tclsh${TCL_VERSION}-threads tclsh${TCL_VERSION} tclsh]) |
693 | | ;; |
694 | | *) |
695 | | # Otherwise, look for a non-versioned tclsh |
696 | | AC_PATH_PROG([TCLSH], [tclsh tclsh${TCL_VERSION}]) |
697 | | ;; |
698 | | esac |
699 | | if test "x$TCLSH" = "x" ; then |
700 | | AC_MSG_ERROR([Could not find tclsh]) |
701 | | fi |
702 | | |
703 | | AC_SUBST(TCLSH) |
704 | | ]) |
705 | | |
706 | | # MP_TCL_PACKAGE |
707 | | # Determine if a Tcl package is present. |
708 | | # |
709 | | # Arguments: |
710 | | # Package name (may include the version) |
711 | | # |
712 | | # Syntax: |
713 | | # MP_TCL_PACKAGE (package, [action-if-found], [action-if-not-found]) |
714 | | # |
715 | | # Requires: |
716 | | # TCLSH must be set |
717 | | # |
718 | | # Results: |
719 | | # Execute action-if-found or action-if-not-found |
720 | | #--------------------------------------- |
721 | | AC_DEFUN([MP_TCL_PACKAGE],[ |
722 | | AC_MSG_CHECKING([for Tcl $1 package]) |
723 | | package_present=`echo 'if {[[catch {package require $1}]]} {puts -nonewline 0} else {puts -nonewline 1}' | $TCLSH` |
724 | | AS_IF([test "$package_present" = "1"], [$2], [$3])[] |
725 | | ]) |
726 | | |
727 | | # MP_TCL_THREAD_SUPPORT |
728 | | # Determine if thread support is available in tclsh. |
729 | | # |
730 | | # Arguments: |
731 | | # None. |
732 | | # |
733 | | # Requires: |
734 | | # TCLSH must be set |
735 | | # |
736 | | # Results: |
737 | | # Fails if thread support isn't available. |
738 | | #--------------------------------------- |
739 | | AC_DEFUN([MP_TCL_THREAD_SUPPORT],[ |
740 | | AC_MSG_CHECKING([whether tclsh was compiled with threads]) |
741 | | tcl_threadenabled=`echo 'puts -nonewline [[info exists tcl_platform(threaded)]]' | $TCLSH` |
742 | | if test "$tcl_threadenabled" = "1" ; then |
743 | | AC_MSG_RESULT([yes]) |
744 | | else |
745 | | AC_MSG_RESULT([no]) |
746 | | AC_MSG_ERROR([tcl wasn't compiled with threads enabled]) |
747 | | fi |
748 | | ]) |
749 | | |
750 | | # MP_LIBCURL_FLAGS |
751 | | # Sets the flags to compile with libcurl. |
752 | | # |
753 | | # Arguments: |
754 | | # None. |
755 | | # |
756 | | # Requires: |
757 | | # curl-config or user parameters to define the flags. |
758 | | # |
759 | | # Results: |
760 | | # defines some help strings. |
761 | | # sets CFLAGS_LIBCURL and LDFLAGS_LIBCURL |
762 | | #--------------------------------------- |
763 | | AC_DEFUN([MP_LIBCURL_FLAGS],[ |
764 | | AC_ARG_WITH(curlprefix, |
765 | | [ --with-curlprefix base directory for the cURL install '/usr', '/usr/local',...], |
766 | | [ curlprefix=$withval ]) |
767 | | |
768 | | if test "x$curlprefix" = "x"; then |
769 | | AC_PATH_PROG([CURL_CONFIG], [curl-config]) |
770 | | else |
771 | | AC_PATH_PROG([CURL_CONFIG], [curl-config], , [$curlprefix/bin]) |
772 | | fi |
773 | | |
774 | | if test "x$CURL_CONFIG" = "x"; then |
775 | | AC_MSG_ERROR([cannot find curl-config. Is libcurl installed?]) |
776 | | fi |
777 | | |
778 | | CFLAGS_LIBCURL=$($CURL_CONFIG --cflags) |
779 | | if test "x$curlprefix" = "x"; then |
780 | | # System curl-config emits absurd output for --libs |
781 | | # See rdar://7244457 |
782 | | LDFLAGS_LIBCURL="-lcurl" |
783 | | else |
784 | | # Due to a bug in dist, --arch flags are improperly supplied by curl-config. |
785 | | # Get rid of them. |
786 | | LDFLAGS_LIBCURL=$($CURL_CONFIG --libs | [sed 's/-arch [A-Za-z0-9_]* //g']) |
787 | | fi |
788 | | |
789 | | AC_SUBST(CFLAGS_LIBCURL) |
790 | | AC_SUBST(LDFLAGS_LIBCURL) |
791 | | ]) |
792 | | |
793 | | # MP_SQLITE3_FLAGS |
794 | | # Sets the flags to compile with libsqlite3 and tclsqlite3. |
795 | | # |
796 | | # Arguments: |
797 | | # None. |
798 | | # |
799 | | # Requires: |
800 | | # pkgconfig, libsqlite3 in /usr/lib, or user parameters to define the flags. |
801 | | # |
802 | | # Results: |
803 | | # defines some help strings. |
804 | | # sets CFLAGS_SQLITE3 and LDFLAGS_SQLITE3 |
805 | | #--------------------------------------- |
806 | | AC_DEFUN([MP_SQLITE3_FLAGS],[ |
807 | | # first sqlite3 itself |
808 | | AC_ARG_WITH(sqlite3prefix, |
809 | | [ --with-sqlite3prefix base directory for the sqlite3 install '/usr', '/usr/local',...], |
810 | | [ sqlite3prefix=$withval ]) |
811 | | |
812 | | if test "x$sqlite3prefix" = "x"; then |
813 | | # see if it's somewhere like /usr that needs no extra flags |
814 | | LDFLAGS_SQLITE3="-lsqlite3" |
815 | | AC_CHECK_HEADER(sqlite3.h, [],[ |
816 | | # nope - try pkg-config |
817 | | AC_PATH_PROG([PKG_CONFIG], [pkg-config]) |
818 | | if test "x$PKG_CONFIG" = "x" || ! $PKG_CONFIG --exists sqlite3; then |
819 | | AC_MSG_ERROR([cannot find sqlite3 header]) |
820 | | else |
821 | | CFLAGS_SQLITE3=$($PKG_CONFIG --cflags sqlite3) |
822 | | LDFLAGS_SQLITE3=$($PKG_CONFIG --libs sqlite3) |
823 | | # for tclsqlite below |
824 | | mp_sqlite3_dir=$($PKG_CONFIG --variable=prefix sqlite3) |
825 | | if test "x$mp_sqlite3_dir" != "x"; then |
826 | | mp_sqlite3_dir=${mp_sqlite3_dir}/lib/sqlite3 |
827 | | fi |
828 | | fi |
829 | | ]) |
830 | | else |
831 | | CFLAGS_SQLITE3="-I${sqlite3prefix}/include" |
832 | | LDFLAGS_SQLITE3="-L${sqlite3prefix}/lib -lsqlite3" |
833 | | fi |
834 | | |
835 | | # check if we have sqlite3ext.h, using the appropriate cppflags |
836 | | CPPFLAGS_OLD="${CPPFLAGS}" |
837 | | CPPFLAGS="${CPPFLAGS} ${CFLAGS_SQLITE3}" |
838 | | AC_CHECK_HEADERS(sqlite3ext.h) |
839 | | CPPFLAGS="${CPPFLAGS_OLD}" |
840 | | |
841 | | AC_SUBST(CFLAGS_SQLITE3) |
842 | | AC_SUBST(LDFLAGS_SQLITE3) |
843 | | |
844 | | # now the sqlite Tcl bindings |
845 | | AC_ARG_WITH(tcl-sqlite3, |
846 | | AS_HELP_STRING([--with-tcl-sqlite3=DIR], |
847 | | [directory for Tcl sqlite3 (default /usr/lib/sqlite3)]), |
848 | | [mp_sqlite3_dir=$withval]) |
849 | | |
850 | | if test "x$mp_sqlite3_dir" = "x"; then |
851 | | case $host_os in |
852 | | darwin*) |
853 | | mp_sqlite3_dir="/usr/lib/sqlite3" |
854 | | ;; |
855 | | freebsd*) |
856 | | mp_sqlite3_dir="/usr/local/lib/sqlite" |
857 | | ;; |
858 | | *) |
859 | | mp_sqlite3_dir="/usr/share/tcl${TCL_VERSION}/sqlite3" |
860 | | ;; |
861 | | esac |
862 | | fi |
863 | | |
864 | | AC_CACHE_CHECK([for Tcl sqlite3 location], [mp_cv_sqlite3_dir], |
865 | | [mp_cv_sqlite3_dir= |
866 | | test -r "${mp_sqlite3_dir}/pkgIndex.tcl" && mp_cv_sqlite3_dir=$mp_sqlite3_dir |
867 | | ]) |
868 | | |
869 | | SQLITE3_TCL_DIR=$mp_cv_sqlite3_dir |
870 | | AC_SUBST(SQLITE3_TCL_DIR) |
871 | | ]) |
872 | | |
873 | | dnl This macro tests if the compiler supports GCC's |
874 | | dnl __attribute__ syntax for unused variables/parameters |
875 | | AC_DEFUN([MP_COMPILER_ATTRIBUTE_UNUSED], [ |
876 | | AC_MSG_CHECKING([how to mark unused variables]) |
877 | | AC_COMPILE_IFELSE( |
878 | | [AC_LANG_SOURCE([[int a __attribute__ ((unused));]])], |
879 | | [AC_DEFINE(UNUSED, [__attribute__((unused))], [Attribute to mark unused variables])], |
880 | | [AC_DEFINE(UNUSED, [])]) |
881 | | |
882 | | AC_MSG_RESULT([]) |
883 | | |
884 | | ]) |
885 | | |
886 | | dnl This macro ensures MP installation prefix bin/sbin paths are NOT in PATH |
887 | | dnl for configure to prevent potential problems when base/ code is updated |
888 | | dnl and ports are installed that would match needed items. |
889 | | AC_DEFUN([MP_PATH_SCAN],[ |
890 | | oldprefix=$prefix |
891 | | if test "x$prefix" = "xNONE" ; then |
892 | | prefix=$ac_default_prefix |
893 | | fi |
894 | | oldPATH=$PATH |
895 | | newPATH= |
896 | | as_save_IFS=$IFS; IFS=$PATH_SEPARATOR |
897 | | for as_dir in $oldPATH |
898 | | do |
899 | | IFS=$as_save_IFS |
900 | | if test "x$as_dir" != "x$prefix/bin" && |
901 | | test "x$as_dir" != "x$prefix/sbin"; then |
902 | | if test -z "$newPATH"; then |
903 | | newPATH=$as_dir |
904 | | else |
905 | | newPATH=$newPATH$PATH_SEPARATOR$as_dir |
906 | | fi |
907 | | fi |
908 | | done |
909 | | PATH=$newPATH; export PATH |
910 | | AC_SUBST(PATH_CLEANED,$newPATH) |
911 | | prefix=$oldprefix |
912 | | ]) |
913 | | |
914 | | dnl This macro tests for sed support of -E (BSD) or -r (GNU) |
915 | | AC_DEFUN([MP_SED_EXTENDED_REGEXP],[ |
916 | | AC_PATH_PROG(SED, [sed]) |
917 | | |
918 | | if test "x$SED" = "x"; then |
919 | | AC_MSG_ERROR([cannot find sed. Is sed installed?]) |
920 | | fi |
921 | | |
922 | | AC_MSG_CHECKING([which sed flag to use for extended regexp]) |
923 | | [any_sed_flag=`echo foo | $SED -e s/foo+/OK/ 2>&1 | grep OK`] |
924 | | [bsd_sed_flag=`echo foo | $SED -E -e s/foo+/OK/ 2>&1 | grep OK`] |
925 | | [gnu_sed_flag=`echo foo | $SED -r -e s/foo+/OK/ 2>&1 | grep OK`] |
926 | | if test "x$any_sed_flag" = "xOK" ; then |
927 | | AC_MSG_RESULT([none]) |
928 | | SED_EXT= |
929 | | elif test "x$bsd_sed_flag" = "xOK" ; then |
930 | | AC_MSG_RESULT([-E (BSD)]) |
931 | | SED_EXT=-E |
932 | | elif test "x$gnu_sed_flag" = "xOK" ; then |
933 | | AC_MSG_RESULT([-r (GNU)]) |
934 | | SED_EXT=-r |
935 | | else |
936 | | AC_MSG_RESULT([not available]) |
937 | | SED_EXT='N/A' |
938 | | fi |
939 | | AC_SUBST(SED_EXT) |
940 | | ]) |
941 | | |
942 | | dnl This macro tests for tar support of -q (BSD) or not (GNU) |
943 | | AC_DEFUN([MP_TAR_FAST_READ],[ |
944 | | AC_PATH_PROG(TAR, [tar]) |
945 | | |
946 | | AC_MSG_CHECKING([whether tar supports -q]) |
947 | | if $TAR -t -q -f - </dev/null 2>/dev/null ; then |
948 | | AC_MSG_RESULT([yes (bsdtar)]) |
949 | | TAR_Q='q' |
950 | | else |
951 | | AC_MSG_RESULT([no (gnutar)]) |
952 | | TAR_Q= |
953 | | fi |
954 | | AC_SUBST(TAR_Q) |
955 | | ]) |
956 | | |
957 | | dnl This macro tests for tar support of --no-same-owner |
958 | | AC_DEFUN([MP_TAR_NO_SAME_OWNER],[ |
959 | | AC_PATH_PROG(TAR, [tar]) |
960 | | AC_PATH_PROG(GNUTAR, [gnutar]) |
961 | | |
962 | | AC_MSG_CHECKING([for which tar variant to use]) |
963 | | AS_IF([test -n "$GNUTAR"], [TAR_CMD=$GNUTAR], [TAR_CMD=$TAR]) |
964 | | AC_MSG_RESULT([$TAR_CMD]) |
965 | | AC_SUBST(TAR_CMD) |
966 | | |
967 | | AC_MSG_CHECKING([for $TAR_CMD --no-same-owner support]) |
968 | | [no_same_owner_support=`$TAR_CMD --help 2>&1 | grep no-same-owner`] |
969 | | if test -z "$no_same_owner_support" ; then |
970 | | AC_MSG_RESULT([no]) |
971 | | else |
972 | | AC_MSG_RESULT([yes]) |
973 | | TAR_CMD="$TAR_CMD --no-same-owner" |
974 | | fi |
975 | | ]) |
976 | | |
977 | | dnl This macro tests for GNU patch |
978 | | AC_DEFUN([MP_PATCH_GNU_VERSION],[ |
979 | | AC_PATH_PROG(PATCH, [patch]) |
980 | | AC_PATH_PROG(GNUPATCH, [gpatch]) |
981 | | |
982 | | AC_MSG_CHECKING([for GNU (FSF) patch]) |
983 | | AS_IF([test -n "$GNUPATCH"], [PATCH_CMD=$GNUPATCH], [PATCH_CMD=$PATCH]) |
984 | | [fsf_version=`$PATCH_CMD --version 2>&1 | grep "Free Software Foundation"`] |
985 | | if test -z "$fsf_version" ; then |
986 | | AC_MSG_RESULT([none]) |
987 | | else |
988 | | AC_MSG_RESULT([$PATCH_CMD]) |
989 | | GNUPATCH="$PATCH_CMD" |
990 | | fi |
991 | | ]) |
992 | | |
993 | | #------------------------------------------------------------------------ |
994 | | # MP_CHECK_READLINK_IS_P1003_1A -- |
995 | | # |
996 | | # Check if readlink conforms to POSIX 1003.1a standard, define |
997 | | # READLINK_IS_NOT_P1003_1A if it doesn't. |
998 | | # |
999 | | # Arguments: |
1000 | | # None. |
1001 | | # |
1002 | | # Requires: |
1003 | | # None. |
1004 | | # |
1005 | | # Depends: |
1006 | | # AC_LANG_PROGRAM |
1007 | | # |
1008 | | # Results: |
1009 | | # Result is cached. |
1010 | | # |
1011 | | # If readlink doesn't conform to POSIX 1003.1a, defines the following variables: |
1012 | | # READLINK_IS_NOT_P1003_1A |
1013 | | # |
1014 | | #------------------------------------------------------------------------ |
1015 | | AC_DEFUN(MP_CHECK_READLINK_IS_P1003_1A, [ |
1016 | | AC_MSG_CHECKING([if readlink conforms to POSIX 1003.1a]) |
1017 | | |
1018 | | AC_CACHE_VAL(mp_cv_readlink_is_posix_1003_1a, [ |
1019 | | AC_COMPILE_IFELSE([ |
1020 | | AC_LANG_PROGRAM([ |
1021 | | #include <unistd.h> |
1022 | | ssize_t readlink(const char *, char *, size_t); |
1023 | | ], [ |
1024 | | ]) |
1025 | | ], [ |
1026 | | mp_cv_readlink_is_posix_1003_1a="yes" |
1027 | | ], [ |
1028 | | mp_cv_readlink_is_posix_1003_1a="no" |
1029 | | ] |
1030 | | ) |
1031 | | ]) |
1032 | | |
1033 | | AC_MSG_RESULT(${mp_cv_readlink_is_posix_1003_1a}) |
1034 | | |
1035 | | if test x"${mp_cv_readlink_is_posix_1003_1a}" = "xno"; then |
1036 | | AC_DEFINE([READLINK_IS_NOT_P1003_1A], [], [Define to 1 if readlink does not conform with POSIX 1003.1a (where third argument is a size_t and return value is a ssize_t)]) |
1037 | | fi |
1038 | | |
1039 | | AC_SUBST(READLINK_IS_NOT_P1003_1A) |
1040 | | ]) |
1041 | | |
1042 | | #------------------------------------------------------------------------ |
1043 | | # MP_WERROR -- |
1044 | | # |
1045 | | # Enable -Werror |
1046 | | # |
1047 | | # Arguments: |
1048 | | # None. |
1049 | | # |
1050 | | # Requires: |
1051 | | # none |
1052 | | # |
1053 | | # Depends: |
1054 | | # none |
1055 | | # |
1056 | | # Results: |
1057 | | # Substitutes WERROR_CFLAGS variable |
1058 | | #------------------------------------------------------------------------ |
1059 | | AC_DEFUN([MP_WERROR],[ |
1060 | | AC_REQUIRE([AC_PROG_CC]) |
1061 | | AC_ARG_ENABLE(werror, AS_HELP_STRING([--enable-werror],[Add -Werror to CFLAGS. Used for development.]), [enable_werror=${enableval}], [enable_werror=no]) |
1062 | | if test x"$enable_werror" != "xno"; then |
1063 | | CFLAGS_WERROR="-Werror" |
1064 | | else |
1065 | | CFLAGS_WERROR="" |
1066 | | fi |
1067 | | AC_SUBST([CFLAGS_WERROR]) |
1068 | | ]) |
1069 | | |
1070 | | #------------------------------------------------------------------------ |
1071 | | # MP_CHECK_SQLITE_VERSION -- |
1072 | | # |
1073 | | # Check for a specific SQLite version and execute commands depending on availability |
1074 | | # |
1075 | | # Arguments: |
1076 | | # Required SQLite version for the test to succeed in the form of SQLITE_VERSION_NUMBER |
1077 | | # |
1078 | | # Requires: |
1079 | | # MP_SQLITE3_FLAGS |
1080 | | # |
1081 | | # Depends: |
1082 | | # AC_LANG_SOURCE |
1083 | | # |
1084 | | # Results: |
1085 | | # Result is cached. |
1086 | | # |
1087 | | # sets mp_sqlite_version_ge_$1 to yes or no |
1088 | | # |
1089 | | #------------------------------------------------------------------------ |
1090 | | AC_DEFUN(MP_CHECK_SQLITE_VERSION, [ |
1091 | | AC_REQUIRE([MP_SQLITE3_FLAGS]) |
1092 | | |
1093 | | AC_MSG_CHECKING([for SQLite >= $1]) |
1094 | | |
1095 | | mp_check_sqlite_version_cppflags_save=$CPPFLAGS |
1096 | | CPPFLAGS="$CPPFLAGS $CFLAGS_SQLITE3" |
1097 | | |
1098 | | AC_CACHE_VAL(mp_cv_sqlite_version_defined, [ |
1099 | | AC_PREPROC_IFELSE( |
1100 | | [AC_LANG_SOURCE( |
1101 | | [[ |
1102 | | #include <sqlite3.h> |
1103 | | #ifndef SQLITE_VERSION_NUMBER |
1104 | | # error "SQLITE_VERSION_NUMBER undefined" |
1105 | | #endif |
1106 | | ]] |
1107 | | )], |
1108 | | [mp_cv_sqlite_version_defined="yes"], |
1109 | | [AC_MSG_ERROR("SQLITE_VERSION_NUMBER undefined or sqlite3.h not found")] |
1110 | | ) |
1111 | | ]) |
1112 | | |
1113 | | if test x"${mp_cv_sqlite_version_defined}" = "xno"; then |
1114 | | AC_MSG_RESULT([SQLite version not found]) |
1115 | | mp_sqlite_version_ge_$1="no" |
1116 | | else |
1117 | | AC_CACHE_VAL(mp_cv_sqlite_version_ge_$1, [ |
1118 | | AC_PREPROC_IFELSE( |
1119 | | [AC_LANG_SOURCE( |
1120 | | [[ |
1121 | | #include <sqlite3.h> |
1122 | | #if (SQLITE_VERSION_NUMBER >= $1) |
1123 | | /* Everything is fine */ |
1124 | | #else |
1125 | | # error "SQLite version too old" |
1126 | | #endif |
1127 | | ]] |
1128 | | )], |
1129 | | [mp_cv_sqlite_version_ge_$1="yes"], |
1130 | | [mp_cv_sqlite_version_ge_$1="no"] |
1131 | | ) |
1132 | | ]) |
1133 | | |
1134 | | AC_MSG_RESULT(${mp_cv_sqlite_version_ge_$1}) |
1135 | | mp_sqlite_version_ge_$1=${mp_cv_sqlite_version_ge_$1} |
1136 | | fi |
1137 | | |
1138 | | CPPFLAGS=$mp_check_sqlite_version_cppflags_save |
1139 | | ]) |
| 3 | # Copyright (C) 1996-2012 Free Software Foundation, Inc. |