1dnl ###################################################################### 2dnl Do we have a GNUish getopt 3AC_DEFUN([AMU_CHECK_GNU_GETOPT], 4[ 5AC_CACHE_CHECK([for GNU getopt], ac_cv_sys_gnu_getopt, [ 6AC_TRY_RUN([ 7#include <stdio.h> 8#include <unistd.h> 9int main() 10{ 11 int argc = 3; 12 char *argv[] = { "actest", "arg", "-x", NULL }; 13 int c; 14 FILE* rf; 15 int isGNU = 0; 16 17 rf = fopen("conftestresult", "w"); 18 if (rf == NULL) exit(1); 19 20 while ( (c = getopt(argc, argv, "x")) != -1 ) { 21 switch ( c ) { 22 case 'x': 23 isGNU=1; 24 break; 25 default: 26 exit(1); 27 } 28 } 29 fprintf(rf, isGNU ? "yes" : "no"); 30 exit(0); 31} 32],[ 33ac_cv_sys_gnu_getopt="`cat conftestresult`" 34],[ 35ac_cv_sys_gnu_getopt="fail" 36]) 37]) 38if test "$ac_cv_sys_gnu_getopt" = "yes" 39then 40 AC_DEFINE(HAVE_GNU_GETOPT) 41fi 42]) 43