1 #--------------------------------------------------------------------------- 2 # 3 # xc-lt-iface.m4 4 # 5 # Copyright (c) 2013 Daniel Stenberg <daniel (a] haxx.se> 6 # 7 # Permission to use, copy, modify, and distribute this software for any 8 # purpose with or without fee is hereby granted, provided that the above 9 # copyright notice and this permission notice appear in all copies. 10 # 11 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 # 19 #--------------------------------------------------------------------------- 20 21 # serial 1 22 23 24 dnl _XC_LIBTOOL_PREAMBLE 25 dnl ------------------------------------------------- 26 dnl Private macro. 27 dnl 28 dnl Checks some configure script options related with 29 dnl libtool and customizes its default behavior before 30 dnl libtool code is actually used in script. 31 32 m4_define([_XC_LIBTOOL_PREAMBLE], 33 [dnl 34 # ------------------------------------ # 35 # Determine libtool default behavior # 36 # ------------------------------------ # 37 38 # 39 # Default behavior is to enable shared and static libraries on systems 40 # where libtool knows how to build both library versions, and does not 41 # require separate configuration and build runs for each flavor. 42 # 43 44 xc_lt_want_enable_shared='yes' 45 xc_lt_want_enable_static='yes' 46 47 # 48 # User may have disabled shared or static libraries. 49 # 50 case "x$enable_shared" in @%:@ ( 51 xno) 52 xc_lt_want_enable_shared='no' 53 ;; 54 esac 55 case "x$enable_static" in @%:@ ( 56 xno) 57 xc_lt_want_enable_static='no' 58 ;; 59 esac 60 if test "x$xc_lt_want_enable_shared" = 'xno' && 61 test "x$xc_lt_want_enable_static" = 'xno'; then 62 AC_MSG_ERROR([can not disable shared and static libraries simultaneously]) 63 fi 64 65 # 66 # Default behavior on systems that require independent configuration 67 # and build runs for shared and static is to enable shared libraries 68 # and disable static ones. On these systems option '--disable-shared' 69 # must be used in order to build a proper static library. 70 # 71 72 if test "x$xc_lt_want_enable_shared" = 'xyes' && 73 test "x$xc_lt_want_enable_static" = 'xyes'; then 74 case $host_os in @%:@ ( 75 mingw* | pw32* | cegcc* | os2* | aix*) 76 xc_lt_want_enable_static='no' 77 ;; 78 esac 79 fi 80 81 # 82 # Make libtool aware of current shared and static library preferences 83 # taking in account that, depending on host characteristics, libtool 84 # may modify these option preferences later in this configure script. 85 # 86 87 enable_shared=$xc_lt_want_enable_shared 88 enable_static=$xc_lt_want_enable_static 89 90 # 91 # Default behavior is to build PIC objects for shared libraries and 92 # non-PIC objects for static libraries. 93 # 94 95 xc_lt_want_with_pic='default' 96 97 # 98 # User may have specified PIC preference. 99 # 100 101 case "x$with_pic" in @%:@ (( 102 xno) 103 xc_lt_want_with_pic='no' 104 ;; 105 xyes) 106 xc_lt_want_with_pic='yes' 107 ;; 108 esac 109 110 # 111 # Default behavior on some systems where building a shared library out 112 # of non-PIC compiled objects will fail with following linker error 113 # "relocation R_X86_64_32 can not be used when making a shared object" 114 # is to build PIC objects even for static libraries. This behavior may 115 # be overriden using 'configure --disable-shared --without-pic'. 116 # 117 118 if test "x$xc_lt_want_with_pic" = 'xdefault'; then 119 case $host_cpu in @%:@ ( 120 x86_64 | amd64 | ia64) 121 case $host_os in @%:@ ( 122 linux* | freebsd*) 123 xc_lt_want_with_pic='yes' 124 ;; 125 esac 126 ;; 127 esac 128 fi 129 130 # 131 # Make libtool aware of current PIC preference taking in account that, 132 # depending on host characteristics, libtool may modify PIC default 133 # behavior to fit host system idiosyncrasies later in this script. 134 # 135 136 with_pic=$xc_lt_want_with_pic 137 dnl 138 m4_define([$0],[])dnl 139 ]) 140 141 142 dnl _XC_LIBTOOL_BODY 143 dnl ------------------------------------------------- 144 dnl Private macro. 145 dnl 146 dnl This macro performs embedding of libtool code into 147 dnl configure script, regardless of libtool version in 148 dnl use when generating configure script. 149 150 m4_define([_XC_LIBTOOL_BODY], 151 [dnl 152 ## ----------------------- ## 153 ## Start of libtool code ## 154 ## ----------------------- ## 155 m4_ifdef([LT_INIT], 156 [dnl 157 LT_INIT([win32-dll]) 158 ],[dnl 159 AC_LIBTOOL_WIN32_DLL 160 AC_PROG_LIBTOOL 161 ])dnl 162 ## --------------------- ## 163 ## End of libtool code ## 164 ## --------------------- ## 165 dnl 166 m4_define([$0], [])[]dnl 167 ]) 168 169 170 dnl _XC_CHECK_LT_BUILD_LIBRARIES 171 dnl ------------------------------------------------- 172 dnl Private macro. 173 dnl 174 dnl Checks wether libtool shared and static libraries 175 dnl are finally built depending on user input, default 176 dnl behavior and knowledge that libtool has about host 177 dnl characteristics. 178 dnl Results stored in following shell variables: 179 dnl xc_lt_build_shared 180 dnl xc_lt_build_static 181 182 m4_define([_XC_CHECK_LT_BUILD_LIBRARIES], 183 [dnl 184 # 185 # Verify if finally libtool shared libraries will be built 186 # 187 188 case "x$enable_shared" in @%:@ (( 189 xyes | xno) 190 xc_lt_build_shared=$enable_shared 191 ;; 192 *) 193 AC_MSG_ERROR([unexpected libtool enable_shared value: $enable_shared]) 194 ;; 195 esac 196 197 # 198 # Verify if finally libtool static libraries will be built 199 # 200 201 case "x$enable_static" in @%:@ (( 202 xyes | xno) 203 xc_lt_build_static=$enable_static 204 ;; 205 *) 206 AC_MSG_ERROR([unexpected libtool enable_static value: $enable_static]) 207 ;; 208 esac 209 dnl 210 m4_define([$0],[])dnl 211 ]) 212 213 214 dnl _XC_CHECK_LT_SHLIB_USE_VERSION_INFO 215 dnl ------------------------------------------------- 216 dnl Private macro. 217 dnl 218 dnl Checks if the -version-info linker flag must be 219 dnl provided when building libtool shared libraries. 220 dnl Result stored in xc_lt_shlib_use_version_info. 221 222 m4_define([_XC_CHECK_LT_SHLIB_USE_VERSION_INFO], 223 [dnl 224 # 225 # Verify if libtool shared libraries should be linked using flag -version-info 226 # 227 228 AC_MSG_CHECKING([whether to build shared libraries with -version-info]) 229 xc_lt_shlib_use_version_info='yes' 230 if test "x$version_type" = 'xnone'; then 231 xc_lt_shlib_use_version_info='no' 232 fi 233 case $host_os in @%:@ ( 234 amigaos*) 235 xc_lt_shlib_use_version_info='yes' 236 ;; 237 esac 238 AC_MSG_RESULT([$xc_lt_shlib_use_version_info]) 239 dnl 240 m4_define([$0], [])[]dnl 241 ]) 242 243 244 dnl _XC_CHECK_LT_SHLIB_USE_NO_UNDEFINED 245 dnl ------------------------------------------------- 246 dnl Private macro. 247 dnl 248 dnl Checks if the -no-undefined linker flag must be 249 dnl provided when building libtool shared libraries. 250 dnl Result stored in xc_lt_shlib_use_no_undefined. 251 252 m4_define([_XC_CHECK_LT_SHLIB_USE_NO_UNDEFINED], 253 [dnl 254 # 255 # Verify if libtool shared libraries should be linked using flag -no-undefined 256 # 257 258 AC_MSG_CHECKING([whether to build shared libraries with -no-undefined]) 259 xc_lt_shlib_use_no_undefined='no' 260 if test "x$allow_undefined" = 'xno'; then 261 xc_lt_shlib_use_no_undefined='yes' 262 elif test "x$allow_undefined_flag" = 'xunsupported'; then 263 xc_lt_shlib_use_no_undefined='yes' 264 fi 265 case $host_os in @%:@ ( 266 cygwin* | mingw* | pw32* | cegcc* | os2* | aix*) 267 xc_lt_shlib_use_no_undefined='yes' 268 ;; 269 esac 270 AC_MSG_RESULT([$xc_lt_shlib_use_no_undefined]) 271 dnl 272 m4_define([$0], [])[]dnl 273 ]) 274 275 276 dnl _XC_CHECK_LT_SHLIB_USE_MIMPURE_TEXT 277 dnl ------------------------------------------------- 278 dnl Private macro. 279 dnl 280 dnl Checks if the -mimpure-text linker flag must be 281 dnl provided when building libtool shared libraries. 282 dnl Result stored in xc_lt_shlib_use_mimpure_text. 283 284 m4_define([_XC_CHECK_LT_SHLIB_USE_MIMPURE_TEXT], 285 [dnl 286 # 287 # Verify if libtool shared libraries should be linked using flag -mimpure-text 288 # 289 290 AC_MSG_CHECKING([whether to build shared libraries with -mimpure-text]) 291 xc_lt_shlib_use_mimpure_text='no' 292 case $host_os in @%:@ ( 293 solaris2*) 294 if test "x$GCC" = 'xyes'; then 295 xc_lt_shlib_use_mimpure_text='yes' 296 fi 297 ;; 298 esac 299 AC_MSG_RESULT([$xc_lt_shlib_use_mimpure_text]) 300 dnl 301 m4_define([$0], [])[]dnl 302 ]) 303 304 305 dnl _XC_CHECK_LT_BUILD_WITH_PIC 306 dnl ------------------------------------------------- 307 dnl Private macro. 308 dnl 309 dnl Checks wether libtool shared and static libraries 310 dnl would be built with PIC depending on user input, 311 dnl default behavior and knowledge that libtool has 312 dnl about host characteristics. 313 dnl Results stored in following shell variables: 314 dnl xc_lt_build_shared_with_pic 315 dnl xc_lt_build_static_with_pic 316 317 m4_define([_XC_CHECK_LT_BUILD_WITH_PIC], 318 [dnl 319 # 320 # Find out wether libtool libraries would be built wit PIC 321 # 322 323 case "x$pic_mode" in @%:@ (((( 324 xdefault) 325 xc_lt_build_shared_with_pic='yes' 326 xc_lt_build_static_with_pic='no' 327 ;; 328 xyes) 329 xc_lt_build_shared_with_pic='yes' 330 xc_lt_build_static_with_pic='yes' 331 ;; 332 xno) 333 xc_lt_build_shared_with_pic='no' 334 xc_lt_build_static_with_pic='no' 335 ;; 336 *) 337 xc_lt_build_shared_with_pic='unknown' 338 xc_lt_build_static_with_pic='unknown' 339 AC_MSG_WARN([unexpected libtool pic_mode value: $pic_mode]) 340 ;; 341 esac 342 AC_MSG_CHECKING([whether to build shared libraries with PIC]) 343 AC_MSG_RESULT([$xc_lt_build_shared_with_pic]) 344 AC_MSG_CHECKING([whether to build static libraries with PIC]) 345 AC_MSG_RESULT([$xc_lt_build_static_with_pic]) 346 dnl 347 m4_define([$0],[])dnl 348 ]) 349 350 351 dnl _XC_CHECK_LT_BUILD_SINGLE_VERSION 352 dnl ------------------------------------------------- 353 dnl Private macro. 354 dnl 355 dnl Checks wether a libtool shared or static library 356 dnl is finally built exclusively without the other. 357 dnl Results stored in following shell variables: 358 dnl xc_lt_build_shared_only 359 dnl xc_lt_build_static_only 360 361 m4_define([_XC_CHECK_LT_BUILD_SINGLE_VERSION], 362 [dnl 363 # 364 # Verify if libtool shared libraries will be built while static not built 365 # 366 367 AC_MSG_CHECKING([whether to build shared libraries only]) 368 if test "$xc_lt_build_shared" = 'yes' && 369 test "$xc_lt_build_static" = 'no'; then 370 xc_lt_build_shared_only='yes' 371 else 372 xc_lt_build_shared_only='no' 373 fi 374 AC_MSG_RESULT([$xc_lt_build_shared_only]) 375 376 # 377 # Verify if libtool static libraries will be built while shared not built 378 # 379 380 AC_MSG_CHECKING([whether to build static libraries only]) 381 if test "$xc_lt_build_static" = 'yes' && 382 test "$xc_lt_build_shared" = 'no'; then 383 xc_lt_build_static_only='yes' 384 else 385 xc_lt_build_static_only='no' 386 fi 387 AC_MSG_RESULT([$xc_lt_build_static_only]) 388 dnl 389 m4_define([$0],[])dnl 390 ]) 391 392 393 dnl _XC_LIBTOOL_POSTLUDE 394 dnl ------------------------------------------------- 395 dnl Private macro. 396 dnl 397 dnl Performs several checks related with libtool that 398 dnl can not be done unless libtool code has already 399 dnl been executed. See individual check descriptions 400 dnl for further info. 401 402 m4_define([_XC_LIBTOOL_POSTLUDE], 403 [dnl 404 _XC_CHECK_LT_BUILD_LIBRARIES 405 _XC_CHECK_LT_SHLIB_USE_VERSION_INFO 406 _XC_CHECK_LT_SHLIB_USE_NO_UNDEFINED 407 _XC_CHECK_LT_SHLIB_USE_MIMPURE_TEXT 408 _XC_CHECK_LT_BUILD_WITH_PIC 409 _XC_CHECK_LT_BUILD_SINGLE_VERSION 410 dnl 411 m4_define([$0],[])dnl 412 ]) 413 414 415 dnl XC_LIBTOOL 416 dnl ------------------------------------------------- 417 dnl Public macro. 418 dnl 419 dnl This macro embeds libtool machinery into configure 420 dnl script, regardless of libtool version, and performs 421 dnl several additional checks whose results can be used 422 dnl later on. 423 dnl 424 dnl Usage of this macro ensures that generated configure 425 dnl script uses equivalent logic irrespective of autoconf 426 dnl or libtool version being used to generate configure 427 dnl script. 428 dnl 429 dnl Results stored in following shell variables: 430 dnl xc_lt_build_shared 431 dnl xc_lt_build_static 432 dnl xc_lt_shlib_use_version_info 433 dnl xc_lt_shlib_use_no_undefined 434 dnl xc_lt_shlib_use_mimpure_text 435 dnl xc_lt_build_shared_with_pic 436 dnl xc_lt_build_static_with_pic 437 dnl xc_lt_build_shared_only 438 dnl xc_lt_build_static_only 439 440 AC_DEFUN([XC_LIBTOOL], 441 [dnl 442 AC_PREREQ([2.50])dnl 443 dnl 444 AC_BEFORE([$0],[LT_INIT])dnl 445 AC_BEFORE([$0],[AC_PROG_LIBTOOL])dnl 446 AC_BEFORE([$0],[AC_LIBTOOL_WIN32_DLL])dnl 447 dnl 448 AC_REQUIRE([XC_CHECK_PATH_SEPARATOR])dnl 449 AC_REQUIRE([AC_CANONICAL_HOST])dnl 450 AC_REQUIRE([AC_PROG_CC])dnl 451 dnl 452 _XC_LIBTOOL_PREAMBLE 453 _XC_LIBTOOL_BODY 454 _XC_LIBTOOL_POSTLUDE 455 dnl 456 m4_ifdef([AC_LIBTOOL_WIN32_DLL], 457 [m4_undefine([AC_LIBTOOL_WIN32_DLL])])dnl 458 m4_ifdef([AC_PROG_LIBTOOL], 459 [m4_undefine([AC_PROG_LIBTOOL])])dnl 460 m4_ifdef([LT_INIT], 461 [m4_undefine([LT_INIT])])dnl 462 dnl 463 m4_define([$0],[])dnl 464 ]) 465 466