1b00ab754SHans Petter Selaskydnl Copyright (c) 1995, 1996, 1997, 1998 2b00ab754SHans Petter Selaskydnl The Regents of the University of California. All rights reserved. 3b00ab754SHans Petter Selaskydnl 4b00ab754SHans Petter Selaskydnl Redistribution and use in source and binary forms, with or without 5b00ab754SHans Petter Selaskydnl modification, are permitted provided that: (1) source code distributions 6b00ab754SHans Petter Selaskydnl retain the above copyright notice and this paragraph in its entirety, (2) 7b00ab754SHans Petter Selaskydnl distributions including binary code include the above copyright notice and 8b00ab754SHans Petter Selaskydnl this paragraph in its entirety in the documentation or other materials 9b00ab754SHans Petter Selaskydnl provided with the distribution, and (3) all advertising materials mentioning 10b00ab754SHans Petter Selaskydnl features or use of this software display the following acknowledgement: 11b00ab754SHans Petter Selaskydnl ``This product includes software developed by the University of California, 12b00ab754SHans Petter Selaskydnl Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 13b00ab754SHans Petter Selaskydnl the University nor the names of its contributors may be used to endorse 14b00ab754SHans Petter Selaskydnl or promote products derived from this software without specific prior 15b00ab754SHans Petter Selaskydnl written permission. 16b00ab754SHans Petter Selaskydnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 17b00ab754SHans Petter Selaskydnl WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 18b00ab754SHans Petter Selaskydnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 19b00ab754SHans Petter Selaskydnl 20b00ab754SHans Petter Selaskydnl LBL autoconf macros 21b00ab754SHans Petter Selaskydnl 22b00ab754SHans Petter Selasky 23b00ab754SHans Petter Selaskydnl 24b00ab754SHans Petter Selaskydnl Do whatever AC_LBL_C_INIT work is necessary before using AC_PROG_CC. 25b00ab754SHans Petter Selaskydnl 26b00ab754SHans Petter Selaskydnl It appears that newer versions of autoconf (2.64 and later) will, 27b00ab754SHans Petter Selaskydnl if you use AC_TRY_COMPILE in a macro, stick AC_PROG_CC at the 28b00ab754SHans Petter Selaskydnl beginning of the macro, even if the macro itself calls AC_PROG_CC. 29b00ab754SHans Petter Selaskydnl See the "Prerequisite Macros" and "Expanded Before Required" sections 30b00ab754SHans Petter Selaskydnl in the Autoconf documentation. 31b00ab754SHans Petter Selaskydnl 32b00ab754SHans Petter Selaskydnl This causes a steaming heap of fail in our case, as we were, in 33b00ab754SHans Petter Selaskydnl AC_LBL_C_INIT, doing the tests we now do in AC_LBL_C_INIT_BEFORE_CC, 34b00ab754SHans Petter Selaskydnl calling AC_PROG_CC, and then doing the tests we now do in 35b00ab754SHans Petter Selaskydnl AC_LBL_C_INIT. Now, we run AC_LBL_C_INIT_BEFORE_CC, AC_PROG_CC, 36b00ab754SHans Petter Selaskydnl and AC_LBL_C_INIT at the top level. 37b00ab754SHans Petter Selaskydnl 38b00ab754SHans Petter SelaskyAC_DEFUN(AC_LBL_C_INIT_BEFORE_CC, 39b00ab754SHans Petter Selasky[ 40b00ab754SHans Petter Selasky AC_BEFORE([$0], [AC_LBL_C_INIT]) 41b00ab754SHans Petter Selasky AC_BEFORE([$0], [AC_PROG_CC]) 42b00ab754SHans Petter Selasky AC_BEFORE([$0], [AC_LBL_FIXINCLUDES]) 43b00ab754SHans Petter Selasky AC_BEFORE([$0], [AC_LBL_DEVEL]) 44b00ab754SHans Petter Selasky AC_ARG_WITH(gcc, [ --without-gcc don't use gcc]) 45b00ab754SHans Petter Selasky $1="" 46b00ab754SHans Petter Selasky if test "${srcdir}" != "." ; then 47b00ab754SHans Petter Selasky $1="-I\$(srcdir)" 48b00ab754SHans Petter Selasky fi 49b00ab754SHans Petter Selasky if test "${CFLAGS+set}" = set; then 50b00ab754SHans Petter Selasky LBL_CFLAGS="$CFLAGS" 51b00ab754SHans Petter Selasky fi 52b00ab754SHans Petter Selasky if test -z "$CC" ; then 53b00ab754SHans Petter Selasky case "$host_os" in 54b00ab754SHans Petter Selasky 55b00ab754SHans Petter Selasky bsdi*) 56b00ab754SHans Petter Selasky AC_CHECK_PROG(SHLICC2, shlicc2, yes, no) 57b00ab754SHans Petter Selasky if test $SHLICC2 = yes ; then 58b00ab754SHans Petter Selasky CC=shlicc2 59b00ab754SHans Petter Selasky export CC 60b00ab754SHans Petter Selasky fi 61b00ab754SHans Petter Selasky ;; 62b00ab754SHans Petter Selasky esac 63b00ab754SHans Petter Selasky fi 64b00ab754SHans Petter Selasky if test -z "$CC" -a "$with_gcc" = no ; then 65b00ab754SHans Petter Selasky CC=cc 66b00ab754SHans Petter Selasky export CC 67b00ab754SHans Petter Selasky fi 68b00ab754SHans Petter Selasky]) 69b00ab754SHans Petter Selasky 70b00ab754SHans Petter Selaskydnl 71b00ab754SHans Petter Selaskydnl Determine which compiler we're using (cc or gcc) 72b00ab754SHans Petter Selaskydnl If using gcc, determine the version number 73b00ab754SHans Petter Selaskydnl If using cc: 74b00ab754SHans Petter Selaskydnl require that it support ansi prototypes 75b00ab754SHans Petter Selaskydnl use -O (AC_PROG_CC will use -g -O2 on gcc, so we don't need to 76b00ab754SHans Petter Selaskydnl do that ourselves for gcc) 77b00ab754SHans Petter Selaskydnl add -g flags, as appropriate 78b00ab754SHans Petter Selaskydnl explicitly specify /usr/local/include 79b00ab754SHans Petter Selaskydnl 80b00ab754SHans Petter Selaskydnl NOTE WELL: with newer versions of autoconf, "gcc" means any compiler 81b00ab754SHans Petter Selaskydnl that defines __GNUC__, which means clang, for example, counts as "gcc". 82b00ab754SHans Petter Selaskydnl 83b00ab754SHans Petter Selaskydnl usage: 84b00ab754SHans Petter Selaskydnl 85b00ab754SHans Petter Selaskydnl AC_LBL_C_INIT(copt, incls) 86b00ab754SHans Petter Selaskydnl 87b00ab754SHans Petter Selaskydnl results: 88b00ab754SHans Petter Selaskydnl 89b00ab754SHans Petter Selaskydnl $1 (copt set) 90b00ab754SHans Petter Selaskydnl $2 (incls set) 91b00ab754SHans Petter Selaskydnl CC 92b00ab754SHans Petter Selaskydnl LDFLAGS 93b00ab754SHans Petter Selaskydnl LBL_CFLAGS 94b00ab754SHans Petter Selaskydnl 95b00ab754SHans Petter SelaskyAC_DEFUN(AC_LBL_C_INIT, 96b00ab754SHans Petter Selasky[ 97b00ab754SHans Petter Selasky AC_BEFORE([$0], [AC_LBL_FIXINCLUDES]) 98b00ab754SHans Petter Selasky AC_BEFORE([$0], [AC_LBL_DEVEL]) 99b00ab754SHans Petter Selasky AC_BEFORE([$0], [AC_LBL_SHLIBS_INIT]) 100b00ab754SHans Petter Selasky if test "$GCC" = yes ; then 101b00ab754SHans Petter Selasky # 102b00ab754SHans Petter Selasky # -Werror forces warnings to be errors. 103b00ab754SHans Petter Selasky # 104b00ab754SHans Petter Selasky ac_lbl_cc_force_warning_errors=-Werror 105b00ab754SHans Petter Selasky 106b00ab754SHans Petter Selasky # 107b00ab754SHans Petter Selasky # Try to have the compiler default to hiding symbols, 108b00ab754SHans Petter Selasky # so that only symbols explicitly exported with 109b00ab754SHans Petter Selasky # PCAP_API will be visible outside (shared) libraries. 110b00ab754SHans Petter Selasky # 111b00ab754SHans Petter Selasky AC_LBL_CHECK_COMPILER_OPT($1, -fvisibility=hidden) 112b00ab754SHans Petter Selasky else 113b00ab754SHans Petter Selasky $2="$$2 -I/usr/local/include" 114b00ab754SHans Petter Selasky LDFLAGS="$LDFLAGS -L/usr/local/lib" 115b00ab754SHans Petter Selasky 116b00ab754SHans Petter Selasky case "$host_os" in 117b00ab754SHans Petter Selasky 118b00ab754SHans Petter Selasky darwin*) 119b00ab754SHans Petter Selasky # 120b00ab754SHans Petter Selasky # This is assumed either to be GCC or clang, both 121b00ab754SHans Petter Selasky # of which use -Werror to force warnings to be errors. 122b00ab754SHans Petter Selasky # 123b00ab754SHans Petter Selasky ac_lbl_cc_force_warning_errors=-Werror 124b00ab754SHans Petter Selasky 125b00ab754SHans Petter Selasky # 126b00ab754SHans Petter Selasky # Try to have the compiler default to hiding symbols, 127b00ab754SHans Petter Selasky # so that only symbols explicitly exported with 128b00ab754SHans Petter Selasky # PCAP_API will be visible outside (shared) libraries. 129b00ab754SHans Petter Selasky # 130b00ab754SHans Petter Selasky AC_LBL_CHECK_COMPILER_OPT($1, -fvisibility=hidden) 131b00ab754SHans Petter Selasky ;; 132b00ab754SHans Petter Selasky 133b00ab754SHans Petter Selasky hpux*) 134b00ab754SHans Petter Selasky # 135b00ab754SHans Petter Selasky # HP C, which is what we presume we're using, doesn't 136b00ab754SHans Petter Selasky # exit with a non-zero exit status if we hand it an 137b00ab754SHans Petter Selasky # invalid -W flag, can't be forced to do so even with 138b00ab754SHans Petter Selasky # +We, and doesn't handle GCC-style -W flags, so we 139b00ab754SHans Petter Selasky # don't want to try using GCC-style -W flags. 140b00ab754SHans Petter Selasky # 141b00ab754SHans Petter Selasky ac_lbl_cc_dont_try_gcc_dashW=yes 142b00ab754SHans Petter Selasky ;; 143b00ab754SHans Petter Selasky 144b00ab754SHans Petter Selasky irix*) 145b00ab754SHans Petter Selasky # 146b00ab754SHans Petter Selasky # MIPS C, which is what we presume we're using, doesn't 147b00ab754SHans Petter Selasky # necessarily exit with a non-zero exit status if we 148b00ab754SHans Petter Selasky # hand it an invalid -W flag, can't be forced to do 149b00ab754SHans Petter Selasky # so, and doesn't handle GCC-style -W flags, so we 150b00ab754SHans Petter Selasky # don't want to try using GCC-style -W flags. 151b00ab754SHans Petter Selasky # 152b00ab754SHans Petter Selasky ac_lbl_cc_dont_try_gcc_dashW=yes 153b00ab754SHans Petter Selasky # 154b00ab754SHans Petter Selasky # It also, apparently, defaults to "char" being 155b00ab754SHans Petter Selasky # unsigned, unlike most other C implementations; 156b00ab754SHans Petter Selasky # I suppose we could say "signed char" whenever 157b00ab754SHans Petter Selasky # we want to guarantee a signed "char", but let's 158b00ab754SHans Petter Selasky # just force signed chars. 159b00ab754SHans Petter Selasky # 160b00ab754SHans Petter Selasky # -xansi is normally the default, but the 161b00ab754SHans Petter Selasky # configure script was setting it; perhaps -cckr 162b00ab754SHans Petter Selasky # was the default in the Old Days. (Then again, 163b00ab754SHans Petter Selasky # that would probably be for backwards compatibility 164b00ab754SHans Petter Selasky # in the days when ANSI C was Shiny and New, i.e. 165b00ab754SHans Petter Selasky # 1989 and the early '90's, so maybe we can just 166b00ab754SHans Petter Selasky # drop support for those compilers.) 167b00ab754SHans Petter Selasky # 168b00ab754SHans Petter Selasky # -g is equivalent to -g2, which turns off 169b00ab754SHans Petter Selasky # optimization; we choose -g3, which generates 170b00ab754SHans Petter Selasky # debugging information but doesn't turn off 171b00ab754SHans Petter Selasky # optimization (even if the optimization would 172b00ab754SHans Petter Selasky # cause inaccuracies in debugging). 173b00ab754SHans Petter Selasky # 174b00ab754SHans Petter Selasky $1="$$1 -xansi -signed -g3" 175b00ab754SHans Petter Selasky ;; 176b00ab754SHans Petter Selasky 177b00ab754SHans Petter Selasky osf*) 178b00ab754SHans Petter Selasky # 179b00ab754SHans Petter Selasky # Presumed to be DEC OSF/1, Digital UNIX, or 180b00ab754SHans Petter Selasky # Tru64 UNIX. 181b00ab754SHans Petter Selasky # 182b00ab754SHans Petter Selasky # The DEC C compiler, which is what we presume we're 183b00ab754SHans Petter Selasky # using, doesn't exit with a non-zero exit status if we 184b00ab754SHans Petter Selasky # hand it an invalid -W flag, can't be forced to do 185b00ab754SHans Petter Selasky # so, and doesn't handle GCC-style -W flags, so we 186b00ab754SHans Petter Selasky # don't want to try using GCC-style -W flags. 187b00ab754SHans Petter Selasky # 188b00ab754SHans Petter Selasky ac_lbl_cc_dont_try_gcc_dashW=yes 189b00ab754SHans Petter Selasky # 190b00ab754SHans Petter Selasky # -g is equivalent to -g2, which turns off 191b00ab754SHans Petter Selasky # optimization; we choose -g3, which generates 192b00ab754SHans Petter Selasky # debugging information but doesn't turn off 193b00ab754SHans Petter Selasky # optimization (even if the optimization would 194b00ab754SHans Petter Selasky # cause inaccuracies in debugging). 195b00ab754SHans Petter Selasky # 196b00ab754SHans Petter Selasky $1="$$1 -g3" 197b00ab754SHans Petter Selasky ;; 198b00ab754SHans Petter Selasky 199b00ab754SHans Petter Selasky solaris*) 200b00ab754SHans Petter Selasky # 201b00ab754SHans Petter Selasky # Assumed to be Sun C, which requires -errwarn to force 202b00ab754SHans Petter Selasky # warnings to be treated as errors. 203b00ab754SHans Petter Selasky # 204b00ab754SHans Petter Selasky ac_lbl_cc_force_warning_errors=-errwarn 205b00ab754SHans Petter Selasky 206b00ab754SHans Petter Selasky # 207b00ab754SHans Petter Selasky # Try to have the compiler default to hiding symbols, 208b00ab754SHans Petter Selasky # so that only symbols explicitly exported with 209b00ab754SHans Petter Selasky # PCAP_API will be visible outside (shared) libraries. 210b00ab754SHans Petter Selasky # 211b00ab754SHans Petter Selasky AC_LBL_CHECK_COMPILER_OPT($1, -xldscope=hidden) 212b00ab754SHans Petter Selasky ;; 213b00ab754SHans Petter Selasky 214b00ab754SHans Petter Selasky ultrix*) 215b00ab754SHans Petter Selasky AC_MSG_CHECKING(that Ultrix $CC hacks const in prototypes) 216b00ab754SHans Petter Selasky AC_CACHE_VAL(ac_cv_lbl_cc_const_proto, 217b00ab754SHans Petter Selasky AC_TRY_COMPILE( 218b00ab754SHans Petter Selasky [#include <sys/types.h>], 219b00ab754SHans Petter Selasky [struct a { int b; }; 220b00ab754SHans Petter Selasky void c(const struct a *)], 221b00ab754SHans Petter Selasky ac_cv_lbl_cc_const_proto=yes, 222b00ab754SHans Petter Selasky ac_cv_lbl_cc_const_proto=no)) 223b00ab754SHans Petter Selasky AC_MSG_RESULT($ac_cv_lbl_cc_const_proto) 224b00ab754SHans Petter Selasky if test $ac_cv_lbl_cc_const_proto = no ; then 225b00ab754SHans Petter Selasky AC_DEFINE(const,[], 226b00ab754SHans Petter Selasky [to handle Ultrix compilers that don't support const in prototypes]) 227b00ab754SHans Petter Selasky fi 228b00ab754SHans Petter Selasky ;; 229b00ab754SHans Petter Selasky esac 230b00ab754SHans Petter Selasky $1="$$1 -O" 231b00ab754SHans Petter Selasky fi 232b00ab754SHans Petter Selasky]) 233b00ab754SHans Petter Selasky 234b00ab754SHans Petter Selaskydnl 2356f9cba8fSJoseph Mingronednl Save the values of various variables that affect compilation and 2366f9cba8fSJoseph Mingronednl linking, and that we don't ourselves modify persistently; done 2376f9cba8fSJoseph Mingronednl before a test involving compiling or linking is done, so that we 2386f9cba8fSJoseph Mingronednl can restore those variables after the test is done. 239b00ab754SHans Petter Selaskydnl 2406f9cba8fSJoseph MingroneAC_DEFUN(AC_LBL_SAVE_CHECK_STATE, 241b00ab754SHans Petter Selasky[ 242b00ab754SHans Petter Selasky save_CFLAGS="$CFLAGS" 2436f9cba8fSJoseph Mingrone save_LIBS="$LIBS" 2446f9cba8fSJoseph Mingrone save_LDFLAGS="$LDFLAGS" 245b00ab754SHans Petter Selasky]) 2466f9cba8fSJoseph Mingrone 2476f9cba8fSJoseph Mingronednl 2486f9cba8fSJoseph Mingronednl Restore the values of variables saved by AC_LBL_SAVE_CHECK_STATE. 2496f9cba8fSJoseph Mingronednl 2506f9cba8fSJoseph MingroneAC_DEFUN(AC_LBL_RESTORE_CHECK_STATE, 2516f9cba8fSJoseph Mingrone[ 252b00ab754SHans Petter Selasky CFLAGS="$save_CFLAGS" 2536f9cba8fSJoseph Mingrone LIBS="$save_LIBS" 2546f9cba8fSJoseph Mingrone LDFLAGS="$save_LDFLAGS" 255b00ab754SHans Petter Selasky]) 256b00ab754SHans Petter Selasky 257b00ab754SHans Petter Selaskydnl 258b00ab754SHans Petter Selaskydnl Check whether the compiler option specified as the second argument 259b00ab754SHans Petter Selaskydnl is supported by the compiler and, if so, add it to the macro 260b00ab754SHans Petter Selaskydnl specified as the first argument 261b00ab754SHans Petter Selaskydnl 26257e22627SCy Schubertdnl If a third argument is supplied, treat it as C code to be compiled 26357e22627SCy Schubertdnl with the flag in question, and the "treat warnings as errors" flag 26457e22627SCy Schubertdnl set, and don't add the flag to the first argument if the compile 26557e22627SCy Schubertdnl fails; this is for warning options cause problems that can't be 26657e22627SCy Schubertdnl worked around. If a third argument is supplied, a fourth argument 2676f9cba8fSJoseph Mingronednl should also be supplied; it's a message describing what the test 26857e22627SCy Schubertdnl program is checking. 26957e22627SCy Schubertdnl 270b00ab754SHans Petter SelaskyAC_DEFUN(AC_LBL_CHECK_COMPILER_OPT, 271b00ab754SHans Petter Selasky [ 272b00ab754SHans Petter Selasky AC_MSG_CHECKING([whether the compiler supports the $2 option]) 273b00ab754SHans Petter Selasky save_CFLAGS="$CFLAGS" 274b00ab754SHans Petter Selasky CFLAGS="$CFLAGS $2" 2756f9cba8fSJoseph Mingrone # 2766f9cba8fSJoseph Mingrone # XXX - yes, this depends on the way AC_LANG_WERROR works, 2776f9cba8fSJoseph Mingrone # but no mechanism is provided to turn AC_LANG_WERROR on 2786f9cba8fSJoseph Mingrone # *and then turn it back off*, so that we *only* do it when 2796f9cba8fSJoseph Mingrone # testing compiler options - 15 years after somebody asked 2806f9cba8fSJoseph Mingrone # for it: 2816f9cba8fSJoseph Mingrone # 2826f9cba8fSJoseph Mingrone # https://autoconf.gnu.narkive.com/gTAVmfKD/how-to-cancel-flags-set-by-ac-lang-werror 2836f9cba8fSJoseph Mingrone # 2846f9cba8fSJoseph Mingrone save_ac_c_werror_flag="$ac_c_werror_flag" 2856f9cba8fSJoseph Mingrone ac_c_werror_flag=yes 2866f9cba8fSJoseph Mingrone # 2876f9cba8fSJoseph Mingrone # We use AC_LANG_SOURCE() so that we can control the complete 2886f9cba8fSJoseph Mingrone # content of the program being compiled. We do not, for example, 2896f9cba8fSJoseph Mingrone # want the default "int main()" that AC_LANG_PROGRAM() generates, 2906f9cba8fSJoseph Mingrone # as it will generate a warning with -Wold-style-definition, meaning 2916f9cba8fSJoseph Mingrone # that we would treat it as not working, as the test will fail if 2926f9cba8fSJoseph Mingrone # *any* error output, including a warning due to the flag we're 2936f9cba8fSJoseph Mingrone # testing, is generated; see 2946f9cba8fSJoseph Mingrone # 2956f9cba8fSJoseph Mingrone # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us 2966f9cba8fSJoseph Mingrone # https://www.postgresql.org/message-id/2192993.1591682589%40sss.pgh.pa.us 2976f9cba8fSJoseph Mingrone # 2986f9cba8fSJoseph Mingrone # This may, as per those two messages, be fixed in autoconf 2.70, 299*afdbf109SJoseph Mingrone # but we only require 2.69 or newer for now. 3006f9cba8fSJoseph Mingrone # 3016f9cba8fSJoseph Mingrone AC_COMPILE_IFELSE( 3026f9cba8fSJoseph Mingrone [AC_LANG_SOURCE([[int main(void) { return 0; }]])], 303b00ab754SHans Petter Selasky [ 304b00ab754SHans Petter Selasky AC_MSG_RESULT([yes]) 30557e22627SCy Schubert can_add_to_cflags=yes 30657e22627SCy Schubert # 30757e22627SCy Schubert # The compile supports this; do we have some C code for 30857e22627SCy Schubert # which the warning should *not* appear? 30957e22627SCy Schubert # We test the fourth argument because the third argument 31057e22627SCy Schubert # could contain quotes, breaking the test. 31157e22627SCy Schubert # 31257e22627SCy Schubert if test "x$4" != "x" 31357e22627SCy Schubert then 31457e22627SCy Schubert CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors" 31557e22627SCy Schubert AC_MSG_CHECKING(whether $2 $4) 31657e22627SCy Schubert AC_COMPILE_IFELSE( 31757e22627SCy Schubert [AC_LANG_SOURCE($3)], 31857e22627SCy Schubert [ 31957e22627SCy Schubert # 32057e22627SCy Schubert # Not a problem. 32157e22627SCy Schubert # 32257e22627SCy Schubert AC_MSG_RESULT(no) 32357e22627SCy Schubert ], 32457e22627SCy Schubert [ 32557e22627SCy Schubert # 32657e22627SCy Schubert # A problem. 32757e22627SCy Schubert # 32857e22627SCy Schubert AC_MSG_RESULT(yes) 32957e22627SCy Schubert can_add_to_cflags=no 33057e22627SCy Schubert ]) 33157e22627SCy Schubert fi 332b00ab754SHans Petter Selasky CFLAGS="$save_CFLAGS" 33357e22627SCy Schubert if test x"$can_add_to_cflags" = "xyes" 33457e22627SCy Schubert then 335b00ab754SHans Petter Selasky $1="$$1 $2" 33657e22627SCy Schubert fi 337b00ab754SHans Petter Selasky ], 338b00ab754SHans Petter Selasky [ 339b00ab754SHans Petter Selasky AC_MSG_RESULT([no]) 340b00ab754SHans Petter Selasky CFLAGS="$save_CFLAGS" 341b00ab754SHans Petter Selasky ]) 3426f9cba8fSJoseph Mingrone ac_c_werror_flag="$save_ac_c_werror_flag" 343b00ab754SHans Petter Selasky ]) 344b00ab754SHans Petter Selasky 345b00ab754SHans Petter Selaskydnl 346b00ab754SHans Petter Selaskydnl Check whether the compiler supports an option to generate 347b00ab754SHans Petter Selaskydnl Makefile-style dependency lines 348b00ab754SHans Petter Selaskydnl 349b00ab754SHans Petter Selaskydnl GCC uses -M for this. Non-GCC compilers that support this 350b00ab754SHans Petter Selaskydnl use a variety of flags, including but not limited to -M. 351b00ab754SHans Petter Selaskydnl 352b00ab754SHans Petter Selaskydnl We test whether the flag in question is supported, as older 353b00ab754SHans Petter Selaskydnl versions of compilers might not support it. 354b00ab754SHans Petter Selaskydnl 355b00ab754SHans Petter Selaskydnl We don't try all the possible flags, just in case some flag means 356b00ab754SHans Petter Selaskydnl "generate dependencies" on one compiler but means something else 357b00ab754SHans Petter Selaskydnl on another compiler. 358b00ab754SHans Petter Selaskydnl 359b00ab754SHans Petter Selaskydnl Most compilers that support this send the output to the standard 360b00ab754SHans Petter Selaskydnl output by default. IBM's XLC, however, supports -M but sends 361b00ab754SHans Petter Selaskydnl the output to {sourcefile-basename}.u, and AIX has no /dev/stdout 362b00ab754SHans Petter Selaskydnl to work around that, so we don't bother with XLC. 363b00ab754SHans Petter Selaskydnl 364b00ab754SHans Petter SelaskyAC_DEFUN(AC_LBL_CHECK_DEPENDENCY_GENERATION_OPT, 365b00ab754SHans Petter Selasky [ 366b00ab754SHans Petter Selasky AC_MSG_CHECKING([whether the compiler supports generating dependencies]) 367b00ab754SHans Petter Selasky if test "$GCC" = yes ; then 368b00ab754SHans Petter Selasky # 369b00ab754SHans Petter Selasky # GCC, or a compiler deemed to be GCC by AC_PROG_CC (even 370b00ab754SHans Petter Selasky # though it's not); we assume that, in this case, the flag 371b00ab754SHans Petter Selasky # would be -M. 372b00ab754SHans Petter Selasky # 373b00ab754SHans Petter Selasky ac_lbl_dependency_flag="-M" 374b00ab754SHans Petter Selasky else 375b00ab754SHans Petter Selasky # 376b00ab754SHans Petter Selasky # Not GCC or a compiler deemed to be GCC; what platform is 377b00ab754SHans Petter Selasky # this? (We're assuming that if the compiler isn't GCC 378b00ab754SHans Petter Selasky # it's the compiler from the vendor of the OS; that won't 379b00ab754SHans Petter Selasky # necessarily be true for x86 platforms, where it might be 380b00ab754SHans Petter Selasky # the Intel C compiler.) 381b00ab754SHans Petter Selasky # 382b00ab754SHans Petter Selasky case "$host_os" in 383b00ab754SHans Petter Selasky 384b00ab754SHans Petter Selasky irix*|osf*|darwin*) 385b00ab754SHans Petter Selasky # 386b00ab754SHans Petter Selasky # MIPS C for IRIX, DEC C, and clang all use -M. 387b00ab754SHans Petter Selasky # 388b00ab754SHans Petter Selasky ac_lbl_dependency_flag="-M" 389b00ab754SHans Petter Selasky ;; 390b00ab754SHans Petter Selasky 391b00ab754SHans Petter Selasky solaris*) 392b00ab754SHans Petter Selasky # 393b00ab754SHans Petter Selasky # Sun C uses -xM. 394b00ab754SHans Petter Selasky # 395b00ab754SHans Petter Selasky ac_lbl_dependency_flag="-xM" 396b00ab754SHans Petter Selasky ;; 397b00ab754SHans Petter Selasky 398b00ab754SHans Petter Selasky hpux*) 399b00ab754SHans Petter Selasky # 400b00ab754SHans Petter Selasky # HP's older C compilers don't support this. 401b00ab754SHans Petter Selasky # HP's newer C compilers support this with 402b00ab754SHans Petter Selasky # either +M or +Make; the older compilers 403b00ab754SHans Petter Selasky # interpret +M as something completely 404b00ab754SHans Petter Selasky # different, so we use +Make so we don't 405b00ab754SHans Petter Selasky # think it works with the older compilers. 406b00ab754SHans Petter Selasky # 407b00ab754SHans Petter Selasky ac_lbl_dependency_flag="+Make" 408b00ab754SHans Petter Selasky ;; 409b00ab754SHans Petter Selasky 410b00ab754SHans Petter Selasky *) 411b00ab754SHans Petter Selasky # 412b00ab754SHans Petter Selasky # Not one of the above; assume no support for 413b00ab754SHans Petter Selasky # generating dependencies. 414b00ab754SHans Petter Selasky # 415b00ab754SHans Petter Selasky ac_lbl_dependency_flag="" 416b00ab754SHans Petter Selasky ;; 417b00ab754SHans Petter Selasky esac 418b00ab754SHans Petter Selasky fi 419b00ab754SHans Petter Selasky 420b00ab754SHans Petter Selasky # 421b00ab754SHans Petter Selasky # Is ac_lbl_dependency_flag defined and, if so, does the compiler 422b00ab754SHans Petter Selasky # complain about it? 423b00ab754SHans Petter Selasky # 424b00ab754SHans Petter Selasky # Note: clang doesn't seem to exit with an error status when handed 425b00ab754SHans Petter Selasky # an unknown non-warning error, even if you pass it 426b00ab754SHans Petter Selasky # -Werror=unknown-warning-option. However, it always supports 427b00ab754SHans Petter Selasky # -M, so the fact that this test always succeeds with clang 428b00ab754SHans Petter Selasky # isn't an issue. 429b00ab754SHans Petter Selasky # 430b00ab754SHans Petter Selasky if test ! -z "$ac_lbl_dependency_flag"; then 431b00ab754SHans Petter Selasky AC_LANG_CONFTEST( 432b00ab754SHans Petter Selasky [AC_LANG_SOURCE([[int main(void) { return 0; }]])]) 433b00ab754SHans Petter Selasky if AC_RUN_LOG([eval "$CC $ac_lbl_dependency_flag conftest.c >/dev/null 2>&1"]); then 434b00ab754SHans Petter Selasky AC_MSG_RESULT([yes, with $ac_lbl_dependency_flag]) 435b00ab754SHans Petter Selasky DEPENDENCY_CFLAG="$ac_lbl_dependency_flag" 4366f9cba8fSJoseph Mingrone MKDEP='${top_srcdir}/mkdep' 437b00ab754SHans Petter Selasky else 438b00ab754SHans Petter Selasky AC_MSG_RESULT([no]) 439b00ab754SHans Petter Selasky # 440b00ab754SHans Petter Selasky # We can't run mkdep, so have "make depend" do 441b00ab754SHans Petter Selasky # nothing. 442b00ab754SHans Petter Selasky # 4436f9cba8fSJoseph Mingrone MKDEP='${top_srcdir}/nomkdep' 444b00ab754SHans Petter Selasky fi 445b00ab754SHans Petter Selasky rm -rf conftest* 446b00ab754SHans Petter Selasky else 447b00ab754SHans Petter Selasky AC_MSG_RESULT([no]) 448b00ab754SHans Petter Selasky # 449b00ab754SHans Petter Selasky # We can't run mkdep, so have "make depend" do 450b00ab754SHans Petter Selasky # nothing. 451b00ab754SHans Petter Selasky # 4526f9cba8fSJoseph Mingrone MKDEP='${top_srcdir}/nomkdep' 453b00ab754SHans Petter Selasky fi 454b00ab754SHans Petter Selasky AC_SUBST(DEPENDENCY_CFLAG) 455b00ab754SHans Petter Selasky AC_SUBST(MKDEP) 456b00ab754SHans Petter Selasky ]) 457b00ab754SHans Petter Selasky 458b00ab754SHans Petter Selaskydnl 459b00ab754SHans Petter Selaskydnl Determine what options are needed to build a shared library 460b00ab754SHans Petter Selaskydnl 461b00ab754SHans Petter Selaskydnl usage: 462b00ab754SHans Petter Selaskydnl 463b00ab754SHans Petter Selaskydnl AC_LBL_SHLIBS_INIT 464b00ab754SHans Petter Selaskydnl 465b00ab754SHans Petter Selaskydnl results: 466b00ab754SHans Petter Selaskydnl 467b00ab754SHans Petter Selaskydnl V_SHLIB_CCOPT (modified to build position-independent code) 468b00ab754SHans Petter Selaskydnl V_SHLIB_CMD 469b00ab754SHans Petter Selaskydnl V_SHLIB_OPT 470b00ab754SHans Petter Selaskydnl V_SONAME_OPT 471b00ab754SHans Petter Selaskydnl 472b00ab754SHans Petter SelaskyAC_DEFUN(AC_LBL_SHLIBS_INIT, 473b00ab754SHans Petter Selasky [AC_PREREQ(2.50) 474b00ab754SHans Petter Selasky if test "$GCC" = yes ; then 475b00ab754SHans Petter Selasky # 476b00ab754SHans Petter Selasky # On platforms where we build a shared library: 477b00ab754SHans Petter Selasky # 478b00ab754SHans Petter Selasky # add options to generate position-independent code, 479b00ab754SHans Petter Selasky # if necessary (it's the default in AIX and Darwin/macOS); 480b00ab754SHans Petter Selasky # 481b00ab754SHans Petter Selasky # define option to set the soname of the shared library, 482b00ab754SHans Petter Selasky # if the OS supports that; 483b00ab754SHans Petter Selasky # 484b00ab754SHans Petter Selasky # add options to specify, at link time, a directory to 485b00ab754SHans Petter Selasky # add to the run-time search path, if that's necessary. 486b00ab754SHans Petter Selasky # 487b00ab754SHans Petter Selasky V_SHLIB_CMD="\$(CC)" 488b00ab754SHans Petter Selasky V_SHLIB_OPT="-shared" 489b00ab754SHans Petter Selasky case "$host_os" in 490b00ab754SHans Petter Selasky 491b00ab754SHans Petter Selasky aix*) 492b00ab754SHans Petter Selasky ;; 493b00ab754SHans Petter Selasky 4946f9cba8fSJoseph Mingrone freebsd*|netbsd*|openbsd*|dragonfly*|linux*|osf*|haiku*|midipix*) 495b00ab754SHans Petter Selasky # 4966f9cba8fSJoseph Mingrone # Platforms where the C compiler is GCC or accepts 4976f9cba8fSJoseph Mingrone # compatible command-line arguments, and the linker 4986f9cba8fSJoseph Mingrone # is the GNU linker or accepts compatible command-line 4996f9cba8fSJoseph Mingrone # arguments. 500b00ab754SHans Petter Selasky # 501b00ab754SHans Petter Selasky # Some instruction sets require -fPIC on some 502b00ab754SHans Petter Selasky # operating systems. Check for them. If you 503b00ab754SHans Petter Selasky # have a combination that requires it, add it 504b00ab754SHans Petter Selasky # here. 505b00ab754SHans Petter Selasky # 506b00ab754SHans Petter Selasky PIC_OPT=-fpic 507b00ab754SHans Petter Selasky case "$host_cpu" in 508b00ab754SHans Petter Selasky 509b00ab754SHans Petter Selasky sparc64*) 510b00ab754SHans Petter Selasky case "$host_os" in 511b00ab754SHans Petter Selasky 51257e22627SCy Schubert freebsd*|openbsd*|linux*) 513b00ab754SHans Petter Selasky PIC_OPT=-fPIC 514b00ab754SHans Petter Selasky ;; 515b00ab754SHans Petter Selasky esac 516b00ab754SHans Petter Selasky ;; 517b00ab754SHans Petter Selasky esac 518b00ab754SHans Petter Selasky V_SHLIB_CCOPT="$V_SHLIB_CCOPT $PIC_OPT" 519b00ab754SHans Petter Selasky V_SONAME_OPT="-Wl,-soname," 520b00ab754SHans Petter Selasky ;; 521b00ab754SHans Petter Selasky 522b00ab754SHans Petter Selasky hpux*) 523b00ab754SHans Petter Selasky V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic" 524b00ab754SHans Petter Selasky # 525b00ab754SHans Petter Selasky # XXX - this assumes GCC is using the HP linker, 526b00ab754SHans Petter Selasky # rather than the GNU linker, and that the "+h" 527b00ab754SHans Petter Selasky # option is used on all HP-UX platforms, both .sl 528b00ab754SHans Petter Selasky # and .so. 529b00ab754SHans Petter Selasky # 530b00ab754SHans Petter Selasky V_SONAME_OPT="-Wl,+h," 531b00ab754SHans Petter Selasky # 5326f9cba8fSJoseph Mingrone # By default, directories specified with -L 533b00ab754SHans Petter Selasky # are added to the run-time search path, so 534b00ab754SHans Petter Selasky # we don't add them in pcap-config. 535b00ab754SHans Petter Selasky # 536b00ab754SHans Petter Selasky ;; 537b00ab754SHans Petter Selasky 538b00ab754SHans Petter Selasky solaris*) 539b00ab754SHans Petter Selasky V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic" 540b00ab754SHans Petter Selasky # 5416f9cba8fSJoseph Mingrone # Sun/Oracle's C compiler, GCC, and GCC-compatible 5426f9cba8fSJoseph Mingrone # compilers support -Wl,{comma-separated list of options}, 5436f9cba8fSJoseph Mingrone # and we use the C compiler, not ld, for all linking, 5446f9cba8fSJoseph Mingrone # including linking to produce a shared library. 545b00ab754SHans Petter Selasky # 546b00ab754SHans Petter Selasky V_SONAME_OPT="-Wl,-h," 547b00ab754SHans Petter Selasky ;; 548b00ab754SHans Petter Selasky esac 549b00ab754SHans Petter Selasky else 550b00ab754SHans Petter Selasky # 551b00ab754SHans Petter Selasky # Set the appropriate compiler flags and, on platforms 552b00ab754SHans Petter Selasky # where we build a shared library: 553b00ab754SHans Petter Selasky # 554b00ab754SHans Petter Selasky # add options to generate position-independent code, 555b00ab754SHans Petter Selasky # if necessary (it's the default in Darwin/macOS); 556b00ab754SHans Petter Selasky # 557b00ab754SHans Petter Selasky # if we generate ".so" shared libraries, define the 558b00ab754SHans Petter Selasky # appropriate options for building the shared library; 559b00ab754SHans Petter Selasky # 560b00ab754SHans Petter Selasky # add options to specify, at link time, a directory to 561b00ab754SHans Petter Selasky # add to the run-time search path, if that's necessary. 562b00ab754SHans Petter Selasky # 563b00ab754SHans Petter Selasky # Note: spaces after V_SONAME_OPT are significant; on 564b00ab754SHans Petter Selasky # some platforms the soname is passed with a GCC-like 565b00ab754SHans Petter Selasky # "-Wl,-soname,{soname}" option, with the soname part 566b00ab754SHans Petter Selasky # of the option, while on other platforms the C compiler 567b00ab754SHans Petter Selasky # driver takes it as a regular option with the soname 5686f9cba8fSJoseph Mingrone # following the option. 569b00ab754SHans Petter Selasky # 570b00ab754SHans Petter Selasky case "$host_os" in 571b00ab754SHans Petter Selasky 572b00ab754SHans Petter Selasky aix*) 573b00ab754SHans Petter Selasky V_SHLIB_CMD="\$(CC)" 574b00ab754SHans Petter Selasky V_SHLIB_OPT="-G -bnoentry -bexpall" 575b00ab754SHans Petter Selasky ;; 576b00ab754SHans Petter Selasky 577b00ab754SHans Petter Selasky freebsd*|netbsd*|openbsd*|dragonfly*|linux*) 578b00ab754SHans Petter Selasky # 5796f9cba8fSJoseph Mingrone # Platforms where the C compiler is GCC or accepts 5806f9cba8fSJoseph Mingrone # compatible command-line arguments, and the linker 5816f9cba8fSJoseph Mingrone # is the GNU linker or accepts compatible command-line 5826f9cba8fSJoseph Mingrone # arguments. 5836f9cba8fSJoseph Mingrone # 5846f9cba8fSJoseph Mingrone # XXX - does 64-bit SPARC require -fPIC? 585b00ab754SHans Petter Selasky # 586b00ab754SHans Petter Selasky V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic" 587b00ab754SHans Petter Selasky V_SHLIB_CMD="\$(CC)" 588b00ab754SHans Petter Selasky V_SHLIB_OPT="-shared" 589b00ab754SHans Petter Selasky V_SONAME_OPT="-Wl,-soname," 590b00ab754SHans Petter Selasky ;; 591b00ab754SHans Petter Selasky 592b00ab754SHans Petter Selasky hpux*) 593b00ab754SHans Petter Selasky V_SHLIB_CCOPT="$V_SHLIB_CCOPT +z" 594b00ab754SHans Petter Selasky V_SHLIB_CMD="\$(LD)" 595b00ab754SHans Petter Selasky V_SHLIB_OPT="-b" 596b00ab754SHans Petter Selasky V_SONAME_OPT="+h " 597b00ab754SHans Petter Selasky # 5986f9cba8fSJoseph Mingrone # By default, directories specified with -L 599b00ab754SHans Petter Selasky # are added to the run-time search path, so 600b00ab754SHans Petter Selasky # we don't add them in pcap-config. 601b00ab754SHans Petter Selasky # 602b00ab754SHans Petter Selasky ;; 603b00ab754SHans Petter Selasky 604b00ab754SHans Petter Selasky osf*) 605b00ab754SHans Petter Selasky # 606b00ab754SHans Petter Selasky # Presumed to be DEC OSF/1, Digital UNIX, or 607b00ab754SHans Petter Selasky # Tru64 UNIX. 608b00ab754SHans Petter Selasky # 609b00ab754SHans Petter Selasky V_SHLIB_CMD="\$(CC)" 610b00ab754SHans Petter Selasky V_SHLIB_OPT="-shared" 611b00ab754SHans Petter Selasky V_SONAME_OPT="-soname " 612b00ab754SHans Petter Selasky ;; 613b00ab754SHans Petter Selasky 614b00ab754SHans Petter Selasky solaris*) 615b00ab754SHans Petter Selasky V_SHLIB_CCOPT="$V_SHLIB_CCOPT -Kpic" 616b00ab754SHans Petter Selasky V_SHLIB_CMD="\$(CC)" 617b00ab754SHans Petter Selasky V_SHLIB_OPT="-G" 6186f9cba8fSJoseph Mingrone # 6196f9cba8fSJoseph Mingrone # Sun/Oracle's C compiler, GCC, and GCC-compatible 6206f9cba8fSJoseph Mingrone # compilers support -Wl,{comma-separated list of options}, 6216f9cba8fSJoseph Mingrone # and we use the C compiler, not ld, for all linking, 6226f9cba8fSJoseph Mingrone # including linking to produce a shared library. 6236f9cba8fSJoseph Mingrone # 6246f9cba8fSJoseph Mingrone V_SONAME_OPT="-Wl,-h," 625b00ab754SHans Petter Selasky ;; 626b00ab754SHans Petter Selasky esac 627b00ab754SHans Petter Selasky fi 628b00ab754SHans Petter Selasky]) 629b00ab754SHans Petter Selasky 630b00ab754SHans Petter Selasky# 631b00ab754SHans Petter Selasky# Try compiling a sample of the type of code that appears in 632b00ab754SHans Petter Selasky# gencode.c with "inline", "__inline__", and "__inline". 633b00ab754SHans Petter Selasky# 634b00ab754SHans Petter Selasky# Autoconf's AC_C_INLINE, at least in autoconf 2.13, isn't good enough, 635b00ab754SHans Petter Selasky# as it just tests whether a function returning "int" can be inlined; 636b00ab754SHans Petter Selasky# at least some versions of HP's C compiler can inline that, but can't 637b00ab754SHans Petter Selasky# inline a function that returns a struct pointer. 638b00ab754SHans Petter Selasky# 639b00ab754SHans Petter Selasky# Make sure we use the V_CCOPT flags, because some of those might 640b00ab754SHans Petter Selasky# disable inlining. 641b00ab754SHans Petter Selasky# 642b00ab754SHans Petter SelaskyAC_DEFUN(AC_LBL_C_INLINE, 643b00ab754SHans Petter Selasky [AC_MSG_CHECKING(for inline) 644b00ab754SHans Petter Selasky save_CFLAGS="$CFLAGS" 645b00ab754SHans Petter Selasky CFLAGS="$V_CCOPT" 646b00ab754SHans Petter Selasky AC_CACHE_VAL(ac_cv_lbl_inline, [ 647b00ab754SHans Petter Selasky ac_cv_lbl_inline="" 648b00ab754SHans Petter Selasky ac_lbl_cc_inline=no 649b00ab754SHans Petter Selasky for ac_lbl_inline in inline __inline__ __inline 650b00ab754SHans Petter Selasky do 651b00ab754SHans Petter Selasky AC_TRY_COMPILE( 652b00ab754SHans Petter Selasky [#define inline $ac_lbl_inline 653b00ab754SHans Petter Selasky static inline struct iltest *foo(void); 654b00ab754SHans Petter Selasky struct iltest { 655b00ab754SHans Petter Selasky int iltest1; 656b00ab754SHans Petter Selasky int iltest2; 657b00ab754SHans Petter Selasky }; 658b00ab754SHans Petter Selasky 659b00ab754SHans Petter Selasky static inline struct iltest * 660b00ab754SHans Petter Selasky foo() 661b00ab754SHans Petter Selasky { 662b00ab754SHans Petter Selasky static struct iltest xxx; 663b00ab754SHans Petter Selasky 664b00ab754SHans Petter Selasky return &xxx; 665b00ab754SHans Petter Selasky }],,ac_lbl_cc_inline=yes,) 666b00ab754SHans Petter Selasky if test "$ac_lbl_cc_inline" = yes ; then 667b00ab754SHans Petter Selasky break; 668b00ab754SHans Petter Selasky fi 669b00ab754SHans Petter Selasky done 670b00ab754SHans Petter Selasky if test "$ac_lbl_cc_inline" = yes ; then 671b00ab754SHans Petter Selasky ac_cv_lbl_inline=$ac_lbl_inline 672b00ab754SHans Petter Selasky fi]) 673b00ab754SHans Petter Selasky CFLAGS="$save_CFLAGS" 674b00ab754SHans Petter Selasky if test ! -z "$ac_cv_lbl_inline" ; then 675b00ab754SHans Petter Selasky AC_MSG_RESULT($ac_cv_lbl_inline) 676b00ab754SHans Petter Selasky else 677b00ab754SHans Petter Selasky AC_MSG_RESULT(no) 678b00ab754SHans Petter Selasky fi 679b00ab754SHans Petter Selasky AC_DEFINE_UNQUOTED(inline, $ac_cv_lbl_inline, [Define as token for inline if inlining supported])]) 680b00ab754SHans Petter Selasky 6816f9cba8fSJoseph Mingrone# 6826f9cba8fSJoseph Mingrone# Test whether we have __atomic_load_n() and __atomic_store_n(). 6836f9cba8fSJoseph Mingrone# 6846f9cba8fSJoseph Mingrone# We use AC_TRY_LINK because AC_TRY_COMPILE will succeed, as the 6856f9cba8fSJoseph Mingrone# compiler will just think that those functions are undefined, 6866f9cba8fSJoseph Mingrone# and perhaps warn about that, but not fail to compile. 6876f9cba8fSJoseph Mingrone# 6886f9cba8fSJoseph MingroneAC_DEFUN(AC_PCAP_C___ATOMICS, 6896f9cba8fSJoseph Mingrone [ 6906f9cba8fSJoseph Mingrone AC_MSG_CHECKING(for __atomic_load_n) 6916f9cba8fSJoseph Mingrone AC_CACHE_VAL(ac_cv_have___atomic_load_n, 6926f9cba8fSJoseph Mingrone AC_TRY_LINK([], 6936f9cba8fSJoseph Mingrone [ 6946f9cba8fSJoseph Mingrone int i = 17; 6956f9cba8fSJoseph Mingrone int j; 6966f9cba8fSJoseph Mingrone j = __atomic_load_n(&i, __ATOMIC_RELAXED); 6976f9cba8fSJoseph Mingrone ], 6986f9cba8fSJoseph Mingrone ac_have___atomic_load_n=yes, 6996f9cba8fSJoseph Mingrone ac_have___atomic_load_n=no)) 7006f9cba8fSJoseph Mingrone AC_MSG_RESULT($ac_have___atomic_load_n) 7016f9cba8fSJoseph Mingrone if test $ac_have___atomic_load_n = yes ; then 7026f9cba8fSJoseph Mingrone AC_DEFINE(HAVE___ATOMIC_LOAD_N, 1, 7036f9cba8fSJoseph Mingrone [define if __atomic_load_n is supported by the compiler]) 7046f9cba8fSJoseph Mingrone fi 7056f9cba8fSJoseph Mingrone 7066f9cba8fSJoseph Mingrone AC_MSG_CHECKING(for __atomic_store_n) 7076f9cba8fSJoseph Mingrone AC_CACHE_VAL(ac_cv_have___atomic_store_n, 7086f9cba8fSJoseph Mingrone AC_TRY_LINK([], 7096f9cba8fSJoseph Mingrone [ 7106f9cba8fSJoseph Mingrone int i; 7116f9cba8fSJoseph Mingrone __atomic_store_n(&i, 17, __ATOMIC_RELAXED); 7126f9cba8fSJoseph Mingrone ], 7136f9cba8fSJoseph Mingrone ac_have___atomic_store_n=yes, 7146f9cba8fSJoseph Mingrone ac_have___atomic_store_n=no)) 7156f9cba8fSJoseph Mingrone AC_MSG_RESULT($ac_have___atomic_store_n) 7166f9cba8fSJoseph Mingrone if test $ac_have___atomic_store_n = yes ; then 7176f9cba8fSJoseph Mingrone AC_DEFINE(HAVE___ATOMIC_STORE_N, 1, 7186f9cba8fSJoseph Mingrone [define if __atomic_store_n is supported by the compiler]) 7196f9cba8fSJoseph Mingrone fi]) 7206f9cba8fSJoseph Mingrone 721b00ab754SHans Petter Selaskydnl 722b00ab754SHans Petter Selaskydnl If using gcc, make sure we have ANSI ioctl definitions 723b00ab754SHans Petter Selaskydnl 724b00ab754SHans Petter Selaskydnl usage: 725b00ab754SHans Petter Selaskydnl 726b00ab754SHans Petter Selaskydnl AC_LBL_FIXINCLUDES 727b00ab754SHans Petter Selaskydnl 728b00ab754SHans Petter SelaskyAC_DEFUN(AC_LBL_FIXINCLUDES, 729b00ab754SHans Petter Selasky [if test "$GCC" = yes ; then 730b00ab754SHans Petter Selasky AC_MSG_CHECKING(for ANSI ioctl definitions) 731b00ab754SHans Petter Selasky AC_CACHE_VAL(ac_cv_lbl_gcc_fixincludes, 732b00ab754SHans Petter Selasky AC_TRY_COMPILE( 733b00ab754SHans Petter Selasky [/* 734b00ab754SHans Petter Selasky * This generates a "duplicate case value" when fixincludes 735b00ab754SHans Petter Selasky * has not be run. 736b00ab754SHans Petter Selasky */ 737b00ab754SHans Petter Selasky# include <sys/types.h> 738b00ab754SHans Petter Selasky# include <sys/time.h> 739b00ab754SHans Petter Selasky# include <sys/ioctl.h> 740b00ab754SHans Petter Selasky# ifdef HAVE_SYS_IOCCOM_H 741b00ab754SHans Petter Selasky# include <sys/ioccom.h> 742b00ab754SHans Petter Selasky# endif], 743b00ab754SHans Petter Selasky [switch (0) { 744b00ab754SHans Petter Selasky case _IO('A', 1):; 745b00ab754SHans Petter Selasky case _IO('B', 1):; 746b00ab754SHans Petter Selasky }], 747b00ab754SHans Petter Selasky ac_cv_lbl_gcc_fixincludes=yes, 748b00ab754SHans Petter Selasky ac_cv_lbl_gcc_fixincludes=no)) 749b00ab754SHans Petter Selasky AC_MSG_RESULT($ac_cv_lbl_gcc_fixincludes) 750b00ab754SHans Petter Selasky if test $ac_cv_lbl_gcc_fixincludes = no ; then 751b00ab754SHans Petter Selasky # Don't cache failure 752b00ab754SHans Petter Selasky unset ac_cv_lbl_gcc_fixincludes 753b00ab754SHans Petter Selasky AC_MSG_ERROR(see the INSTALL for more info) 754b00ab754SHans Petter Selasky fi 755b00ab754SHans Petter Selasky fi]) 756b00ab754SHans Petter Selasky 757b00ab754SHans Petter Selaskydnl 758b00ab754SHans Petter Selaskydnl Checks to see if union wait is used with WEXITSTATUS() 759b00ab754SHans Petter Selaskydnl 760b00ab754SHans Petter Selaskydnl usage: 761b00ab754SHans Petter Selaskydnl 762b00ab754SHans Petter Selaskydnl AC_LBL_UNION_WAIT 763b00ab754SHans Petter Selaskydnl 764b00ab754SHans Petter Selaskydnl results: 765b00ab754SHans Petter Selaskydnl 766b00ab754SHans Petter Selaskydnl DECLWAITSTATUS (defined) 767b00ab754SHans Petter Selaskydnl 768b00ab754SHans Petter SelaskyAC_DEFUN(AC_LBL_UNION_WAIT, 769b00ab754SHans Petter Selasky [AC_MSG_CHECKING(if union wait is used) 770b00ab754SHans Petter Selasky AC_CACHE_VAL(ac_cv_lbl_union_wait, 771b00ab754SHans Petter Selasky AC_TRY_COMPILE([ 772b00ab754SHans Petter Selasky# include <sys/types.h> 773b00ab754SHans Petter Selasky# include <sys/wait.h>], 774b00ab754SHans Petter Selasky [int status; 775b00ab754SHans Petter Selasky u_int i = WEXITSTATUS(status); 776b00ab754SHans Petter Selasky u_int j = waitpid(0, &status, 0);], 777b00ab754SHans Petter Selasky ac_cv_lbl_union_wait=no, 778b00ab754SHans Petter Selasky ac_cv_lbl_union_wait=yes)) 779b00ab754SHans Petter Selasky AC_MSG_RESULT($ac_cv_lbl_union_wait) 780b00ab754SHans Petter Selasky if test $ac_cv_lbl_union_wait = yes ; then 781b00ab754SHans Petter Selasky AC_DEFINE(DECLWAITSTATUS,union wait,[type for wait]) 782b00ab754SHans Petter Selasky else 783b00ab754SHans Petter Selasky AC_DEFINE(DECLWAITSTATUS,int,[type for wait]) 784b00ab754SHans Petter Selasky fi]) 785b00ab754SHans Petter Selasky 786b00ab754SHans Petter Selaskydnl 787b00ab754SHans Petter Selaskydnl Checks to see if -R is used 788b00ab754SHans Petter Selaskydnl 789b00ab754SHans Petter Selaskydnl usage: 790b00ab754SHans Petter Selaskydnl 791b00ab754SHans Petter Selaskydnl AC_LBL_HAVE_RUN_PATH 792b00ab754SHans Petter Selaskydnl 793b00ab754SHans Petter Selaskydnl results: 794b00ab754SHans Petter Selaskydnl 795b00ab754SHans Petter Selaskydnl ac_cv_lbl_have_run_path (yes or no) 796b00ab754SHans Petter Selaskydnl 797b00ab754SHans Petter SelaskyAC_DEFUN(AC_LBL_HAVE_RUN_PATH, 798b00ab754SHans Petter Selasky [AC_MSG_CHECKING(for ${CC-cc} -R) 799b00ab754SHans Petter Selasky AC_CACHE_VAL(ac_cv_lbl_have_run_path, 800b00ab754SHans Petter Selasky [echo 'main(){}' > conftest.c 801b00ab754SHans Petter Selasky ${CC-cc} -o conftest conftest.c -R/a1/b2/c3 >conftest.out 2>&1 802b00ab754SHans Petter Selasky if test ! -s conftest.out ; then 803b00ab754SHans Petter Selasky ac_cv_lbl_have_run_path=yes 804b00ab754SHans Petter Selasky else 805b00ab754SHans Petter Selasky ac_cv_lbl_have_run_path=no 806b00ab754SHans Petter Selasky fi 807b00ab754SHans Petter Selasky rm -f -r conftest*]) 808b00ab754SHans Petter Selasky AC_MSG_RESULT($ac_cv_lbl_have_run_path) 809b00ab754SHans Petter Selasky ]) 810b00ab754SHans Petter Selasky 811b00ab754SHans Petter Selaskydnl 812b00ab754SHans Petter Selaskydnl If the file .devel exists: 813b00ab754SHans Petter Selaskydnl Add some warning flags if the compiler supports them 814b00ab754SHans Petter Selaskydnl If an os prototype include exists, symlink os-proto.h to it 815b00ab754SHans Petter Selaskydnl 816b00ab754SHans Petter Selaskydnl usage: 817b00ab754SHans Petter Selaskydnl 818b00ab754SHans Petter Selaskydnl AC_LBL_DEVEL(copt) 819b00ab754SHans Petter Selaskydnl 820b00ab754SHans Petter Selaskydnl results: 821b00ab754SHans Petter Selaskydnl 822b00ab754SHans Petter Selaskydnl $1 (copt appended) 823b00ab754SHans Petter Selaskydnl HAVE_OS_PROTO_H (defined) 824b00ab754SHans Petter Selaskydnl os-proto.h (symlinked) 825b00ab754SHans Petter Selaskydnl 826b00ab754SHans Petter SelaskyAC_DEFUN(AC_LBL_DEVEL, 827b00ab754SHans Petter Selasky [rm -f os-proto.h 828b00ab754SHans Petter Selasky if test "${LBL_CFLAGS+set}" = set; then 829b00ab754SHans Petter Selasky $1="$$1 ${LBL_CFLAGS}" 830b00ab754SHans Petter Selasky fi 831b00ab754SHans Petter Selasky if test -f .devel ; then 832b00ab754SHans Petter Selasky # 833b00ab754SHans Petter Selasky # Skip all the warning option stuff on some compilers. 834b00ab754SHans Petter Selasky # 835b00ab754SHans Petter Selasky if test "$ac_lbl_cc_dont_try_gcc_dashW" != yes; then 83657e22627SCy Schubert AC_LBL_CHECK_COMPILER_OPT($1, -W) 837b00ab754SHans Petter Selasky AC_LBL_CHECK_COMPILER_OPT($1, -Wall) 838b00ab754SHans Petter Selasky AC_LBL_CHECK_COMPILER_OPT($1, -Wcomma) 839*afdbf109SJoseph Mingrone # Warns about safeguards added in case the enums are 840*afdbf109SJoseph Mingrone # extended 841*afdbf109SJoseph Mingrone # AC_LBL_CHECK_COMPILER_OPT($1, -Wcovered-switch-default) 84257e22627SCy Schubert AC_LBL_CHECK_COMPILER_OPT($1, -Wdocumentation) 84357e22627SCy Schubert AC_LBL_CHECK_COMPILER_OPT($1, -Wformat-nonliteral) 844b00ab754SHans Petter Selasky AC_LBL_CHECK_COMPILER_OPT($1, -Wmissing-noreturn) 84557e22627SCy Schubert AC_LBL_CHECK_COMPILER_OPT($1, -Wmissing-prototypes) 84657e22627SCy Schubert AC_LBL_CHECK_COMPILER_OPT($1, -Wmissing-variable-declarations) 847*afdbf109SJoseph Mingrone AC_LBL_CHECK_COMPILER_OPT($1, -Wnull-pointer-subtraction) 8486f9cba8fSJoseph Mingrone AC_LBL_CHECK_COMPILER_OPT($1, -Wpointer-arith) 8496f9cba8fSJoseph Mingrone AC_LBL_CHECK_COMPILER_OPT($1, -Wpointer-sign) 85057e22627SCy Schubert AC_LBL_CHECK_COMPILER_OPT($1, -Wshadow) 851*afdbf109SJoseph Mingrone AC_LBL_CHECK_COMPILER_OPT($1, -Wshorten-64-to-32) 85257e22627SCy Schubert AC_LBL_CHECK_COMPILER_OPT($1, -Wsign-compare) 85357e22627SCy Schubert AC_LBL_CHECK_COMPILER_OPT($1, -Wstrict-prototypes) 854*afdbf109SJoseph Mingrone AC_LBL_CHECK_COMPILER_OPT($1, -Wundef) 85557e22627SCy Schubert # 85657e22627SCy Schubert # This can cause problems with ntohs(), ntohl(), 85757e22627SCy Schubert # htons(), and htonl() on some platforms, such 85857e22627SCy Schubert # as OpenBSD 6.3 with Clang 5.0.1. I guess the 85957e22627SCy Schubert # problem is that the macro that ultimately does 86057e22627SCy Schubert # the byte-swapping involves a conditional 86157e22627SCy Schubert # expression that tests whether the value being 86257e22627SCy Schubert # swapped is a compile-time constant or not, 86357e22627SCy Schubert # using __builtin_constant_p(), and, depending 86457e22627SCy Schubert # on whether it is, does a compile-time swap or 86557e22627SCy Schubert # a run-time swap; perhaps the compiler always 86657e22627SCy Schubert # considers one of the two results of the 867*afdbf109SJoseph Mingrone # conditional expression is never evaluated, 86857e22627SCy Schubert # because the conditional check is done at 86957e22627SCy Schubert # compile time, and thus always says "that 87057e22627SCy Schubert # expression is never executed". 87157e22627SCy Schubert # 87257e22627SCy Schubert # (Perhaps there should be a way of flagging 87357e22627SCy Schubert # an expression that you *want* evaluated at 87457e22627SCy Schubert # compile time, so that the compiler 1) warns 87557e22627SCy Schubert # if it *can't* be evaluated at compile time 87657e22627SCy Schubert # and 2) *doesn't* warn that the true or false 87757e22627SCy Schubert # branch will never be reached.) 87857e22627SCy Schubert # 87957e22627SCy Schubert AC_LBL_CHECK_COMPILER_OPT($1, -Wunreachable-code, 88057e22627SCy Schubert [ 88157e22627SCy Schubert#include <arpa/inet.h> 88257e22627SCy Schubert 88357e22627SCy Schubertunsigned short 88457e22627SCy Schuberttestme(unsigned short a) 88557e22627SCy Schubert{ 88657e22627SCy Schubert return ntohs(a); 88757e22627SCy Schubert} 88857e22627SCy Schubert ], 88957e22627SCy Schubert [generates warnings from ntohs()]) 890*afdbf109SJoseph Mingrone AC_LBL_CHECK_COMPILER_OPT($1, -Wunused-but-set-parameter) 891*afdbf109SJoseph Mingrone AC_LBL_CHECK_COMPILER_OPT($1, -Wunused-but-set-variable) 892*afdbf109SJoseph Mingrone AC_LBL_CHECK_COMPILER_OPT($1, -Wunused-parameter) 893*afdbf109SJoseph Mingrone AC_LBL_CHECK_COMPILER_OPT($1, -Wused-but-marked-unused) 894b00ab754SHans Petter Selasky fi 895b00ab754SHans Petter Selasky AC_LBL_CHECK_DEPENDENCY_GENERATION_OPT() 896b00ab754SHans Petter Selasky # 897b00ab754SHans Petter Selasky # We used to set -n32 for IRIX 6 when not using GCC (presumed 898b00ab754SHans Petter Selasky # to mean that we're using MIPS C or MIPSpro C); it specified 899b00ab754SHans Petter Selasky # the "new" faster 32-bit ABI, introduced in IRIX 6.2. I'm 900b00ab754SHans Petter Selasky # not sure why that would be something to do *only* with a 901b00ab754SHans Petter Selasky # .devel file; why should the ABI for which we produce code 902b00ab754SHans Petter Selasky # depend on .devel? 903b00ab754SHans Petter Selasky # 904b00ab754SHans Petter Selasky os=`echo $host_os | sed -e 's/\([[0-9]][[0-9]]*\)[[^0-9]].*$/\1/'` 905b00ab754SHans Petter Selasky name="lbl/os-$os.h" 906b00ab754SHans Petter Selasky if test -f $name ; then 907b00ab754SHans Petter Selasky ln -s $name os-proto.h 908b00ab754SHans Petter Selasky AC_DEFINE(HAVE_OS_PROTO_H, 1, 909b00ab754SHans Petter Selasky [if there's an os_proto.h for this platform, to use additional prototypes]) 910b00ab754SHans Petter Selasky else 911b00ab754SHans Petter Selasky AC_MSG_WARN(can't find $name) 912b00ab754SHans Petter Selasky fi 913b00ab754SHans Petter Selasky fi]) 914b00ab754SHans Petter Selasky 915b00ab754SHans Petter Selaskydnl 916b00ab754SHans Petter Selaskydnl Improved version of AC_CHECK_LIB 917b00ab754SHans Petter Selaskydnl 918b00ab754SHans Petter Selaskydnl Thanks to John Hawkinson (jhawk@mit.edu) 919b00ab754SHans Petter Selaskydnl 920b00ab754SHans Petter Selaskydnl usage: 921b00ab754SHans Petter Selaskydnl 922b00ab754SHans Petter Selaskydnl AC_LBL_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [, 923b00ab754SHans Petter Selaskydnl ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) 924b00ab754SHans Petter Selaskydnl 925b00ab754SHans Petter Selaskydnl results: 926b00ab754SHans Petter Selaskydnl 927b00ab754SHans Petter Selaskydnl LIBS 928b00ab754SHans Petter Selaskydnl 929b00ab754SHans Petter Selaskydnl XXX - "AC_LBL_LIBRARY_NET" was redone to use "AC_SEARCH_LIBS" 930b00ab754SHans Petter Selaskydnl rather than "AC_LBL_CHECK_LIB", so this isn't used any more. 931b00ab754SHans Petter Selaskydnl We keep it around for reference purposes in case it's ever 932b00ab754SHans Petter Selaskydnl useful in the future. 933b00ab754SHans Petter Selaskydnl 934b00ab754SHans Petter Selasky 935b00ab754SHans Petter Selaskydefine(AC_LBL_CHECK_LIB, 936b00ab754SHans Petter Selasky[AC_MSG_CHECKING([for $2 in -l$1]) 937b00ab754SHans Petter Selaskydnl Use a cache variable name containing the library, function 938b00ab754SHans Petter Selaskydnl name, and extra libraries to link with, because the test really is 939b00ab754SHans Petter Selaskydnl for library $1 defining function $2, when linked with potinal 940b00ab754SHans Petter Selaskydnl library $5, not just for library $1. Separate tests with the same 941b00ab754SHans Petter Selaskydnl $1 and different $2's or $5's may have different results. 942b00ab754SHans Petter Selaskyac_lib_var=`echo $1['_']$2['_']$5 | sed 'y%./+- %__p__%'` 943b00ab754SHans Petter SelaskyAC_CACHE_VAL(ac_cv_lbl_lib_$ac_lib_var, 944b00ab754SHans Petter Selasky[ac_save_LIBS="$LIBS" 945b00ab754SHans Petter SelaskyLIBS="-l$1 $5 $LIBS" 946b00ab754SHans Petter SelaskyAC_TRY_LINK(dnl 947b00ab754SHans Petter Selaskyifelse([$2], [main], , dnl Avoid conflicting decl of main. 948b00ab754SHans Petter Selasky[/* Override any gcc2 internal prototype to avoid an error. */ 949b00ab754SHans Petter Selasky]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus 950b00ab754SHans Petter Selaskyextern "C" 951b00ab754SHans Petter Selasky#endif 952b00ab754SHans Petter Selasky])dnl 953b00ab754SHans Petter Selasky[/* We use char because int might match the return type of a gcc2 954b00ab754SHans Petter Selasky builtin and then its argument prototype would still apply. */ 955b00ab754SHans Petter Selaskychar $2(); 956b00ab754SHans Petter Selasky]), 957b00ab754SHans Petter Selasky [$2()], 958b00ab754SHans Petter Selasky eval "ac_cv_lbl_lib_$ac_lib_var=yes", 959b00ab754SHans Petter Selasky eval "ac_cv_lbl_lib_$ac_lib_var=no") 960b00ab754SHans Petter SelaskyLIBS="$ac_save_LIBS" 961b00ab754SHans Petter Selasky])dnl 962b00ab754SHans Petter Selaskyif eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then 963b00ab754SHans Petter Selasky AC_MSG_RESULT(yes) 964b00ab754SHans Petter Selasky ifelse([$3], , 965b00ab754SHans Petter Selasky[changequote(, )dnl 966b00ab754SHans Petter Selasky ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ 967b00ab754SHans Petter Selasky -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` 968b00ab754SHans Petter Selaskychangequote([, ])dnl 969b00ab754SHans Petter Selasky AC_DEFINE_UNQUOTED($ac_tr_lib) 970b00ab754SHans Petter Selasky LIBS="-l$1 $LIBS" 971b00ab754SHans Petter Selasky], [$3]) 972b00ab754SHans Petter Selaskyelse 973b00ab754SHans Petter Selasky AC_MSG_RESULT(no) 974b00ab754SHans Petter Selaskyifelse([$4], , , [$4 975b00ab754SHans Petter Selasky])dnl 976b00ab754SHans Petter Selaskyfi 977b00ab754SHans Petter Selasky]) 978b00ab754SHans Petter Selasky 979b00ab754SHans Petter Selaskydnl 980b00ab754SHans Petter Selaskydnl AC_LBL_LIBRARY_NET 981b00ab754SHans Petter Selaskydnl 982*afdbf109SJoseph Mingronednl Look for various networking-related libraries that we may need. 983b00ab754SHans Petter Selaskydnl 984*afdbf109SJoseph Mingronednl We need getaddrinfo() to translate host names in filters to IP 985*afdbf109SJoseph Mingronednl addresses. We use getaddrinfo() because we want a portable 986*afdbf109SJoseph Mingronednl thread-safe way of getting information for a host name or port; 987*afdbf109SJoseph Mingronednl there exist _r versions of gethostbyname() and getservbyname() on 988*afdbf109SJoseph Mingronednl some platforms, but not on all platforms. 989b00ab754SHans Petter Selaskydnl 990*afdbf109SJoseph Mingronednl We may also need socket() and other socket functions to support: 991b00ab754SHans Petter Selaskydnl 992*afdbf109SJoseph Mingronednl Local packet capture with capture mechanisms that use sockets. 993*afdbf109SJoseph Mingronednl 994*afdbf109SJoseph Mingronednl Local capture device enumeration if a socket call is needed to 995*afdbf109SJoseph Mingronednl enumerate devices or get device attributes. 996*afdbf109SJoseph Mingronednl 997*afdbf109SJoseph Mingronednl Packet capture from services that put captured packets on the 998*afdbf109SJoseph Mingronednl network, such as rpcap servers. 999*afdbf109SJoseph Mingronednl 1000*afdbf109SJoseph Mingronednl We may also need getnameinfo() for packet capture from services 1001*afdbf109SJoseph Mingronednl that put packets on the network. 1002b00ab754SHans Petter Selaskydnl 1003b00ab754SHans Petter SelaskyAC_DEFUN(AC_LBL_LIBRARY_NET, [ 1004b00ab754SHans Petter Selasky # 1005*afdbf109SJoseph Mingrone # Most operating systems have getaddrinfo(), and the other routines 1006*afdbf109SJoseph Mingrone # we may need, in the default searched libraries (e.g., libc). 1007*afdbf109SJoseph Mingrone # Check there first. 1008b00ab754SHans Petter Selasky # 1009b00ab754SHans Petter Selasky AC_CHECK_FUNC(getaddrinfo,, 1010b00ab754SHans Petter Selasky [ 1011b00ab754SHans Petter Selasky # 1012b00ab754SHans Petter Selasky # Not found in the standard system libraries. 1013*afdbf109SJoseph Mingrone # 1014*afdbf109SJoseph Mingrone # In some versions of Solaris, we need to link with libsocket 1015*afdbf109SJoseph Mingrone # and libnsl, so check in libsocket and also link with liblnsl 1016*afdbf109SJoseph Mingrone # when doing this test. 1017*afdbf109SJoseph Mingrone # 1018*afdbf109SJoseph Mingrone # Linking with libsocket and libnsl will find all the routines 1019*afdbf109SJoseph Mingrone # we need. 1020b00ab754SHans Petter Selasky # 1021b00ab754SHans Petter Selasky AC_CHECK_LIB(socket, getaddrinfo, 1022b00ab754SHans Petter Selasky [ 1023b00ab754SHans Petter Selasky # 1024b00ab754SHans Petter Selasky # OK, we found it in libsocket. 1025b00ab754SHans Petter Selasky # 1026b00ab754SHans Petter Selasky LIBS="-lsocket -lnsl $LIBS" 1027b00ab754SHans Petter Selasky ], 1028b00ab754SHans Petter Selasky [ 1029b00ab754SHans Petter Selasky # 10306f9cba8fSJoseph Mingrone # Not found in libsocket; test for it in libnetwork, which 10316f9cba8fSJoseph Mingrone # is where it is in Haiku. 10326f9cba8fSJoseph Mingrone # 1033*afdbf109SJoseph Mingrone # Linking with libnetwork will find all the routines we 1034*afdbf109SJoseph Mingrone # need. 1035*afdbf109SJoseph Mingrone # 10366f9cba8fSJoseph Mingrone AC_CHECK_LIB(network, getaddrinfo, 10376f9cba8fSJoseph Mingrone [ 10386f9cba8fSJoseph Mingrone # 10396f9cba8fSJoseph Mingrone # OK, we found it in libnetwork. 10406f9cba8fSJoseph Mingrone # 10416f9cba8fSJoseph Mingrone LIBS="-lnetwork $LIBS" 10426f9cba8fSJoseph Mingrone ], 10436f9cba8fSJoseph Mingrone [ 10446f9cba8fSJoseph Mingrone # 1045b00ab754SHans Petter Selasky # We didn't find it. 1046b00ab754SHans Petter Selasky # 1047b00ab754SHans Petter Selasky AC_MSG_ERROR([getaddrinfo is required, but wasn't found]) 10486f9cba8fSJoseph Mingrone ]) 1049b00ab754SHans Petter Selasky ], -lnsl) 1050b00ab754SHans Petter Selasky 1051b00ab754SHans Petter Selasky # 1052*afdbf109SJoseph Mingrone # We require a version of recvmsg() that conforms to the Single 1053*afdbf109SJoseph Mingrone # UNIX Specification, so that we can check whether a datagram 1054*afdbf109SJoseph Mingrone # received with recvmsg() was truncated when received due to the 1055*afdbf109SJoseph Mingrone # buffer being too small. 1056*afdbf109SJoseph Mingrone # 1057*afdbf109SJoseph Mingrone # On most systems, the version of recvmsg() in the libraries 1058*afdbf109SJoseph Mingrone # found above conforms to the SUS. 1059*afdbf109SJoseph Mingrone # 1060*afdbf109SJoseph Mingrone # On at least some versions of Solaris, it does not conform to 1061*afdbf109SJoseph Mingrone # the SUS, and we need the version in libxnet, which does 1062*afdbf109SJoseph Mingrone # conform. 1063*afdbf109SJoseph Mingrone # 1064*afdbf109SJoseph Mingrone # Check whether libxnet exists and has a version of recvmsg(); 1065*afdbf109SJoseph Mingrone # if it does, link with libxnet before we link with libsocket, 1066*afdbf109SJoseph Mingrone # to get that version. 1067*afdbf109SJoseph Mingrone # 1068*afdbf109SJoseph Mingrone # This test also links with libsocket and libnsl. 1069b00ab754SHans Petter Selasky # 1070b00ab754SHans Petter Selasky AC_CHECK_LIB(xnet, recvmsg, 1071b00ab754SHans Petter Selasky [ 1072b00ab754SHans Petter Selasky # 1073*afdbf109SJoseph Mingrone # libxnet has recvmsg(); link with it as well. 1074b00ab754SHans Petter Selasky # 1075b00ab754SHans Petter Selasky LIBS="-lxnet $LIBS" 1076b00ab754SHans Petter Selasky ], , -lsocket -lnsl) 1077b00ab754SHans Petter Selasky ]) 1078*afdbf109SJoseph Mingrone 1079*afdbf109SJoseph Mingrone # 1080*afdbf109SJoseph Mingrone # DLPI needs putmsg under HP-UX, so test for -lstr while we're at it. 1081*afdbf109SJoseph Mingrone # 1082b00ab754SHans Petter Selasky AC_SEARCH_LIBS(putmsg, str) 1083b00ab754SHans Petter Selasky]) 10846f9cba8fSJoseph Mingrone 10856f9cba8fSJoseph Mingronem4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) 10866f9cba8fSJoseph Mingronednl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- 10876f9cba8fSJoseph Mingronednl serial 11 (pkg-config-0.29) 10886f9cba8fSJoseph Mingronednl 10896f9cba8fSJoseph Mingronednl Copyright © 2004 Scott James Remnant <scott@netsplit.com>. 10906f9cba8fSJoseph Mingronednl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com> 10916f9cba8fSJoseph Mingronednl 10926f9cba8fSJoseph Mingronednl This program is free software; you can redistribute it and/or modify 10936f9cba8fSJoseph Mingronednl it under the terms of the GNU General Public License as published by 10946f9cba8fSJoseph Mingronednl the Free Software Foundation; either version 2 of the License, or 10956f9cba8fSJoseph Mingronednl (at your option) any later version. 10966f9cba8fSJoseph Mingronednl 10976f9cba8fSJoseph Mingronednl This program is distributed in the hope that it will be useful, but 10986f9cba8fSJoseph Mingronednl WITHOUT ANY WARRANTY; without even the implied warranty of 10996f9cba8fSJoseph Mingronednl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11006f9cba8fSJoseph Mingronednl General Public License for more details. 11016f9cba8fSJoseph Mingronednl 11026f9cba8fSJoseph Mingronednl You should have received a copy of the GNU General Public License 11036f9cba8fSJoseph Mingronednl along with this program; if not, write to the Free Software 11046f9cba8fSJoseph Mingronednl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 11056f9cba8fSJoseph Mingronednl 02111-1307, USA. 11066f9cba8fSJoseph Mingronednl 11076f9cba8fSJoseph Mingronednl As a special exception to the GNU General Public License, if you 11086f9cba8fSJoseph Mingronednl distribute this file as part of a program that contains a 11096f9cba8fSJoseph Mingronednl configuration script generated by Autoconf, you may include it under 11106f9cba8fSJoseph Mingronednl the same distribution terms that you use for the rest of that 11116f9cba8fSJoseph Mingronednl program. 11126f9cba8fSJoseph Mingrone 11136f9cba8fSJoseph Mingronednl PKG_PREREQ(MIN-VERSION) 11146f9cba8fSJoseph Mingronednl ----------------------- 11156f9cba8fSJoseph Mingronednl Since: 0.29 11166f9cba8fSJoseph Mingronednl 11176f9cba8fSJoseph Mingronednl Verify that the version of the pkg-config macros are at least 11186f9cba8fSJoseph Mingronednl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's 11196f9cba8fSJoseph Mingronednl installed version of pkg-config, this checks the developer's version 11206f9cba8fSJoseph Mingronednl of pkg.m4 when generating configure. 11216f9cba8fSJoseph Mingronednl 11226f9cba8fSJoseph Mingronednl To ensure that this macro is defined, also add: 11236f9cba8fSJoseph Mingronednl m4_ifndef([PKG_PREREQ], 11246f9cba8fSJoseph Mingronednl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) 11256f9cba8fSJoseph Mingronednl 11266f9cba8fSJoseph Mingronednl See the "Since" comment for each macro you use to see what version 11276f9cba8fSJoseph Mingronednl of the macros you require. 11286f9cba8fSJoseph Mingronem4_defun([PKG_PREREQ], 11296f9cba8fSJoseph Mingrone[m4_define([PKG_MACROS_VERSION], [0.29]) 11306f9cba8fSJoseph Mingronem4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, 11316f9cba8fSJoseph Mingrone [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) 11326f9cba8fSJoseph Mingrone])dnl PKG_PREREQ 11336f9cba8fSJoseph Mingrone 11346f9cba8fSJoseph Mingronednl PKG_PROG_PKG_CONFIG([MIN-VERSION]) 11356f9cba8fSJoseph Mingronednl ---------------------------------- 11366f9cba8fSJoseph Mingronednl Since: 0.16 11376f9cba8fSJoseph Mingronednl 11386f9cba8fSJoseph Mingronednl Search for the pkg-config tool and set the PKG_CONFIG variable to 11396f9cba8fSJoseph Mingronednl first found in the path. Checks that the version of pkg-config found 1140dd744a89SJoseph Mingronednl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.17.0 is 1141dd744a89SJoseph Mingronednl used since that's the first version where --static was supported. 11426f9cba8fSJoseph MingroneAC_DEFUN([PKG_PROG_PKG_CONFIG], 11436f9cba8fSJoseph Mingrone[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) 11446f9cba8fSJoseph Mingronem4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) 11456f9cba8fSJoseph Mingronem4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) 11466f9cba8fSJoseph MingroneAC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) 11476f9cba8fSJoseph MingroneAC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) 11486f9cba8fSJoseph MingroneAC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) 11496f9cba8fSJoseph Mingrone 11506f9cba8fSJoseph Mingroneif test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then 11516f9cba8fSJoseph Mingrone AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) 11526f9cba8fSJoseph Mingronefi 11536f9cba8fSJoseph Mingroneif test -n "$PKG_CONFIG"; then 1154dd744a89SJoseph Mingrone _pkg_min_version=m4_default([$1], [0.17.0]) 11556f9cba8fSJoseph Mingrone AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) 11566f9cba8fSJoseph Mingrone if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then 11576f9cba8fSJoseph Mingrone AC_MSG_RESULT([yes]) 11586f9cba8fSJoseph Mingrone else 11596f9cba8fSJoseph Mingrone AC_MSG_RESULT([no]) 11606f9cba8fSJoseph Mingrone PKG_CONFIG="" 11616f9cba8fSJoseph Mingrone fi 11626f9cba8fSJoseph Mingronefi[]dnl 11636f9cba8fSJoseph Mingrone])dnl PKG_PROG_PKG_CONFIG 11646f9cba8fSJoseph Mingrone 1165*afdbf109SJoseph Mingronednl PKG_CHECK_EXISTS(MODULE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 11666f9cba8fSJoseph Mingronednl ------------------------------------------------------------------- 11676f9cba8fSJoseph Mingronednl Since: 0.18 11686f9cba8fSJoseph Mingronednl 1169*afdbf109SJoseph Mingronednl Check to see whether a particular module exists. Similar to 1170*afdbf109SJoseph Mingronednl PKG_CHECK_MODULE(), but does not set variables or print errors. 11716f9cba8fSJoseph MingroneAC_DEFUN([PKG_CHECK_EXISTS], 11726f9cba8fSJoseph Mingrone[ 11736f9cba8fSJoseph Mingroneif test -n "$PKG_CONFIG" && \ 11746f9cba8fSJoseph Mingrone AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then 11756f9cba8fSJoseph Mingrone m4_default([$2], [:]) 11766f9cba8fSJoseph Mingronem4_ifvaln([$3], [else 11776f9cba8fSJoseph Mingrone $3])dnl 11786f9cba8fSJoseph Mingronefi]) 11796f9cba8fSJoseph Mingrone 1180*afdbf109SJoseph Mingronednl _PKG_CONFIG_WITH_FLAGS([VARIABLE], [FLAGS], [MODULE]) 1181*afdbf109SJoseph Mingronednl --------------------------------------------- 1182*afdbf109SJoseph Mingronednl Internal wrapper calling pkg-config via PKG_CONFIG and, if 1183*afdbf109SJoseph Mingronednl pkg-config fails, reporting the error and quitting. 1184*afdbf109SJoseph Mingronem4_define([_PKG_CONFIG_WITH_FLAGS], 1185*afdbf109SJoseph Mingrone[if test ! -n "$$1"; then 1186*afdbf109SJoseph Mingrone $1=`$PKG_CONFIG $2 "$3" 2>/dev/null` 1187*afdbf109SJoseph Mingrone if test "x$?" != "x0"; then 1188*afdbf109SJoseph Mingrone # 1189*afdbf109SJoseph Mingrone # That failed - report an error. 1190*afdbf109SJoseph Mingrone # Re-run the command, telling pkg-config to print an error 1191*afdbf109SJoseph Mingrone # message, capture the error message, and report it. 1192*afdbf109SJoseph Mingrone # This causes the configuration script to fail, as it means 1193*afdbf109SJoseph Mingrone # the script is almost certainly doing something wrong. 1194*afdbf109SJoseph Mingrone # 1195*afdbf109SJoseph Mingrone _PKG_SHORT_ERRORS_SUPPORTED 1196*afdbf109SJoseph Mingrone if test $_pkg_short_errors_supported = yes; then 1197*afdbf109SJoseph Mingrone _pkg_error_string=`$PKG_CONFIG --short-errors --print-errors $2 "$3" 2>&1` 1198*afdbf109SJoseph Mingrone else 1199*afdbf109SJoseph Mingrone _pkg_error_string=`$PKG_CONFIG --print-errors $2 "$3" 2>&1` 1200*afdbf109SJoseph Mingrone fi 1201*afdbf109SJoseph Mingrone AC_MSG_ERROR([$PKG_CONFIG $2 "$3" failed: $_pkg_error_string]) 1202*afdbf109SJoseph Mingrone fi 1203*afdbf109SJoseph Mingrone fi[]dnl 1204*afdbf109SJoseph Mingrone])dnl _PKG_CONFIG_WITH_FLAGS 1205*afdbf109SJoseph Mingrone 1206*afdbf109SJoseph Mingrone 1207*afdbf109SJoseph Mingronednl _PKG_CONFIG([VARIABLE], [FLAGS], [MODULE]) 12086f9cba8fSJoseph Mingronednl --------------------------------------------- 12096f9cba8fSJoseph Mingronednl Internal wrapper calling pkg-config via PKG_CONFIG and setting 12106f9cba8fSJoseph Mingronednl pkg_failed based on the result. 12116f9cba8fSJoseph Mingronem4_define([_PKG_CONFIG], 12126f9cba8fSJoseph Mingrone[if test -n "$$1"; then 12136f9cba8fSJoseph Mingrone pkg_cv_[]$1="$$1" 12146f9cba8fSJoseph Mingrone elif test -n "$PKG_CONFIG"; then 12156f9cba8fSJoseph Mingrone PKG_CHECK_EXISTS([$3], 12166f9cba8fSJoseph Mingrone [pkg_cv_[]$1=`$PKG_CONFIG $2 "$3" 2>/dev/null` 12176f9cba8fSJoseph Mingrone test "x$?" != "x0" && pkg_failed=yes ], 12186f9cba8fSJoseph Mingrone [pkg_failed=yes]) 12196f9cba8fSJoseph Mingrone else 12206f9cba8fSJoseph Mingrone pkg_failed=untried 12216f9cba8fSJoseph Mingronefi[]dnl 12226f9cba8fSJoseph Mingrone])dnl _PKG_CONFIG 12236f9cba8fSJoseph Mingrone 12246f9cba8fSJoseph Mingronednl _PKG_SHORT_ERRORS_SUPPORTED 12256f9cba8fSJoseph Mingronednl --------------------------- 12266f9cba8fSJoseph Mingronednl Internal check to see if pkg-config supports short errors. 12276f9cba8fSJoseph MingroneAC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], 12286f9cba8fSJoseph Mingrone[ 12296f9cba8fSJoseph Mingroneif $PKG_CONFIG --atleast-pkgconfig-version 0.20; then 12306f9cba8fSJoseph Mingrone _pkg_short_errors_supported=yes 12316f9cba8fSJoseph Mingroneelse 12326f9cba8fSJoseph Mingrone _pkg_short_errors_supported=no 12336f9cba8fSJoseph Mingronefi[]dnl 12346f9cba8fSJoseph Mingrone])dnl _PKG_SHORT_ERRORS_SUPPORTED 12356f9cba8fSJoseph Mingrone 12366f9cba8fSJoseph Mingrone 1237*afdbf109SJoseph Mingronednl PKG_CHECK_MODULE(VARIABLE-PREFIX, MODULE, [ACTION-IF-FOUND], 12386f9cba8fSJoseph Mingronednl [ACTION-IF-NOT-FOUND]) 12396f9cba8fSJoseph Mingronednl -------------------------------------------------------------- 12406f9cba8fSJoseph Mingronednl Since: 0.4.0 1241*afdbf109SJoseph MingroneAC_DEFUN([PKG_CHECK_MODULE], 12426f9cba8fSJoseph Mingrone[ 1243*afdbf109SJoseph MingroneAC_MSG_CHECKING([for $2 with pkg-config]) 1244*afdbf109SJoseph Mingroneif test -n "$PKG_CONFIG"; then 12456f9cba8fSJoseph Mingrone AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $2, overriding pkg-config])dnl 12466f9cba8fSJoseph Mingrone AC_ARG_VAR([$1][_LIBS], [linker flags for $2, overriding pkg-config])dnl 12476f9cba8fSJoseph Mingrone AC_ARG_VAR([$1][_LIBS_STATIC], [static-link linker flags for $2, overriding pkg-config])dnl 12486f9cba8fSJoseph Mingrone 1249*afdbf109SJoseph Mingrone if AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$2"]); then 12506f9cba8fSJoseph Mingrone # 12516f9cba8fSJoseph Mingrone # The package was found, so try to get its C flags and 12526f9cba8fSJoseph Mingrone # libraries. 12536f9cba8fSJoseph Mingrone # 12546f9cba8fSJoseph Mingrone AC_MSG_RESULT([found]) 1255*afdbf109SJoseph Mingrone _PKG_CONFIG_WITH_FLAGS([$1][_CFLAGS], [--cflags], [$2]) 1256*afdbf109SJoseph Mingrone _PKG_CONFIG_WITH_FLAGS([$1][_LIBS], [--libs], [$2]) 1257*afdbf109SJoseph Mingrone _PKG_CONFIG_WITH_FLAGS([$1][_LIBS_STATIC], [--libs --static], [$2]) 1258*afdbf109SJoseph Mingrone m4_default([$3], [:]) 1259*afdbf109SJoseph Mingrone else 12606f9cba8fSJoseph Mingrone AC_MSG_RESULT([not found]) 1261*afdbf109SJoseph Mingrone m4_default([$4], [:]) 1262*afdbf109SJoseph Mingrone fi 1263*afdbf109SJoseph Mingroneelse 1264*afdbf109SJoseph Mingrone # No pkg-config, so obviously not found with pkg-config. 1265*afdbf109SJoseph Mingrone AC_MSG_RESULT([pkg-config not found]) 1266*afdbf109SJoseph Mingrone m4_default([$4], [:]) 1267*afdbf109SJoseph Mingronefi 1268*afdbf109SJoseph Mingrone])dnl PKG_CHECK_MODULE 12696f9cba8fSJoseph Mingrone 12706f9cba8fSJoseph Mingrone 1271*afdbf109SJoseph Mingronednl PKG_CHECK_MODULE_STATIC(VARIABLE-PREFIX, MODULE, [ACTION-IF-FOUND], 12726f9cba8fSJoseph Mingronednl [ACTION-IF-NOT-FOUND]) 12736f9cba8fSJoseph Mingronednl --------------------------------------------------------------------- 12746f9cba8fSJoseph Mingronednl Since: 0.29 12756f9cba8fSJoseph Mingronednl 1276*afdbf109SJoseph Mingronednl Checks for existence of MODULE and gathers its build flags with 12776f9cba8fSJoseph Mingronednl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags 12786f9cba8fSJoseph Mingronednl and VARIABLE-PREFIX_LIBS from --libs. 1279*afdbf109SJoseph MingroneAC_DEFUN([PKG_CHECK_MODULE_STATIC], 12806f9cba8fSJoseph Mingrone[ 12816f9cba8fSJoseph Mingrone_save_PKG_CONFIG=$PKG_CONFIG 12826f9cba8fSJoseph MingronePKG_CONFIG="$PKG_CONFIG --static" 1283*afdbf109SJoseph MingronePKG_CHECK_MODULE($@) 12846f9cba8fSJoseph MingronePKG_CONFIG=$_save_PKG_CONFIG[]dnl 1285*afdbf109SJoseph Mingrone])dnl PKG_CHECK_MODULE_STATIC 12866f9cba8fSJoseph Mingrone 12876f9cba8fSJoseph Mingrone 12886f9cba8fSJoseph Mingronednl PKG_INSTALLDIR([DIRECTORY]) 12896f9cba8fSJoseph Mingronednl ------------------------- 12906f9cba8fSJoseph Mingronednl Since: 0.27 12916f9cba8fSJoseph Mingronednl 12926f9cba8fSJoseph Mingronednl Substitutes the variable pkgconfigdir as the location where a module 12936f9cba8fSJoseph Mingronednl should install pkg-config .pc files. By default the directory is 12946f9cba8fSJoseph Mingronednl $libdir/pkgconfig, but the default can be changed by passing 12956f9cba8fSJoseph Mingronednl DIRECTORY. The user can override through the --with-pkgconfigdir 12966f9cba8fSJoseph Mingronednl parameter. 12976f9cba8fSJoseph MingroneAC_DEFUN([PKG_INSTALLDIR], 12986f9cba8fSJoseph Mingrone[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) 12996f9cba8fSJoseph Mingronem4_pushdef([pkg_description], 13006f9cba8fSJoseph Mingrone [pkg-config installation directory @<:@]pkg_default[@:>@]) 13016f9cba8fSJoseph MingroneAC_ARG_WITH([pkgconfigdir], 13026f9cba8fSJoseph Mingrone [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, 13036f9cba8fSJoseph Mingrone [with_pkgconfigdir=]pkg_default) 13046f9cba8fSJoseph MingroneAC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) 13056f9cba8fSJoseph Mingronem4_popdef([pkg_default]) 13066f9cba8fSJoseph Mingronem4_popdef([pkg_description]) 13076f9cba8fSJoseph Mingrone])dnl PKG_INSTALLDIR 13086f9cba8fSJoseph Mingrone 13096f9cba8fSJoseph Mingrone 13106f9cba8fSJoseph Mingronednl PKG_NOARCH_INSTALLDIR([DIRECTORY]) 13116f9cba8fSJoseph Mingronednl -------------------------------- 13126f9cba8fSJoseph Mingronednl Since: 0.27 13136f9cba8fSJoseph Mingronednl 13146f9cba8fSJoseph Mingronednl Substitutes the variable noarch_pkgconfigdir as the location where a 13156f9cba8fSJoseph Mingronednl module should install arch-independent pkg-config .pc files. By 13166f9cba8fSJoseph Mingronednl default the directory is $datadir/pkgconfig, but the default can be 13176f9cba8fSJoseph Mingronednl changed by passing DIRECTORY. The user can override through the 13186f9cba8fSJoseph Mingronednl --with-noarch-pkgconfigdir parameter. 13196f9cba8fSJoseph MingroneAC_DEFUN([PKG_NOARCH_INSTALLDIR], 13206f9cba8fSJoseph Mingrone[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) 13216f9cba8fSJoseph Mingronem4_pushdef([pkg_description], 13226f9cba8fSJoseph Mingrone [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) 13236f9cba8fSJoseph MingroneAC_ARG_WITH([noarch-pkgconfigdir], 13246f9cba8fSJoseph Mingrone [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, 13256f9cba8fSJoseph Mingrone [with_noarch_pkgconfigdir=]pkg_default) 13266f9cba8fSJoseph MingroneAC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) 13276f9cba8fSJoseph Mingronem4_popdef([pkg_default]) 13286f9cba8fSJoseph Mingronem4_popdef([pkg_description]) 13296f9cba8fSJoseph Mingrone])dnl PKG_NOARCH_INSTALLDIR 13306f9cba8fSJoseph Mingrone 13316f9cba8fSJoseph Mingrone 13326f9cba8fSJoseph Mingronednl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, 13336f9cba8fSJoseph Mingronednl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 13346f9cba8fSJoseph Mingronednl ------------------------------------------- 13356f9cba8fSJoseph Mingronednl Since: 0.28 13366f9cba8fSJoseph Mingronednl 13376f9cba8fSJoseph Mingronednl Retrieves the value of the pkg-config variable for the given module. 13386f9cba8fSJoseph MingroneAC_DEFUN([PKG_CHECK_VAR], 13396f9cba8fSJoseph Mingrone[ 13406f9cba8fSJoseph MingroneAC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl 13416f9cba8fSJoseph Mingrone 13426f9cba8fSJoseph Mingrone_PKG_CONFIG([$1], [--variable="][$3]["], [$2]) 13436f9cba8fSJoseph MingroneAS_VAR_COPY([$1], [pkg_cv_][$1]) 13446f9cba8fSJoseph Mingrone 13456f9cba8fSJoseph MingroneAS_VAR_IF([$1], [""], [$5], [$4])dnl 13466f9cba8fSJoseph Mingrone])dnl PKG_CHECK_VAR 1347