3 # Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@openbsd.org>
4 # Copyright (c) 2017, 2018 Kristaps Dzonsons <kristaps@bsd.lv>
5 # Copyright (c) 2022, 2023 Omar Polo <op@omarpolo.com>
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.
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.
19 OCONFIGURE_VERSION="0.3.8"
22 # This script outputs two files: config.h and Makefile.configure.
23 # It tries to read from configure.local, which contains predefined
24 # values we won't autoconfigure.
26 # If you want to use configure with your project, have your GNUmakefile
27 # or BSDmakefile---whichever---try to import/include Makefile.configure
28 # at the beginning of the file.
30 # Like so (note no quotes, no period, etc.):
32 # include Makefile.configure
34 # If it exists, configure was run; otherwise, it wasn't.
36 # You'll probably want to change parts of this file. I've noted the
37 # parts that you'll probably change in the section documentation.
39 # See https://github.com/kristapsdz/oconfigure for more.
47 \`configure' configures amused to adapt to many kinds of systems.
49 Usage: $0 [-h] [--prefix=path] [VAR=VALUE]...
51 The options are as follows:
53 -h, --help print this help message
55 --prefix=path equivalent to specify the PREFIX variable, supported
56 for compatibility with other common "configure" scripts.
58 --backend=name equivalent to specify the BACKEND variable, can be either
63 BACKEND audio backend to use; can be "sndio" or "alsa"
65 CFLAGS generic C compiler flags
66 CPPFLAGS C preprocessors flags
67 LDADD generic linker flags
68 LDADD_LIB_ASOUND linker flags for libasound
69 LDADD_LIB_FLAC linker flags for libflac
70 LDADD_LIB_IMSG linker flags for libimsg
71 LDADD_LIB_MD linker flags for libmd
72 LDADD_LIB_MPG123 linker flags for libmpg123
73 LDADD_LIB_OPUSFILE linker flags for libopusfile
74 LDADD_LIB_SNDIO linker flags for libsndio
75 LDADD_LIB_SOCKET linker flags for libsocket
76 LDADD_LIB_VORBISFILE linker flags for libvorbisfile
77 LDFLAGS extra linker flags
78 DESTDIR destination directory
79 PREFIX where to install files
80 MANDIR where to install man pages (PREFIX/man)
81 LIBDIR where to install libraries (PREFIX/lib)
82 BINDIR where to install executables (PREFIX/bin)
83 SHAREDIR where to install misc files (PREFIX/share)
84 SBINDIR where to install system executables (PREFIX/sbin)
85 INCLUDEDIR where to install header files (PREFIX/include)
86 PKG_CONFIG pkg-config program, \`false' to disable (pkg-config)
88 Additionally, the following environment variables are used if set:
90 CC the C compiler to use (defaults to cc, clang or gcc)
91 CFLAGS generic C compiler flags
97 #----------------------------------------------------------------------
98 # Prepare for running: move aside previous configure runs.
99 # Output file descriptor usage:
100 # 1 (stdout): config.h or Makefile.configure
101 # 2 (stderr): original stderr, usually to the console
103 # You DO NOT want to change this.
104 #----------------------------------------------------------------------
106 [ -w config.log ] && mv config.log config.log.old
107 [ -w config.h ] && mv config.h config.h.old
110 echo "config.log: writing..."
112 # GNU submake prints different output if invoked recursively, which
113 # messes up CC and CFLAGS detection. Pass --no-print-directory if
114 # we have a MAKELEVEL (GNU and FreeBSD make) and the argument is
119 if [ -n "${MAKELEVEL}" ]; then
120 if [ "${MAKELEVEL}" -gt 0 ] ; then
121 MAKE_FLAGS="--no-print-directory"
122 echo "all:" | make ${MAKE_FLAGS} -sf - 2>/dev/null || MAKE_FLAGS=""
126 if [ -n "$MAKE_FLAGS" ]; then
127 echo "GNU submake detected: using --no-print-directory" 1>&2
128 echo "GNU submake detected: using --no-print-directory" 1>&3
131 #----------------------------------------------------------------------
132 # Initialize all variables here such that nothing can leak in from the
133 # environment except for CC and CFLAGS, which we might have passed in.
134 #----------------------------------------------------------------------
137 CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | make ${MAKE_FLAGS} -sf -`
138 CFLAGS=`printf "all:\\n\\t@echo \\\$(CFLAGS)\\n" | make ${MAKE_FLAGS} -sf -`
139 CFLAGS="${CFLAGS} -g -W -Wall -Wextra -Wmissing-prototypes"
140 CFLAGS="${CFLAGS} -Wstrict-prototypes -Wmissing-declarations"
141 CFLAGS="${CFLAGS} -Wno-unused-parameter -Wno-sign-compare -Wno-pointer-sign"
151 LDADD_LIB_VORBISFILE=
170 # SunOS sets "cc", but this doesn't exist.
171 # It does have gcc, so try that instead.
172 # Prefer clang, though.
174 command -v ${CC} 2>/dev/null 1>&2 || {
175 echo "${CC} not found: trying clang" 1>&2
176 echo "${CC} not found: trying clang" 1>&3
178 command -v ${CC} 2>/dev/null 1>&2 || {
179 echo "${CC} not found: trying gcc" 1>&2
180 echo "${CC} not found: trying gcc" 1>&3
182 command -v ${CC} 2>/dev/null 1>&2 || {
183 echo "gcc not found: giving up" 1>&2
184 echo "gcc not found: giving up" 1>&3
190 command -v pkg-config 2>/dev/null 1>&2 && {
191 PKG_CONFIG=pkg-config
192 echo "pkg-config found" 1>&2
193 echo "pkg-config found" 1>&3
195 echo "pkg-config not found" 1>&2
196 echo "pkg-config not found" 1>&3
199 #----------------------------------------------------------------------
200 # These are the values that will be pushed into config.h after we test
201 # for whether they're supported or not.
202 # Each of these must have a runtest(), below.
203 # Please sort by alpha, for clarity.
204 # You WANT to change this.
205 #----------------------------------------------------------------------
232 HAVE_PROGRAM_INVOCATION_SHORT_NAME=
252 #----------------------------------------------------------------------
253 # Allow certain variables to be overriden on the command line.
254 #----------------------------------------------------------------------
256 while [ $# -gt 0 ]; do
260 if [ "$key" = "--prefix" ]; then
262 if [ "$1" = "--prefix" ]; then
263 if ! shift 2>&1 >/dev/null; then
264 echo "$0: missing value for --prefix" 1>&2
271 if [ "$key" = "--backend" ]; then
273 if [ "$1" = "--backend" ]; then
274 if ! shift 2>&1 >/dev/null; then
275 echo "$0 missing value for --backend" 1>&2
282 if [ "$1" = "$key" ]; then
283 echo "$0: invalid key-value: $1" 1>&2
292 alsa) BACKEND=alsa ;;
293 sndio) BACKEND=sndio ;;
295 echo "unknown audio backend: $val" 1>&2
305 LDADD_LIB_ASOUND="$val"
310 LDADD_LIB_FLAC="$val"
314 LDADD_LIB_IMSG="$val"
322 LDADD_LIB_MPG123="$val"
326 LDADD_LIB_OPUSFILE="$val"
330 LDADD_LIB_SNDIO="$val"
335 LDADD_LIB_SOCKET="$val"
338 LDADD_LIB_VORBISFILE)
339 LDADD_LIB_VORBISFILE="$val"
340 HAVE_LIB_VORBISFILE=1
365 echo "$0: invalid key: $key" 1>&2
370 #----------------------------------------------------------------------
371 # Allow configure.local to override all variables, default settings,
372 # command-line arguments, and tested features, above.
373 # You PROBABLY DO NOT want to change this.
374 #----------------------------------------------------------------------
376 if [ -r ./configure.local ]; then
377 echo "configure.local: reading..." 1>&2
378 echo "configure.local: reading..." 1>&3
379 cat ./configure.local 1>&3
382 echo "configure.local: no (fully automatic configuration)" 1>&2
383 echo "configure.local: no (fully automatic configuration)" 1>&3
388 #----------------------------------------------------------------------
389 # Infrastructure for running tests.
390 # These consists of a series of functions that will attempt to run the
391 # given test file and record its exit into a HAVE_xxx variable.
392 # You DO NOT want to change this.
393 #----------------------------------------------------------------------
395 COMP="${CC} ${CFLAGS} ${CPPFLAGS} -Wno-unused -Werror"
397 # Check whether this HAVE_ setting is manually overridden.
398 # If yes, use the override, if no, do not decide anything yet.
399 # Arguments: lower-case test name, manual value
402 eval _manual=\${LDADD_${2}}
403 if [ -z "$_manual" ]; then
404 eval _manual=\${HAVE_${2}}
407 [ -z "${_manual}" ] && return 1
408 echo "${1}: manual (${_manual})" 1>&2
409 echo "${1}: manual (${_manual})" 1>&3
414 # Run a single autoconfiguration test.
415 # In case of success, enable the feature.
416 # In case of failure, do not decide anything yet.
417 # Arguments: lower-case test name, upper-case test name, additional
418 # CFLAGS, additional LIBS.
425 cat 1>&3 << __HEREDOC__
427 ${COMP} -DTEST_${2} ${3} -o test-${1} tests.c ${LDFLAGS} ${4}
429 if ${COMP} -DTEST_${2} ${3} -o "test-${1}" tests.c ${LDFLAGS} ${4} 1>&3 2>&3; then
430 echo "${1}: ${CC} succeeded" 1>&3
432 if [ -n "${5}" ] ; then
433 echo "${1}: ${CC} failed with $? (retrying)" 1>&3
434 cat 1>&3 << __HEREDOC__
436 ${COMP} -DTEST_${2} ${3} -o test-${1} tests.c ${LDFLAGS} ${5}
438 if ${COMP} -DTEST_${2} ${3} -o "test-${1}" tests.c ${LDFLAGS} ${5} 1>&3 2>&3; then
439 echo "${1}: ${CC} succeeded" 1>&3
440 extralib="(with ${5})"
442 test -n "${PKG_CONFIG}" -a -n "${6}" && ${PKG_CONFIG} "$6"
443 if [ $? -eq 0 ]; then
444 echo "${1}: ${CC} failed with $? (retrying)" 1>&3
445 pkgcfs=$($PKG_CONFIG --cflags "${6}")
446 pkglib=$($PKG_CONFIG --libs "${6}")
447 cat 1>&3 << __HEREDOC__
449 ${COMP} -DTEST_${2} ${3} ${pkgcfs} -o test-${1} tests.c ${LDFLAGS} ${pkglib}
451 if ${COMP} -DTEST_${2} ${3} ${pkgcfs} -o test-${1} tests.c ${LDFLAGS} ${pkglib} 1>&3 2>&3; then
452 echo "${1}: ${CC} succeeded" 1>&3
453 extralib="(with ${pkgcfs} ${pkglib})"
455 echo "${1}: ${CC} failed with $?" 1>&3
460 echo "${1}: ${CC} failed with $?" 1>&3
466 echo "${1}: ${CC} failed with $?" 1>&3
474 if [ -n "${pkgcfs}" -o -n "${pkglib}" ]; then
475 CFLAGS="${CFLAGS} ${pkgcfs}"
476 eval "LDADD_${2}=\"${pkglib}\""
477 elif [ -n "${extralib}" ]; then
478 eval "LDADD_${2}=\"${5}\""
479 elif [ -n "${4}" ]; then
480 eval "LDADD_${2}=\"${4}\""
483 echo "${1}: yes ${extralib}" 1>&2
484 echo "${1}: yes ${extralib}" 1>&3
491 # Run a complete autoconfiguration test, including the check for
492 # a manual override and disabling the feature on failure.
493 # Arguments: lower case name, upper case name, additional CFLAGS,
494 # additional LDADD, alternative LDADD, pkg-config name.
497 ismanual "${1}" "${2}" && return 0
498 singletest "${1}" "${2}" "${3}" "${4}" "${5}" "${6}" && return 0
504 #----------------------------------------------------------------------
505 # Begin running the tests themselves.
506 # All of your tests must be defined here.
507 # Please sort as the HAVE_xxxx values were defined.
508 # You WANT to change this.
509 # It consists of the following columns:
513 # (3) argument to cc *before* -o
514 # (4) argument to cc *after*
515 # (5) alternative argument to cc *after*
516 # (6) name for pkg-config auto-discovery
517 #----------------------------------------------------------------------
519 if runtest -MMD _MMD -MMD; then
520 CFLAGS="${CFLAGS} -MMD"
521 echo "adding -MMD to CFLAGS" 1>&2
522 echo "adding -MMD to CFLAGS" 1>&3
525 runtest capsicum CAPSICUM || true
526 runtest err ERR || true
527 runtest explicit_bzero EXPLICIT_BZERO || true
528 runtest flock FLOCK || true
529 runtest freezero FREEZERO || true
530 runtest getdtablecount GETDTABLECOUNT || true
531 runtest getexecname GETEXECNAME || true
532 runtest getprogname GETPROGNAME || true
533 runtest INFTIM INFTIM || true
534 runtest landlock LANDLOCK || true
536 runtest lib_imsg LIB_IMSG "" "" "-lutil" || true
537 runtest lib_md LIB_MD "" "" "-lmd" "libmd" || true
538 runtest lib_socket LIB_SOCKET "" "" "-lsocket -lnsl" || true
540 runtest lib_flac LIB_FLAC "" "" "-lFLAC" "flac" || true
541 runtest lib_mpg123 LIB_MPG123 "" "" "-lmpg123" "libmpg123" || true
542 runtest lib_opusfile LIB_OPUSFILE "" "" "-lopusfile" "opusfile" || true
543 runtest lib_vorbisfile LIB_VORBISFILE "" "" "-lvorbisfile" "vorbisfile" || true
545 runtest memmem MEMMEM || true
546 runtest memrchr MEMRCHR || true
547 runtest memset_s MEMSET_S || true
548 runtest optreset OPTRESET || true
549 runtest PATH_MAX PATH_MAX || true
550 runtest pledge PLEDGE || true
551 runtest program_invocation_short_name PROGRAM_INVOCATION_SHORT_NAME || true
552 runtest PR_SET_NAME PR_SET_NAME || true
553 runtest reallocarray REALLOCARRAY || true
554 runtest recallocarray RECALLOCARRAY || true
555 runtest sandbox_init SANDBOX_INIT "-Wno-deprecated" || true
556 runtest setproctitle SETPROCTITLE || true
557 runtest SOCK_NONBLOCK SOCK_NONBLOCK || true
558 runtest static STATIC "" "-static" || true
559 runtest strlcat STRLCAT || true
560 runtest strlcpy STRLCPY || true
561 runtest strndup STRNDUP || true
562 runtest strnlen STRNLEN || true
563 runtest strtonum STRTONUM || true
564 runtest sys_queue SYS_QUEUE || true
565 runtest sys_file SYS_FILE || true
566 runtest timespecsub TIMESPECSUB || true
567 runtest unveil UNVEIL || true
568 runtest __progname __PROGNAME || true
570 if [ $BACKEND != alsa ]; then # auto or sndio
571 runtest lib_sndio LIB_SNDIO "" "" "-lsndio" "sndio" || true
572 runtest sio_flush SIO_FLUSH "" "" "${LDADD_LIB_SNDIO}" || true
574 if [ "${HAVE_LIB_SNDIO}" -eq 0 ]; then
575 if [ $BACKEND = sndio ]; then
576 echo "Fatal: missing libsndio" 1>&2
577 echo "Fatal: missing libsndio" 1>&3
587 if [ $BACKEND != sndio ]; then # auto or alsa
588 runtest lib_asound LIB_ASOUND "" "" "-lasound" "alsa" || true
589 if [ "${HAVE_LIB_ASOUND}" -eq 0 ]; then
590 if [ $BACKEND = alsa ]; then
591 echo "Fatal: missing libasound" 1>&2
592 echo "Fatal: missing libasound" 1>&3
594 echo "Fatal: missing libasound or libsndio" 1>&2
595 echo "Fatal: missing libasound or libsndio" 1>&3
602 if [ "${HAVE_LIB_FLAC}" -eq 0 -o \
603 "${HAVE_LIB_MPG123}" -eq 0 -o \
604 "${HAVE_LIB_OPUSFILE}" -eq 0 -o \
605 "${HAVE_LIB_VORBISFILE}" -eq 0 ]; then
606 echo "Fatal: missing required audio libraries" 1>&2
607 echo "Fatal: missing required audio libraries" 1>&3
611 #----------------------------------------------------------------------
612 # Output writing: generate the config.h file.
613 # This file contains all of the HAVE_xxxx variables necessary for
614 # compiling your source.
615 # You must include "config.h" BEFORE any other variables.
616 # You WANT to change this.
617 #----------------------------------------------------------------------
621 # Start with prologue.
624 #ifndef OCONFIGURE_CONFIG_H
625 #define OCONFIGURE_CONFIG_H
628 # error "Do not use C++: this is a C application."
630 #if !defined(__GNUC__) || (__GNUC__ < 4)
631 # define __attribute__(x)
633 #if defined(__linux__) || defined(__MINT__)
634 # define _GNU_SOURCE /* memmem, memrchr, setresuid... */
635 # define _DEFAULT_SOURCE /* le32toh, crypt, ... */
637 #if defined(__NetBSD__)
638 # define _OPENBSD_SOURCE /* reallocarray, etc. */
641 # ifndef _XOPEN_SOURCE /* SunOS already defines */
642 # define _XOPEN_SOURCE /* XPGx */
644 # define _XOPEN_SOURCE_EXTENDED 1 /* XPG4v2 */
645 # ifndef __EXTENSIONS__ /* SunOS already defines */
646 # define __EXTENSIONS__ /* reallocarray, etc. */
649 #if !defined(__BEGIN_DECLS)
650 # define __BEGIN_DECLS
652 #if !defined(__END_DECLS)
658 # This is just for size_t, mode_t, and dev_t.
659 # Most of these functions, in the real world, pull in <string.h> or
660 # someting that pulls in support for size_t.
661 # Our function declarations are standalone, so specify them here.
663 if [ ${HAVE_LIB_IMSG} -eq 0 -o \
664 ${HAVE_MEMMEM} -eq 0 -o \
665 ${HAVE_MEMRCHR} -eq 0 -o \
666 ${HAVE_REALLOCARRAY} -eq 0 -o \
667 ${HAVE_RECALLOCARRAY} -eq 0 -o \
668 ${HAVE_STRLCAT} -eq 0 -o \
669 ${HAVE_STRLCPY} -eq 0 -o \
670 ${HAVE_STRNDUP} -eq 0 -o \
671 ${HAVE_STRNLEN} -eq 0 ]
673 echo "#include <sys/types.h> /* size_t, mode_t, dev_t */ "
677 if [ ${HAVE_FLOCK} -eq 0 ]; then
678 if [ ${HAVE_SYS_FILE} -eq 0 ]; then
680 echo "#include <sys/file.h>"
683 echo "int flock(int, int);"
684 echo "#define LOCK_SH 0x1"
685 echo "#define LOCK_EX 0x2"
686 echo "#define LOCK_NB 0x4"
691 if [ ${HAVE_ERR} -eq 0 ]; then
692 echo "#include <stdarg.h> /* err(3) */"
695 echo "#include <err.h>"
699 if [ ${HAVE_PLEDGE} -eq 0 ]; then
700 echo "#define pledge(p, e) (0)"
703 echo "#include <unistd.h>"
707 # Now we handle our HAVE_xxxx values.
708 # Most will just be defined as 0 or 1.
710 if [ ${HAVE_PATH_MAX} -eq 0 ]
712 echo "#define PATH_MAX 4096"
716 if [ ${HAVE_INFTIM} -eq 0 ]
718 echo "#define INFTIM (-1) /* poll.h */"
724 * Results of configuration feature-testing.
726 #define HAVE_CAPSICUM ${HAVE_CAPSICUM}
727 #define HAVE_ERR ${HAVE_ERR}
728 #define HAVE_EXPLICIT_BZERO ${HAVE_EXPLICIT_BZERO}
729 #define HAVE_FLOCK ${HAVE_FLOCK}
730 #define HAVE_FREEZERO ${HAVE_FREEZERO}
731 #define HAVE_GETDTABLECOUNT ${HAVE_GETDTABLECOUNT}
732 #define HAVE_GETEXECNAME ${HAVE_GETEXECNAME}
733 #define HAVE_GETPROGNAME ${HAVE_GETPROGNAME}
734 #define HAVE_LIB_IMSG ${HAVE_LIB_IMSG}
735 #define HAVE_INFTIM ${HAVE_INFTIM}
736 #define HAVE_LANDLOCK ${HAVE_LANDLOCK}
737 #define HAVE_MEMMEM ${HAVE_MEMMEM}
738 #define HAVE_MEMRCHR ${HAVE_MEMRCHR}
739 #define HAVE_MEMSET_S ${HAVE_MEMSET_S}
740 #define HAVE_OPTRESET ${HAVE_OPTRESET}
741 #define HAVE_PATH_MAX ${HAVE_PATH_MAX}
742 #define HAVE_PLEDGE ${HAVE_PLEDGE}
743 #define HAVE_PROGRAM_INVOCATION_SHORT_NAME ${HAVE_PROGRAM_INVOCATION_SHORT_NAME}
744 #define HAVE_PR_SET_NAME ${HAVE_PR_SET_NAME}
745 #define HAVE_REALLOCARRAY ${HAVE_REALLOCARRAY}
746 #define HAVE_RECALLOCARRAY ${HAVE_RECALLOCARRAY}
747 #define HAVE_SANDBOX_INIT ${HAVE_SANDBOX_INIT}
748 #define HAVE_SETPROCTITLE ${HAVE_SETPROCTITLE}
749 #define HAVE_SIO_FLUSH ${HAVE_SIO_FLUSH}
750 #define HAVE_SOCK_NONBLOCK ${HAVE_SOCK_NONBLOCK}
751 #define HAVE_STRLCAT ${HAVE_STRLCAT}
752 #define HAVE_STRLCPY ${HAVE_STRLCPY}
753 #define HAVE_STRNDUP ${HAVE_STRNDUP}
754 #define HAVE_STRNLEN ${HAVE_STRNLEN}
755 #define HAVE_STRTONUM ${HAVE_STRTONUM}
756 #define HAVE_SYS_FILE ${HAVE_SYS_FILE}
757 #define HAVE_SYS_QUEUE ${HAVE_SYS_QUEUE}
758 #define HAVE_SYSTRACE ${HAVE_SYSTRACE}
759 #define HAVE_TIMESPECSUB ${HAVE_TIMESPECSUB}
760 #define HAVE_UNVEIL ${HAVE_UNVEIL}
761 #define HAVE___PROGNAME ${HAVE___PROGNAME}
765 # Now we do our function declarations for missing functions.
767 [ ${HAVE_ERR} -eq 0 ] && \
770 * Compatibility functions for err(3).
772 extern void err(int, const char *, ...) __attribute__((noreturn));
773 extern void errc(int, int, const char *, ...) __attribute__((noreturn));
774 extern void errx(int, const char *, ...) __attribute__((noreturn));
775 extern void verr(int, const char *, va_list) __attribute__((noreturn));
776 extern void verrc(int, int, const char *, va_list) __attribute__((noreturn));
777 extern void verrx(int, const char *, va_list) __attribute__((noreturn));
778 extern void warn(const char *, ...);
779 extern void warnx(const char *, ...);
780 extern void warnc(int, const char *, ...);
781 extern void vwarn(const char *, va_list);
782 extern void vwarnc(int, const char *, va_list);
783 extern void vwarnx(const char *, va_list);
786 [ ${HAVE_EXPLICIT_BZERO} -eq 0 ] && \
789 * Compatibility for explicit_bzero(3).
791 extern void explicit_bzero(void *, size_t);
795 [ ${HAVE_FREEZERO} -eq 0 ] && \
798 * Compatibility for freezero(3).
800 extern void freezero(void *, size_t);
804 [ ${HAVE_MEMMEM} -eq 0 ] && \
807 * Compatibility for memmem(3).
809 void *memmem(const void *, size_t, const void *, size_t);
813 [ ${HAVE_MEMRCHR} -eq 0 ] && \
816 * Compatibility for memrchr(3).
818 void *memrchr(const void *b, int, size_t);
822 [ ${HAVE_GETPROGNAME} -eq 0 ] && \
825 * Compatibility for getprogname(3).
827 extern const char *getprogname(void);
831 [ ${HAVE_REALLOCARRAY} -eq 0 ] && \
834 * Compatibility for reallocarray(3).
836 extern void *reallocarray(void *, size_t, size_t);
840 [ ${HAVE_RECALLOCARRAY} -eq 0 ] && \
843 * Compatibility for recallocarray(3).
845 extern void *recallocarray(void *, size_t, size_t, size_t);
849 [ ${HAVE_SETPROCTITLE} -eq 0 ] && \
852 * Compatibility for setproctitle(3).
854 extern void setproctitle(const char *, ...);
858 [ ${HAVE_STRLCAT} -eq 0 ] && \
861 * Compatibility for strlcat(3).
863 extern size_t strlcat(char *, const char *, size_t);
867 [ ${HAVE_STRLCPY} -eq 0 ] && \
870 * Compatibility for strlcpy(3).
872 extern size_t strlcpy(char *, const char *, size_t);
876 [ ${HAVE_STRNDUP} -eq 0 ] && \
879 * Compatibility for strndup(3).
881 extern char *strndup(const char *, size_t);
885 [ ${HAVE_STRNLEN} -eq 0 ] && \
888 * Compatibility for strnlen(3).
890 extern size_t strnlen(const char *, size_t);
894 [ ${HAVE_STRTONUM} -eq 0 ] && \
897 * Compatibility for strotnum(3).
899 extern long long strtonum(const char *, long long, long long, const char **);
903 if [ ${HAVE_SYS_QUEUE} -eq 0 ]; then
908 echo "#include <sys/queue.h>"
912 echo "#include <sys/uio.h>"
913 echo "#include <stdint.h>"
914 if [ ${HAVE_LIB_IMSG} -eq 0 ]; then
915 echo "#include \"imsg.h\""
917 echo "#include <imsg.h>"
923 # define __dead __attribute__((noreturn))
927 #define sio_flush(hdl) (sio_stop(hdl))
930 #if !HAVE_GETDTABLECOUNT
931 /* XXX: on linux it should be possible to inspect /proc/self/fd/ */
932 #define getdtablecount() (0)
936 /* replace host' getopt with OpenBSD' one */
937 #define opterr BSDopterr
938 #define optind BSDoptind
939 #define optopt BSDoptopt
940 #define optreset BSDoptreset
941 #define optarg BSDoptarg
942 #define getopt BSDgetopt
944 extern int BSDopterr, BSDoptind, BSDoptopt, BSDoptreset;
945 extern char *BSDoptarg;
948 #if !HAVE_TIMESPECSUB
950 void timespecsub(struct timespec *, struct timespec *, struct timespec *);
953 #endif /*!OCONFIGURE_CONFIG_H*/
956 echo "config.h: written" 1>&2
957 echo "config.h: written" 1>&3
959 #----------------------------------------------------------------------
960 # Now we go to generate our Makefile.configure.
961 # This file is simply a bunch of Makefile variables.
962 # They'll work in both GNUmakefile and BSDmakefile.
963 # You MIGHT want to change this.
964 #----------------------------------------------------------------------
966 exec > Makefile.configure
968 [ -z "${BINDIR}" ] && BINDIR="${PREFIX}/bin"
969 [ -z "${SBINDIR}" ] && SBINDIR="${PREFIX}/sbin"
970 [ -z "${INCLUDEDIR}" ] && INCLUDEDIR="${PREFIX}/include"
971 [ -z "${LIBDIR}" ] && LIBDIR="${PREFIX}/lib"
972 [ -z "${MANDIR}" ] && MANDIR="${PREFIX}/man"
973 [ -z "${SHAREDIR}" ] && SHAREDIR="${PREFIX}/share"
975 [ -z "${INSTALL_PROGRAM}" ] && INSTALL_PROGRAM="${INSTALL} -m 0555"
976 [ -z "${INSTALL_LIB}" ] && INSTALL_LIB="${INSTALL} -m 0444"
977 [ -z "${INSTALL_MAN}" ] && INSTALL_MAN="${INSTALL} -m 0444"
978 [ -z "${INSTALL_DATA}" ] && INSTALL_DATA="${INSTALL} -m 0444"
984 CPPFLAGS = ${CPPFLAGS}
986 LDADD_LIB_IMSG = ${LDADD_LIB_IMSG}
987 LDADD_DECODERS = ${LDADD_LIB_FLAC} ${LDADD_LIB_MPG123} ${LDADD_LIB_OPUSFILE} \
988 ${LDADD_LIB_VORBISFILE}
989 LDADD_LIB_MD = ${LDADD_LIB_MD}
990 LDADD_LIB_SOCKET = ${LDADD_LIB_SOCKET}
991 LDADD_BACKEND = ${LDADD_LIB_SNDIO} ${LDADD_LIB_ASOUND}
992 LDADD_STATIC = ${LDADD_STATIC}
997 SHAREDIR = ${SHAREDIR}
999 INCLUDEDIR = ${INCLUDEDIR}
1002 INSTALL = ${INSTALL}
1003 INSTALL_PROGRAM = ${INSTALL_PROGRAM}
1004 INSTALL_LIB = ${INSTALL_LIB}
1005 INSTALL_MAN = ${INSTALL_MAN}
1006 INSTALL_DATA = ${INSTALL_DATA}
1009 echo "Makefile.configure: written" 1>&2
1010 echo "Makefile.configure: written" 1>&3