1dnl -*- buffer-read-only: t -*- vi: set ro: 2dnl 3dnl DO NOT EDIT THIS FILE (libopts.m4) 4dnl 5dnl It has been AutoGen-ed 6dnl From the definitions libopts.def 7dnl and the template file conftest.tpl 8dnl 9dnl do always before generated macros: 10dnl 11AC_DEFUN([INVOKE_LIBOPTS_MACROS_FIRST],[ 12 AC_REQUIRE([AC_HEADER_STDC]) 13 AC_HEADER_DIRENT 14 15 # ================= 16 # AC_CHECK_HEADERS 17 # ================= 18 AC_CHECK_HEADERS([ \ 19 sys/mman.h sys/param.h sys/poll.h sys/procset.h \ 20 sys/select.h sys/socket.h sys/stropts.h sys/time.h \ 21 sys/un.h sys/wait.h dlfcn.h errno.h \ 22 fcntl.h libgen.h libintl.h memory.h \ 23 netinet/in.h setjmp.h stdbool.h sysexits.h \ 24 unistd.h utime.h]) 25 26 AC_CHECK_HEADERS([stdarg.h varargs.h], 27 [lo_have_arg_hdr=true;break], 28 [lo_have_arg_hdr=false]) 29 30 AC_CHECK_HEADERS([string.h strings.h], 31 [lo_have_str_hdr=true;break], 32 [lo_have_str_hdr=false]) 33 34 AC_CHECK_HEADERS([limits.h sys/limits.h values.h], 35 [lo_have_lim_hdr=true;break], 36 [lo_have_lim_hdr=false]) 37 38 AC_CHECK_HEADERS([inttypes.h stdint.h], 39 [lo_have_typ_hdr=true;break], 40 [lo_have_typ_hdr=false]) 41 gl_STDNORETURN_H 42 43 # ---------------------------------------------------------------------- 44 # check for various programs used during the build. 45 # On OS/X, "wchar.h" needs "runetype.h" to work properly. 46 # ---------------------------------------------------------------------- 47 AC_CHECK_HEADERS([runetype.h wchar.h], [], [],[ 48 AC_INCLUDES_DEFAULT 49 #if HAVE_RUNETYPE_H 50 # include <runetype.h> 51 #endif 52 ]) 53 54 AC_ARG_ENABLE([nls], 55 AS_HELP_STRING([--disable-nls],[disable nls support in libopts])) 56 AS_IF([test "x$enable_nls" != "xno" && \ 57 test "X${ac_cv_header_libintl_h}" = Xyes], [ 58 AC_DEFINE([ENABLE_NLS],[1],[nls support in libopts])]) 59 60 # -------------------------------------------- 61 # Verify certain entries from AC_CHECK_HEADERS 62 # -------------------------------------------- 63 [${lo_have_arg_hdr} || \ 64 ]AC_MSG_ERROR([you must have stdarg.h or varargs.h on your system])[ 65 66 ${lo_have_str_hdr} || \ 67 ]AC_MSG_ERROR([you must have string.h or strings.h on your system])[ 68 69 ${lo_have_lim_hdr} || \ 70 ]AC_MSG_ERROR( 71 [you must have one of limits.h, sys/limits.h or values.h])[ 72 73 ${lo_have_typ_hdr} || \ 74 ]AC_MSG_ERROR([you must have inttypes.h or stdint.h on your system])[ 75 76 for f in sys_types sys_param sys_stat string errno stdlib memory setjmp 77 do eval as_ac_var=\${ac_cv_header_${f}_h} 78 test "X${as_ac_var}" = Xyes || { 79 ]AC_MSG_ERROR([you must have ${f}.h on your system])[ 80 } 81 done 82 test "X${ac_cv_header_inttypes_h-no}" = Xyes || \ 83 echo '#include <stdint.h>' > inttypes.h] 84 85 # ---------------------------------------------------------------------- 86 # Checks for typedefs 87 # ---------------------------------------------------------------------- 88 AC_CHECK_TYPES(wchar_t) 89 AC_CHECK_TYPES(wint_t, [], [], [ 90 AC_INCLUDES_DEFAULT 91 #if HAVE_RUNETYPE_H 92 # include <runetype.h> 93 #endif 94 #if HAVE_WCHAR_H 95 # include <wchar.h> 96 #endif 97 ]) 98 AC_CHECK_TYPES([int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, 99 intptr_t, uintptr_t, uint_t, pid_t, size_t, ptrdiff_t]) 100 AC_CHECK_SIZEOF(char *, 8) 101 AC_CHECK_SIZEOF(int, 4) 102 AC_CHECK_SIZEOF(long, 8) 103 AC_CHECK_SIZEOF(short, 2) 104 105 # ------------ 106 # AC_CHECK_LIB 107 # ------------ 108 AC_CHECK_LIB(gen, pathfind) 109 AC_CHECK_LIB(intl,gettext) 110 AC_FUNC_VPRINTF 111 AC_FUNC_FORK 112 AC_CHECK_FUNCS([mmap canonicalize_file_name snprintf strdup strchr \ 113 strrchr strsignal fchmod fstat chmod]) 114 AC_PROG_SED 115 [while : 116 do 117 POSIX_SHELL=`which bash` 118 test -x "$POSIX_SHELL" && break 119 POSIX_SHELL=`which dash` 120 test -x "$POSIX_SHELL" && break 121 POSIX_SHELL=/usr/xpg4/bin/sh 122 test -x "$POSIX_SHELL" && break 123 POSIX_SHELL=`/bin/sh -c ' 124 exec 2>/dev/null 125 if ! true ; then exit 1 ; fi 126 echo /bin/sh'` 127 test -x "$POSIX_SHELL" && break 128 ]AC_MSG_ERROR([cannot locate a working POSIX shell])[ 129 done] 130 AC_DEFINE_UNQUOTED([POSIX_SHELL], ["${POSIX_SHELL}"], 131 [define to a working POSIX compliant shell]) 132 AC_SUBST([POSIX_SHELL]) 133]) 134 135dnl 136dnl @synopsis INVOKE_LIBOPTS_MACROS 137dnl 138dnl This macro will invoke the AutoConf macros specified in libopts.def 139dnl that have not been disabled with "omit-invocation". 140dnl 141AC_DEFUN([LIBOPTS_WITH_REGEX_HEADER],[ 142 AC_ARG_WITH([regex-header], 143 AS_HELP_STRING([--with-regex-header], [a reg expr header is specified]), 144 [libopts_cv_with_regex_header=${with_regex_header}], 145 AC_CACHE_CHECK([whether a reg expr header is specified], libopts_cv_with_regex_header, 146 libopts_cv_with_regex_header=no) 147 ) # end of AC_ARG_WITH 148 if test "X${libopts_cv_with_regex_header}" != Xno 149 then 150 AC_DEFINE_UNQUOTED([REGEX_HEADER],[<${libopts_cv_with_regex_header}>]) 151 else 152 AC_DEFINE([REGEX_HEADER],[<regex.h>],[name of regex header file]) 153 fi 154 155]) # end of AC_DEFUN of LIBOPTS_WITH_REGEX_HEADER 156 157 158AC_DEFUN([LIBOPTS_WITHLIB_REGEX],[ 159 AC_ARG_WITH([libregex], 160 AS_HELP_STRING([--with-libregex], [libregex installation prefix]), 161 [libopts_cv_with_libregex_root=${with_libregex}], 162 AC_CACHE_CHECK([whether with-libregex was specified], libopts_cv_with_libregex_root, 163 libopts_cv_with_libregex_root=no) 164 ) # end of AC_ARG_WITH libregex 165 166 if test "${with_libregex+set}" = set && \ 167 test "X${withval}" = Xno 168 then ## disabled by request 169 libopts_cv_with_libregex_root=no 170 libopts_cv_with_libregex_cflags=no 171 libopts_cv_with_libregex_libs=no 172 else 173 174 AC_ARG_WITH([libregex-cflags], 175 AS_HELP_STRING([--with-libregex-cflags], [libregex compile flags]), 176 [libopts_cv_with_libregex_cflags=${with_libregex_cflags}], 177 AC_CACHE_CHECK([whether with-libregex-cflags was specified], libopts_cv_with_libregex_cflags, 178 libopts_cv_with_libregex_cflags=no) 179 ) # end of AC_ARG_WITH libregex-cflags 180 181 AC_ARG_WITH([libregex-libs], 182 AS_HELP_STRING([--with-libregex-libs], [libregex link command arguments]), 183 [libopts_cv_with_libregex_libs=${with_libregex_libs}], 184 AC_CACHE_CHECK([whether with-libregex-libs was specified], libopts_cv_with_libregex_libs, 185 libopts_cv_with_libregex_libs=no) 186 ) # end of AC_ARG_WITH libregex-libs 187 188 case "X${libopts_cv_with_libregex_cflags}" in 189 Xyes|Xno|X ) 190 case "X${libopts_cv_with_libregex_root}" in 191 Xyes|Xno|X ) libopts_cv_with_libregex_cflags=no ;; 192 * ) libopts_cv_with_libregex_cflags=-I${libopts_cv_with_libregex_root}/include ;; 193 esac 194 esac 195 case "X${libopts_cv_with_libregex_libs}" in 196 Xyes|Xno|X ) 197 case "X${libopts_cv_with_libregex_root}" in 198 Xyes|Xno|X ) libopts_cv_with_libregex_libs=no ;; 199 * ) libopts_cv_with_libregex_libs="-L${libopts_cv_with_libregex_root}/lib -lregex" ;; 200 esac 201 esac 202 libopts_save_CPPFLAGS="${CPPFLAGS}" 203 libopts_save_LIBS="${LIBS}" 204 case "X${libopts_cv_with_libregex_cflags}" in 205 Xyes|Xno|X ) 206 libopts_cv_with_libregex_cflags="" ;; 207 * ) CPPFLAGS="${CPPFLAGS} ${libopts_cv_with_libregex_cflags}" ;; 208 esac 209 case "X${libopts_cv_with_libregex_libs}" in 210 Xyes|Xno|X ) 211 libopts_cv_with_libregex_libs="" ;; 212 * ) 213 LIBS="${LIBS} ${libopts_cv_with_libregex_libs}" ;; 214 esac 215 LIBREGEX_CFLAGS="" 216 LIBREGEX_LIBS="" 217 AC_MSG_CHECKING([whether libregex functions properly]) 218 AC_CACHE_VAL([libopts_cv_with_libregex],[ 219 AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <stdio.h> 220@%:@include <stdlib.h> 221@%:@include <sys/types.h> 222@%:@include REGEX_HEADER 223static regex_t re; 224void comp_re(char const * pzPat) { 225 int res = regcomp( &re, pzPat, REG_EXTENDED|REG_ICASE|REG_NEWLINE ); 226 if (res == 0) return; 227 exit( res ); } 228int main() { 229 regmatch_t m@<:@2@:>@; 230 comp_re( "^.*\@S|@" ); 231 comp_re( "()|no.*" ); 232 comp_re( "." ); 233 if (regexec( &re, "X", 2, m, 0 ) != 0) return 1; 234 if ((m@<:@0@:>@.rm_so != 0) || (m@<:@0@:>@.rm_eo != 1)) { 235 fputs( "error: regex -->.<-- did not match\n", stderr ); 236 return 1; 237 } 238 return 0; }])], 239 [libopts_cv_with_libregex=yes], [libopts_cv_with_libregex=no], 240 [libopts_cv_with_libregex=no]) # end of AC_RUN_IFELSE 241 ]) # end of AC_CACHE_VAL for libopts_cv_with_libregex 242 fi ## disabled by request 243 AC_MSG_RESULT([${libopts_cv_with_libregex}]) 244 if test "X${libopts_cv_with_libregex}" != Xno 245 then 246 AC_DEFINE([WITH_LIBREGEX],[1], 247 [Define this if a working libregex can be found]) 248 else 249 CPPFLAGS="${libopts_save_CPPFLAGS}" 250 LIBS="${libopts_save_LIBS}" 251 libopts_cv_with_libregex_root=no 252libopts_cv_with_libregex_cflags=no 253libopts_cv_with_libregex_libs=no 254libopts_cv_with_libregex=no 255 fi 256 257]) # end of AC_DEFUN of LIBOPTS_WITHLIB_REGEX 258 259 260AC_DEFUN([LIBOPTS_RUN_PATHFIND],[ 261 AC_MSG_CHECKING([whether pathfind(3) works]) 262 AC_CACHE_VAL([libopts_cv_run_pathfind],[ 263 AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <string.h> 264@%:@include <stdlib.h> 265int main (int argc, char ** argv) { 266 char * pz = pathfind( getenv( "PATH" ), "sh", "x" ); 267 return (pz == 0) ? 1 : 0; 268}])], 269 [libopts_cv_run_pathfind=yes],[libopts_cv_run_pathfind=no],[libopts_cv_run_pathfind=no] 270 ) # end of RUN_IFELSE 271 ]) # end of AC_CACHE_VAL for libopts_cv_run_pathfind 272 AC_MSG_RESULT([${libopts_cv_run_pathfind}]) 273 if test "X${libopts_cv_run_pathfind}" != Xno 274 then 275 AC_DEFINE([HAVE_PATHFIND],[1], 276 [Define this if pathfind(3) works]) 277 fi 278 279]) # end of AC_DEFUN of LIBOPTS_RUN_PATHFIND 280 281 282AC_DEFUN([LIBOPTS_TEST_DEV_ZERO],[ 283 AC_MSG_CHECKING([whether /dev/zero is readable device]) 284 AC_CACHE_VAL([libopts_cv_test_dev_zero],[ 285 libopts_cv_test_dev_zero=`exec 2> /dev/null 286dzero=\`ls -lL /dev/zero | egrep ^c......r\` 287test -z "${dzero}" && exit 1 288echo ${dzero}` 289 if test $? -ne 0 || test -z "$libopts_cv_test_dev_zero" 290 then libopts_cv_test_dev_zero=no 291 fi 292 ]) # end of CACHE_VAL of libopts_cv_test_dev_zero 293 AC_MSG_RESULT([${libopts_cv_test_dev_zero}]) 294 if test "X${libopts_cv_test_dev_zero}" != Xno 295 then 296 AC_DEFINE([HAVE_DEV_ZERO],[1], 297 [Define this if /dev/zero is readable device]) 298 fi 299 300]) # end of AC_DEFUN of LIBOPTS_TEST_DEV_ZERO 301 302 303AC_DEFUN([LIBOPTS_RUN_REALPATH],[ 304 AC_MSG_CHECKING([whether we have a functional realpath(3C)]) 305 AC_CACHE_VAL([libopts_cv_run_realpath],[ 306 AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <limits.h> 307@%:@include <stdlib.h> 308int main (int argc, char ** argv) { 309@%:@ifndef PATH_MAX 310choke me!! 311@%:@else 312 char zPath@<:@PATH_MAX+1@:>@; 313@%:@endif 314 char *pz = realpath(argv@<:@0@:>@, zPath); 315 return (pz == zPath) ? 0 : 1; 316}])], 317 [libopts_cv_run_realpath=yes],[libopts_cv_run_realpath=no],[libopts_cv_run_realpath=no] 318 ) # end of RUN_IFELSE 319 ]) # end of AC_CACHE_VAL for libopts_cv_run_realpath 320 AC_MSG_RESULT([${libopts_cv_run_realpath}]) 321 if test "X${libopts_cv_run_realpath}" != Xno 322 then 323 AC_DEFINE([HAVE_REALPATH],[1], 324 [Define this if we have a functional realpath(3C)]) 325 fi 326 327]) # end of AC_DEFUN of LIBOPTS_RUN_REALPATH 328 329 330AC_DEFUN([LIBOPTS_RUN_STRFTIME],[ 331 AC_MSG_CHECKING([whether strftime() works]) 332 AC_CACHE_VAL([libopts_cv_run_strftime],[ 333 AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <time.h> 334@%:@include <string.h> 335char t_buf@<:@ 64 @:>@; 336int main() { 337 static char const z@<:@@:>@ = "Thursday Aug 28 240"; 338 struct tm tm; 339 tm.tm_sec = 36; /* seconds after the minute @<:@0, 61@:>@ */ 340 tm.tm_min = 44; /* minutes after the hour @<:@0, 59@:>@ */ 341 tm.tm_hour = 12; /* hour since midnight @<:@0, 23@:>@ */ 342 tm.tm_mday = 28; /* day of the month @<:@1, 31@:>@ */ 343 tm.tm_mon = 7; /* months since January @<:@0, 11@:>@ */ 344 tm.tm_year = 86; /* years since 1900 */ 345 tm.tm_wday = 4; /* days since Sunday @<:@0, 6@:>@ */ 346 tm.tm_yday = 239; /* days since January 1 @<:@0, 365@:>@ */ 347 tm.tm_isdst = 1; /* flag for daylight savings time */ 348 strftime( t_buf, sizeof( t_buf ), "%A %b %d %j", &tm ); 349 return (strcmp( t_buf, z ) != 0); }])], 350 [libopts_cv_run_strftime=yes],[libopts_cv_run_strftime=no],[libopts_cv_run_strftime=no] 351 ) # end of RUN_IFELSE 352 ]) # end of AC_CACHE_VAL for libopts_cv_run_strftime 353 AC_MSG_RESULT([${libopts_cv_run_strftime}]) 354 if test "X${libopts_cv_run_strftime}" != Xno 355 then 356 AC_DEFINE([HAVE_STRFTIME],[1], 357 [Define this if strftime() works]) 358 fi 359 360]) # end of AC_DEFUN of LIBOPTS_RUN_STRFTIME 361 362 363AC_DEFUN([LIBOPTS_RUN_FOPEN_BINARY],[ 364 AC_MSG_CHECKING([whether fopen accepts "b" mode]) 365 AC_CACHE_VAL([libopts_cv_run_fopen_binary],[ 366 AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <stdio.h> 367int main (int argc, char ** argv) { 368FILE * fp = fopen("conftest.@S|@ac_ext", "rb"); 369return (fp == NULL) ? 1 : fclose(fp); }])], 370 [libopts_cv_run_fopen_binary=yes],[libopts_cv_run_fopen_binary=no],[libopts_cv_run_fopen_binary=no] 371 ) # end of RUN_IFELSE 372 ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_binary 373 AC_MSG_RESULT([${libopts_cv_run_fopen_binary}]) 374 if test "X${libopts_cv_run_fopen_binary}" != Xno 375 then 376 AC_DEFINE([FOPEN_BINARY_FLAG],"b", 377 [fopen(3) accepts a 'b' in the mode flag]) 378 else 379 AC_DEFINE([FOPEN_BINARY_FLAG],"", 380 [fopen(3) accepts a 'b' in the mode flag]) 381 fi 382 383]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_BINARY 384 385 386AC_DEFUN([LIBOPTS_RUN_FOPEN_TEXT],[ 387 AC_MSG_CHECKING([whether fopen accepts "t" mode]) 388 AC_CACHE_VAL([libopts_cv_run_fopen_text],[ 389 AC_RUN_IFELSE([AC_LANG_SOURCE([@%:@include <stdio.h> 390int main (int argc, char ** argv) { 391FILE * fp = fopen("conftest.@S|@ac_ext", "rt"); 392return (fp == NULL) ? 1 : fclose(fp); }])], 393 [libopts_cv_run_fopen_text=yes],[libopts_cv_run_fopen_text=no],[libopts_cv_run_fopen_text=no] 394 ) # end of RUN_IFELSE 395 ]) # end of AC_CACHE_VAL for libopts_cv_run_fopen_text 396 AC_MSG_RESULT([${libopts_cv_run_fopen_text}]) 397 if test "X${libopts_cv_run_fopen_text}" != Xno 398 then 399 AC_DEFINE([FOPEN_TEXT_FLAG],"t", 400 [fopen(3) accepts a 't' in the mode flag]) 401 else 402 AC_DEFINE([FOPEN_TEXT_FLAG],"", 403 [fopen(3) accepts a 't' in the mode flag]) 404 fi 405 406]) # end of AC_DEFUN of LIBOPTS_RUN_FOPEN_TEXT 407 408 409AC_DEFUN([LIBOPTS_DISABLE_OPTIONAL_ARGS],[ 410 AC_ARG_ENABLE([optional-args], 411 AS_HELP_STRING([--disable-optional-args], [not wanting optional option args]), 412 [libopts_cv_enable_optional_args=${enable_optional_args}], 413 AC_CACHE_CHECK([whether not wanting optional option args], libopts_cv_enable_optional_args, 414 libopts_cv_enable_optional_args=yes) 415 ) # end of AC_ARG_ENABLE 416 if test "X${libopts_cv_enable_optional_args}" = Xno 417 then 418 AC_DEFINE([NO_OPTIONAL_OPT_ARGS], [1], 419 [Define this if optional arguments are disallowed]) 420 fi 421 422]) # end of AC_DEFUN of LIBOPTS_DISABLE_OPTIONAL_ARGS 423 424 425AC_DEFUN([INVOKE_LIBOPTS_MACROS],[ 426 AC_REQUIRE([INVOKE_LIBOPTS_MACROS_FIRST]) 427 # Check to see if a reg expr header is specified. 428 LIBOPTS_WITH_REGEX_HEADER 429 430 # Check to see if a working libregex can be found. 431 LIBOPTS_WITHLIB_REGEX 432 433 # Check to see if pathfind(3) works. 434 LIBOPTS_RUN_PATHFIND 435 436 # Check to see if /dev/zero is readable device. 437 LIBOPTS_TEST_DEV_ZERO 438 439 # Check to see if we have a functional realpath(3C). 440 LIBOPTS_RUN_REALPATH 441 442 # Check to see if strftime() works. 443 LIBOPTS_RUN_STRFTIME 444 445 # Check to see if fopen accepts "b" mode. 446 LIBOPTS_RUN_FOPEN_BINARY 447 448 # Check to see if fopen accepts "t" mode. 449 LIBOPTS_RUN_FOPEN_TEXT 450 451 # Check to see if not wanting optional option args. 452 LIBOPTS_DISABLE_OPTIONAL_ARGS 453 454]) # end AC_DEFUN of INVOKE_LIBOPTS_MACROS 455 456dnl @synopsis LIBOPTS_CHECK 457dnl 458dnl If autoopts-config works, add the linking information to LIBS. 459dnl Otherwise, add ``libopts-${ao_rev}'' to SUBDIRS and run all 460dnl the config tests that the library needs. Invoke the 461dnl "INVOKE_LIBOPTS_MACROS" macro iff we are building libopts. 462dnl 463dnl This file is part of AutoGen. 464dnl AutoGen Copyright (C) 1992-2015 by Bruce Korb - all rights reserved 465dnl 466dnl AutoGen is free software: you can redistribute it and/or modify it 467dnl under the terms of the GNU General Public License as published by the 468dnl Free Software Foundation, either version 3 of the License, or 469dnl (at your option) any later version. 470dnl 471dnl AutoGen is distributed in the hope that it will be useful, but 472dnl WITHOUT ANY WARRANTY; without even the implied warranty of 473dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 474dnl See the GNU General Public License for more details. 475dnl 476dnl You should have received a copy of the GNU General Public License along 477dnl with this program. If not, see <http://www.gnu.org/licenses/>. 478dnl 479dnl Default to system libopts 480dnl 481AC_DEFUN([LIBOPTS_CHECK_COMMON],[ 482 AC_REQUIRE([INVOKE_LIBOPTS_MACROS_FIRST]) 483 [NEED_LIBOPTS_DIR=''] 484 m4_pushdef([AO_Libopts_Dir], 485 [ifelse($1, , [libopts], [$1])]) 486 AC_ARG_ENABLE([local-libopts], 487 AC_HELP_STRING([--enable-local-libopts], 488 [Use the supplied libopts tearoff code]),[ 489 if test x$enableval = xyes ; then 490 AC_MSG_NOTICE([Using supplied libopts tearoff]) 491 LIBOPTS_CFLAGS='-I$(top_srcdir)/AO_Libopts_Dir' 492 NEED_LIBOPTS_DIR=true 493 LIBOPTS_LDADD='$(top_builddir)/AO_Libopts_Dir/libopts.la' 494 fi]) 495 496 AC_ARG_ENABLE([libopts-install], 497 AC_HELP_STRING([--enable-libopts-install], 498 [Install libopts with client installation])) 499 AM_CONDITIONAL([INSTALL_LIBOPTS],[test "X${enable_libopts_install}" = Xyes]) 500 501 [if test -z "${NEED_LIBOPTS_DIR}" ; then] 502 AC_MSG_CHECKING([whether autoopts-config can be found]) 503 AC_ARG_WITH([autoopts-config], 504 AC_HELP_STRING([--with-autoopts-config], 505 [specify the config-info script]), 506 [lo_cv_with_autoopts_config=${with_autoopts_config}], 507 AC_CACHE_CHECK([whether autoopts-config is specified], 508 [lo_cv_with_autoopts_config], 509 [if autoopts-config --help 2>/dev/null 1>&2 510 then lo_cv_with_autoopts_config=autoopts-config 511 elif libopts-config --help 2>/dev/null 1>&2 512 then lo_cv_with_autoopts_config=libopts-config 513 else lo_cv_with_autoopts_config=no ; fi]) 514 ) # end of AC_ARG_WITH 515 516 AC_CACHE_VAL([lo_cv_test_autoopts],[ 517 if test -z "${lo_cv_with_autoopts_config}" \ 518 -o X"${lo_cv_with_autoopts_config}" = Xno 519 then 520 if autoopts-config --help 2>/dev/null 1>&2 521 then lo_cv_with_autoopts_config=autoopts-config 522 elif libopts-config --help 2>/dev/null 1>&2 523 then lo_cv_with_autoopts_config=libopts-config 524 else lo_cv_with_autoopts_config=false ; fi 525 fi 526 lo_cv_test_autoopts=` 527 ${lo_cv_with_autoopts_config} --libs` 2> /dev/null 528 if test $? -ne 0 -o -z "${lo_cv_test_autoopts}" 529 then lo_cv_test_autoopts=no ; fi 530 ]) # end of CACHE_VAL 531 AC_MSG_RESULT([${lo_cv_test_autoopts}]) 532 533 [if test "X${lo_cv_test_autoopts}" != Xno 534 then 535 LIBOPTS_LDADD="${lo_cv_test_autoopts}" 536 LIBOPTS_CFLAGS="`${lo_cv_with_autoopts_config} --cflags`" 537 else 538 LIBOPTS_LDADD='$(top_builddir)/]AO_Libopts_Dir[/libopts.la' 539 LIBOPTS_CFLAGS='-I$(top_srcdir)/]AO_Libopts_Dir[' 540 NEED_LIBOPTS_DIR=true 541 fi 542 fi # end of if test -z "${NEED_LIBOPTS_DIR}" 543 if test -n "${LIBOPTS_BUILD_BLOCKED}" ; then 544 NEED_LIBOPTS_DIR='' 545 fi] 546 AM_CONDITIONAL([NEED_LIBOPTS], [test -n "${NEED_LIBOPTS_DIR}"]) 547 AC_SUBST(LIBOPTS_LDADD) 548 AC_SUBST(LIBOPTS_CFLAGS) 549 AC_SUBST(LIBOPTS_DIR, AO_Libopts_Dir) 550 m4_popdef([AO_Libopts_Dir]) 551[# end of AC_DEFUN of LIBOPTS_CHECK_COMMON] 552]) 553dnl 554dnl AC_CONFIG_FILES conditionalization requires using AM_COND_IF, however 555dnl AM_COND_IF is new to Automake 1.11. To use it on new Automake without 556dnl requiring same, a fallback implementation for older Automake is provided. 557dnl Note that disabling of AC_CONFIG_FILES requires Automake 1.11, this code 558dnl is correct only in terms of m4sh generated script. 559dnl 560m4_ifndef([AM_COND_IF], 561 [AC_DEFUN([AM_COND_IF], [ 562 if test -z "$$1_TRUE"; then : 563 m4_n([$2])[]dnl 564 m4_ifval([$3],[ 565 else 566 $3 567 ])dnl 568 fi[]dnl 569 ])dnl 570]) 571dnl 572AC_DEFUN([LIBOPTS_CHECK_NOBUILD], [ 573 m4_pushdef([AO_Libopts_Dir], 574 [ifelse($1, , [libopts], [$1])]) 575 LIBOPTS_BUILD_BLOCKED=true 576 LIBOPTS_CHECK_COMMON(AO_Libopts_Dir) 577 m4_popdef([AO_Libopts_Dir])dnl 578# end of AC_DEFUN of LIBOPTS_CHECK_NOBUILD 579]) 580dnl 581AC_DEFUN([LIBOPTS_CHECK], [ 582 m4_pushdef([AO_Libopts_Dir], 583 [ifelse($1, , [libopts], [$1])]) 584 LIBOPTS_BUILD_BLOCKED='' 585 LIBOPTS_CHECK_COMMON(AO_Libopts_Dir) 586 AM_COND_IF([NEED_LIBOPTS], [ 587 INVOKE_LIBOPTS_MACROS 588 ]) 589 AC_CONFIG_FILES(AO_Libopts_Dir/Makefile) 590 m4_popdef([AO_Libopts_Dir])dnl 591# end of AC_DEFUN of LIBOPTS_CHECK 592]) 593