Annotation of embedaddon/tmux/configure.ac, revision 1.1.1.1
1.1 misho 1: # configure.ac
2:
3: AC_INIT(tmux, 2.4)
4: AC_PREREQ([2.60])
5:
6: AC_CONFIG_AUX_DIR(etc)
7: AC_CONFIG_LIBOBJ_DIR(compat)
8: AM_INIT_AUTOMAKE([foreign subdir-objects])
9:
10: AC_CANONICAL_HOST
11:
12: # When CFLAGS isn't set at this stage and gcc is detected by the macro below,
13: # autoconf will automatically use CFLAGS="-O2 -g". Prevent that by using an
14: # empty default.
15: : ${CFLAGS=""}
16:
17: # Save user CPPFLAGS, CFLAGS and LDFLAGS. We need to change them because
18: # AC_CHECK_HEADER doesn't give us any other way to update the include
19: # paths. But for Makefile.am we want to use AM_CPPFLAGS and friends.
20: SAVED_CFLAGS="$CFLAGS"
21: SAVED_CPPFLAGS="$CPPFLAGS"
22: SAVED_LDFLAGS="$LDFLAGS"
23:
24: # Set up the compiler in two different ways and say yes we may want to install.
25: AC_PROG_CC
26: AM_PROG_CC_C_O
27: AC_PROG_CC_C99
28: AC_PROG_CPP
29: AC_PROG_EGREP
30: AC_PROG_INSTALL
31: PKG_PROG_PKG_CONFIG
32: AC_USE_SYSTEM_EXTENSIONS
33:
34: # Default tmux.conf goes in /etc not ${prefix}/etc.
35: test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
36:
37: # Is this --enable-debug?
38: AC_ARG_ENABLE(
39: debug,
40: AC_HELP_STRING(--enable-debug, enable debug build flags),
41: )
42: AM_CONDITIONAL(IS_DEBUG, test "x$enable_debug" = xyes)
43:
44: # Is this a static build?
45: AC_ARG_ENABLE(
46: static,
47: AC_HELP_STRING(--enable-static, create a static build)
48: )
49: if test "x$enable_static" = xyes; then
50: test "x$PKG_CONFIG" != x && PKG_CONFIG="$PKG_CONFIG --static"
51: AM_LDFLAGS="-static $AM_LDFLAGS"
52: LDFLAGS="$AM_LDFLAGS $SAVED_LDFLAGS"
53: fi
54:
55: # Is this gcc?
56: AM_CONDITIONAL(IS_GCC, test "x$GCC" = xyes)
57:
58: # Is this Sun CC?
59: AC_EGREP_CPP(
60: yes,
61: [
62: #ifdef __SUNPRO_C
63: yes
64: #endif
65: ],
66: found_suncc=yes,
67: found_suncc=no
68: )
69: AM_CONDITIONAL(IS_SUNCC, test "x$found_suncc" = xyes)
70:
71: # Check for various headers. Alternatives included from compat.h.
72: AC_CHECK_HEADERS([ \
73: bitstring.h \
74: dirent.h \
75: fcntl.h \
76: inttypes.h \
77: libutil.h \
78: ndir.h \
79: paths.h \
80: pty.h \
81: stdint.h \
82: sys/dir.h \
83: sys/ndir.h \
84: sys/tree.h \
85: util.h \
86: ])
87:
88: # Look for library needed for flock.
89: AC_SEARCH_LIBS(flock, bsd)
90:
91: # Check for functions that are replaced or omitted.
92: AC_CHECK_FUNCS([ \
93: dirfd \
94: flock \
95: prctl \
96: sysconf \
97: ])
98:
99: # Check for functions with a compatibility implementation.
100: AC_REPLACE_FUNCS([ \
101: asprintf \
102: cfmakeraw \
103: closefrom \
104: explicit_bzero \
105: fgetln \
106: fparseln \
107: freezero \
108: getdtablecount \
109: getprogname \
110: recallocarray \
111: reallocarray \
112: setenv \
113: setproctitle \
114: strcasestr \
115: strlcat \
116: strlcpy \
117: strndup \
118: strsep \
119: strtonum \
120: ])
121: AC_FUNC_STRNLEN
122:
123: # Look for clock_gettime. Must come before event_init.
124: AC_SEARCH_LIBS(clock_gettime, rt)
125:
126: # Look for libevent.
127: PKG_CHECK_MODULES(
128: LIBEVENT,
129: libevent,
130: [
131: AM_CFLAGS="$LIBEVENT_CFLAGS $AM_CFLAGS"
132: CFLAGS="$AM_CFLAGS $SAVED_CFLAGS"
133: LIBS="$LIBEVENT_LIBS $LIBS"
134: found_libevent=yes
135: ],
136: [
137: AC_SEARCH_LIBS(
138: event_init,
139: [event event-1.4 event2],
140: found_libevent=yes,
141: found_libevent=no
142: )
143: ]
144: )
145: AC_CHECK_HEADER(
146: event.h,
147: ,
148: found_libevent=no
149: )
150: if test "x$found_libevent" = xno; then
151: AC_MSG_ERROR("libevent not found")
152: fi
153:
154: # Look for ncurses.
155: PKG_CHECK_MODULES(
156: LIBTINFO,
157: tinfo,
158: found_ncurses=yes,
159: found_ncurses=no
160: )
161: if test "x$found_ncurses" = xno; then
162: PKG_CHECK_MODULES(
163: LIBNCURSES,
164: ncurses,
165: found_ncurses=yes,
166: found_ncurses=no
167: )
168: fi
169: if test "x$found_ncurses" = xno; then
170: PKG_CHECK_MODULES(
171: LIBNCURSES,
172: ncursesw,
173: found_ncurses=yes,
174: found_ncurses=no
175: )
176: fi
177: if test "x$found_ncurses" = xyes; then
178: CPPFLAGS="$LIBNCURSES_CFLAGS $LIBTINFO_CFLAGS $CPPFLAGS"
179: LIBS="$LIBNCURSES_LIBS $LIBTINFO_LIBS $LIBS"
180: else
181: # pkg-config didn't work, try ncurses.
182: AC_CHECK_LIB(
183: tinfo,
184: setupterm,
185: found_ncurses=yes,
186: found_ncurses=no
187: )
188: if test "x$found_ncurses" = xno; then
189: AC_CHECK_LIB(
190: ncurses,
191: setupterm,
192: found_ncurses=yes,
193: found_ncurses=no
194: )
195: fi
196: if test "x$found_ncurses" = xyes; then
197: AC_CHECK_HEADER(
198: ncurses.h,
199: LIBS="$LIBS -lncurses",
200: found_ncurses=no)
201: fi
202: fi
203: if test "x$found_ncurses" = xyes; then
204: AC_DEFINE(HAVE_NCURSES_H)
205: else
206: # No ncurses, try curses.
207: AC_CHECK_LIB(
208: curses,
209: setupterm,
210: found_curses=yes,
211: found_curses=no
212: )
213: AC_CHECK_HEADER(
214: curses.h,
215: ,
216: found_curses=no)
217: if test "x$found_curses" = xyes; then
218: LIBS="$LIBS -lcurses"
219: AC_DEFINE(HAVE_CURSES_H)
220: else
221: AC_MSG_ERROR("curses not found")
222: fi
223: fi
224:
225: # Look for utempter.
226: AC_ARG_ENABLE(
227: utempter,
228: AC_HELP_STRING(--enable-utempter, use utempter if it is installed)
229: )
230: if test "x$enable_utempter" = xyes; then
231: AC_CHECK_HEADER(utempter.h, enable_utempter=yes, enable_utempter=no)
232: if test "x$enable_utempter" = xyes; then
233: AC_SEARCH_LIBS(
234: utempter_add_record,
235: utempter,
236: enable_utempter=yes,
237: enable_utempter=no
238: )
239: fi
240: if test "x$enable_utempter" = xyes; then
241: AC_DEFINE(HAVE_UTEMPTER)
242: else
243: AC_MSG_ERROR("utempter not found")
244: fi
245: fi
246:
247: # Look for utf8proc.
248: AC_ARG_ENABLE(
249: utf8proc,
250: AC_HELP_STRING(--enable-utf8proc, use utf8proc if it is installed)
251: )
252: if test "x$enable_utf8proc" = xyes; then
253: AC_CHECK_HEADER(utf8proc.h, enable_utf8proc=yes, enable_utf8proc=no)
254: if test "x$enable_utf8proc" = xyes; then
255: AC_SEARCH_LIBS(
256: utf8proc_charwidth,
257: utf8proc,
258: enable_utf8proc=yes,
259: enable_utf8proc=no
260: )
261: fi
262: if test "x$enable_utf8proc" = xyes; then
263: AC_DEFINE(HAVE_UTF8PROC)
264: else
265: AC_MSG_ERROR("utf8proc not found")
266: fi
267: fi
268: AM_CONDITIONAL(HAVE_UTF8PROC, [test "x$enable_utf8proc" = xyes])
269:
270: # Check for b64_ntop. If we have b64_ntop, we assume b64_pton as well.
271: AC_MSG_CHECKING(for b64_ntop)
272: AC_TRY_LINK(
273: [
274: #include <sys/types.h>
275: #include <netinet/in.h>
276: #include <resolv.h>
277: ],
278: [b64_ntop(NULL, 0, NULL, 0);],
279: found_b64_ntop=yes,
280: found_b64_ntop=no
281: )
282: if test "x$found_b64_ntop" = xno; then
283: AC_MSG_RESULT(no)
284:
285: AC_MSG_CHECKING(for b64_ntop with -lresolv)
286: LIBS="$LIBS -lresolv"
287: AC_TRY_LINK(
288: [
289: #include <sys/types.h>
290: #include <netinet/in.h>
291: #include <resolv.h>
292: ],
293: [b64_ntop(NULL, 0, NULL, 0);],
294: found_b64_ntop=yes,
295: found_b64_ntop=no
296: )
297: if test "x$found_b64_ntop" = xno; then
298: AC_MSG_RESULT(no)
299: fi
300: fi
301: if test "x$found_b64_ntop" = xyes; then
302: AC_DEFINE(HAVE_B64_NTOP)
303: AC_MSG_RESULT(yes)
304: else
305: AC_LIBOBJ(base64)
306: fi
307:
308: # Look for networking libraries.
309: AC_SEARCH_LIBS(inet_ntoa, nsl)
310: AC_SEARCH_LIBS(socket, socket)
311: AC_CHECK_LIB(xnet, socket)
312:
313: # Check for CMSG_DATA. Some platforms require _XOPEN_SOURCE_EXTENDED (for
314: # example see xopen_networking(7) on HP-UX).
315: XOPEN_DEFINES=
316: AC_MSG_CHECKING(for CMSG_DATA)
317: AC_EGREP_CPP(
318: yes,
319: [
320: #include <sys/socket.h>
321: #ifdef CMSG_DATA
322: yes
323: #endif
324: ],
325: found_cmsg_data=yes,
326: found_cmsg_data=no
327: )
328: AC_MSG_RESULT($found_cmsg_data)
329: if test "x$found_cmsg_data" = xno; then
330: AC_MSG_CHECKING(if CMSG_DATA needs _XOPEN_SOURCE_EXTENDED)
331: AC_EGREP_CPP(
332: yes,
333: [
334: #define _XOPEN_SOURCE 1
335: #define _XOPEN_SOURCE_EXTENDED 1
336: #include <sys/socket.h>
337: #ifdef CMSG_DATA
338: yes
339: #endif
340: ],
341: found_cmsg_data=yes,
342: found_cmsg_data=no
343: )
344: AC_MSG_RESULT($found_cmsg_data)
345: if test "x$found_cmsg_data" = xyes; then
346: XOPEN_DEFINES="-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED"
347: else
348: AC_MSG_ERROR("CMSG_DATA not found")
349: fi
350: fi
351: AC_SUBST(XOPEN_DEFINES)
352:
353: # Look for err and friends in err.h.
354: AC_CHECK_FUNC(err, found_err_h=yes, found_err_h=no)
355: AC_CHECK_FUNC(errx, , found_err_h=no)
356: AC_CHECK_FUNC(warn, , found_err_h=no)
357: AC_CHECK_FUNC(warnx, , found_err_h=no)
358: if test "x$found_err_h" = xyes; then
359: AC_CHECK_HEADER(err.h, , found_err_h=no)
360: else
361: AC_LIBOBJ(err)
362: fi
363:
364: # Look for imsg_init in libutil.
365: AC_SEARCH_LIBS(imsg_init, util, found_imsg_init=yes, found_imsg_init=no)
366: if test "x$found_imsg_init" = xyes; then
367: AC_DEFINE(HAVE_IMSG)
368: else
369: AC_LIBOBJ(imsg)
370: AC_LIBOBJ(imsg-buffer)
371: fi
372:
373: # Look for daemon, compat/daemon.c used if missing. Solaris 10 has it in
374: # libresolv, but no declaration anywhere, so check for declaration as well as
375: # function.
376: AC_CHECK_FUNC(daemon, found_daemon=yes, found_daemon=no)
377: AC_CHECK_DECL(
378: daemon,
379: ,
380: found_daemon=no,
381: [
382: #include <stdlib.h>
383: #include <unistd.h>
384: ]
385: )
386: if test "x$found_daemon" = xyes; then
387: AC_DEFINE(HAVE_DAEMON)
388: else
389: AC_LIBOBJ(daemon)
390: fi
391:
392: # Look for stravis, compat/{vis,unvis}.c used if missing.
393: AC_CHECK_FUNC(stravis, found_stravis=yes, found_stravis=no)
394: if test "x$found_stravis" = xyes; then
395: AC_MSG_CHECKING(if strnvis is broken)
396: AC_EGREP_HEADER([strnvis\(char \*, const char \*, size_t, int\)],
397: vis.h,
398: AC_MSG_RESULT(no),
399: [found_stravis=no])
400: if test "x$found_stravis" = xno; then
401: AC_MSG_RESULT(yes)
402: fi
403: fi
404: if test "x$found_stravis" = xyes; then
405: AC_CHECK_DECL(
406: VIS_DQ,
407: ,
408: found_stravis=no,
409: [
410: #include <stdlib.h>
411: #include <vis.h>
412: ]
413: )
414: fi
415: if test "x$found_stravis" = xyes; then
416: AC_DEFINE(HAVE_VIS)
417: else
418: AC_LIBOBJ(vis)
419: AC_LIBOBJ(unvis)
420: fi
421:
422: # Look for getopt. glibc's getopt does not enforce argument order and the ways
423: # of making it do so are stupid, so just use our own instead.
424: AC_CHECK_FUNC(getopt, found_getopt=yes, found_getopt=no)
425: if test "x$found_getopt" != xno; then
426: AC_MSG_CHECKING(if getopt is suitable)
427: AC_EGREP_CPP(
428: yes,
429: [
430: #include <features.h>
431: #ifdef __GLIBC__
432: yes
433: #endif
434: ],
435: [
436: found_getopt=no
437: AC_MSG_RESULT(no)
438: ],
439: AC_MSG_RESULT(yes))
440: fi
441: if test "x$found_getopt" != xno; then
442: AC_CHECK_DECLS(
443: [optarg, optind, optreset],
444: ,
445: found_getopt=no,
446: [
447: #include <unistd.h>
448: ])
449: fi
450: if test "x$found_getopt" != xno; then
451: AC_DEFINE(HAVE_GETOPT)
452: else
453: AC_LIBOBJ(getopt)
454: fi
455:
456: # Look for forkpty in libutil. compat/forkpty-*.c is linked if not found.
457: AC_SEARCH_LIBS(forkpty, util, found_forkpty=yes, found_forkpty=no)
458: if test "x$found_forkpty" = xyes; then
459: AC_DEFINE(HAVE_FORKPTY)
460: fi
461: AM_CONDITIONAL(NEED_FORKPTY, test "x$found_forkpty" = xno)
462:
463: # Look for a suitable queue.h.
464: AC_CHECK_DECL(
465: TAILQ_CONCAT,
466: found_queue_h=yes,
467: found_queue_h=no,
468: [#include <sys/queue.h>]
469: )
470: AC_CHECK_DECL(
471: TAILQ_PREV,
472: found_queue_h=yes,
473: found_queue_h=no,
474: [#include <sys/queue.h>]
475: )
476: AC_CHECK_DECL(
477: TAILQ_REPLACE,
478: ,
479: found_queue_h=no,
480: [#include <sys/queue.h>]
481: )
482: if test "x$found_queue_h" = xyes; then
483: AC_DEFINE(HAVE_QUEUE_H)
484: fi
485:
486: # Look for __progname.
487: AC_MSG_CHECKING(for __progname)
488: AC_LINK_IFELSE([AC_LANG_SOURCE(
489: [
490: #include <stdio.h>
491: #include <stdlib.h>
492: extern char *__progname;
493: int main(void) {
494: const char *cp = __progname;
495: printf("%s\n", cp);
496: exit(0);
497: }
498: ])],
499: [AC_DEFINE(HAVE___PROGNAME) AC_MSG_RESULT(yes)],
500: AC_MSG_RESULT(no)
501: )
502:
503: # Look for program_invocation_short_name.
504: AC_MSG_CHECKING(for program_invocation_short_name)
505: AC_LINK_IFELSE([AC_LANG_SOURCE(
506: [
507: #include <errno.h>
508: #include <stdio.h>
509: #include <stdlib.h>
510: int main(void) {
511: const char *cp = program_invocation_short_name;
512: printf("%s\n", cp);
513: exit(0);
514: }
515: ])],
516: [AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME) AC_MSG_RESULT(yes)],
517: AC_MSG_RESULT(no)
518: )
519:
520: # Look for prctl(PR_SET_NAME).
521: AC_CHECK_DECL(
522: PR_SET_NAME,
523: AC_DEFINE(HAVE_PR_SET_NAME),
524: ,
525: [#include <sys/prctl.h>]
526: )
527:
528: # Look for fcntl(F_CLOSEM).
529: AC_CHECK_DECL(
530: F_CLOSEM,
531: AC_DEFINE(HAVE_FCNTL_CLOSEM),
532: ,
533: [#include <fcntl.h>]
534: )
535:
536: # Look for /proc/$$.
537: AC_MSG_CHECKING(for /proc/\$\$)
538: if test -d /proc/$$; then
539: AC_DEFINE(HAVE_PROC_PID)
540: AC_MSG_RESULT(yes)
541: else
542: AC_MSG_RESULT(no)
543: fi
544:
545: # Man page defaults to mdoc.
546: MANFORMAT=mdoc
547: AC_SUBST(MANFORMAT)
548:
549: # Figure out the platform.
550: AC_MSG_CHECKING(platform)
551: case "$host_os" in
552: *aix*)
553: AC_MSG_RESULT(aix)
554: PLATFORM=aix
555: ;;
556: *darwin*)
557: AC_MSG_RESULT(darwin)
558: AC_DEFINE(BROKEN_CMSG_FIRSTHDR)
559: PLATFORM=darwin
560: ;;
561: *dragonfly*)
562: AC_MSG_RESULT(dragonfly)
563: PLATFORM=dragonfly
564: ;;
565: *linux*)
566: AC_MSG_RESULT(linux)
567: PLATFORM=linux
568: ;;
569: *freebsd*)
570: AC_MSG_RESULT(freebsd)
571: PLATFORM=freebsd
572: ;;
573: *netbsd*)
574: AC_MSG_RESULT(netbsd)
575: PLATFORM=netbsd
576: ;;
577: *openbsd*)
578: AC_MSG_RESULT(openbsd)
579: PLATFORM=openbsd
580: ;;
581: *sunos*)
582: AC_MSG_RESULT(sunos)
583: PLATFORM=sunos
584: ;;
585: *solaris*)
586: AC_MSG_RESULT(sunos)
587: PLATFORM=sunos
588: MANFORMAT=man
589: ;;
590: *hpux*)
591: AC_MSG_RESULT(hpux)
592: PLATFORM=hpux
593: ;;
594: *cygwin*)
595: AC_MSG_RESULT(cygwin)
596: PLATFORM=cygwin
597: ;;
598: *)
599: AC_MSG_RESULT(unknown)
600: PLATFORM=unknown
601: ;;
602: esac
603: AC_SUBST(PLATFORM)
604: AM_CONDITIONAL(IS_AIX, test "x$PLATFORM" = xaix)
605: AM_CONDITIONAL(IS_DARWIN, test "x$PLATFORM" = xdarwin)
606: AM_CONDITIONAL(IS_DRAGONFLY, test "x$PLATFORM" = xdragonfly)
607: AM_CONDITIONAL(IS_LINUX, test "x$PLATFORM" = xlinux)
608: AM_CONDITIONAL(IS_FREEBSD, test "x$PLATFORM" = xfreebsd)
609: AM_CONDITIONAL(IS_NETBSD, test "x$PLATFORM" = xnetbsd)
610: AM_CONDITIONAL(IS_OPENBSD, test "x$PLATFORM" = xopenbsd)
611: AM_CONDITIONAL(IS_SUNOS, test "x$PLATFORM" = xsunos)
612: AM_CONDITIONAL(IS_HPUX, test "x$PLATFORM" = xhpux)
613: AM_CONDITIONAL(IS_UNKNOWN, test "x$PLATFORM" = xunknown)
614:
615: # Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user
616: # variables.
617: AC_SUBST(AM_CPPFLAGS)
618: CPPFLAGS="$SAVED_CPPFLAGS"
619: AC_SUBST(AM_CFLAGS)
620: CFLAGS="$SAVED_CFLAGS"
621: AC_SUBST(AM_LDFLAGS)
622: LDFLAGS="$SAVED_LDFLAGS"
623:
624: # autoconf should create a Makefile.
625: AC_OUTPUT(Makefile)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>