wmail: fixed NULL-pointer dereference if opendir(3) fails.
[dockapps.git] / wmpower / configure.in
blob2312e9777e1637c944269a91a99ed89f74f04a12
1 AC_INIT([wmpower],[0.4.3],[michele.noberasco@tiscali.it])
2 AC_PREREQ(2.58)
3 AC_CONFIG_SRCDIR(src/wmpower.c)
4 AM_INIT_AUTOMAKE([1.7 check-news dist-bzip2])
6 AC_GNU_SOURCE
7 AC_PROG_INSTALL
8 AC_PROG_CC
9 AC_PROG_RANLIB
11 # Set my own flags for gcc
12         if test "$MY_CFLAGS" = ""; then
13                 if test "x$GCC" = "xyes"; then
14                         CPULAGS=""
15                         MY_CFLAGS="-Os -fomit-frame-pointer -pipe -W -Wall"
16                         GCC_TEST_MESSAGE="Checking for gcc version"
17                         AC_MSG_CHECKING([$GCC_TEST_MESSAGE])
18                         GCCVERSION="`$CC -dumpversion`"
19                         AC_MSG_RESULT([$GCCVERSION])
20                         if test "`$CC -dumpversion | grep 3.`" != ""; then
21                                 #Good! let see if we can see the system arch
22                                 PROCESSOR=`cat /proc/cpuinfo`
23                                 #Is our CPU a Celeron?
24                           if test "`echo $PROCESSOR | grep \"Celeron\"`" != ""; then
25                                   CPUFLAGS="-march=pentium2"
26                                 fi
27                                 if test "`echo $PROCESSOR | grep \"Celeron (Coppermine)\"`" != ""; then
28                                         CPUFLAGS="-march=pentium3"
29                                 fi
30                                 #Is our CPU a Pentium?
31                                 if test "`echo $PROCESSOR | grep \"Pentium\"`" != ""; then
32                                         CPUFLAGS="-march=pentium"
33                                 fi
34                                 #Is our CPU a Pentium II?
35                                 if test "`echo $PROCESSOR | grep \"Pentium II\"`" != ""; then
36                                         CPUFLAGS="-march=pentium2"
37                                 fi
38                                 #Is our CPU a Pentium III?
39                                 if test "`echo $PROCESSOR | grep \"Pentium III\"`" != ""; then
40                                         CPUFLAGS="-march=pentium3"
41                                 fi
42                                 #Is our CPU a Pentium 4?
43                                 if test "`echo $PROCESSOR | grep \"Intel(R) Pentium(R) 4\"`" != ""; then
44                                         CPUFLAGS="-march=pentium4"
45                                 fi
46                                 #K6 processor
47                                 if test "`echo $PROCESSOR | grep \"AMD-K6(tm)\"`" != ""; then
48                                   CPUFLAGS="-march=k6"
49                                 fi
50                                 #Athlon processors
51                                 if test "`echo $PROCESSOR | grep \"AMD Athlon(tm)\"`" != ""; then
52                                   CPUFLAGS="-march=athlon"
53                                 fi
54                                 if test "`echo $PROCESSOR | grep \"AMD Athlon(tm) MP\"`" != ""; then
55                                   CPUFLAGS="-march=athlon-mp"
56                                 fi
57                                 if test "`echo $PROCESSOR | grep \"AMD Athlon(tm) XP\"`" != ""; then
58                                   CPUFLAGS="-march=athlon-xp"
59                                 fi
60                                 if test "`echo $PROCESSOR | grep \"AMD Athlon(tm) 64\"`" != ""; then
61                                    CPUFLAGS="-march=athlon64"
62                                 fi
63                                 #Is our CPU an Ultra Sparc?
64                                 if test "`echo $PROCESSOR | grep \"UltraSparc\"`" != ""; then
65                                         CPUFLAGS="-mcpu=ultrasparc"
66                                 fi
67                         else
68                                 #Alas, we can set only generic arch optimizations
69                                 PROCESSOR=`uname -m | grep 86`
70                                 if test "$PROCESSOR" != ""; then
71                                         CPUFLAGS="-march=$PROCESSOR"
72                                 fi
73                         fi
74                         if test "$CPUFLAGS" != ""; then
75                                 echo "Applying architecture optimizations: "$CPUFLAGS
76                         fi
77                         CFLAGS="$CPUFLAGS $MY_CFLAGS"
78                 fi
79         else
80                 CFLAGS="$MY_CFLAGS"
81         fi
82 # End of setting suctom flags for gcc
84 # Check wether we are x86 or not
85         AC_MSG_CHECKING([for machine class])
86         X86=""
87         HW=`uname -m`
88         if test "`echo $HW | grep \"86\"`" != ""; then
89                 X86="1"
90         fi
91         AC_SUBST(X86)
92         AC_MSG_RESULT([$HW])
93 # End check for x86 hardware
95 # Check for C headers
96         HEADERS="stdio.h stdlib.h stdarg.h string.h syslog.h time.h unistd.h ctype.h pwd.h sys/types.h \
97         fcntl.h sys/stat.h sys/ioctl.h envz.h X11/X.h X11/Xlib.h X11/xpm.h X11/extensions/shape.h"
98         HEADERS_ERROR_MESSAGE="One or more system headers that are necessary to compile this program are missing on this system. Cannot continue."
99         AC_CHECK_HEADERS([$HEADERS],,[AC_MSG_ERROR([$HEADERS_ERROR_MESSAGE])],)
100         AC_HEADER_DIRENT
101 # End check for C headers
103 # Check wether we can spawn new threads
104         AC_CHECK_HEADERS([pthread.h],,[AC_MSG_ERROR([$HEADERS_ERROR_MESSAGE])],)
105         AC_CHECK_LIB(pthread, pthread_create, , , )
106 # end threads check
108 AC_CONFIG_FILES([Makefile
109         src/Makefile
110         src/dockapp/Makefile
111         src/power_management/Makefile
113 AC_OUTPUT