Uwe Hermann | 43e5747 | 2011-12-30 11:23:22 +0100 | [diff] [blame] | 1 | ## |
Uwe Hermann | 630293b | 2013-04-23 22:10:41 +0200 | [diff] [blame] | 2 | ## This file is part of the sigrok-cli project. |
Uwe Hermann | 43e5747 | 2011-12-30 11:23:22 +0100 | [diff] [blame] | 3 | ## |
| 4 | ## Copyright (C) 2010 Bert Vermeulen <bert@biot.com> |
| 5 | ## |
| 6 | ## This program is free software: you can redistribute it and/or modify |
| 7 | ## it under the terms of the GNU General Public License as published by |
| 8 | ## the Free Software Foundation, either version 3 of the License, or |
| 9 | ## (at your option) any later version. |
| 10 | ## |
| 11 | ## This program is distributed in the hope that it will be useful, |
| 12 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | ## GNU General Public License for more details. |
| 15 | ## |
| 16 | ## You should have received a copy of the GNU General Public License |
| 17 | ## along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | ## |
| 19 | |
Uwe Hermann | 2658103 | 2012-01-28 21:26:56 +0100 | [diff] [blame] | 20 | # We require at least autoconf 2.63 (AC_INIT format changed there). |
| 21 | AC_PREREQ([2.63]) |
Uwe Hermann | 43e5747 | 2011-12-30 11:23:22 +0100 | [diff] [blame] | 22 | |
Uwe Hermann | b6479f7 | 2013-05-04 21:37:41 +0200 | [diff] [blame^] | 23 | AC_INIT([sigrok-cli], [0.4.0], [sigrok-devel@lists.sourceforge.net], |
Bert Vermeulen | de0a066 | 2013-03-12 22:49:16 +0100 | [diff] [blame] | 24 | [sigrok-cli], [http://www.sigrok.org]) |
Uwe Hermann | 43e5747 | 2011-12-30 11:23:22 +0100 | [diff] [blame] | 25 | |
| 26 | AC_CONFIG_SRCDIR([sigrok-cli.c]) |
| 27 | |
| 28 | AC_CONFIG_HEADERS([config.h]) |
Uwe Hermann | d04f8fd | 2012-01-03 21:55:48 +0100 | [diff] [blame] | 29 | AC_CONFIG_MACRO_DIR([autostuff]) |
| 30 | AC_CONFIG_AUX_DIR([autostuff]) |
Uwe Hermann | 43e5747 | 2011-12-30 11:23:22 +0100 | [diff] [blame] | 31 | |
Uwe Hermann | 2658103 | 2012-01-28 21:26:56 +0100 | [diff] [blame] | 32 | # We require at least automake 1.11 (needed for 'silent rules'). |
Uwe Hermann | 82dad9a | 2013-03-17 13:09:35 +0100 | [diff] [blame] | 33 | AM_INIT_AUTOMAKE([1.11 -Wall -Werror std-options check-news]) |
Uwe Hermann | 43e5747 | 2011-12-30 11:23:22 +0100 | [diff] [blame] | 34 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
Pekka Nikander | 04ef707 | 2012-05-11 19:23:21 +0300 | [diff] [blame] | 35 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) |
Uwe Hermann | 43e5747 | 2011-12-30 11:23:22 +0100 | [diff] [blame] | 36 | |
Uwe Hermann | 9142511 | 2012-01-04 00:49:06 +0100 | [diff] [blame] | 37 | AH_TOP([#ifndef SIGROK_CLI_CONFIG_H |
Uwe Hermann | 43e5747 | 2011-12-30 11:23:22 +0100 | [diff] [blame] | 38 | #define SIGROK_CLI_CONFIG_H /* To stop multiple inclusions. */]) |
| 39 | AH_BOTTOM([#endif /* SIGROK_CLI_CONFIG_H */]) |
| 40 | |
Uwe Hermann | 12ea952 | 2012-12-28 17:30:56 +0100 | [diff] [blame] | 41 | # Enable more compiler warnings via -Wall and -Wextra. |
| 42 | CFLAGS="$CFLAGS -Wall -Wextra" |
Uwe Hermann | 43e5747 | 2011-12-30 11:23:22 +0100 | [diff] [blame] | 43 | |
| 44 | # Checks for programs. |
| 45 | AC_PROG_CC |
| 46 | AC_PROG_CPP |
| 47 | AC_PROG_INSTALL |
| 48 | AC_PROG_LN_S |
| 49 | |
| 50 | # Initialize libtool. |
| 51 | LT_INIT |
| 52 | |
| 53 | # Initialize pkg-config. |
| 54 | # We require at least 0.22, as "Requires.private" behaviour changed there. |
| 55 | PKG_PROG_PKG_CONFIG([0.22]) |
| 56 | |
| 57 | # Checks for libraries. |
Bert Vermeulen | de0a066 | 2013-03-12 22:49:16 +0100 | [diff] [blame] | 58 | AC_ARG_WITH([libsigrokdecode], |
| 59 | AS_HELP_STRING([--with-libsigrokdecode], |
| 60 | [compile with libsigrokdecode support]), |
| 61 | [WITH_SRD=$enableval],[WITH_SRD=yes]) |
| 62 | AM_CONDITIONAL(WITH_SRD, test x$WITH_SRD = xyes) |
Uwe Hermann | 43e5747 | 2011-12-30 11:23:22 +0100 | [diff] [blame] | 63 | |
Bert Vermeulen | 366237a | 2012-06-23 01:17:36 +0200 | [diff] [blame] | 64 | AM_PATH_GLIB_2_0([2.28.0], |
Bert Vermeulen | de0a066 | 2013-03-12 22:49:16 +0100 | [diff] [blame] | 65 | [CFLAGS="$CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"]) |
Uwe Hermann | 81f487d | 2012-01-04 03:09:20 +0100 | [diff] [blame] | 66 | |
Uwe Hermann | 6deff8e | 2012-06-01 00:23:47 +0200 | [diff] [blame] | 67 | PKG_CHECK_MODULES([libsigrok], [libsigrok >= 0.2.0], |
Uwe Hermann | 43e5747 | 2011-12-30 11:23:22 +0100 | [diff] [blame] | 68 | [CFLAGS="$CFLAGS $libsigrok_CFLAGS"; |
| 69 | LIBS="$LIBS $libsigrok_LIBS"]) |
| 70 | |
Bert Vermeulen | de0a066 | 2013-03-12 22:49:16 +0100 | [diff] [blame] | 71 | if test "x$WITH_SRD" = "xyes"; then |
Uwe Hermann | 7091896 | 2013-05-03 19:53:09 +0200 | [diff] [blame] | 72 | PKG_CHECK_MODULES([libsigrokdecode], [libsigrokdecode >= 0.2.0], |
Bert Vermeulen | de0a066 | 2013-03-12 22:49:16 +0100 | [diff] [blame] | 73 | [CFLAGS="$CFLAGS $libsigrokdecode_CFLAGS"; |
| 74 | LIBS="$LIBS $libsigrokdecode_LIBS"; |
| 75 | AC_DEFINE(HAVE_SRD, [1], [libsigrokdecode is available.])] |
| 76 | ) |
| 77 | fi |
Uwe Hermann | 43e5747 | 2011-12-30 11:23:22 +0100 | [diff] [blame] | 78 | |
| 79 | # Checks for header files. |
| 80 | # These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h. |
| 81 | AC_CHECK_HEADERS([sys/time.h termios.h]) |
| 82 | |
| 83 | # Checks for typedefs, structures, and compiler characteristics. |
| 84 | AC_C_INLINE |
| 85 | AC_TYPE_INT8_T |
| 86 | AC_TYPE_INT16_T |
| 87 | AC_TYPE_INT32_T |
| 88 | AC_TYPE_INT64_T |
| 89 | AC_TYPE_UINT8_T |
| 90 | AC_TYPE_UINT16_T |
| 91 | AC_TYPE_UINT32_T |
| 92 | AC_TYPE_UINT64_T |
| 93 | AC_TYPE_SIZE_T |
| 94 | |
| 95 | # Checks for library functions. |
| 96 | AC_CHECK_FUNCS([strcasecmp strchr strerror strstr strtol]) |
| 97 | |
| 98 | AC_SUBST(MAKEFLAGS, '--no-print-directory') |
| 99 | AC_SUBST(AM_LIBTOOLFLAGS, '--silent') |
| 100 | |
| 101 | AC_CONFIG_FILES([Makefile |
Uwe Hermann | 2c45d10 | 2012-02-06 21:39:13 +0100 | [diff] [blame] | 102 | contrib/Makefile |
| 103 | contrib/sigrok-cli.nsi |
Uwe Hermann | 58b0362 | 2013-04-22 13:46:13 +0200 | [diff] [blame] | 104 | contrib/sigrok-cli_cross.nsi |
Uwe Hermann | 43e5747 | 2011-12-30 11:23:22 +0100 | [diff] [blame] | 105 | doc/Makefile]) |
| 106 | |
| 107 | AC_OUTPUT |
| 108 | |
Uwe Hermann | 81f487d | 2012-01-04 03:09:20 +0100 | [diff] [blame] | 109 | echo |
| 110 | echo "sigrok-cli configuration summary:" |
| 111 | echo |
| 112 | echo " - Package version: $VERSION" |
| 113 | echo " - Prefix: $prefix" |
Uwe Hermann | 397969a | 2013-04-15 12:30:31 +0200 | [diff] [blame] | 114 | echo " - Building on: $build" |
| 115 | echo " - Building for: $host" |
Uwe Hermann | 81f487d | 2012-01-04 03:09:20 +0100 | [diff] [blame] | 116 | echo |
| 117 | echo "Detected libraries:" |
| 118 | echo |
| 119 | |
| 120 | # Note: This only works for libs with pkg-config integration. |
Uwe Hermann | 7091896 | 2013-05-03 19:53:09 +0200 | [diff] [blame] | 121 | for lib in "glib-2.0 >= 2.28.0" "libsigrok >= 0.2.0" "libsigrokdecode >= 0.2.0"; do |
Bert Vermeulen | de0a066 | 2013-03-12 22:49:16 +0100 | [diff] [blame] | 122 | if test "$lib" = "libsigrokdecode" -a "$WITH_SRD" != "yes" ; then |
| 123 | answer="no" |
| 124 | else |
| 125 | if `$PKG_CONFIG --exists $lib`; then |
| 126 | ver=`$PKG_CONFIG --modversion $lib` |
| 127 | answer="yes ($ver)" |
| 128 | else |
| 129 | answer="no" |
| 130 | fi |
| 131 | fi |
| 132 | echo " - $lib: $answer" |
Uwe Hermann | 81f487d | 2012-01-04 03:09:20 +0100 | [diff] [blame] | 133 | done |
| 134 | |
| 135 | echo |
| 136 | |