blob: 43c7a1ffae1a585101c125bb9c860cf6ba3737ed [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 Silverstein31c8edc2010-01-05 02:25:45 +00007AC_INIT(gflags, 1.3, 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)
Craig Silverstein688ea022009-09-11 00:15:50 +000011AM_INIT_AUTOMAKE([dist-zip])
Craig Silversteinb9f23482007-03-22 00:15:41 +000012AM_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 Silverstein5a3c7f82009-04-15 21:57:04 +000019AC_CANONICAL_HOST
20
21# Populate $host_cpu, $host_os, etc.
22AC_CANONICAL_HOST
23case $host_os in
24 *mingw*)
25 # Disabling fast install keeps libtool from creating wrapper scripts
26 # around the executables it builds. Such scripts have caused failures on
27 # MinGW. Using this option means an extra link step is executed during
28 # "make install".
29 AC_DISABLE_FAST_INSTALL
Craig Silverstein688ea022009-09-11 00:15:50 +000030 # /tmp is a mount-point in mingw, and hard to use. use cwd instead
Craig Silversteinab3d7652009-11-10 16:33:51 +000031 TEST_TMPDIR=gflags_testdir
Craig Silverstein5a3c7f82009-04-15 21:57:04 +000032 ;;
33 *)
34 AC_ENABLE_FAST_INSTALL
Craig Silversteinab3d7652009-11-10 16:33:51 +000035 TEST_TMPDIR=/tmp/gflags
Craig Silverstein5a3c7f82009-04-15 21:57:04 +000036 ;;
37esac
Craig Silversteinab3d7652009-11-10 16:33:51 +000038AC_SUBST(TEST_TMPDIR)
Craig Silversteinb9f23482007-03-22 00:15:41 +000039
40# Uncomment this if you'll be exporting libraries (.so's)
41AC_PROG_LIBTOOL
42AC_SUBST(LIBTOOL_DEPS)
43
44# Check whether some low-level functions/files are available
45AC_HEADER_STDC
46
47# These are tested for by AC_HEADER_STDC, but I check again to set the var
48AC_CHECK_HEADER(stdint.h, ac_cv_have_stdint_h=1, ac_cv_have_stdint_h=0)
49AC_CHECK_HEADER(sys/types.h, ac_cv_have_systypes_h=1, ac_cv_have_systypes_h=0)
50AC_CHECK_HEADER(inttypes.h, ac_cv_have_inttypes_h=1, ac_cv_have_inttypes_h=0)
Craig Silverstein5a3c7f82009-04-15 21:57:04 +000051AC_CHECK_HEADERS([fnmatch.h])
Craig Silversteinb9f23482007-03-22 00:15:41 +000052
53# These are the types I need. We look for them in either stdint.h,
54# sys/types.h, or inttypes.h, all of which are part of the default-includes.
55AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0)
56AC_CHECK_TYPE(u_int16_t, ac_cv_have_u_int16_t=1, ac_cv_have_u_int16_t=0)
Craig Silverstein67914682008-08-21 00:50:59 +000057AC_CHECK_TYPE(__int16, ac_cv_have___int16=1, ac_cv_have___int16=0)
Craig Silversteinb9f23482007-03-22 00:15:41 +000058
Craig Silverstein67914682008-08-21 00:50:59 +000059AC_CHECK_FUNCS([strtoll strtoq])
Craig Silverstein688ea022009-09-11 00:15:50 +000060AC_CHECK_FUNCS([setenv putenv]) # MinGW has putenv but not setenv
Craig Silverstein690172b2007-04-20 21:16:33 +000061
Craig Silversteinb9f23482007-03-22 00:15:41 +000062AX_C___ATTRIBUTE__
Craig Silversteineb208392007-08-15 19:44:54 +000063# We only care about __attribute__ ((unused))
64if test x"$ac_cv___attribute__" = x"yes"; then
65 ac_cv___attribute__unused="__attribute__ ((unused))"
66else
67 ac_cv___attribute__unused=
68fi
69
Craig Silversteinb9f23482007-03-22 00:15:41 +000070ACX_PTHREAD
71
72# Find out what namespace 'normal' STL code lives in, and also what namespace
73# the user wants our classes to be defined in
74AC_CXX_STL_NAMESPACE
75AC_DEFINE_GOOGLE_NAMESPACE(google)
76
Craig Silverstein5a3c7f82009-04-15 21:57:04 +000077# Solaris 10 6/06 has a bug where /usr/sfw/lib/libstdc++.la is empty.
78# If so, we replace it with our own version.
79LIBSTDCXX_LA_LINKER_FLAG=
80if test -f /usr/sfw/lib/libstdc++.la && ! test -s /usr/sfw/lib/libstdc++.la
81then
82 LIBSTDCXX_LA_LINKER_FLAG='-L$(top_srcdir)/src/solaris'
83fi
84AC_SUBST(LIBSTDCXX_LA_LINKER_FLAG)
85
Craig Silversteinb9f23482007-03-22 00:15:41 +000086# These are what's needed by gflags.h.in
87AC_SUBST(ac_google_start_namespace)
88AC_SUBST(ac_google_end_namespace)
89AC_SUBST(ac_google_namespace)
Craig Silversteineb208392007-08-15 19:44:54 +000090AC_SUBST(ac_cv___attribute__unused)
Craig Silversteinb9f23482007-03-22 00:15:41 +000091AC_SUBST(ac_cv_have_stdint_h)
92AC_SUBST(ac_cv_have_systypes_h)
93AC_SUBST(ac_cv_have_inttypes_h)
94AC_SUBST(ac_cv_have_uint16_t)
95AC_SUBST(ac_cv_have_u_int16_t)
Craig Silverstein67914682008-08-21 00:50:59 +000096AC_SUBST(ac_cv_have___int16)
Craig Silversteinb9f23482007-03-22 00:15:41 +000097
98## Check out ../autoconf/ for other macros you can call to do useful stuff
99
Craig Silversteinab3d7652009-11-10 16:33:51 +0000100# For windows, this has a non-trivial value (__declspec(export)), but any
101# system that uses configure wants this to be the empty string.
102AC_DEFINE(GFLAGS_DLL_DECL,,
103 [Always the empty-string on non-windows systems.
104 On windows, should be "__declspec(dllexport)".
105 This way, when we compile the dll, we export our functions/classes.
106 It's safe to define this here because config.h is only used
107 internally, to compile the DLL, and every DLL source file
108 #includes "config.h" before anything else.])
109
Craig Silversteinb9f23482007-03-22 00:15:41 +0000110# Write generated configuration file, and also .h files
Craig Silverstein67914682008-08-21 00:50:59 +0000111AC_CONFIG_FILES([Makefile src/gflags/gflags.h src/gflags/gflags_completions.h])
Craig Silversteinb9f23482007-03-22 00:15:41 +0000112AC_OUTPUT