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