openvcdiff | 311c714 | 2008-08-26 19:29:25 +0000 | [diff] [blame] | 1 | ## Process this file with autoconf to produce configure. |
| 2 | ## In general, the safest way to proceed is to run ./autogen.sh |
| 3 | |
| 4 | # make sure we're interpreted by some minimal autoconf |
| 5 | AC_PREREQ(2.57) |
| 6 | |
openvcdiff@gmail.com | 732fff2 | 2010-08-04 18:00:00 +0000 | [diff] [blame^] | 7 | AC_INIT(open-vcdiff, 0.8, opensource@google.com) |
openvcdiff | 311c714 | 2008-08-26 19:29:25 +0000 | [diff] [blame] | 8 | AC_CONFIG_SRCDIR(README) |
openvcdiff@gmail.com | 732fff2 | 2010-08-04 18:00:00 +0000 | [diff] [blame^] | 9 | AC_CONFIG_MACRO_DIR([m4 gflags/m4]) |
openvcdiff | 311c714 | 2008-08-26 19:29:25 +0000 | [diff] [blame] | 10 | AM_INIT_AUTOMAKE |
| 11 | AM_CONFIG_HEADER(src/config.h) |
| 12 | |
| 13 | # Checks for programs. |
| 14 | AC_PROG_CC |
| 15 | AC_PROG_CPP |
| 16 | AC_PROG_CXX |
| 17 | AM_CONDITIONAL(GCC, test "$GCC" = yes) # let the Makefile know if we're gcc |
| 18 | AC_CANONICAL_HOST |
| 19 | |
openvcdiff | baf44ea | 2009-04-09 19:20:49 +0000 | [diff] [blame] | 20 | # Issue #21: Fail to test on MinGW 5.1.4 |
| 21 | # Disabling fast install keeps libtool from creating wrapper scripts around |
| 22 | # the executables it builds. Such scripts have caused failures on MinGW. |
| 23 | # Using this option means an extra link step is executed during "make install". |
| 24 | AC_DISABLE_FAST_INSTALL |
| 25 | |
openvcdiff@gmail.com | 732fff2 | 2010-08-04 18:00:00 +0000 | [diff] [blame^] | 26 | LT_INIT |
openvcdiff | 311c714 | 2008-08-26 19:29:25 +0000 | [diff] [blame] | 27 | AC_PROG_LIBTOOL |
| 28 | AC_SUBST(LIBTOOL_DEPS) |
| 29 | |
| 30 | # Check whether some low-level functions/files are available |
| 31 | AC_HEADER_STDC |
| 32 | |
openvcdiff@gmail.com | 732fff2 | 2010-08-04 18:00:00 +0000 | [diff] [blame^] | 33 | # Built-in memcmp can be inefficient when gcc compiles for x86 or PowerPC |
| 34 | # processors. In those cases, use an alternative function instead of memcmp. |
openvcdiff | 28db807 | 2008-10-10 23:29:11 +0000 | [diff] [blame] | 35 | case $host_cpu in |
openvcdiff@gmail.com | 732fff2 | 2010-08-04 18:00:00 +0000 | [diff] [blame^] | 36 | *86*|powerpc*) |
openvcdiff | 28db807 | 2008-10-10 23:29:11 +0000 | [diff] [blame] | 37 | if test "$GCC" = "yes"; then |
| 38 | AC_DEFINE(VCDIFF_USE_BLOCK_COMPARE_WORDS, 1, |
| 39 | Use custom compare function instead of memcmp) |
| 40 | fi |
openvcdiff | d483287 | 2008-09-02 18:21:13 +0000 | [diff] [blame] | 41 | ;; |
openvcdiff | 311c714 | 2008-08-26 19:29:25 +0000 | [diff] [blame] | 42 | esac |
| 43 | |
| 44 | AC_CHECK_HEADERS([ext/rope]) |
| 45 | AC_CHECK_HEADERS([getopt.h]) |
| 46 | AC_CHECK_HEADERS([malloc.h]) |
| 47 | AC_CHECK_HEADERS([sys/mman.h]) |
| 48 | AC_CHECK_HEADERS([sys/time.h]) |
| 49 | AC_CHECK_HEADERS([unistd.h]) |
| 50 | AC_CHECK_HEADERS([windows.h]) |
| 51 | AC_CHECK_FUNCS([gettimeofday QueryPerformanceCounter]) |
| 52 | AC_CHECK_FUNCS([memalign posix_memalign]) |
| 53 | AC_CHECK_FUNCS([mprotect]) |
| 54 | |
| 55 | # Start of definitions needed by gflags package |
| 56 | |
openvcdiff@gmail.com | 732fff2 | 2010-08-04 18:00:00 +0000 | [diff] [blame^] | 57 | # These are tested for by AC_HEADER_STDC, but I check again to set the var |
| 58 | AC_CHECK_HEADER(stdint.h, ac_cv_have_stdint_h=1, ac_cv_have_stdint_h=0) |
| 59 | AC_CHECK_HEADER(sys/types.h, ac_cv_have_systypes_h=1, ac_cv_have_systypes_h=0) |
| 60 | AC_CHECK_HEADER(inttypes.h, ac_cv_have_inttypes_h=1, ac_cv_have_inttypes_h=0) |
openvcdiff | 311c714 | 2008-08-26 19:29:25 +0000 | [diff] [blame] | 61 | AC_CHECK_HEADERS([fnmatch.h]) |
openvcdiff@gmail.com | 732fff2 | 2010-08-04 18:00:00 +0000 | [diff] [blame^] | 62 | |
| 63 | # These are the types I need. We look for them in either stdint.h, |
| 64 | # sys/types.h, or inttypes.h, all of which are part of the default-includes. |
| 65 | AC_CHECK_TYPE(uint16_t, ac_cv_have_uint16_t=1, ac_cv_have_uint16_t=0) |
| 66 | AC_CHECK_TYPE(u_int16_t, ac_cv_have_u_int16_t=1, ac_cv_have_u_int16_t=0) |
| 67 | AC_CHECK_TYPE(__int16, ac_cv_have___int16=1, ac_cv_have___int16=0) |
| 68 | |
openvcdiff | 311c714 | 2008-08-26 19:29:25 +0000 | [diff] [blame] | 69 | AC_CHECK_FUNCS([strtoll strtoq]) |
openvcdiff@gmail.com | 732fff2 | 2010-08-04 18:00:00 +0000 | [diff] [blame^] | 70 | AC_CHECK_FUNCS([setenv putenv]) # MinGW has putenv but not setenv |
openvcdiff | 311c714 | 2008-08-26 19:29:25 +0000 | [diff] [blame] | 71 | |
| 72 | AX_C___ATTRIBUTE__ |
openvcdiff@gmail.com | 732fff2 | 2010-08-04 18:00:00 +0000 | [diff] [blame^] | 73 | # We only care about __attribute__ ((unused)) |
| 74 | if test x"$ac_cv___attribute__" = x"yes"; then |
| 75 | ac_cv___attribute__unused="__attribute__ ((unused))" |
| 76 | else |
| 77 | ac_cv___attribute__unused= |
| 78 | fi |
| 79 | |
| 80 | ACX_PTHREAD |
| 81 | |
| 82 | # Find out what namespace 'normal' STL code lives in, and also what namespace |
| 83 | # the user wants our classes to be defined in |
| 84 | AC_CXX_STL_NAMESPACE |
| 85 | AC_DEFINE_GOOGLE_NAMESPACE(google) |
| 86 | |
| 87 | # These are what's needed by gflags.h.in |
| 88 | AC_SUBST(ac_google_start_namespace) |
| 89 | AC_SUBST(ac_google_end_namespace) |
| 90 | AC_SUBST(ac_google_namespace) |
| 91 | AC_SUBST(ac_cv___attribute__unused) |
| 92 | AC_SUBST(ac_cv_have_stdint_h) |
| 93 | AC_SUBST(ac_cv_have_systypes_h) |
| 94 | AC_SUBST(ac_cv_have_inttypes_h) |
| 95 | AC_SUBST(ac_cv_have_uint16_t) |
| 96 | AC_SUBST(ac_cv_have_u_int16_t) |
| 97 | AC_SUBST(ac_cv_have___int16) |
| 98 | |
| 99 | # For windows, this has a non-trivial value (__declspec(export)), but any |
| 100 | # system that uses configure wants this to be the empty string. |
| 101 | AC_DEFINE(GFLAGS_DLL_DECL,, |
| 102 | [Always the empty-string on non-windows systems. |
| 103 | On windows, should be "__declspec(dllexport)". |
| 104 | This way, when we compile the dll, we export our functions/classes. |
| 105 | It's safe to define this here because config.h is only used |
| 106 | internally, to compile the DLL, and every DLL source file |
| 107 | #includes "config.h" before anything else.]) |
openvcdiff | 311c714 | 2008-08-26 19:29:25 +0000 | [diff] [blame] | 108 | |
openvcdiff | 311c714 | 2008-08-26 19:29:25 +0000 | [diff] [blame] | 109 | # End of definitions needed by gflags package |
| 110 | |
openvcdiff | d184578 | 2009-03-20 21:56:15 +0000 | [diff] [blame] | 111 | # Solaris 10 6/06 has a bug where /usr/sfw/lib/libstdc++.la is empty. |
| 112 | # If so, we replace it with our own version. |
| 113 | LIBSTDCXX_LA_LINKER_FLAG= |
| 114 | if test -f /usr/sfw/lib/libstdc++.la && ! test -s /usr/sfw/lib/libstdc++.la |
| 115 | then |
| 116 | LIBSTDCXX_LA_LINKER_FLAG='-L$(top_srcdir)/src/solaris' |
| 117 | fi |
| 118 | AC_SUBST(LIBSTDCXX_LA_LINKER_FLAG) |
| 119 | |
openvcdiff@gmail.com | 732fff2 | 2010-08-04 18:00:00 +0000 | [diff] [blame^] | 120 | AC_CONFIG_FILES([Makefile |
| 121 | gflags/src/gflags/gflags.h |
| 122 | gflags/src/gflags/gflags_completions.h]) |
openvcdiff | 311c714 | 2008-08-26 19:29:25 +0000 | [diff] [blame] | 123 | AC_OUTPUT |