build: make the "rpm" rule work once again
[iwhd.git] / configure.ac
blobbfd6f5d29976c558b0090717b81d962b43a6c6f1
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 # Copyright (C) 1991, 1993-2010 Red Hat, Inc.
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.
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.
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/>.
19 AC_PREREQ([2.65])
20 AC_INIT([iwhd],
21         m4_esyscmd([build-aux/git-version-gen .tarball-version]),
22         [iwhd-devel@fedorahosted.org])
23 AC_CONFIG_AUX_DIR([build-aux])
25 AC_CONFIG_HEADERS([config.h:config.hin])
26 AM_INIT_AUTOMAKE([1.11.1 color-tests parallel-tests])
27 AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
29 # Checks for programs.
30 AC_PROG_CXX
31 AC_PROG_CC
32 AM_PROG_CC_C_O
33 gl_EARLY
34 AC_PROG_RANLIB
35 AC_TYPE_UINT64_T
37 gl_INIT
39 AC_PROG_YACC
40 AC_PROG_LEX
41 AM_MISSING_PROG([HELP2MAN], [help2man])
43 AC_CHECK_LIB([curl], [curl_easy_init],
44         [CURL_LIB=-lcurl],
45         [AC_MSG_ERROR([Missing required CURL lib])])
46 AC_SUBST([CURL_LIB])
48 AC_CHECK_LIB([jansson], [json_object_get],
49         [JANSSON_LIB=-ljansson],
50         [AC_MSG_ERROR([Missing required Jansson lib])])
51 AC_SUBST([JANSSON_LIB])
53 AC_CHECK_LIB([microhttpd], [MHD_start_daemon],
54         [UHTTPD_LIB=-lmicrohttpd],
55         [AC_MSG_ERROR([Missing required microhttpd lib])])
56 AC_SUBST([UHTTPD_LIB])
58 AC_CHECK_LIB([pthread], [pthread_create],
59         [PTHREAD_LIB=-lpthread],
60         [AC_MSG_ERROR([Missing required pthread lib])])
61 AC_SUBST([PTHREAD_LIB])
63 AC_CHECK_LIB([glib-2.0], [g_hash_table_new_full],
64         [GLIB2_LIB=-lglib-2.0],
65         [AC_MSG_ERROR([Missing required glib2 lib])])
66 AC_SUBST([GLIB2_LIB])
68 PKG_CHECK_MODULES([HAIL],[libhail >= 0.8])
69 AC_SUBST([HAIL_LIBS])
70 AC_SUBST([HAIL_CFLAGS])
72 AC_CHECK_LIB([xml2], [xmlInitParser],
73         [XML2_LIB=-lxml2],
74         [AC_MSG_ERROR([Missing required XML2 lib])])
75 AC_SUBST([XML2_LIB])
77 # from http://www.gnu.org/software/autoconf-archive/
78 AX_BOOST_BASE
79 AX_BOOST_SYSTEM
80 AX_BOOST_THREAD
82 AC_ARG_ENABLE([gcc-warnings],
83   [AS_HELP_STRING([--enable-gcc-warnings],
84                   [turn on lots of GCC warnings (for developers)])],
85   [case $enableval in
86      yes|no) ;;
87      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
88    esac
89    gl_gcc_warnings=$enableval],
90   [gl_gcc_warnings=no]
93 if test "$gl_gcc_warnings" = yes; then
94   gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
95   AC_SUBST([WERROR_CFLAGS])
97   nw=
98   # This, $nw, is the list of warnings we disable.
99   nw="$nw -Wdeclaration-after-statement" # too useful to forbid
100   nw="$nw -Waggregate-return"       # anachronistic
101   nw="$nw -Wlong-long"              # C90 is anachronistic (lib/gethrxtime.h)
102   nw="$nw -Wc++-compat"             # We don't care about C++ compilers
103   nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
104   nw="$nw -Wtraditional"            # Warns on #elif which we use often
105   nw="$nw -Wcast-qual"              # Too many warnings for now
106   nw="$nw -Wconversion"             # Too many warnings for now
107   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
108   nw="$nw -Wsign-conversion"        # Too many warnings for now
109   nw="$nw -Wtraditional-conversion" # Too many warnings for now
110   nw="$nw -Wunreachable-code"       # Too many warnings for now
111   nw="$nw -Wunused-macros"          # bison-generated
112   nw="$nw -Wpadded"                 # Our structs are not padded
113   nw="$nw -Wredundant-decls"        # openat.h declares e.g., mkdirat
114   nw="$nw -Wlogical-op"             # any use of fwrite provokes this
115   nw="$nw -Wformat-nonliteral"      # who.c and pinky.c strftime uses
116   nw="$nw -Wvla"                    # warnings in gettext.h
117   nw="$nw -Wnested-externs"         # use of XARGMATCH/verify_function__
118   nw="$nw -Wswitch-enum"            # Too many warnings for now
119   nw="$nw -Wswitch-default"         # Too many warnings for now
120   nw="$nw -Wstack-protector"        # not worth working around
121   nw="$nw -Wstrict-overflow"        # in bison-generated code
122   nw="$nw -Wunsafe-loop-optimizations" # in bison-generated code
123   nw="$nw -Wmissing-noreturn"       # yy_fatal_error in flex-generated code
125   gl_MANYWARN_ALL_GCC([ws])
126   gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
127   for w in $ws; do
128     gl_WARN_ADD([$w])
129   done
130   gl_WARN_ADD([-Wno-unused])
131   gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
132   gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
133   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
135   # In spite of excluding -Wlogical-op above, it is enabled, as of
136   # gcc 4.5.0 20090517, and it provokes warnings in cat.c, dd.c, truncate.c
137   gl_WARN_ADD([-Wno-logical-op])
139   gl_WARN_ADD([-fdiagnostics-show-option])
140   gl_WARN_ADD([-funit-at-a-time])
142   AC_SUBST([WARN_CFLAGS])
144   AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
145   AC_DEFINE([_FORTIFY_SOURCE], [2],
146     [enable compile-time and run-time bounds-checking, and some warnings])
147   AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
149   # We use a slightly smaller set of warning options for lib/.
150   # Remove the following and save the result in GNULIB_WARN_CFLAGS.
151   nw=
152   nw="$nw -Wuninitialized"
153   nw="$nw -Wmissing-prototypes"
154   nw="$nw -Wold-style-definition"
155   gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
156   AC_SUBST([GNULIB_WARN_CFLAGS])
158   # For gnulib-tests, the set is slightly smaller still.
159   nw=
160   nw="$nw -Wstrict-prototypes"
161   gl_MANYWARN_COMPLEMENT([GNULIB_TEST_WARN_CFLAGS],
162                          [$GNULIB_WARN_CFLAGS], [$nw])
163   AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
166 AC_CONFIG_FILES([
167 Makefile
168 gnulib-tests/Makefile
169 lib/Makefile
170 man/Makefile
171 t/Makefile
173 AC_OUTPUT