1 dnl Copyright 1998 The OpenLDAP Foundation, All Rights Reserved.
2 dnl COPYING RESTRICTIONS APPLY, See COPYRIGHT file
4 dnl OpenLDAP Autoconf Macros
6 dnl builtin(include, build/libtool.m4)dnl
7 dnl --------------------------------------------------------------------
8 dnl Restricted form of AC_ARG_ENABLE that limits user options
12 dnl $3 = default value (auto)
13 dnl $4 = allowed values (auto yes no)
14 AC_DEFUN([OL_ARG_ENABLE], [# OpenLDAP --enable-$1
15 AC_ARG_ENABLE($1,[$2 (]ifelse($3,,auto,$3)[)],[
17 for ol_val in ifelse($4,,[auto yes no],[$4]) ; do
18 if test "$enableval" = "$ol_val" ; then
22 if test "$ol_arg" = "invalid" ; then
23 AC_MSG_ERROR(bad value $enableval for --enable-$1)
25 ol_enable_$1="$ol_arg"
27 [ ol_enable_$1=ifelse($3,,"auto","$3")])dnl
28 dnl AC_VERBOSE(OpenLDAP -enable-$1 $ol_enable_$1)
32 dnl --------------------------------------------------------------------
33 dnl Restricted form of AC_ARG_WITH that limits user options
37 dnl $3 = default value (no)
38 dnl $4 = allowed values (yes or no)
39 AC_DEFUN([OL_ARG_WITH], [# OpenLDAP --with-$1
40 AC_ARG_WITH($1,[$2 (]ifelse($3,,yes,$3)[)],[
42 for ol_val in ifelse($4,,[yes no],[$4]) ; do
43 if test "$withval" = "$ol_val" ; then
47 if test "$ol_arg" = "invalid" ; then
48 AC_MSG_ERROR(bad value $withval for --with-$1)
52 [ ol_with_$1=ifelse($3,,"no","$3")])dnl
53 dnl AC_VERBOSE(OpenLDAP --with-$1 $ol_with_$1)
57 dnl ====================================================================
58 dnl check if hard links are supported.
60 AC_DEFUN([OL_PROG_LN_H], [# test for ln hardlink support
61 AC_MSG_CHECKING(whether ln works)
62 AC_CACHE_VAL(ol_cv_prog_LN_H,
63 [rm -f conftest.src conftest.dst
64 echo "conftest" > conftest.src
65 if ln conftest.src conftest.dst 2>/dev/null
71 rm -f conftest.src conftest.dst
73 LN_H="$ol_cv_prog_LN_H"
74 if test "$ol_cv_prog_LN_H" = "ln"; then
82 dnl ====================================================================
83 dnl Check if system uses EBCDIC instead of ASCII
84 AC_DEFUN([OL_CPP_EBCDIC], [# test for EBCDIC
85 AC_MSG_CHECKING([for EBCDIC])
86 AC_CACHE_VAL(ol_cv_cpp_ebcdic,[
89 #include <__ASCII__/generate_error.h>
92 [ol_cv_cpp_ebcdic=yes],
93 [ol_cv_cpp_ebcdic=no])])
94 AC_MSG_RESULT($ol_cv_cpp_ebcdic)
95 if test $ol_cv_cpp_ebcdic = yes ; then
96 AC_DEFINE(HAVE_EBCDIC,1, [define if system uses EBCDIC instead of ASCII])
100 dnl --------------------------------------------------------------------
101 dnl OpenLDAP version of STDC header check w/ EBCDIC support
102 AC_DEFUN(OL_HEADER_STDC,
104 AC_REQUIRE([OL_CPP_EBCDIC])dnl
105 AC_CACHE_CHECK([for ANSI C header files], ol_cv_header_stdc,
106 [AC_TRY_CPP([#include <stdlib.h>
109 #include <float.h>], ol_cv_header_stdc=yes, ol_cv_header_stdc=no)
111 if test $ol_cv_header_stdc = yes; then
112 # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
113 AC_EGREP_HEADER(memchr, string.h, , ol_cv_header_stdc=no)
116 if test $ol_cv_header_stdc = yes; then
117 # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
118 AC_EGREP_HEADER(free, stdlib.h, , ol_cv_header_stdc=no)
121 if test $ol_cv_header_stdc = yes; then
122 # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
123 AC_TRY_RUN([#include <ctype.h>
125 # define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
126 # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
128 # define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
129 || ('j' <= (c) && (c) <= 'r') \
130 || ('s' <= (c) && (c) <= 'z'))
131 # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
133 #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
134 int main () { int i; for (i = 0; i < 256; i++)
135 if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
137 ], , ol_cv_header_stdc=no, :)
139 if test $ol_cv_header_stdc = yes; then
140 AC_DEFINE(STDC_HEADERS)
142 ac_cv_header_stdc=disable
145 dnl ====================================================================
146 dnl Check if db.h is Berkeley DB2
148 dnl defines ol_cv_header_db2 to 'yes' or 'no'
151 dnl AC_CHECK_HEADERS(db.h)
153 AC_DEFUN([OL_HEADER_BERKELEY_DB2],
154 [AC_CHECK_HEADERS(db.h)
155 if test $ac_cv_header_db_h = yes ; then
156 AC_CACHE_CHECK([if db.h is DB2], [ol_cv_header_db2],[
157 AC_EGREP_CPP(__db_version_2,[
159 /* this check could be improved */
160 # ifdef DB_VERSION_MAJOR
161 # if DB_VERSION_MAJOR == 2
165 ], ol_cv_header_db2=yes, ol_cv_header_db2=no)])
170 dnl --------------------------------------------------------------------
171 dnl Check if Berkeley DB2 library exists
172 dnl Check for dbopen in standard libraries or -ldb
174 dnl defines ol_cv_lib_db2 to '-ldb' or 'no'
177 dnl AC_CHECK_LIB(db,db_open)
179 AC_DEFUN([OL_LIB_BERKELEY_DB2],
180 [AC_CACHE_CHECK([for DB2 library], [ol_cv_lib_db2],
182 AC_CHECK_LIB(db,db_open,[ol_cv_lib_db2=-ldb],[ol_cv_lib_db2=no])
187 dnl --------------------------------------------------------------------
188 dnl Check if Berkeley db2 exists
190 dnl defines ol_cv_berkeley_db2 to 'yes' or 'no'
193 dnl OL_LIB_BERKELEY_DB2
194 dnl OL_HEADER_BERKELEY_DB2
196 AC_DEFUN([OL_BERKELEY_DB2],
197 [AC_REQUIRE([OL_LIB_BERKELEY_DB2])
198 AC_REQUIRE([OL_HEADER_BERKELEY_DB2])
199 AC_CACHE_CHECK([for Berkeley DB2], [ol_cv_berkeley_db2], [
200 if test "$ol_cv_lib_db2" = no -o "$ol_cv_header_db2" = no ; then
201 ol_cv_berkeley_db2=no
203 ol_cv_berkeley_db2=yes
206 if test $ol_cv_berkeley_db2 = yes ; then
207 AC_DEFINE(HAVE_BERKELEY_DB2,1, [define if Berkeley DBv2 is available])
211 dnl ====================================================================
212 dnl Check for db.h/db_185.h is Berkeley DB
214 dnl defines ol_cv_header_db to 'yes' or 'no'
217 dnl OL_HEADER_BERKELEY_DB2
218 dnl AC_CHECK_HEADERS(db_185.h)
220 AC_DEFUN([OL_HEADER_BERKELEY_DB],
221 [AC_REQUIRE([OL_HEADER_BERKELEY_DB2])
222 AC_CHECK_HEADERS(db_185.h)
223 if test "$ol_cv_header_db2" = yes ; then
226 ol_cv_header_db=$ac_cv_header_db_185_h
228 ol_cv_header_db=$ac_cv_header_db_h
232 dnl --------------------------------------------------------------------
233 dnl Check if Berkeley DB library exists
234 dnl Check for dbopen in standard libraries or -ldb
236 dnl defines ol_cv_lib_db to 'yes' or '-ldb' or 'no'
237 dnl 'yes' implies dbopen is in $LIBS
240 dnl AC_CHECK_FUNC(dbopen)
241 dnl AC_CHECK_LIB(db,dbopen)
243 AC_DEFUN([OL_LIB_BERKELEY_DB],
244 [AC_CACHE_CHECK([for Berkeley DB library], [ol_cv_lib_db],
246 AC_CHECK_FUNC(dbopen,[ol_cv_lib_db=yes], [
247 AC_CHECK_LIB(db,dbopen,[ol_cv_lib_db=-ldb],[ol_cv_lib_db=no])
253 dnl --------------------------------------------------------------------
254 dnl Check if Berkeley DB exists
256 dnl defines ol_cv_berkeley_db to 'yes' or 'no'
259 dnl OL_LIB_BERKELEY_DB
260 dnl OL_HEADER_BERKELEY_DB
262 AC_DEFUN([OL_BERKELEY_DB],
263 [AC_REQUIRE([OL_LIB_BERKELEY_DB])
264 AC_REQUIRE([OL_HEADER_BERKELEY_DB])
265 AC_CACHE_CHECK([for Berkeley DB], [ol_cv_berkeley_db], [
266 if test "$ol_cv_lib_db" = no -o "$ol_cv_header_db" = no ; then
269 ol_cv_berkeley_db=yes
272 if test $ol_cv_berkeley_db = yes ; then
273 AC_DEFINE(HAVE_BERKELEY_DB,1, [define if Berkeley DB is available])
277 dnl ====================================================================
278 dnl Check if GDBM library exists
279 dnl Check for gdbm_open in standard libraries or -lgdbm
281 dnl defines ol_cv_lib_gdbm to 'yes' or '-lgdbm' or 'no'
282 dnl 'yes' implies gdbm_open is in $LIBS
285 dnl AC_CHECK_FUNC(gdbm_open)
286 dnl AC_CHECK_LIB(gdbm,gdbm_open)
288 AC_DEFUN([OL_LIB_GDBM],
289 [AC_CACHE_CHECK(for GDBM library, [ol_cv_lib_gdbm],
291 AC_CHECK_FUNC(gdbm_open,[ol_cv_lib_gdbm=yes], [
292 AC_CHECK_LIB(gdbm,gdbm_open,[ol_cv_lib_gdbm=-lgdbm],[ol_cv_lib_gdbm=no])
298 dnl --------------------------------------------------------------------
299 dnl Check if GDBM exists
301 dnl defines ol_cv_gdbm to 'yes' or 'no'
305 dnl AC_CHECK_HEADERS(gdbm.h)
308 [AC_REQUIRE([OL_LIB_GDBM])
309 AC_CHECK_HEADERS(gdbm.h)
310 AC_CACHE_CHECK(for db, [ol_cv_gdbm], [
311 if test $ol_cv_lib_gdbm = no -o $ac_cv_header_gdbm_h = no ; then
317 if test $ol_cv_gdbm = yes ; then
318 AC_DEFINE(HAVE_GDBM,1, [define if GNU DBM is available])
322 dnl ====================================================================
323 dnl Check if NDBM library exists
324 dnl Check for dbm_open in standard libraries or -lndbm or -ldbm
326 dnl defines ol_cv_lib_ndbm to 'yes' or '-lndbm' or -ldbm or 'no'
327 dnl 'yes' implies ndbm_open is in $LIBS
330 dnl AC_CHECK_FUNC(dbm_open)
331 dnl AC_CHECK_LIB(ndbm,dbm_open)
332 dnl AC_CHECK_LIB(dbm,dbm_open)
335 dnl should also check SVR4 case: dbm_open() in -lucb but that
336 dnl would requiring dealing with -L/usr/ucblib
338 AC_DEFUN([OL_LIB_NDBM],
339 [AC_CACHE_CHECK(for NDBM library, [ol_cv_lib_ndbm],
341 AC_CHECK_FUNC(dbm_open,[ol_cv_lib_ndbm=yes], [
342 AC_CHECK_LIB(ndbm,dbm_open,[ol_cv_lib_ndbm=-lndbm], [
343 AC_CHECK_LIB(dbm,dbm_open,[ol_cv_lib_ndbm=-ldbm],
344 [ol_cv_lib_ndbm=no])dnl
351 dnl --------------------------------------------------------------------
352 dnl Check if NDBM exists
354 dnl defines ol_cv_ndbm to 'yes' or 'no'
358 dnl AC_CHECK_HEADERS(ndbm.h)
361 dnl Doesn't handle SVR4 case (see above)
364 [AC_REQUIRE([OL_LIB_NDBM])
365 AC_CHECK_HEADERS(ndbm.h)
366 AC_CACHE_CHECK(for db, [ol_cv_ndbm], [
367 if test $ol_cv_lib_ndbm = no -o $ac_cv_header_ndbm_h = no ; then
373 if test $ol_cv_ndbm = yes ; then
374 AC_DEFINE(HAVE_NDBM,1, [define if NDBM is available])
378 dnl ====================================================================
379 dnl Check POSIX Thread version
381 dnl defines ol_cv_posix_version to 'final' or 'draft' or 'unknown'
382 dnl 'unknown' implies that the version could not be detected
383 dnl or that pthreads.h does exist. Existance of pthreads.h
384 dnl should be tested separately.
386 AC_DEFUN([OL_POSIX_THREAD_VERSION],
387 [AC_CACHE_CHECK([POSIX thread version],[ol_cv_pthread_version],[
388 AC_EGREP_CPP(pthread_version_final,[
389 # include <pthread.h>
390 /* this check could be improved */
391 # ifdef PTHREAD_ONCE_INIT
392 pthread_version_final
394 ], ol_pthread_final=yes, ol_pthread_final=no)
396 AC_EGREP_CPP(pthread_version_draft4,[
397 # include <pthread.h>
398 /* this check could be improved */
399 # ifdef pthread_once_init
400 pthread_version_draft4
402 ], ol_pthread_draft4=yes, ol_pthread_draft4=no)
404 if test $ol_pthread_final = yes -a $ol_pthread_draft4 = no; then
405 ol_cv_pthread_version=final
406 elif test $ol_pthread_final = no -a $ol_pthread_draft4 = yes; then
407 ol_cv_pthread_version=draft4
409 ol_cv_pthread_version=unknown
414 dnl --------------------------------------------------------------------
415 dnl Check LinuxThread
417 dnl defines ol_cv_linux_threads to 'yes' or 'no'
418 dnl 'no' implies pthreads.h is not LinuxThreads or pthreads.h
419 dnl doesn't exists. Existance of pthread.h should separately
422 AC_DEFUN([OL_LINUX_THREADS],
424 AC_CACHE_CHECK([for LinuxThreads], [ol_cv_linux_threads], [
425 res=`grep Linuxthreads /usr/include/pthread.h 2>/dev/null | wc -l`
426 if test "$res" -gt 0 ; then
427 ol_cv_linux_threads=yes
429 ol_cv_linux_threads=no
434 dnl ====================================================================
435 dnl Check if toupper() requires islower() to be called first
436 AC_DEFUN([OL_C_UPPER_LOWER],
438 AC_MSG_CHECKING([if toupper() requires islower()])
439 AC_CACHE_VAL(ol_cv_c_upper_lower,[
444 if ('C' == toupper('C'))
449 [ol_cv_c_upper_lower=no],
450 [ol_cv_c_upper_lower=yes],
451 [ol_cv_c_upper_lower=safe])])
452 AC_MSG_RESULT($ol_cv_c_upper_lower)
453 if test $ol_cv_c_upper_lower != no ; then
454 AC_DEFINE(C_UPPER_LOWER,1, [define if toupper() requires islower()])
458 dnl ====================================================================
459 dnl Check for declaration of sys_errlist in one of stdio.h and errno.h.
460 dnl Declaration of sys_errlist on BSD4.4 interferes with our declaration.
461 dnl Reported by Keith Bostic.
462 AC_DEFUN([OL_SYS_ERRLIST],
464 AC_MSG_CHECKING([declaration of sys_errlist])
465 AC_CACHE_VAL(ol_cv_dcl_sys_errlist,[
468 #include <sys/types.h>
469 #include <errno.h> ],
470 [char *c = (char *) *sys_errlist],
471 [ol_cv_dcl_sys_errlist=yes],
472 [ol_cv_dcl_sys_errlist=no])])
473 AC_MSG_RESULT($ol_cv_dcl_sys_errlist)
474 # It's possible (for near-UNIX clones) that sys_errlist doesn't exist
475 if test $ol_cv_dcl_sys_errlist = no ; then
476 AC_DEFINE(DECL_SYS_ERRLIST,1,
477 [define if sys_errlist is not declared in stdio.h or errno.h])
478 AC_MSG_CHECKING([existence of sys_errlist])
479 AC_CACHE_VAL(ol_cv_have_sys_errlist,[
480 AC_TRY_LINK([#include <errno.h>],
481 [char *c = (char *) *sys_errlist],
482 [ol_cv_have_sys_errlist=yes],
483 [ol_cv_have_sys_errlist=no])])
484 AC_MSG_RESULT($ol_cv_have_sys_errlist)
485 if test $ol_cv_have_sys_errlist = yes ; then
486 AC_DEFINE(HAVE_SYS_ERRLIST,1,
487 [define if you actually have sys_errlist in your libs])
492 dnl ====================================================================
493 dnl Check to see if we should not declare strdup if we have it
495 AC_DEFUN([OL_DECL_STRDUP],
497 AC_MSG_CHECKING([strdup declaration])
498 AC_CACHE_VAL(ol_cv_dcl_strdup,[
500 #include <string.h> ],
501 [extern char *strdup();],
502 [ol_cv_dcl_strdup=yes],
503 [ol_cv_dcl_strdup=no])])
504 AC_MSG_RESULT($ol_cv_dcl_strdup)
505 if test $ol_cv_dcl_strdup = yes ; then
506 AC_DEFINE(DECL_STRDUP,1,
507 [define if you have strdup() but it's not declared])
511 dnl ====================================================================
512 dnl Early MIPS compilers (used in Ultrix 4.2) don't like
513 dnl "int x; int *volatile a = &x; *a = 0;"
514 dnl -- borrowed from PDKSH
515 AC_DEFUN(OL_C_VOLATILE,
516 [AC_CACHE_CHECK(if compiler understands volatile, ol_cv_c_volatile,
517 [AC_TRY_COMPILE([int x, y, z;],
518 [volatile int a; int * volatile b = x ? &y : &z;
519 /* Older MIPS compilers (eg., in Ultrix 4.2) don't like *b = 0 */
520 *b = 0;], ol_cv_c_volatile=yes, ol_cv_c_volatile=no)])
521 if test $ol_cv_c_volatile = yes; then
528 dnl ====================================================================
529 dnl Define sig_atomic_t if not defined in signal.h
530 AC_DEFUN(OL_TYPE_SIG_ATOMIC_T,
531 [AC_CACHE_CHECK(for sig_atomic_t, ol_cv_type_sig_atomic_t,
532 [AC_TRY_COMPILE([#include <signal.h>], [sig_atomic_t atomic;],
533 ol_cv_type_sig_atomic_t=yes, ol_cv_type_sig_atomic_t=no)])
534 if test $ol_cv_type_sig_atomic_t = no; then
535 AC_DEFINE(sig_atomic_t, int)
539 dnl ====================================================================
540 dnl check no of arguments for ctime_r
541 AC_DEFUN(OL_FUNC_CTIME_R_NARGS,
542 [AC_CACHE_CHECK(number of arguments of ctime_r, ol_cv_func_ctime_r_nargs,
543 [AC_TRY_COMPILE([#include <time.h>],
544 [time_t ti; char *buffer; ctime_r(&ti,buffer,32);],
545 ol_cv_func_ctime_r_nargs=3,
546 [AC_TRY_COMPILE([#include <time.h>],
547 [time_t ti; char *buffer; ctime_r(&ti,buffer);],
548 ol_cv_func_ctime_r_nargs=2,
549 ol_cv_func_ctime_r_nargs=0)])])
550 if test $ol_cv_func_ctime_r_nargs -gt 1 ; then
551 AC_DEFINE_UNQUOTED(CTIME_R_NARGS, $ol_cv_func_ctime_r_nargs,
552 [set to the number of arguments ctime_r() expects])
556 dnl --------------------------------------------------------------------
557 dnl check return type of ctime_r()
558 AC_DEFUN(OL_FUNC_CTIME_R_TYPE,
559 [AC_CACHE_CHECK(return type of ctime_r, ol_cv_func_ctime_r_type,
560 [AC_TRY_COMPILE([#include <time.h>],
562 ol_cv_func_ctime_r_type="int", ol_cv_func_ctime_r_type="charp")
564 if test $ol_cv_func_ctime_r_type = "int" ; then
565 AC_DEFINE(CTIME_R_RETURNS_INT,1, [define if ctime_r() returns int])
568 dnl ====================================================================
569 dnl check no of arguments for gethostbyname_r
570 AC_DEFUN(OL_FUNC_GETHOSTBYNAME_R_NARGS,
571 [AC_CACHE_CHECK(number of arguments of gethostbyname_r,
572 ol_cv_func_gethostbyname_r_nargs,
573 [AC_TRY_COMPILE([#include <sys/types.h>
574 #include <sys/socket.h>
575 #include <netinet/in.h>
577 #define BUFSIZE (sizeof(struct hostent)+10)],
578 [struct hostent hent; char buffer[BUFSIZE];
579 int bufsize=BUFSIZE;int h_errno;
580 (void)gethostbyname_r("segovia.cs.purdue.edu", &hent,
581 buffer, bufsize, &h_errno);],
582 ol_cv_func_gethostbyname_r_nargs=5,
583 [AC_TRY_COMPILE([#include <sys/types.h>
584 #include <sys/socket.h>
585 #include <netinet/in.h>
587 #define BUFSIZE (sizeof(struct hostent)+10)],
588 [struct hostent hent;struct hostent *rhent;
589 char buffer[BUFSIZE];
590 int bufsize=BUFSIZE;int h_errno;
591 (void)gethostbyname_r("localhost", &hent, buffer, bufsize,
593 ol_cv_func_gethostbyname_r_nargs=6,
594 ol_cv_func_gethostbyname_r_nargs=0)])])
595 if test $ol_cv_func_gethostbyname_r_nargs -gt 1 ; then
596 AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_NARGS,
597 $ol_cv_func_gethostbyname_r_nargs,
598 [set to the number of arguments gethostbyname_r() expects])
602 dnl check no of arguments for gethostbyaddr_r
603 AC_DEFUN(OL_FUNC_GETHOSTBYADDR_R_NARGS,
604 [AC_CACHE_CHECK(number of arguments of gethostbyaddr_r,
605 [ol_cv_func_gethostbyaddr_r_nargs],
606 [AC_TRY_COMPILE([#include <sys/types.h>
607 #include <sys/socket.h>
608 #include <netinet/in.h>
610 #define BUFSIZE (sizeof(struct hostent)+10)],
611 [struct hostent hent; char buffer[BUFSIZE];
613 size_t alen=sizeof(struct in_addr);
614 int bufsize=BUFSIZE;int h_errno;
615 (void)gethostbyaddr_r( (void *)&(add.s_addr),
616 alen, AF_INET, &hent, buffer, bufsize, &h_errno);],
617 ol_cv_func_gethostbyaddr_r_nargs=7,
618 [AC_TRY_COMPILE([#include <sys/types.h>
619 #include <sys/socket.h>
620 #include <netinet/in.h>
622 #define BUFSIZE (sizeof(struct hostent)+10)],
623 [struct hostent hent;
624 struct hostent *rhent; char buffer[BUFSIZE];
626 size_t alen=sizeof(struct in_addr);
627 int bufsize=BUFSIZE;int h_errno;
628 (void)gethostbyaddr_r( (void *)&(add.s_addr),
629 alen, AF_INET, &hent, buffer, bufsize,
631 ol_cv_func_gethostbyaddr_r_nargs=8,
632 ol_cv_func_gethostbyaddr_r_nargs=0)])])
633 if test $ol_cv_func_gethostbyaddr_r_nargs -gt 1 ; then
634 AC_DEFINE_UNQUOTED(GETHOSTBYADDR_R_NARGS,
635 $ol_cv_func_gethostbyaddr_r_nargs,
636 [set to the number of arguments gethostbyaddr_r() expects])