configure.ac revision 1.1.1.7
1# configure.ac 2 3AC_INIT([tmux], 3.2) 4AC_PREREQ([2.60]) 5 6AC_CONFIG_AUX_DIR(etc) 7AC_CONFIG_LIBOBJ_DIR(compat) 8AM_INIT_AUTOMAKE([foreign subdir-objects]) 9 10AC_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. 20SAVED_CFLAGS="$CFLAGS" 21SAVED_CPPFLAGS="$CPPFLAGS" 22SAVED_LDFLAGS="$LDFLAGS" 23 24# Is this oss-fuzz build? 25AC_ARG_ENABLE( 26 fuzzing, 27 AC_HELP_STRING(--enable-fuzzing, build fuzzers) 28) 29AC_ARG_VAR( 30 FUZZING_LIBS, 31 AC_HELP_STRING(libraries to link fuzzing targets with) 32) 33 34# Set up convenient fuzzing defaults before initializing compiler. 35if test "x$enable_fuzzing" = xyes; then 36 AC_DEFINE(NEED_FUZZING) 37 test "x$CC" == x && CC=clang 38 test "x$FUZZING_LIBS" == x && \ 39 FUZZING_LIBS="-fsanitize=fuzzer" 40 test "x$SAVED_CFLAGS" == x && \ 41 AM_CFLAGS="-g -fsanitize=fuzzer-no-link,address" 42fi 43 44# Set up the compiler in two different ways and say yes we may want to install. 45AC_PROG_CC 46AM_PROG_CC_C_O 47AC_PROG_CC_C99 48AC_PROG_CPP 49AC_PROG_EGREP 50AC_PROG_INSTALL 51AC_PROG_YACC 52PKG_PROG_PKG_CONFIG 53AC_USE_SYSTEM_EXTENSIONS 54 55# Default tmux.conf goes in /etc not ${prefix}/etc. 56test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc 57 58# Is this --enable-debug? 59case "x$VERSION" in xnext*) enable_debug=yes;; esac 60AC_ARG_ENABLE( 61 debug, 62 AC_HELP_STRING(--enable-debug, enable debug build flags), 63) 64AM_CONDITIONAL(IS_DEBUG, test "x$enable_debug" = xyes) 65 66# Is this a static build? 67AC_ARG_ENABLE( 68 static, 69 AC_HELP_STRING(--enable-static, create a static build) 70) 71if test "x$enable_static" = xyes; then 72 test "x$PKG_CONFIG" != x && PKG_CONFIG="$PKG_CONFIG --static" 73 AM_LDFLAGS="-static $AM_LDFLAGS" 74 LDFLAGS="$AM_LDFLAGS $SAVED_LDFLAGS" 75fi 76 77# Do we need fuzzers? 78AM_CONDITIONAL(NEED_FUZZING, test "x$enable_fuzzing" = xyes) 79 80# Is this gcc? 81AM_CONDITIONAL(IS_GCC, test "x$GCC" = xyes -a "x$enable_fuzzing" != xyes) 82 83# Is this Sun CC? 84AC_EGREP_CPP( 85 yes, 86 [ 87 #ifdef __SUNPRO_C 88 yes 89 #endif 90 ], 91 found_suncc=yes, 92 found_suncc=no 93) 94AM_CONDITIONAL(IS_SUNCC, test "x$found_suncc" = xyes) 95 96# Check for various headers. Alternatives included from compat.h. 97AC_CHECK_HEADERS([ \ 98 bitstring.h \ 99 dirent.h \ 100 fcntl.h \ 101 inttypes.h \ 102 libproc.h \ 103 libutil.h \ 104 ndir.h \ 105 paths.h \ 106 pty.h \ 107 stdint.h \ 108 sys/dir.h \ 109 sys/ndir.h \ 110 sys/tree.h \ 111 util.h \ 112]) 113 114# Look for sys_signame. 115AC_SEARCH_LIBS(sys_signame, , AC_DEFINE(HAVE_SYS_SIGNAME)) 116 117# Look for fmod. 118AC_CHECK_LIB(m, fmod) 119 120# Look for library needed for flock. 121AC_SEARCH_LIBS(flock, bsd) 122 123# Check for functions that are replaced or omitted. 124AC_CHECK_FUNCS([ \ 125 dirfd \ 126 flock \ 127 prctl \ 128 proc_pidinfo \ 129 sysconf 130]) 131 132# Check for functions with a compatibility implementation. 133AC_REPLACE_FUNCS([ \ 134 asprintf \ 135 cfmakeraw \ 136 clock_gettime \ 137 closefrom \ 138 explicit_bzero \ 139 fgetln \ 140 freezero \ 141 getdtablecount \ 142 getdtablesize \ 143 getline \ 144 getprogname \ 145 memmem \ 146 setenv \ 147 setproctitle \ 148 strcasestr \ 149 strlcat \ 150 strlcpy \ 151 strndup \ 152 strsep \ 153 strtonum \ 154]) 155AC_FUNC_STRNLEN 156 157# Clang sanitizers wrap reallocarray even if it isn't available on the target 158# system. When compiled it always returns NULL and crashes the program. To 159# detect this we need a more complicated test. 160AC_MSG_CHECKING([for working reallocarray]) 161AC_RUN_IFELSE([AC_LANG_PROGRAM( 162 [#include <stdlib.h>], 163 [return (reallocarray(NULL, 1, 1) == NULL);] 164 )], 165 AC_MSG_RESULT(yes), 166 [AC_LIBOBJ(reallocarray) AC_MSG_RESULT([no])] 167) 168AC_MSG_CHECKING([for working recallocarray]) 169AC_RUN_IFELSE([AC_LANG_PROGRAM( 170 [#include <stdlib.h>], 171 [return (recallocarray(NULL, 1, 1, 1) == NULL);] 172 )], 173 AC_MSG_RESULT(yes), 174 [AC_LIBOBJ(recallocarray) AC_MSG_RESULT([no])] 175) 176 177# Look for clock_gettime. Must come before event_init. 178AC_SEARCH_LIBS(clock_gettime, rt) 179 180# Always use our getopt because 1) glibc's doesn't enforce argument order 2) 181# musl does not set optarg to NULL for flags without arguments (although it is 182# not required to, but it is helpful) 3) there are probably other weird 183# implementations. 184AC_LIBOBJ(getopt) 185 186# Look for libevent. Try libevent_core or libevent with pkg-config first then 187# look for the library. 188PKG_CHECK_MODULES( 189 LIBEVENT_CORE, 190 [libevent_core >= 2], 191 [ 192 AM_CPPFLAGS="$LIBEVENT_CORE_CFLAGS $AM_CPPFLAGS" 193 CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS" 194 LIBS="$LIBEVENT_CORE_LIBS $LIBS" 195 found_libevent=yes 196 ], 197 found_libevent=no 198) 199if test x$found_libevent = xno; then 200 PKG_CHECK_MODULES( 201 LIBEVENT, 202 [libevent >= 2], 203 [ 204 AM_CPPFLAGS="$LIBEVENT_CFLAGS $AM_CPPFLAGS" 205 CPPFLAGS="$AM_CPPFLAGS $SAVED_CPPFLAGS" 206 LIBS="$LIBEVENT_LIBS $LIBS" 207 found_libevent=yes 208 ], 209 found_libevent=no 210 ) 211fi 212if test x$found_libevent = xno; then 213 AC_SEARCH_LIBS( 214 event_init, 215 [event_core event event-1.4], 216 found_libevent=yes, 217 found_libevent=no 218 ) 219fi 220AC_CHECK_HEADER( 221 event2/event.h, 222 AC_DEFINE(HAVE_EVENT2_EVENT_H), 223 [ 224 AC_CHECK_HEADER( 225 event.h, 226 AC_DEFINE(HAVE_EVENT_H), 227 found_libevent=no 228 ) 229 ] 230) 231if test "x$found_libevent" = xno; then 232 AC_MSG_ERROR("libevent not found") 233fi 234 235# Look for ncurses or curses. Try pkg-config first then directly for the 236# library. 237PKG_CHECK_MODULES( 238 LIBTINFO, 239 tinfo, 240 [ 241 AM_CPPFLAGS="$LIBTINFO_CFLAGS $AM_CPPFLAGS" 242 CPPFLAGS="$LIBTINFO_CFLAGS $SAVED_CPPFLAGS" 243 LIBS="$LIBTINFO_LIBS $LIBS" 244 found_ncurses=yes 245 ], 246 found_ncurses=no 247) 248if test "x$found_ncurses" = xno; then 249 PKG_CHECK_MODULES( 250 LIBNCURSES, 251 ncurses, 252 [ 253 AM_CPPFLAGS="$LIBNCURSES_CFLAGS $AM_CPPFLAGS" 254 CPPFLAGS="$LIBNCURSES_CFLAGS $SAVED_CPPFLAGS" 255 LIBS="$LIBNCURSES_LIBS $LIBS" 256 found_ncurses=yes 257 ], 258 found_ncurses=no 259 ) 260fi 261if test "x$found_ncurses" = xno; then 262 PKG_CHECK_MODULES( 263 LIBNCURSESW, 264 ncursesw, 265 [ 266 AM_CPPFLAGS="$LIBNCURSESW_CFLAGS $AM_CPPFLAGS" 267 CPPFLAGS="$LIBNCURSESW_CFLAGS $SAVED_CPPFLAGS" 268 LIBS="$LIBNCURSESW_LIBS $LIBS" 269 found_ncurses=yes 270 ], 271 found_ncurses=no 272 ) 273fi 274if test "x$found_ncurses" = xno; then 275 AC_SEARCH_LIBS( 276 setupterm, 277 [tinfo ncurses ncursesw], 278 found_ncurses=yes, 279 found_ncurses=no 280 ) 281 if test "x$found_ncurses" = xyes; then 282 AC_CHECK_HEADER( 283 ncurses.h, 284 LIBS="$LIBS -lncurses", 285 found_ncurses=no 286 ) 287 fi 288fi 289if test "x$found_ncurses" = xyes; then 290 AC_DEFINE(HAVE_NCURSES_H) 291else 292 AC_CHECK_LIB( 293 curses, 294 setupterm, 295 found_curses=yes, 296 found_curses=no 297 ) 298 AC_CHECK_HEADER( 299 curses.h, 300 , 301 found_curses=no 302 ) 303 if test "x$found_curses" = xyes; then 304 LIBS="$LIBS -lcurses" 305 AC_DEFINE(HAVE_CURSES_H) 306 else 307 AC_MSG_ERROR("curses not found") 308 fi 309fi 310 311# Look for utempter. 312AC_ARG_ENABLE( 313 utempter, 314 AC_HELP_STRING(--enable-utempter, use utempter if it is installed) 315) 316if test "x$enable_utempter" = xyes; then 317 AC_CHECK_HEADER(utempter.h, enable_utempter=yes, enable_utempter=no) 318 if test "x$enable_utempter" = xyes; then 319 AC_SEARCH_LIBS( 320 utempter_add_record, 321 utempter, 322 enable_utempter=yes, 323 enable_utempter=no 324 ) 325 fi 326 if test "x$enable_utempter" = xyes; then 327 AC_DEFINE(HAVE_UTEMPTER) 328 else 329 AC_MSG_ERROR("utempter not found") 330 fi 331fi 332 333# Look for utf8proc. 334AC_ARG_ENABLE( 335 utf8proc, 336 AC_HELP_STRING(--enable-utf8proc, use utf8proc if it is installed) 337) 338if test "x$enable_utf8proc" = xyes; then 339 AC_CHECK_HEADER(utf8proc.h, enable_utf8proc=yes, enable_utf8proc=no) 340 if test "x$enable_utf8proc" = xyes; then 341 AC_SEARCH_LIBS( 342 utf8proc_charwidth, 343 utf8proc, 344 enable_utf8proc=yes, 345 enable_utf8proc=no 346 ) 347 fi 348 if test "x$enable_utf8proc" = xyes; then 349 AC_DEFINE(HAVE_UTF8PROC) 350 else 351 AC_MSG_ERROR("utf8proc not found") 352 fi 353fi 354AM_CONDITIONAL(HAVE_UTF8PROC, [test "x$enable_utf8proc" = xyes]) 355 356# Check for b64_ntop. If we have b64_ntop, we assume b64_pton as well. 357AC_MSG_CHECKING(for b64_ntop) 358AC_TRY_LINK( 359 [ 360 #include <sys/types.h> 361 #include <netinet/in.h> 362 #include <resolv.h> 363 ], 364 [b64_ntop(NULL, 0, NULL, 0);], 365 found_b64_ntop=yes, 366 found_b64_ntop=no 367) 368AC_MSG_RESULT($found_b64_ntop) 369OLD_LIBS="$LIBS" 370if test "x$found_b64_ntop" = xno; then 371 AC_MSG_CHECKING(for b64_ntop with -lresolv) 372 LIBS="$OLD_LIBS -lresolv" 373 AC_TRY_LINK( 374 [ 375 #include <sys/types.h> 376 #include <netinet/in.h> 377 #include <resolv.h> 378 ], 379 [b64_ntop(NULL, 0, NULL, 0);], 380 found_b64_ntop=yes, 381 found_b64_ntop=no 382 ) 383 AC_MSG_RESULT($found_b64_ntop) 384fi 385if test "x$found_b64_ntop" = xno; then 386 AC_MSG_CHECKING(for b64_ntop with -lnetwork) 387 LIBS="$OLD_LIBS -lnetwork" 388 AC_TRY_LINK( 389 [ 390 #include <sys/types.h> 391 #include <netinet/in.h> 392 #include <resolv.h> 393 ], 394 [b64_ntop(NULL, 0, NULL, 0);], 395 found_b64_ntop=yes, 396 found_b64_ntop=no 397 ) 398 AC_MSG_RESULT($found_b64_ntop) 399fi 400if test "x$found_b64_ntop" = xyes; then 401 AC_DEFINE(HAVE_B64_NTOP) 402else 403 LIBS="$OLD_LIBS" 404 AC_LIBOBJ(base64) 405fi 406 407# Look for networking libraries. 408AC_SEARCH_LIBS(inet_ntoa, nsl) 409AC_SEARCH_LIBS(socket, socket) 410AC_CHECK_LIB(xnet, socket) 411 412# Check if using glibc and have malloc_trim(3). The glibc free(3) is pretty bad 413# about returning memory to the kernel unless the application tells it when to 414# with malloc_trim(3). 415AC_MSG_CHECKING(if free doesn't work very well) 416AC_LINK_IFELSE([AC_LANG_SOURCE( 417 [ 418 #include <stdlib.h> 419 #ifdef __GLIBC__ 420 #include <malloc.h> 421 int main(void) { 422 malloc_trim (0); 423 exit(0); 424 } 425 #else 426 no 427 #endif 428 ])], 429 found_malloc_trim=yes, 430 found_malloc_trim=no 431) 432AC_MSG_RESULT($found_malloc_trim) 433if test "x$found_malloc_trim" = xyes; then 434 AC_DEFINE(HAVE_MALLOC_TRIM) 435fi 436 437# Check for CMSG_DATA. On some platforms like HP-UX this requires UNIX 95 438# (_XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED) (see xopen_networking(7)). On 439# others, UNIX 03 (_XOPEN_SOURCE 600, see standards(7) on Solaris). 440XOPEN_DEFINES= 441AC_MSG_CHECKING(for CMSG_DATA) 442AC_EGREP_CPP( 443 yes, 444 [ 445 #include <sys/socket.h> 446 #ifdef CMSG_DATA 447 yes 448 #endif 449 ], 450 found_cmsg_data=yes, 451 found_cmsg_data=no 452) 453AC_MSG_RESULT($found_cmsg_data) 454if test "x$found_cmsg_data" = xno; then 455 AC_MSG_CHECKING(if CMSG_DATA needs _XOPEN_SOURCE_EXTENDED) 456 AC_EGREP_CPP( 457 yes, 458 [ 459 #define _XOPEN_SOURCE 1 460 #define _XOPEN_SOURCE_EXTENDED 1 461 #include <sys/socket.h> 462 #ifdef CMSG_DATA 463 yes 464 #endif 465 ], 466 found_cmsg_data=yes, 467 found_cmsg_data=no 468 ) 469 AC_MSG_RESULT($found_cmsg_data) 470 if test "x$found_cmsg_data" = xyes; then 471 XOPEN_DEFINES="-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED" 472 fi 473fi 474if test "x$found_cmsg_data" = xno; then 475 AC_MSG_CHECKING(if CMSG_DATA needs _XOPEN_SOURCE 600) 476 AC_EGREP_CPP( 477 yes, 478 [ 479 #define _XOPEN_SOURCE 600 480 #include <sys/socket.h> 481 #ifdef CMSG_DATA 482 yes 483 #endif 484 ], 485 found_cmsg_data=yes, 486 found_cmsg_data=no 487 ) 488 AC_MSG_RESULT($found_cmsg_data) 489 if test "x$found_cmsg_data" = xyes; then 490 XOPEN_DEFINES="-D_XOPEN_SOURCE=600" 491 else 492 AC_MSG_ERROR("CMSG_DATA not found") 493 fi 494fi 495AC_SUBST(XOPEN_DEFINES) 496 497# Look for err and friends in err.h. 498AC_CHECK_FUNC(err, found_err_h=yes, found_err_h=no) 499AC_CHECK_FUNC(errx, , found_err_h=no) 500AC_CHECK_FUNC(warn, , found_err_h=no) 501AC_CHECK_FUNC(warnx, , found_err_h=no) 502if test "x$found_err_h" = xyes; then 503 AC_CHECK_HEADER(err.h, , found_err_h=no) 504else 505 AC_LIBOBJ(err) 506fi 507 508# Look for imsg_init in libutil. 509AC_SEARCH_LIBS(imsg_init, util, found_imsg_init=yes, found_imsg_init=no) 510if test "x$found_imsg_init" = xyes; then 511 AC_DEFINE(HAVE_IMSG) 512else 513 AC_LIBOBJ(imsg) 514 AC_LIBOBJ(imsg-buffer) 515fi 516 517# Look for daemon, compat/daemon.c used if missing. Solaris 10 has it in 518# libresolv, but no declaration anywhere, so check for declaration as well as 519# function. 520AC_CHECK_FUNC(daemon, found_daemon=yes, found_daemon=no) 521AC_CHECK_DECL( 522 daemon, 523 , 524 found_daemon=no, 525 [ 526 #include <stdlib.h> 527 #include <unistd.h> 528 ] 529) 530if test "x$found_daemon" = xyes; then 531 AC_DEFINE(HAVE_DAEMON) 532else 533 AC_LIBOBJ(daemon) 534fi 535 536# Look for stravis, compat/{vis,unvis}.c used if missing. 537AC_CHECK_FUNC(stravis, found_stravis=yes, found_stravis=no) 538if test "x$found_stravis" = xyes; then 539 AC_MSG_CHECKING(if strnvis is broken) 540 AC_EGREP_HEADER([strnvis\(char \*, const char \*, size_t, int\)], 541 vis.h, 542 AC_MSG_RESULT(no), 543 [found_stravis=no]) 544 if test "x$found_stravis" = xno; then 545 AC_MSG_RESULT(yes) 546 fi 547fi 548if test "x$found_stravis" = xyes; then 549 AC_CHECK_DECL( 550 VIS_DQ, 551 , 552 found_stravis=no, 553 [ 554 #include <stdlib.h> 555 #include <vis.h> 556 ] 557) 558fi 559if test "x$found_stravis" = xyes; then 560 AC_DEFINE(HAVE_VIS) 561else 562 AC_LIBOBJ(vis) 563 AC_LIBOBJ(unvis) 564fi 565 566# Look for fdforkpty and forkpty in libutil. 567AC_SEARCH_LIBS(fdforkpty, util, found_fdforkpty=yes, found_fdforkpty=no) 568if test "x$found_fdforkpty" = xyes; then 569 AC_DEFINE(HAVE_FDFORKPTY) 570else 571 AC_LIBOBJ(fdforkpty) 572fi 573AC_SEARCH_LIBS(forkpty, util, found_forkpty=yes, found_forkpty=no) 574if test "x$found_forkpty" = xyes; then 575 AC_DEFINE(HAVE_FORKPTY) 576fi 577AM_CONDITIONAL(NEED_FORKPTY, test "x$found_forkpty" = xno) 578 579# Look for kinfo_getfile in libutil. 580AC_SEARCH_LIBS(kinfo_getfile, [util util-freebsd]) 581 582# Look for a suitable queue.h. 583AC_CHECK_DECL( 584 TAILQ_CONCAT, 585 found_queue_h=yes, 586 found_queue_h=no, 587 [#include <sys/queue.h>] 588) 589AC_CHECK_DECL( 590 TAILQ_PREV, 591 found_queue_h=yes, 592 found_queue_h=no, 593 [#include <sys/queue.h>] 594) 595AC_CHECK_DECL( 596 TAILQ_REPLACE, 597 , 598 found_queue_h=no, 599 [#include <sys/queue.h>] 600) 601if test "x$found_queue_h" = xyes; then 602 AC_DEFINE(HAVE_QUEUE_H) 603fi 604 605# Look for __progname. 606AC_MSG_CHECKING(for __progname) 607AC_LINK_IFELSE([AC_LANG_SOURCE( 608 [ 609 #include <stdio.h> 610 #include <stdlib.h> 611 extern char *__progname; 612 int main(void) { 613 const char *cp = __progname; 614 printf("%s\n", cp); 615 exit(0); 616 } 617 ])], 618 [AC_DEFINE(HAVE___PROGNAME) AC_MSG_RESULT(yes)], 619 AC_MSG_RESULT(no) 620) 621 622# Look for program_invocation_short_name. 623AC_MSG_CHECKING(for program_invocation_short_name) 624AC_LINK_IFELSE([AC_LANG_SOURCE( 625 [ 626 #include <errno.h> 627 #include <stdio.h> 628 #include <stdlib.h> 629 int main(void) { 630 const char *cp = program_invocation_short_name; 631 printf("%s\n", cp); 632 exit(0); 633 } 634 ])], 635 [AC_DEFINE(HAVE_PROGRAM_INVOCATION_SHORT_NAME) AC_MSG_RESULT(yes)], 636 AC_MSG_RESULT(no) 637) 638 639# Look for prctl(PR_SET_NAME). 640AC_CHECK_DECL( 641 PR_SET_NAME, 642 AC_DEFINE(HAVE_PR_SET_NAME), 643 , 644 [#include <sys/prctl.h>] 645) 646 647# Look for fcntl(F_CLOSEM). 648AC_CHECK_DECL( 649 F_CLOSEM, 650 AC_DEFINE(HAVE_FCNTL_CLOSEM), 651 , 652 [#include <fcntl.h>] 653) 654 655# Look for /proc/$$. 656AC_MSG_CHECKING(for /proc/\$\$) 657if test -d /proc/$$; then 658 AC_DEFINE(HAVE_PROC_PID) 659 AC_MSG_RESULT(yes) 660else 661 AC_MSG_RESULT(no) 662fi 663 664# Man page defaults to mdoc. 665MANFORMAT=mdoc 666AC_SUBST(MANFORMAT) 667 668# Figure out the platform. 669AC_MSG_CHECKING(platform) 670case "$host_os" in 671 *aix*) 672 AC_MSG_RESULT(aix) 673 PLATFORM=aix 674 ;; 675 *darwin*) 676 AC_MSG_RESULT(darwin) 677 PLATFORM=darwin 678 # 679 # OS X uses __dead2 instead of __dead, like FreeBSD. But it 680 # defines __dead away so it needs to be removed before we can 681 # replace it. 682 # 683 AC_DEFINE(BROKEN___DEAD) 684 # 685 # OS X CMSG_FIRSTHDR is broken, so redefine it with a working 686 # one. daemon works but has some stupid side effects, so use 687 # our internal version which has a workaround. 688 # 689 AC_DEFINE(BROKEN_CMSG_FIRSTHDR) 690 AC_LIBOBJ(daemon) 691 AC_LIBOBJ(daemon-darwin) 692 ;; 693 *dragonfly*) 694 AC_MSG_RESULT(dragonfly) 695 PLATFORM=dragonfly 696 ;; 697 *linux*) 698 AC_MSG_RESULT(linux) 699 PLATFORM=linux 700 ;; 701 *freebsd*) 702 AC_MSG_RESULT(freebsd) 703 PLATFORM=freebsd 704 ;; 705 *netbsd*) 706 AC_MSG_RESULT(netbsd) 707 PLATFORM=netbsd 708 ;; 709 *openbsd*) 710 AC_MSG_RESULT(openbsd) 711 PLATFORM=openbsd 712 ;; 713 *sunos*) 714 AC_MSG_RESULT(sunos) 715 PLATFORM=sunos 716 ;; 717 *solaris*) 718 AC_MSG_RESULT(sunos) 719 PLATFORM=sunos 720 case `/usr/bin/nroff --version 2>&1` in 721 *GNU*) 722 # Solaris 11.4 and later use GNU groff. 723 MANFORMAT=mdoc 724 ;; 725 *) 726 # Solaris 2.0 to 11.3 use AT&T nroff. 727 MANFORMAT=man 728 ;; 729 esac 730 ;; 731 *hpux*) 732 AC_MSG_RESULT(hpux) 733 PLATFORM=hpux 734 ;; 735 *cygwin*|*msys*) 736 AC_MSG_RESULT(cygwin) 737 PLATFORM=cygwin 738 ;; 739 *haiku*) 740 AC_MSG_RESULT(haiku) 741 PLATFORM=haiku 742 ;; 743 *) 744 AC_MSG_RESULT(unknown) 745 PLATFORM=unknown 746 ;; 747esac 748AC_SUBST(PLATFORM) 749AM_CONDITIONAL(IS_AIX, test "x$PLATFORM" = xaix) 750AM_CONDITIONAL(IS_DARWIN, test "x$PLATFORM" = xdarwin) 751AM_CONDITIONAL(IS_DRAGONFLY, test "x$PLATFORM" = xdragonfly) 752AM_CONDITIONAL(IS_LINUX, test "x$PLATFORM" = xlinux) 753AM_CONDITIONAL(IS_FREEBSD, test "x$PLATFORM" = xfreebsd) 754AM_CONDITIONAL(IS_NETBSD, test "x$PLATFORM" = xnetbsd) 755AM_CONDITIONAL(IS_OPENBSD, test "x$PLATFORM" = xopenbsd) 756AM_CONDITIONAL(IS_SUNOS, test "x$PLATFORM" = xsunos) 757AM_CONDITIONAL(IS_HPUX, test "x$PLATFORM" = xhpux) 758AM_CONDITIONAL(IS_HAIKU, test "x$PLATFORM" = xhaiku) 759AM_CONDITIONAL(IS_UNKNOWN, test "x$PLATFORM" = xunknown) 760 761# Save our CFLAGS/CPPFLAGS/LDFLAGS for the Makefile and restore the old user 762# variables. 763AC_SUBST(AM_CPPFLAGS) 764CPPFLAGS="$SAVED_CPPFLAGS" 765AC_SUBST(AM_CFLAGS) 766CFLAGS="$SAVED_CFLAGS" 767AC_SUBST(AM_LDFLAGS) 768LDFLAGS="$SAVED_LDFLAGS" 769 770# autoconf should create a Makefile. 771AC_OUTPUT(Makefile) 772