blob: c0a8e037da6eebe9dc2a23c907e25e2bc7c1dc74 [file] [log] [blame]
Craig Silversteinb9f23482007-03-22 00:15:41 +00001## Process this file with autoconf to produce configure.
Craig Silverstein2b66a842007-06-12 23:59:42 +00002## In general, the safest way to proceed is to run ./autogen.sh
Craig Silversteinb9f23482007-03-22 00:15:41 +00003
4# make sure we're interpreted by some minimal autoconf
5AC_PREREQ(2.57)
6
Craig Silversteinc79c32d2008-07-22 23:29:39 +00007AC_INIT(gflags, 0.9, opensource@google.com)
Craig Silversteinb9f23482007-03-22 00:15:41 +00008# The argument here is just something that should be in the current directory
9# (for sanity checking)
10AC_CONFIG_SRCDIR(README)
11AM_INIT_AUTOMAKE
12AM_CONFIG_HEADER(src/config.h)
13
14# Checks for programs.
15AC_PROG_CC
16AC_PROG_CPP
17AC_PROG_CXX
Craig Silversteinc79c32d2008-07-22 23:29:39 +000018AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc
Craig Silversteinb9f23482007-03-22 00:15:41 +000019
20# Uncomment this if you'll be exporting libraries (.so's)
21AC_PROG_LIBTOOL
22AC_SUBST(LIBTOOL_DEPS)
23
24# Check whether some low-level functions/files are available
25AC_HEADER_STDC
26
27# These are tested for by AC_HEADER_STDC, but I check again to set the var
28AC_CHECK_HEADER(stdint.h, ac_cv_have_stdint_h=1, ac_cv_have_stdint_h=0)
29AC_CHECK_HEADER(sys/types.h, ac_cv_have_systypes_h=1, ac_cv_have_systypes_h=0)
30AC_CHECK_HEADER(inttypes.h, ac_cv_have_inttypes_h=1, ac_cv_have_inttypes_h=0)
31
32# These are the types I need. We look for them in either stdint.h,
33# sys/types.h, or inttypes.h, all of which are part of the default-includes.
34AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0)
35AC_CHECK_TYPE(u_int16_t, ac_cv_have_u_int16_t=1, ac_cv_have_u_int16_t=0)
36AC_CHECK_TYPE(__uint16, ac_cv_have___uint16=1, ac_cv_have___uint16=0)
37
Craig Silverstein690172b2007-04-20 21:16:33 +000038AC_CHECK_FUNCS(strtoll)
39AC_CHECK_FUNCS(strtoq)
40
Craig Silversteinb9f23482007-03-22 00:15:41 +000041AX_C___ATTRIBUTE__
Craig Silversteineb208392007-08-15 19:44:54 +000042# We only care about __attribute__ ((unused))
43if test x"$ac_cv___attribute__" = x"yes"; then
44 ac_cv___attribute__unused="__attribute__ ((unused))"
45else
46 ac_cv___attribute__unused=
47fi
48
Craig Silversteinb9f23482007-03-22 00:15:41 +000049ACX_PTHREAD
50
51# Find out what namespace 'normal' STL code lives in, and also what namespace
52# the user wants our classes to be defined in
53AC_CXX_STL_NAMESPACE
54AC_DEFINE_GOOGLE_NAMESPACE(google)
55
56# These are what's needed by gflags.h.in
57AC_SUBST(ac_google_start_namespace)
58AC_SUBST(ac_google_end_namespace)
59AC_SUBST(ac_google_namespace)
Craig Silversteineb208392007-08-15 19:44:54 +000060AC_SUBST(ac_cv___attribute__unused)
Craig Silversteinb9f23482007-03-22 00:15:41 +000061AC_SUBST(ac_cv_have_stdint_h)
62AC_SUBST(ac_cv_have_systypes_h)
63AC_SUBST(ac_cv_have_inttypes_h)
64AC_SUBST(ac_cv_have_uint16_t)
65AC_SUBST(ac_cv_have_u_int16_t)
66AC_SUBST(ac_cv_have___uint16)
67
68## Check out ../autoconf/ for other macros you can call to do useful stuff
69
70# Write generated configuration file, and also .h files
Craig Silversteinc79c32d2008-07-22 23:29:39 +000071AC_CONFIG_FILES([Makefile src/google/gflags.h src/google/gflags_completions.h])
Craig Silversteinb9f23482007-03-22 00:15:41 +000072AC_OUTPUT