File: configure.in

package info (click to toggle)
gentoo 0.11.46-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 5,648 kB
  • ctags: 4,313
  • sloc: ansic: 33,912; sh: 3,903; makefile: 649; yacc: 316; sed: 16
file content (162 lines) | stat: -rw-r--r-- 6,169 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# -----------------------------------------------------------------------------
# Initialize everything
# -----------------------------------------------------------------------------

AC_INIT(src/gentoo.c)

gentoo_major_version=0
gentoo_minor_version=11
gentoo_micro_version=46

AM_INIT_AUTOMAKE(gentoo,$gentoo_major_version.$gentoo_minor_version.$gentoo_micro_version)

AC_DEFINE_UNQUOTED(GENTOO_MAJOR_VERSION,$gentoo_major_version,[Major version.])
AC_DEFINE_UNQUOTED(GENTOO_MINOR_VERSION,$gentoo_minor_version,[Minor version.])
AC_DEFINE_UNQUOTED(GENTOO_MICRO_VERSION,$gentoo_micro_version,[Minor version.])

DATE=`date +%Y-%m-%d`

AC_SUBST(DATE)

# -----------------------------------------------------------------------------
# Checks 
# -----------------------------------------------------------------------------

AC_PROG_CC

dnl Don't just call it CFLAGS, since it then gets inherited into intl/, and GNU
dnl and I don't exactly code alike. Don't include CFLAGS as set by AC_PROG_CC
dnl above, since it includes -g -O2 for gcc, for reasons unknown.
GENTOO_CFLAGS="-Wall -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Werror-implicit-function-declaration"

AC_ARG_ENABLE(debug,
  [  --enable-debug          have debug info compiled in],
  AC_DEFINE(DEBUG, 1, [Whether debug code should be compiled in.])
  GENTOO_CFLAGS="$GENTOO_CFLAGS -g -pg",
  GENTOO_CFLAGS="$GENTOO_CFLAGS -O2")

AC_SUBST(GENTOO_CFLAGS)

AC_PROG_CPP
AC_PROG_RANLIB
AM_PATH_GTK(1.2.0,,AC_MSG_ERROR(Bad GTK+ version))

dnl Let's try to test if the host supports "file -f - -n", i.e. if the file
dnl command can read file names from stdin (-f -) and also flush (-n) its
dnl answers as soon as possible. This is a highly desirable combination of
dnl capabilities from gentoo's point of view. I encourage everyone to upgrade
dnl their file commands if they fail this test.
AC_MSG_CHECKING([whether file understands -f - -n option combo])
if ( echo "." | file -f - -n >/dev/null 2>/dev/null ) ; then
  AC_DEFINE(HAVE_GOOD_FILE, 1, [Whether the file command supports -f - -n options.])
  AC_MSG_RESULT([yes])
else
  AC_MSG_RESULT([no])
  AC_MSG_WARN(["
   This system's 'file' command (`which file`) doesn't seem to"
   support the '-f - -n' option combination. gentoo's 'file' usage"
   will be limited. Consider upgrading to the version of 'file'"
   from <ftp://ftp.astron.com/pub/file/>, version 3.35 or later."
   At the moment, you will not lose any crucial functionality by"
   running gentoo with a different 'file' command, although this"
   may change in the future."])
fi


dnl Let's see if host supports FAM, so we can use it to automatically
dnl refresh panes when things change. We do dual testing, just because
dnl it feels safer: first investigate if -lfam contains the expected
dnl stuff, then see if a #include <fam.h> works. Hand me that belt.
testfam=yes
AC_ARG_ENABLE(fam,
   AC_HELP_STRING([--disable-fam], [do not look for FAM (File Alteration Monitor) (default is to use FAM if found)]),
   [if test "x$enableval" = "xno" ; then
      testfam=no
    fi],
   [testfam=yes])
if test "x$testfam" = "xyes" ; then
  AC_SEARCH_LIBS([FAMOpen], [fam], [famlib=yes], [famlib=no], , [C])
fi
if test "x$famlib" = "xyes" ; then
   AC_MSG_CHECKING([whether FAM test program compiles])
   AC_TRY_COMPILE([
    #include <fam.h>], [
    int main(void)
    {
     FAMConnection c;
     return FAMOpen(&c) == 0;
    }],
    AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_FAM, 1, [Whether the host supports SGI's FAM technology.]),
    AC_MSG_RESULT([no]))
fi


dnl For my next trick, let's see if _FILE_OFFSET_BITS can be played with for large file support.
dnl We do this in two steps: first figure out struct stat's st_size member's size for a "plain
dnl compile, and it that's just 32 we try again with _FILE_OFFSET_BITS=64 defined. If that works,
dnl we simply build gentoo with it and hope for the best.
AC_MSG_CHECKING([number of bits in st_size field])
bits="test failed"
dnl Put the entire testing program into a variable, for easier re-use below.
bitstest=`cat <<TESTPROG_EOF
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>

 int main(void)
 {
   struct stat stbuf;
   FILE        *out;

   if((out = fopen("conftest.statbits", "wt")) != NULL)
   {
     fprintf(out, "%d\n", CHAR_BIT * sizeof stbuf.st_size);
     fclose(out);
   }
   exit(out != NULL ? EXIT_SUCCESS : EXIT_FAILURE);
 }
TESTPROG_EOF`
AC_TRY_RUN([$bitstest], bits=`cat conftest.statbits`)
AC_MSG_RESULT([$bits])
if test "x$bits" = "x32" ; then
  AC_MSG_CHECKING([again, with -D_FILE_OFFSET_BITS=64])
  oldflags=$CPPFLAGS
  CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE"
  bits="test failed"
  AC_TRY_RUN([$bitstest], bits=`cat conftest.statbits`, , CPPFLAGS=$oldflags)
  AC_MSG_RESULT([$bits])
fi


dnl Let's try and get a grip on the host's idea of statvfs() vs statfs(),
dnl and the related structure name. Should help clean out platform-specific
dnl tests in the actual code, and thus approach The Point of Autoconf.
AC_CHECK_MEMBER([struct statvfs.f_bsize],
  [AC_DEFINE(HAVE_STRUCT_STATVFS, 1, [Whether host supports <sys/statvfs.h> and struct statvfs.])
   statfs=statvfs],
  [AC_CHECK_MEMBER([struct statfs.f_bsize],
     [AC_DEFINE(HAVE_STRUCT_STATFS, 1, [Whether host supports <sys/statfs.h> and struct statfs.])
      statfs=statfs],
      statfs=failed,
     [#include <sys/statfs.h>])],
  [#include <sys/statvfs.h>])

dnl Tests are missing here. It would be nice to have tests to check
dnl the mntent_wrap.c stuff.

dnl Kick the gettext subsystem into action.
dnl We include an obsolete ALL_LINGUAS setting to keep Automake quiet, but
dnl pay by getting a snotty warning from Autoconf instead. Sigh.
ALL_LINGUAS=`grep -v \# po/LINGUAS`
AM_GNU_GETTEXT

# -----------------------------------------------------------------------------
# Output
# -----------------------------------------------------------------------------

AM_CONFIG_HEADER(config.h)
AC_OUTPUT([gentoorc gentoogtkrc gentoo.spec Makefile icons/Makefile \
	   widgets/Makefile src/Makefile intl/Makefile po/Makefile.in m4/Makefile])