Craig Silverstein | b9f2348 | 2007-03-22 00:15:41 +0000 | [diff] [blame] | 1 | ## Process this file with autoconf to produce configure. |
Craig Silverstein | 2b66a84 | 2007-06-12 23:59:42 +0000 | [diff] [blame] | 2 | ## In general, the safest way to proceed is to run ./autogen.sh |
Craig Silverstein | b9f2348 | 2007-03-22 00:15:41 +0000 | [diff] [blame] | 3 | |
| 4 | # make sure we're interpreted by some minimal autoconf |
| 5 | AC_PREREQ(2.57) |
| 6 | |
Craig Silverstein | 31c8edc | 2010-01-05 02:25:45 +0000 | [diff] [blame] | 7 | AC_INIT(gflags, 1.3, opensource@google.com) |
Craig Silverstein | b9f2348 | 2007-03-22 00:15:41 +0000 | [diff] [blame] | 8 | # The argument here is just something that should be in the current directory |
| 9 | # (for sanity checking) |
| 10 | AC_CONFIG_SRCDIR(README) |
Craig Silverstein | 688ea02 | 2009-09-11 00:15:50 +0000 | [diff] [blame] | 11 | AM_INIT_AUTOMAKE([dist-zip]) |
Craig Silverstein | b9f2348 | 2007-03-22 00:15:41 +0000 | [diff] [blame] | 12 | AM_CONFIG_HEADER(src/config.h) |
| 13 | |
| 14 | # Checks for programs. |
| 15 | AC_PROG_CC |
| 16 | AC_PROG_CPP |
| 17 | AC_PROG_CXX |
Craig Silverstein | c79c32d | 2008-07-22 23:29:39 +0000 | [diff] [blame] | 18 | AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc |
Craig Silverstein | 5a3c7f8 | 2009-04-15 21:57:04 +0000 | [diff] [blame] | 19 | AC_CANONICAL_HOST |
| 20 | |
| 21 | # Populate $host_cpu, $host_os, etc. |
| 22 | AC_CANONICAL_HOST |
| 23 | case $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 Silverstein | 688ea02 | 2009-09-11 00:15:50 +0000 | [diff] [blame] | 30 | # /tmp is a mount-point in mingw, and hard to use. use cwd instead |
Craig Silverstein | ab3d765 | 2009-11-10 16:33:51 +0000 | [diff] [blame] | 31 | TEST_TMPDIR=gflags_testdir |
Craig Silverstein | 5a3c7f8 | 2009-04-15 21:57:04 +0000 | [diff] [blame] | 32 | ;; |
| 33 | *) |
| 34 | AC_ENABLE_FAST_INSTALL |
Craig Silverstein | ab3d765 | 2009-11-10 16:33:51 +0000 | [diff] [blame] | 35 | TEST_TMPDIR=/tmp/gflags |
Craig Silverstein | 5a3c7f8 | 2009-04-15 21:57:04 +0000 | [diff] [blame] | 36 | ;; |
| 37 | esac |
Craig Silverstein | ab3d765 | 2009-11-10 16:33:51 +0000 | [diff] [blame] | 38 | AC_SUBST(TEST_TMPDIR) |
Craig Silverstein | b9f2348 | 2007-03-22 00:15:41 +0000 | [diff] [blame] | 39 | |
| 40 | # Uncomment this if you'll be exporting libraries (.so's) |
| 41 | AC_PROG_LIBTOOL |
| 42 | AC_SUBST(LIBTOOL_DEPS) |
| 43 | |
| 44 | # Check whether some low-level functions/files are available |
| 45 | AC_HEADER_STDC |
| 46 | |
| 47 | # These are tested for by AC_HEADER_STDC, but I check again to set the var |
| 48 | AC_CHECK_HEADER(stdint.h, ac_cv_have_stdint_h=1, ac_cv_have_stdint_h=0) |
| 49 | AC_CHECK_HEADER(sys/types.h, ac_cv_have_systypes_h=1, ac_cv_have_systypes_h=0) |
| 50 | AC_CHECK_HEADER(inttypes.h, ac_cv_have_inttypes_h=1, ac_cv_have_inttypes_h=0) |
Craig Silverstein | 5a3c7f8 | 2009-04-15 21:57:04 +0000 | [diff] [blame] | 51 | AC_CHECK_HEADERS([fnmatch.h]) |
Craig Silverstein | b9f2348 | 2007-03-22 00:15:41 +0000 | [diff] [blame] | 52 | |
| 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. |
| 55 | AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0) |
| 56 | AC_CHECK_TYPE(u_int16_t, ac_cv_have_u_int16_t=1, ac_cv_have_u_int16_t=0) |
Craig Silverstein | 6791468 | 2008-08-21 00:50:59 +0000 | [diff] [blame] | 57 | AC_CHECK_TYPE(__int16, ac_cv_have___int16=1, ac_cv_have___int16=0) |
Craig Silverstein | b9f2348 | 2007-03-22 00:15:41 +0000 | [diff] [blame] | 58 | |
Craig Silverstein | 6791468 | 2008-08-21 00:50:59 +0000 | [diff] [blame] | 59 | AC_CHECK_FUNCS([strtoll strtoq]) |
Craig Silverstein | 688ea02 | 2009-09-11 00:15:50 +0000 | [diff] [blame] | 60 | AC_CHECK_FUNCS([setenv putenv]) # MinGW has putenv but not setenv |
Craig Silverstein | 690172b | 2007-04-20 21:16:33 +0000 | [diff] [blame] | 61 | |
Craig Silverstein | b9f2348 | 2007-03-22 00:15:41 +0000 | [diff] [blame] | 62 | AX_C___ATTRIBUTE__ |
Craig Silverstein | eb20839 | 2007-08-15 19:44:54 +0000 | [diff] [blame] | 63 | # We only care about __attribute__ ((unused)) |
| 64 | if test x"$ac_cv___attribute__" = x"yes"; then |
| 65 | ac_cv___attribute__unused="__attribute__ ((unused))" |
| 66 | else |
| 67 | ac_cv___attribute__unused= |
| 68 | fi |
| 69 | |
Craig Silverstein | b9f2348 | 2007-03-22 00:15:41 +0000 | [diff] [blame] | 70 | ACX_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 |
| 74 | AC_CXX_STL_NAMESPACE |
| 75 | AC_DEFINE_GOOGLE_NAMESPACE(google) |
| 76 | |
Craig Silverstein | 5a3c7f8 | 2009-04-15 21:57:04 +0000 | [diff] [blame] | 77 | # 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. |
| 79 | LIBSTDCXX_LA_LINKER_FLAG= |
| 80 | if test -f /usr/sfw/lib/libstdc++.la && ! test -s /usr/sfw/lib/libstdc++.la |
| 81 | then |
| 82 | LIBSTDCXX_LA_LINKER_FLAG='-L$(top_srcdir)/src/solaris' |
| 83 | fi |
| 84 | AC_SUBST(LIBSTDCXX_LA_LINKER_FLAG) |
| 85 | |
Craig Silverstein | b9f2348 | 2007-03-22 00:15:41 +0000 | [diff] [blame] | 86 | # These are what's needed by gflags.h.in |
| 87 | AC_SUBST(ac_google_start_namespace) |
| 88 | AC_SUBST(ac_google_end_namespace) |
| 89 | AC_SUBST(ac_google_namespace) |
Craig Silverstein | eb20839 | 2007-08-15 19:44:54 +0000 | [diff] [blame] | 90 | AC_SUBST(ac_cv___attribute__unused) |
Craig Silverstein | b9f2348 | 2007-03-22 00:15:41 +0000 | [diff] [blame] | 91 | AC_SUBST(ac_cv_have_stdint_h) |
| 92 | AC_SUBST(ac_cv_have_systypes_h) |
| 93 | AC_SUBST(ac_cv_have_inttypes_h) |
| 94 | AC_SUBST(ac_cv_have_uint16_t) |
| 95 | AC_SUBST(ac_cv_have_u_int16_t) |
Craig Silverstein | 6791468 | 2008-08-21 00:50:59 +0000 | [diff] [blame] | 96 | AC_SUBST(ac_cv_have___int16) |
Craig Silverstein | b9f2348 | 2007-03-22 00:15:41 +0000 | [diff] [blame] | 97 | |
| 98 | ## Check out ../autoconf/ for other macros you can call to do useful stuff |
| 99 | |
Craig Silverstein | ab3d765 | 2009-11-10 16:33:51 +0000 | [diff] [blame] | 100 | # For windows, this has a non-trivial value (__declspec(export)), but any |
| 101 | # system that uses configure wants this to be the empty string. |
| 102 | AC_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 Silverstein | b9f2348 | 2007-03-22 00:15:41 +0000 | [diff] [blame] | 110 | # Write generated configuration file, and also .h files |
Craig Silverstein | 6791468 | 2008-08-21 00:50:59 +0000 | [diff] [blame] | 111 | AC_CONFIG_FILES([Makefile src/gflags/gflags.h src/gflags/gflags_completions.h]) |
Craig Silverstein | b9f2348 | 2007-03-22 00:15:41 +0000 | [diff] [blame] | 112 | AC_OUTPUT |